Coverage for src/hush_hush/_generated/models/create_token_request.py: 54%
37 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
11T = TypeVar("T", bound="CreateTokenRequest")
14@_attrs_define
15class CreateTokenRequest:
16 """
17 Attributes:
18 description (str):
19 ttl_seconds (int): How long a token stays valid for, starting now. The default is 90
20 days (7776000), and the cap is 365 days (31536000): a longer
21 lifetime is a 422 that names the limit. A zero or negative value is
22 a 400. The cap applies when a token is minted or rotated; a token
23 issued before it existed keeps working until it expires.
25 The field stays `required` so generated clients keep a plain
26 integer rather than an optional one, which would change their types
27 for a limit they don't need. A request that leaves it out anyway is
28 given the default rather than rejected.
29 """
31 description: str
32 ttl_seconds: int
33 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35 def to_dict(self) -> dict[str, Any]:
36 description = self.description
38 ttl_seconds = self.ttl_seconds
40 field_dict: dict[str, Any] = {}
41 field_dict.update(self.additional_properties)
42 field_dict.update(
43 {
44 "description": description,
45 "ttl_seconds": ttl_seconds,
46 }
47 )
49 return field_dict
51 @classmethod
52 def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
53 d = dict(src_dict)
54 description = d.pop("description")
56 ttl_seconds = d.pop("ttl_seconds")
58 create_token_request = cls(
59 description=description,
60 ttl_seconds=ttl_seconds,
61 )
63 create_token_request.additional_properties = d
64 return create_token_request
66 @property
67 def additional_keys(self) -> list[str]:
68 return list(self.additional_properties.keys())
70 def __getitem__(self, key: str) -> Any:
71 return self.additional_properties[key]
73 def __setitem__(self, key: str, value: Any) -> None:
74 self.additional_properties[key] = value
76 def __delitem__(self, key: str) -> None:
77 del self.additional_properties[key]
79 def __contains__(self, key: str) -> bool:
80 return key in self.additional_properties