docket-client 0.3.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. docket/__init__.py +8 -0
  2. docket/api/__init__.py +1 -0
  3. docket/api/access/__init__.py +1 -0
  4. docket/api/access/add_principal.py +193 -0
  5. docket/api/access/archive_role_assignment.py +182 -0
  6. docket/api/access/create_api_token.py +198 -0
  7. docket/api/access/create_application_principal.py +188 -0
  8. docket/api/access/create_role_assignment.py +194 -0
  9. docket/api/access/list_api_tokens.py +184 -0
  10. docket/api/access/list_principals.py +184 -0
  11. docket/api/access/list_role_assignments.py +200 -0
  12. docket/api/access/revoke_api_token.py +173 -0
  13. docket/api/identity/__init__.py +1 -0
  14. docket/api/identity/create_my_api_token.py +206 -0
  15. docket/api/identity/get_me.py +127 -0
  16. docket/api/identity/list_my_api_tokens.py +151 -0
  17. docket/api/identity/revoke_my_api_token.py +178 -0
  18. docket/api/recurring_acquisitions/__init__.py +1 -0
  19. docket/api/recurring_acquisitions/archive_recurring_acquisition.py +207 -0
  20. docket/api/recurring_acquisitions/create_recurring_acquisition.py +218 -0
  21. docket/api/recurring_acquisitions/get_recurring_acquisition.py +163 -0
  22. docket/api/recurring_acquisitions/list_recurring_acquisitions.py +248 -0
  23. docket/api/recurring_acquisitions/preview_recurring_acquisition.py +187 -0
  24. docket/api/recurring_acquisitions/preview_split_recurring_acquisition.py +232 -0
  25. docket/api/recurring_acquisitions/split_recurring_acquisition.py +258 -0
  26. docket/api/runs/__init__.py +1 -0
  27. docket/api/runs/get_run.py +160 -0
  28. docket/api/runs/list_runs.py +180 -0
  29. docket/api/runs/report_run_outcome.py +206 -0
  30. docket/api/scheduled_acquisitions/__init__.py +1 -0
  31. docket/api/scheduled_acquisitions/archive_scheduled_acquisition.py +203 -0
  32. docket/api/scheduled_acquisitions/create_scheduled_acquisition.py +185 -0
  33. docket/api/scheduled_acquisitions/get_resolved_settings.py +169 -0
  34. docket/api/scheduled_acquisitions/get_scheduled_acquisition.py +159 -0
  35. docket/api/scheduled_acquisitions/list_active_acquisitions.py +297 -0
  36. docket/api/scheduled_acquisitions/list_runs_for_scheduled_acquisition.py +191 -0
  37. docket/api/scheduled_acquisitions/list_scheduled_acquisitions.py +332 -0
  38. docket/api/scheduled_acquisitions/preview_scheduled_acquisition_edit.py +224 -0
  39. docket/api/scheduled_acquisitions/set_planning_status.py +199 -0
  40. docket/api/scheduled_acquisitions/start_run.py +221 -0
  41. docket/api/scheduled_acquisitions/update_scheduled_acquisition.py +226 -0
  42. docket/api/settings/__init__.py +1 -0
  43. docket/api/settings/list_behavior_curriculum_discriminator_values.py +188 -0
  44. docket/api/settings/list_behavior_curriculum_settings.py +199 -0
  45. docket/api/settings/list_fip_discriminator_values.py +184 -0
  46. docket/api/settings/list_fip_settings.py +195 -0
  47. docket/api/settings/list_live_behavior_curriculum_settings.py +233 -0
  48. docket/api/settings/list_live_fip_settings.py +225 -0
  49. docket/api/settings/preview_behavior_curriculum_settings.py +191 -0
  50. docket/api/settings/preview_fip_settings.py +177 -0
  51. docket/api/settings/push_behavior_curriculum_settings.py +222 -0
  52. docket/api/settings/push_fip_settings.py +206 -0
  53. docket/api/templates/__init__.py +1 -0
  54. docket/api/templates/archive_template.py +203 -0
  55. docket/api/templates/create_template.py +206 -0
  56. docket/api/templates/get_template.py +159 -0
  57. docket/api/templates/list_templates.py +174 -0
  58. docket/api/templates/update_template.py +234 -0
  59. docket/api/vocabulary/__init__.py +1 -0
  60. docket/api/vocabulary/list_instruments.py +165 -0
  61. docket/api/vocabulary/list_persons.py +132 -0
  62. docket/api/vocabulary/list_projects.py +132 -0
  63. docket/api/vocabulary/list_subjects.py +132 -0
  64. docket/api/vocabulary/lookup_person.py +166 -0
  65. docket/api/vocabulary/lookup_subject.py +166 -0
  66. docket/api/vocabulary/sync_vocabulary.py +148 -0
  67. docket/client.py +272 -0
  68. docket/errors.py +16 -0
  69. docket/models/__init__.py +221 -0
  70. docket/models/access_role.py +12 -0
  71. docket/models/access_role_nullable_type_1.py +12 -0
  72. docket/models/access_role_nullable_type_2_type_1.py +12 -0
  73. docket/models/access_role_nullable_type_3_type_1.py +12 -0
  74. docket/models/acquisition_variable.py +72 -0
  75. docket/models/acquisition_warning.py +126 -0
  76. docket/models/add_principal_request.py +83 -0
  77. docket/models/api_token_response.py +271 -0
  78. docket/models/api_token_status.py +10 -0
  79. docket/models/archive_recurring_acquisition_request.py +77 -0
  80. docket/models/archive_recurring_acquisition_response.py +83 -0
  81. docket/models/archive_scheduled_acquisition_request.py +78 -0
  82. docket/models/archive_template_request.py +66 -0
  83. docket/models/auth_mode.py +10 -0
  84. docket/models/behavior_curriculum_push_settings_request.py +85 -0
  85. docket/models/behavior_curriculum_settings.py +55 -0
  86. docket/models/behavior_curriculum_settings_preview_response.py +102 -0
  87. docket/models/behavior_curriculum_settings_preview_response_promoted.py +50 -0
  88. docket/models/behavior_curriculum_settings_version_response.py +160 -0
  89. docket/models/behavior_curriculum_settings_version_response_promoted.py +50 -0
  90. docket/models/caller_kind.py +11 -0
  91. docket/models/create_api_token_request.py +97 -0
  92. docket/models/create_application_principal_request.py +65 -0
  93. docket/models/create_personal_api_token_request.py +167 -0
  94. docket/models/create_recurring_acquisition_request.py +269 -0
  95. docket/models/create_role_assignment_request.py +99 -0
  96. docket/models/create_scheduled_acquisition_request.py +265 -0
  97. docket/models/create_template_request.py +323 -0
  98. docket/models/created_api_token_response.py +82 -0
  99. docket/models/effective_status.py +15 -0
  100. docket/models/fip_color.py +13 -0
  101. docket/models/fip_fiber.py +93 -0
  102. docket/models/fip_mode.py +9 -0
  103. docket/models/fip_push_settings_request.py +82 -0
  104. docket/models/fip_settings.py +91 -0
  105. docket/models/fip_settings_preview_response.py +97 -0
  106. docket/models/fip_settings_preview_response_promoted.py +50 -0
  107. docket/models/fip_settings_version_response.py +155 -0
  108. docket/models/fip_settings_version_response_promoted.py +50 -0
  109. docket/models/future_occurrences.py +9 -0
  110. docket/models/get_resolved_settings_response_200.py +65 -0
  111. docket/models/held_role_response.py +116 -0
  112. docket/models/http_validation_problem_details.py +204 -0
  113. docket/models/http_validation_problem_details_errors.py +59 -0
  114. docket/models/instrument_response.py +91 -0
  115. docket/models/kept_occurrence.py +85 -0
  116. docket/models/kept_occurrence_reason.py +10 -0
  117. docket/models/list_active_acquisitions_effective_status_item.py +15 -0
  118. docket/models/list_scheduled_acquisitions_planning_status.py +11 -0
  119. docket/models/me_caller.py +118 -0
  120. docket/models/me_permission.py +98 -0
  121. docket/models/me_response.py +158 -0
  122. docket/models/me_role.py +75 -0
  123. docket/models/occurrence_preview.py +121 -0
  124. docket/models/occurrence_summary.py +126 -0
  125. docket/models/occurrence_warnings.py +91 -0
  126. docket/models/permission_action.py +12 -0
  127. docket/models/person_assignment.py +74 -0
  128. docket/models/person_lookup_response.py +131 -0
  129. docket/models/person_response.py +103 -0
  130. docket/models/person_role.py +9 -0
  131. docket/models/personal_token_limits.py +92 -0
  132. docket/models/planning_status.py +11 -0
  133. docket/models/principal_kind.py +9 -0
  134. docket/models/principal_response.py +216 -0
  135. docket/models/problem_details.py +177 -0
  136. docket/models/project_response.py +75 -0
  137. docket/models/recurrence_exception_kind.py +13 -0
  138. docket/models/recurrence_exception_response.py +103 -0
  139. docket/models/recurrence_frequency.py +9 -0
  140. docket/models/recurrence_preview_response.py +101 -0
  141. docket/models/recurrence_rule.py +207 -0
  142. docket/models/recurring_acquisition_created_response.py +123 -0
  143. docket/models/recurring_acquisition_detail_response.py +105 -0
  144. docket/models/recurring_acquisition_response.py +326 -0
  145. docket/models/report_run_outcome_request.py +89 -0
  146. docket/models/resolution_mode.py +10 -0
  147. docket/models/resolved_settings.py +73 -0
  148. docket/models/role_assignment_response.py +157 -0
  149. docket/models/role_origin.py +10 -0
  150. docket/models/role_source_kind.py +10 -0
  151. docket/models/run_origin.py +9 -0
  152. docket/models/run_outcome.py +9 -0
  153. docket/models/run_response.py +181 -0
  154. docket/models/run_settings_snapshot.py +72 -0
  155. docket/models/run_start_response.py +91 -0
  156. docket/models/run_start_response_settings.py +65 -0
  157. docket/models/run_status.py +11 -0
  158. docket/models/scheduled_acquisition_edit_preview_response.py +150 -0
  159. docket/models/scheduled_acquisition_response.py +366 -0
  160. docket/models/set_planning_status_request.py +90 -0
  161. docket/models/settings_selector.py +138 -0
  162. docket/models/skipped_occurrence.py +85 -0
  163. docket/models/split_preview_response.py +129 -0
  164. docket/models/split_recurring_acquisition_request.py +261 -0
  165. docket/models/split_recurring_acquisition_response.py +159 -0
  166. docket/models/start_run_request.py +73 -0
  167. docket/models/subject_lookup_response.py +149 -0
  168. docket/models/subject_response.py +128 -0
  169. docket/models/sync_counts.py +80 -0
  170. docket/models/sync_response.py +81 -0
  171. docket/models/template_response.py +302 -0
  172. docket/models/update_scheduled_acquisition_request.py +235 -0
  173. docket/models/update_template_request.py +279 -0
  174. docket/models/weekday.py +14 -0
  175. docket/types.py +54 -0
  176. docket_auth/__init__.py +239 -0
  177. docket_client-0.3.2.dist-info/METADATA +233 -0
  178. docket_client-0.3.2.dist-info/RECORD +188 -0
  179. docket_client-0.3.2.dist-info/WHEEL +4 -0
  180. docket_client-0.3.2.dist-info/entry_points.txt +2 -0
  181. docket_mcp/__init__.py +6 -0
  182. docket_mcp/api.py +207 -0
  183. docket_mcp/config.py +57 -0
  184. docket_mcp/server.py +78 -0
  185. docket_mcp/signin.py +155 -0
  186. docket_mcp/slots.py +80 -0
  187. docket_mcp/times.py +160 -0
  188. docket_mcp/tools.py +1202 -0
@@ -0,0 +1,126 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ from typing import cast
12
+ import datetime
13
+
14
+
15
+ T = TypeVar("T", bound="AcquisitionWarning")
16
+
17
+
18
+ @_attrs_define
19
+ class AcquisitionWarning:
20
+ """A non-blocking notice attached to a create or edit response. Warnings never
21
+ reject the write.
22
+
23
+ Attributes:
24
+ code (str): Machine-readable kind; currently only `instrument_overlap`.
25
+ message (str): Human-readable explanation.
26
+ acquisition_id (int): The other acquisition involved.
27
+ subject_id (str): Subject of the other acquisition.
28
+ scheduled_start (datetime.datetime): UTC instant, ISO 8601 with offset, e.g. 2026-10-15T16:00:00Z.
29
+ scheduled_end (datetime.datetime | None):
30
+ """
31
+
32
+ code: str
33
+ message: str
34
+ acquisition_id: int
35
+ subject_id: str
36
+ scheduled_start: datetime.datetime
37
+ scheduled_end: datetime.datetime | None
38
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
39
+
40
+ def to_dict(self) -> dict[str, Any]:
41
+ code = self.code
42
+
43
+ message = self.message
44
+
45
+ acquisition_id = self.acquisition_id
46
+
47
+ subject_id = self.subject_id
48
+
49
+ scheduled_start = self.scheduled_start.isoformat()
50
+
51
+ scheduled_end: None | str
52
+ if isinstance(self.scheduled_end, datetime.datetime):
53
+ scheduled_end = self.scheduled_end.isoformat()
54
+ else:
55
+ scheduled_end = self.scheduled_end
56
+
57
+ field_dict: dict[str, Any] = {}
58
+ field_dict.update(self.additional_properties)
59
+ field_dict.update(
60
+ {
61
+ "code": code,
62
+ "message": message,
63
+ "acquisition_id": acquisition_id,
64
+ "subject_id": subject_id,
65
+ "scheduled_start": scheduled_start,
66
+ "scheduled_end": scheduled_end,
67
+ }
68
+ )
69
+
70
+ return field_dict
71
+
72
+ @classmethod
73
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
74
+ d = dict(src_dict)
75
+ code = d.pop("code")
76
+
77
+ message = d.pop("message")
78
+
79
+ acquisition_id = d.pop("acquisition_id")
80
+
81
+ subject_id = d.pop("subject_id")
82
+
83
+ scheduled_start = datetime.datetime.fromisoformat(d.pop("scheduled_start"))
84
+
85
+ def _parse_scheduled_end(data: object) -> datetime.datetime | None:
86
+ if data is None:
87
+ return data
88
+ try:
89
+ if not isinstance(data, str):
90
+ raise TypeError()
91
+ componentsschemas_instant_nullable_type_1 = datetime.datetime.fromisoformat(data)
92
+
93
+ return componentsschemas_instant_nullable_type_1
94
+ except (TypeError, ValueError, AttributeError, KeyError):
95
+ pass
96
+ return cast(datetime.datetime | None, data)
97
+
98
+ scheduled_end = _parse_scheduled_end(d.pop("scheduled_end"))
99
+
100
+ acquisition_warning = cls(
101
+ code=code,
102
+ message=message,
103
+ acquisition_id=acquisition_id,
104
+ subject_id=subject_id,
105
+ scheduled_start=scheduled_start,
106
+ scheduled_end=scheduled_end,
107
+ )
108
+
109
+ acquisition_warning.additional_properties = d
110
+ return acquisition_warning
111
+
112
+ @property
113
+ def additional_keys(self) -> list[str]:
114
+ return list(self.additional_properties.keys())
115
+
116
+ def __getitem__(self, key: str) -> Any:
117
+ return self.additional_properties[key]
118
+
119
+ def __setitem__(self, key: str, value: Any) -> None:
120
+ self.additional_properties[key] = value
121
+
122
+ def __delitem__(self, key: str) -> None:
123
+ del self.additional_properties[key]
124
+
125
+ def __contains__(self, key: str) -> bool:
126
+ return key in self.additional_properties
@@ -0,0 +1,83 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ from ..models.principal_kind import PrincipalKind
12
+
13
+
14
+ T = TypeVar("T", bound="AddPrincipalRequest")
15
+
16
+
17
+ @_attrs_define
18
+ class AddPrincipalRequest:
19
+ """Registers a principal before it has signed in (how rig applications are added).
20
+
21
+ Attributes:
22
+ object_id (str): Directory object id (a GUID) of the person or the application's service principal.
23
+ kind (PrincipalKind): What kind of directory principal a role is held by.
24
+ display_name (str): A label for the list.
25
+ """
26
+
27
+ object_id: str
28
+ kind: PrincipalKind
29
+ display_name: str
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ object_id = self.object_id
34
+
35
+ kind = self.kind.value
36
+
37
+ display_name = self.display_name
38
+
39
+ field_dict: dict[str, Any] = {}
40
+ field_dict.update(self.additional_properties)
41
+ field_dict.update(
42
+ {
43
+ "object_id": object_id,
44
+ "kind": kind,
45
+ "display_name": display_name,
46
+ }
47
+ )
48
+
49
+ return field_dict
50
+
51
+ @classmethod
52
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
53
+ d = dict(src_dict)
54
+ object_id = d.pop("object_id")
55
+
56
+ kind = PrincipalKind(d.pop("kind"))
57
+
58
+ display_name = d.pop("display_name")
59
+
60
+ add_principal_request = cls(
61
+ object_id=object_id,
62
+ kind=kind,
63
+ display_name=display_name,
64
+ )
65
+
66
+ add_principal_request.additional_properties = d
67
+ return add_principal_request
68
+
69
+ @property
70
+ def additional_keys(self) -> list[str]:
71
+ return list(self.additional_properties.keys())
72
+
73
+ def __getitem__(self, key: str) -> Any:
74
+ return self.additional_properties[key]
75
+
76
+ def __setitem__(self, key: str, value: Any) -> None:
77
+ self.additional_properties[key] = value
78
+
79
+ def __delitem__(self, key: str) -> None:
80
+ del self.additional_properties[key]
81
+
82
+ def __contains__(self, key: str) -> bool:
83
+ return key in self.additional_properties
@@ -0,0 +1,271 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ from ..models.access_role_nullable_type_1 import AccessRoleNullableType1
12
+ from ..models.access_role_nullable_type_2_type_1 import AccessRoleNullableType2Type1
13
+ from ..models.access_role_nullable_type_3_type_1 import AccessRoleNullableType3Type1
14
+ from ..models.api_token_status import ApiTokenStatus
15
+ from ..types import UNSET, Unset
16
+ from typing import cast
17
+ import datetime
18
+
19
+
20
+ T = TypeVar("T", bound="ApiTokenResponse")
21
+
22
+
23
+ @_attrs_define
24
+ class ApiTokenResponse:
25
+ """An API token's metadata. The secret is shown once, when created, and never again.
26
+
27
+ Attributes:
28
+ id (int): Token id; also recorded in the audit as `api_token:<id>`.
29
+ principal_object_id (str): The principal the token acts as: it gets exactly that principal's roles.
30
+ name (str): What the token is for.
31
+ prefix (str): First 8 characters of the token (e.g. `dkt_ab12`), to recognize it.
32
+ created_by_object_id (None | str): The admin who issued it. An admin can issue a token for any registered
33
+ person, and it then acts as that person; this makes it visible.
34
+ created_at (datetime.datetime): UTC instant, ISO 8601 with offset, e.g. 2026-10-15T16:00:00Z.
35
+ expires_at (datetime.datetime): UTC instant, ISO 8601 with offset, e.g. 2026-10-15T16:00:00Z.
36
+ last_used_at (datetime.datetime | None):
37
+ revoked_at (datetime.datetime | None):
38
+ status (ApiTokenStatus): Whether an API token can be used.
39
+ personal (bool | Unset): True when the owner created it themselves; false when an admin issued it. Default:
40
+ False.
41
+ max_role (AccessRoleNullableType1 | AccessRoleNullableType2Type1 | AccessRoleNullableType3Type1 | None | Unset):
42
+ """
43
+
44
+ id: int
45
+ principal_object_id: str
46
+ name: str
47
+ prefix: str
48
+ created_by_object_id: None | str
49
+ created_at: datetime.datetime
50
+ expires_at: datetime.datetime
51
+ last_used_at: datetime.datetime | None
52
+ revoked_at: datetime.datetime | None
53
+ status: ApiTokenStatus
54
+ personal: bool | Unset = False
55
+ max_role: (
56
+ AccessRoleNullableType1
57
+ | AccessRoleNullableType2Type1
58
+ | AccessRoleNullableType3Type1
59
+ | None
60
+ | Unset
61
+ ) = UNSET
62
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
63
+
64
+ def to_dict(self) -> dict[str, Any]:
65
+ id = self.id
66
+
67
+ principal_object_id = self.principal_object_id
68
+
69
+ name = self.name
70
+
71
+ prefix = self.prefix
72
+
73
+ created_by_object_id: None | str
74
+ created_by_object_id = self.created_by_object_id
75
+
76
+ created_at = self.created_at.isoformat()
77
+
78
+ expires_at = self.expires_at.isoformat()
79
+
80
+ last_used_at: None | str
81
+ if isinstance(self.last_used_at, datetime.datetime):
82
+ last_used_at = self.last_used_at.isoformat()
83
+ else:
84
+ last_used_at = self.last_used_at
85
+
86
+ revoked_at: None | str
87
+ if isinstance(self.revoked_at, datetime.datetime):
88
+ revoked_at = self.revoked_at.isoformat()
89
+ else:
90
+ revoked_at = self.revoked_at
91
+
92
+ status = self.status.value
93
+
94
+ personal = self.personal
95
+
96
+ max_role: None | str | Unset
97
+ if isinstance(self.max_role, Unset):
98
+ max_role = UNSET
99
+ elif isinstance(self.max_role, AccessRoleNullableType1):
100
+ max_role = self.max_role.value
101
+ elif isinstance(self.max_role, AccessRoleNullableType2Type1):
102
+ max_role = self.max_role.value
103
+ elif isinstance(self.max_role, AccessRoleNullableType3Type1):
104
+ max_role = self.max_role.value
105
+ else:
106
+ max_role = self.max_role
107
+
108
+ field_dict: dict[str, Any] = {}
109
+ field_dict.update(self.additional_properties)
110
+ field_dict.update(
111
+ {
112
+ "id": id,
113
+ "principal_object_id": principal_object_id,
114
+ "name": name,
115
+ "prefix": prefix,
116
+ "created_by_object_id": created_by_object_id,
117
+ "created_at": created_at,
118
+ "expires_at": expires_at,
119
+ "last_used_at": last_used_at,
120
+ "revoked_at": revoked_at,
121
+ "status": status,
122
+ }
123
+ )
124
+ if personal is not UNSET:
125
+ field_dict["personal"] = personal
126
+ if max_role is not UNSET:
127
+ field_dict["max_role"] = max_role
128
+
129
+ return field_dict
130
+
131
+ @classmethod
132
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
133
+ d = dict(src_dict)
134
+ id = d.pop("id")
135
+
136
+ principal_object_id = d.pop("principal_object_id")
137
+
138
+ name = d.pop("name")
139
+
140
+ prefix = d.pop("prefix")
141
+
142
+ def _parse_created_by_object_id(data: object) -> None | str:
143
+ if data is None:
144
+ return data
145
+ return cast(None | str, data)
146
+
147
+ created_by_object_id = _parse_created_by_object_id(d.pop("created_by_object_id"))
148
+
149
+ created_at = datetime.datetime.fromisoformat(d.pop("created_at"))
150
+
151
+ expires_at = datetime.datetime.fromisoformat(d.pop("expires_at"))
152
+
153
+ def _parse_last_used_at(data: object) -> datetime.datetime | None:
154
+ if data is None:
155
+ return data
156
+ try:
157
+ if not isinstance(data, str):
158
+ raise TypeError()
159
+ componentsschemas_instant_nullable_type_1 = datetime.datetime.fromisoformat(data)
160
+
161
+ return componentsschemas_instant_nullable_type_1
162
+ except (TypeError, ValueError, AttributeError, KeyError):
163
+ pass
164
+ return cast(datetime.datetime | None, data)
165
+
166
+ last_used_at = _parse_last_used_at(d.pop("last_used_at"))
167
+
168
+ def _parse_revoked_at(data: object) -> datetime.datetime | None:
169
+ if data is None:
170
+ return data
171
+ try:
172
+ if not isinstance(data, str):
173
+ raise TypeError()
174
+ componentsschemas_instant_nullable_type_1 = datetime.datetime.fromisoformat(data)
175
+
176
+ return componentsschemas_instant_nullable_type_1
177
+ except (TypeError, ValueError, AttributeError, KeyError):
178
+ pass
179
+ return cast(datetime.datetime | None, data)
180
+
181
+ revoked_at = _parse_revoked_at(d.pop("revoked_at"))
182
+
183
+ status = ApiTokenStatus(d.pop("status"))
184
+
185
+ personal = d.pop("personal", UNSET)
186
+
187
+ def _parse_max_role(
188
+ data: object,
189
+ ) -> (
190
+ AccessRoleNullableType1
191
+ | AccessRoleNullableType2Type1
192
+ | AccessRoleNullableType3Type1
193
+ | None
194
+ | Unset
195
+ ):
196
+ if data is None:
197
+ return data
198
+ if isinstance(data, Unset):
199
+ return data
200
+ try:
201
+ if not isinstance(data, str):
202
+ raise TypeError()
203
+ componentsschemas_access_role_nullable_type_1 = AccessRoleNullableType1(data)
204
+
205
+ return componentsschemas_access_role_nullable_type_1
206
+ except (TypeError, ValueError, AttributeError, KeyError):
207
+ pass
208
+ try:
209
+ if not isinstance(data, str):
210
+ raise TypeError()
211
+ componentsschemas_access_role_nullable_type_2_type_1 = AccessRoleNullableType2Type1(
212
+ data
213
+ )
214
+
215
+ return componentsschemas_access_role_nullable_type_2_type_1
216
+ except (TypeError, ValueError, AttributeError, KeyError):
217
+ pass
218
+ try:
219
+ if not isinstance(data, str):
220
+ raise TypeError()
221
+ componentsschemas_access_role_nullable_type_3_type_1 = AccessRoleNullableType3Type1(
222
+ data
223
+ )
224
+
225
+ return componentsschemas_access_role_nullable_type_3_type_1
226
+ except (TypeError, ValueError, AttributeError, KeyError):
227
+ pass
228
+ return cast(
229
+ AccessRoleNullableType1
230
+ | AccessRoleNullableType2Type1
231
+ | AccessRoleNullableType3Type1
232
+ | None
233
+ | Unset,
234
+ data,
235
+ )
236
+
237
+ max_role = _parse_max_role(d.pop("max_role", UNSET))
238
+
239
+ api_token_response = cls(
240
+ id=id,
241
+ principal_object_id=principal_object_id,
242
+ name=name,
243
+ prefix=prefix,
244
+ created_by_object_id=created_by_object_id,
245
+ created_at=created_at,
246
+ expires_at=expires_at,
247
+ last_used_at=last_used_at,
248
+ revoked_at=revoked_at,
249
+ status=status,
250
+ personal=personal,
251
+ max_role=max_role,
252
+ )
253
+
254
+ api_token_response.additional_properties = d
255
+ return api_token_response
256
+
257
+ @property
258
+ def additional_keys(self) -> list[str]:
259
+ return list(self.additional_properties.keys())
260
+
261
+ def __getitem__(self, key: str) -> Any:
262
+ return self.additional_properties[key]
263
+
264
+ def __setitem__(self, key: str, value: Any) -> None:
265
+ self.additional_properties[key] = value
266
+
267
+ def __delitem__(self, key: str) -> None:
268
+ del self.additional_properties[key]
269
+
270
+ def __contains__(self, key: str) -> bool:
271
+ return key in self.additional_properties
@@ -0,0 +1,10 @@
1
+ from enum import Enum
2
+
3
+
4
+ class ApiTokenStatus(str, Enum):
5
+ ACTIVE = "active"
6
+ EXPIRED = "expired"
7
+ REVOKED = "revoked"
8
+
9
+ def __str__(self) -> str:
10
+ return str(self.value)
@@ -0,0 +1,77 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ from ..models.future_occurrences import FutureOccurrences
12
+
13
+
14
+ T = TypeVar("T", bound="ArchiveRecurringAcquisitionRequest")
15
+
16
+
17
+ @_attrs_define
18
+ class ArchiveRecurringAcquisitionRequest:
19
+ """Archive a definition: it generates nothing further, and its history is kept.
20
+
21
+ Attributes:
22
+ expected_version (int): The `version` the client last read. A stale value is rejected with 409
23
+ `version_conflict`.
24
+ future_occurrences (FutureOccurrences): What archiving a definition does to occurrences that have not started
25
+ yet.
26
+ """
27
+
28
+ expected_version: int
29
+ future_occurrences: FutureOccurrences
30
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
31
+
32
+ def to_dict(self) -> dict[str, Any]:
33
+ expected_version = self.expected_version
34
+
35
+ future_occurrences = self.future_occurrences.value
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update(
40
+ {
41
+ "expected_version": expected_version,
42
+ "future_occurrences": future_occurrences,
43
+ }
44
+ )
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
50
+ d = dict(src_dict)
51
+ expected_version = d.pop("expected_version")
52
+
53
+ future_occurrences = FutureOccurrences(d.pop("future_occurrences"))
54
+
55
+ archive_recurring_acquisition_request = cls(
56
+ expected_version=expected_version,
57
+ future_occurrences=future_occurrences,
58
+ )
59
+
60
+ archive_recurring_acquisition_request.additional_properties = d
61
+ return archive_recurring_acquisition_request
62
+
63
+ @property
64
+ def additional_keys(self) -> list[str]:
65
+ return list(self.additional_properties.keys())
66
+
67
+ def __getitem__(self, key: str) -> Any:
68
+ return self.additional_properties[key]
69
+
70
+ def __setitem__(self, key: str, value: Any) -> None:
71
+ self.additional_properties[key] = value
72
+
73
+ def __delitem__(self, key: str) -> None:
74
+ del self.additional_properties[key]
75
+
76
+ def __contains__(self, key: str) -> bool:
77
+ return key in self.additional_properties
@@ -0,0 +1,83 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..types import UNSET, Unset
10
+
11
+ from typing import cast
12
+
13
+ if TYPE_CHECKING:
14
+ from ..models.recurring_acquisition_response import RecurringAcquisitionResponse
15
+
16
+
17
+ T = TypeVar("T", bound="ArchiveRecurringAcquisitionResponse")
18
+
19
+
20
+ @_attrs_define
21
+ class ArchiveRecurringAcquisitionResponse:
22
+ """An archived definition and the occurrences archived with it.
23
+
24
+ Attributes:
25
+ definition (RecurringAcquisitionResponse): A recurring definition: scheduling intent, from which occurrences
26
+ were materialized.
27
+ archived_occurrence_ids (list[int]): Occurrences archived by this call.
28
+ """
29
+
30
+ definition: RecurringAcquisitionResponse
31
+ archived_occurrence_ids: list[int]
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ from ..models.recurring_acquisition_response import RecurringAcquisitionResponse
36
+
37
+ definition = self.definition.to_dict()
38
+
39
+ archived_occurrence_ids = self.archived_occurrence_ids
40
+
41
+ field_dict: dict[str, Any] = {}
42
+ field_dict.update(self.additional_properties)
43
+ field_dict.update(
44
+ {
45
+ "definition": definition,
46
+ "archived_occurrence_ids": archived_occurrence_ids,
47
+ }
48
+ )
49
+
50
+ return field_dict
51
+
52
+ @classmethod
53
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
54
+ from ..models.recurring_acquisition_response import RecurringAcquisitionResponse
55
+
56
+ d = dict(src_dict)
57
+ definition = RecurringAcquisitionResponse.from_dict(d.pop("definition"))
58
+
59
+ archived_occurrence_ids = cast(list[int], d.pop("archived_occurrence_ids"))
60
+
61
+ archive_recurring_acquisition_response = cls(
62
+ definition=definition,
63
+ archived_occurrence_ids=archived_occurrence_ids,
64
+ )
65
+
66
+ archive_recurring_acquisition_response.additional_properties = d
67
+ return archive_recurring_acquisition_response
68
+
69
+ @property
70
+ def additional_keys(self) -> list[str]:
71
+ return list(self.additional_properties.keys())
72
+
73
+ def __getitem__(self, key: str) -> Any:
74
+ return self.additional_properties[key]
75
+
76
+ def __setitem__(self, key: str, value: Any) -> None:
77
+ self.additional_properties[key] = value
78
+
79
+ def __delitem__(self, key: str) -> None:
80
+ del self.additional_properties[key]
81
+
82
+ def __contains__(self, key: str) -> bool:
83
+ return key in self.additional_properties