Coverage for src/hush_hush/_generated/models/rotate_consumer_token_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="RotateConsumerTokenRequest") 

12 

13 

14@_attrs_define 

15class RotateConsumerTokenRequest: 

16 """ 

17 Attributes: 

18 ttl_seconds (int): How long a token stays valid for, starting now. The default is 90 

19 days (7776000), and the cap is 365 days (31536000): a longer 

20 lifetime is a 422 that names the limit. A zero or negative value is 

21 a 400. The cap applies when a token is minted or rotated; a token 

22 issued before it existed keeps working until it expires. 

23 

24 The field stays `required` so generated clients keep a plain 

25 integer rather than an optional one, which would change their types 

26 for a limit they don't need. A request that leaves it out anyway is 

27 given the default rather than rejected. 

28 """ 

29 

30 ttl_seconds: int 

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

32 

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

34 ttl_seconds = self.ttl_seconds 

35 

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

37 field_dict.update(self.additional_properties) 

38 field_dict.update( 

39 { 

40 "ttl_seconds": ttl_seconds, 

41 } 

42 ) 

43 

44 return field_dict 

45 

46 @classmethod 

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

48 d = dict(src_dict) 

49 ttl_seconds = d.pop("ttl_seconds") 

50 

51 rotate_consumer_token_request = cls( 

52 ttl_seconds=ttl_seconds, 

53 ) 

54 

55 rotate_consumer_token_request.additional_properties = d 

56 return rotate_consumer_token_request 

57 

58 @property 

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

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

61 

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

63 return self.additional_properties[key] 

64 

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

66 self.additional_properties[key] = value 

67 

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

69 del self.additional_properties[key] 

70 

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

72 return key in self.additional_properties