Coverage for src/hush_hush/_generated/models/consumers_page.py: 44%
45 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-10-16 16:01 +0000
« 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.
3from __future__ import annotations
5from collections.abc import Mapping
6from typing import TYPE_CHECKING, Any, TypeVar
8from attrs import define as _attrs_define
9from attrs import field as _attrs_field
11if TYPE_CHECKING:
12 from ..models.consumer_entry import ConsumerEntry
15T = TypeVar("T", bound="ConsumersPage")
18@_attrs_define
19class ConsumersPage:
20 """
21 Attributes:
22 consumers (list[ConsumerEntry]):
23 total (int): The total number of consumers matching the request's filter,
24 across every page - not just this page's own count - so a
25 caller can render page-number navigation.
26 """
28 consumers: list[ConsumerEntry]
29 total: int
30 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
32 def to_dict(self) -> dict[str, Any]:
33 consumers = []
34 for consumers_item_data in self.consumers:
35 consumers_item = consumers_item_data.to_dict()
36 consumers.append(consumers_item)
38 total = self.total
40 field_dict: dict[str, Any] = {}
41 field_dict.update(self.additional_properties)
42 field_dict.update(
43 {
44 "consumers": consumers,
45 "total": total,
46 }
47 )
49 return field_dict
51 @classmethod
52 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
53 from ..models.consumer_entry import ConsumerEntry # noqa: PLC0415
55 d = dict(src_dict)
56 consumers = []
57 _consumers = d.pop("consumers")
58 for consumers_item_data in _consumers:
59 consumers_item = ConsumerEntry.from_dict(consumers_item_data)
61 consumers.append(consumers_item)
63 total = d.pop("total")
65 consumers_page = cls(
66 consumers=consumers,
67 total=total,
68 )
70 consumers_page.additional_properties = d
71 return consumers_page
73 @property
74 def additional_keys(self) -> list[str]:
75 return list(self.additional_properties.keys())
77 def __getitem__(self, key: str) -> Any:
78 return self.additional_properties[key]
80 def __setitem__(self, key: str, value: Any) -> None:
81 self.additional_properties[key] = value
83 def __delitem__(self, key: str) -> None:
84 del self.additional_properties[key]
86 def __contains__(self, key: str) -> bool:
87 return key in self.additional_properties