Coverage for src/hush_hush/_generated/models/add_consumer_request.py: 56%

34 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-10-16 16:01 +0000

1# Code generated by openapi-python-client from hush-hush/api/openapi.yaml; DO NOT EDIT. 

2 

3from __future__ import annotations 

4 

5from collections.abc import Mapping 

6from typing import Any, TypeVar 

7 

8from attrs import define as _attrs_define 

9from attrs import field as _attrs_field 

10 

11T = TypeVar("T", bound="AddConsumerRequest") 

12 

13 

14@_attrs_define 

15class AddConsumerRequest: 

16 """ 

17 Attributes: 

18 name (str): The consumer's name. Rejected if it already appears in the directory. 

19 """ 

20 

21 name: str 

22 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) 

23 

24 def to_dict(self) -> dict[str, Any]: 

25 name = self.name 

26 

27 field_dict: dict[str, Any] = {} 

28 field_dict.update(self.additional_properties) 

29 field_dict.update( 

30 { 

31 "name": name, 

32 } 

33 ) 

34 

35 return field_dict 

36 

37 @classmethod 

38 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: 

39 d = dict(src_dict) 

40 name = d.pop("name") 

41 

42 add_consumer_request = cls( 

43 name=name, 

44 ) 

45 

46 add_consumer_request.additional_properties = d 

47 return add_consumer_request 

48 

49 @property 

50 def additional_keys(self) -> list[str]: 

51 return list(self.additional_properties.keys()) 

52 

53 def __getitem__(self, key: str) -> Any: 

54 return self.additional_properties[key] 

55 

56 def __setitem__(self, key: str, value: Any) -> None: 

57 self.additional_properties[key] = value 

58 

59 def __delitem__(self, key: str) -> None: 

60 del self.additional_properties[key] 

61 

62 def __contains__(self, key: str) -> bool: 

63 return key in self.additional_properties