Coverage for src/hush_hush/_generated/models/update_consumer_request.py: 50%
42 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 Any, TypeVar
8from attrs import define as _attrs_define
9from attrs import field as _attrs_field
11from ..types import UNSET, Unset
13T = TypeVar("T", bound="UpdateConsumerRequest")
16@_attrs_define
17class UpdateConsumerRequest:
18 """At least one of `name` or `public_key` is required (enforced by
19 `minProperties` above); a field left out leaves that aspect of the
20 consumer unchanged. There is no way to clear a registered public
21 key through this request, only to set or replace one.
23 Attributes:
24 name (str | Unset): The consumer's new name. If it already matches another
25 recorded consumer, the two merge - every object recording
26 either ends up recording just the new name, no duplicates. A
27 registered public key survives the merge: the target name's
28 own key wins if it already had one, otherwise the renamed
29 consumer's key carries over.
30 public_key (str | Unset): Registers or replaces the consumer's age public key, safe to
31 store server-side since it's public. A consumer's private key
32 SHALL NOT be sent here or anywhere else in this API - this
33 field only ever accepts a public key. Registering a key
34 doesn't require the consumer to already be recorded anywhere;
35 a name never referenced by any object's `used_by` list yet is
36 accepted the same as an existing one.
37 """
39 name: str | Unset = UNSET
40 public_key: str | Unset = UNSET
41 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
43 def to_dict(self) -> dict[str, Any]:
44 name = self.name
46 public_key = self.public_key
48 field_dict: dict[str, Any] = {}
49 field_dict.update(self.additional_properties)
50 field_dict.update({})
51 if name is not UNSET:
52 field_dict["name"] = name
53 if public_key is not UNSET:
54 field_dict["public_key"] = public_key
56 return field_dict
58 @classmethod
59 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
60 d = dict(src_dict)
61 name = d.pop("name", UNSET)
63 public_key = d.pop("public_key", UNSET)
65 update_consumer_request = cls(
66 name=name,
67 public_key=public_key,
68 )
70 update_consumer_request.additional_properties = d
71 return update_consumer_request
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