hushscript 1.0.0__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 (187) hide show
  1. hushscript/__init__.py +97 -0
  2. hushscript/_client.py +687 -0
  3. hushscript/_clock.py +36 -0
  4. hushscript/_config.py +139 -0
  5. hushscript/_errors.py +563 -0
  6. hushscript/_guard.py +61 -0
  7. hushscript/_http.py +624 -0
  8. hushscript/_json.py +55 -0
  9. hushscript/_log.py +155 -0
  10. hushscript/_models.py +144 -0
  11. hushscript/_pacing.py +51 -0
  12. hushscript/_redact.py +140 -0
  13. hushscript/_response.py +67 -0
  14. hushscript/_retry.py +205 -0
  15. hushscript/_shape.py +197 -0
  16. hushscript/_shapes.py +248 -0
  17. hushscript/_version.py +1 -0
  18. hushscript/format.py +224 -0
  19. hushscript/generated/__init__.py +8 -0
  20. hushscript/generated/api/__init__.py +1 -0
  21. hushscript/generated/api/default/__init__.py +1 -0
  22. hushscript/generated/api/default/buy_minutes.py +248 -0
  23. hushscript/generated/api/default/claim_agent_account.py +238 -0
  24. hushscript/generated/api/default/complete_upload.py +238 -0
  25. hushscript/generated/api/default/create_agent_account_signup.py +261 -0
  26. hushscript/generated/api/default/create_setup_session.py +244 -0
  27. hushscript/generated/api/default/create_upload.py +225 -0
  28. hushscript/generated/api/default/get_account.py +169 -0
  29. hushscript/generated/api/default/get_job.py +198 -0
  30. hushscript/generated/api/default/get_org.py +169 -0
  31. hushscript/generated/api/default/get_transcript.py +226 -0
  32. hushscript/generated/api/default/get_transcription_context.py +173 -0
  33. hushscript/generated/api/default/get_upload_part_urls.py +246 -0
  34. hushscript/generated/api/default/heartbeat_upload.py +197 -0
  35. hushscript/generated/api/default/lift_transcript_hold.py +206 -0
  36. hushscript/generated/api/default/list_credit_ledger.py +229 -0
  37. hushscript/generated/api/default/list_deleted_transcripts.py +237 -0
  38. hushscript/generated/api/default/list_holds.py +233 -0
  39. hushscript/generated/api/default/list_jobs.py +249 -0
  40. hushscript/generated/api/default/list_org_audit.py +221 -0
  41. hushscript/generated/api/default/list_org_invoices.py +221 -0
  42. hushscript/generated/api/default/list_org_ledger.py +221 -0
  43. hushscript/generated/api/default/list_org_matters.py +247 -0
  44. hushscript/generated/api/default/list_org_members.py +221 -0
  45. hushscript/generated/api/default/list_org_transcripts.py +233 -0
  46. hushscript/generated/api/default/list_packs.py +169 -0
  47. hushscript/generated/api/default/list_saved_cards.py +169 -0
  48. hushscript/generated/api/default/list_transactions.py +225 -0
  49. hushscript/generated/api/default/list_transcripts.py +225 -0
  50. hushscript/generated/api/default/org_audit_csv.py +163 -0
  51. hushscript/generated/api/default/org_ledger_csv.py +163 -0
  52. hushscript/generated/api/default/org_usage_report.py +247 -0
  53. hushscript/generated/api/default/org_usage_report_csv.py +229 -0
  54. hushscript/generated/api/default/patch_org_member.py +237 -0
  55. hushscript/generated/api/default/place_transcript_hold.py +206 -0
  56. hushscript/generated/api/default/rotate_agent_credentials.py +177 -0
  57. hushscript/generated/api/default/schedule_org_custody.py +215 -0
  58. hushscript/generated/api/default/set_default_card.py +223 -0
  59. hushscript/generated/api/default/upload_part.py +249 -0
  60. hushscript/generated/catalog.py +138 -0
  61. hushscript/generated/client.py +282 -0
  62. hushscript/generated/errors.py +16 -0
  63. hushscript/generated/hints.py +28 -0
  64. hushscript/generated/models/__init__.py +193 -0
  65. hushscript/generated/models/account_response.py +114 -0
  66. hushscript/generated/models/active_hold.py +88 -0
  67. hushscript/generated/models/active_hold_kind.py +18 -0
  68. hushscript/generated/models/agent_claim_request.py +61 -0
  69. hushscript/generated/models/agent_claim_response.py +85 -0
  70. hushscript/generated/models/agent_credentials_rotate_response.py +101 -0
  71. hushscript/generated/models/agent_signup_request.py +118 -0
  72. hushscript/generated/models/agent_signup_request_agent.py +80 -0
  73. hushscript/generated/models/agent_signup_response.py +111 -0
  74. hushscript/generated/models/buy_minutes_body.py +89 -0
  75. hushscript/generated/models/card.py +132 -0
  76. hushscript/generated/models/cards_response.py +90 -0
  77. hushscript/generated/models/complete_upload_body.py +107 -0
  78. hushscript/generated/models/complete_upload_body_parts_type_0_item.py +69 -0
  79. hushscript/generated/models/context_dictionary.py +143 -0
  80. hushscript/generated/models/context_prompt_preset.py +118 -0
  81. hushscript/generated/models/create_setup_session_body.py +62 -0
  82. hushscript/generated/models/create_upload_body.py +254 -0
  83. hushscript/generated/models/create_upload_body_transcription_options_type_0.py +178 -0
  84. hushscript/generated/models/credit_ledger_entry.py +113 -0
  85. hushscript/generated/models/credit_ledger_response.py +90 -0
  86. hushscript/generated/models/deleted_transcript.py +148 -0
  87. hushscript/generated/models/deleted_transcript_cause.py +18 -0
  88. hushscript/generated/models/deleted_transcript_receipt_type_0.py +107 -0
  89. hushscript/generated/models/deleted_transcript_receipt_type_0_items_item.py +69 -0
  90. hushscript/generated/models/deleted_transcripts_response.py +90 -0
  91. hushscript/generated/models/dictionary_entry.py +123 -0
  92. hushscript/generated/models/dictionary_entry_category.py +37 -0
  93. hushscript/generated/models/error.py +155 -0
  94. hushscript/generated/models/error_details.py +94 -0
  95. hushscript/generated/models/get_upload_part_urls_response_200_type_0.py +108 -0
  96. hushscript/generated/models/heartbeat_upload_response_200.py +61 -0
  97. hushscript/generated/models/holds_response.py +90 -0
  98. hushscript/generated/models/job.py +309 -0
  99. hushscript/generated/models/job_failure_kind_type_1.py +16 -0
  100. hushscript/generated/models/job_failure_kind_type_2_type_1.py +16 -0
  101. hushscript/generated/models/job_failure_kind_type_3_type_1.py +16 -0
  102. hushscript/generated/models/job_list.py +90 -0
  103. hushscript/generated/models/lift_transcript_hold_response_200.py +61 -0
  104. hushscript/generated/models/list_jobs_active.py +17 -0
  105. hushscript/generated/models/list_org_matters_status.py +16 -0
  106. hushscript/generated/models/options_summary.py +135 -0
  107. hushscript/generated/models/org_audit_entry.py +105 -0
  108. hushscript/generated/models/org_audit_response.py +90 -0
  109. hushscript/generated/models/org_invoice.py +175 -0
  110. hushscript/generated/models/org_invoices_response.py +90 -0
  111. hushscript/generated/models/org_ledger_entry.py +155 -0
  112. hushscript/generated/models/org_ledger_response.py +90 -0
  113. hushscript/generated/models/org_matter.py +79 -0
  114. hushscript/generated/models/org_matter_status.py +16 -0
  115. hushscript/generated/models/org_matters_response.py +75 -0
  116. hushscript/generated/models/org_member.py +123 -0
  117. hushscript/generated/models/org_members_response.py +90 -0
  118. hushscript/generated/models/org_summary_response.py +482 -0
  119. hushscript/generated/models/org_transcript.py +103 -0
  120. hushscript/generated/models/org_transcripts_response.py +90 -0
  121. hushscript/generated/models/org_usage_report_csv_group_by.py +17 -0
  122. hushscript/generated/models/org_usage_report_group_by.py +17 -0
  123. hushscript/generated/models/org_usage_response.py +112 -0
  124. hushscript/generated/models/org_usage_response_group_by.py +17 -0
  125. hushscript/generated/models/org_usage_row.py +86 -0
  126. hushscript/generated/models/pack.py +107 -0
  127. hushscript/generated/models/packs_response.py +75 -0
  128. hushscript/generated/models/patch_org_member_body.py +102 -0
  129. hushscript/generated/models/patch_org_member_response_200.py +61 -0
  130. hushscript/generated/models/place_transcript_hold_response_200.py +61 -0
  131. hushscript/generated/models/presigned_part_url.py +69 -0
  132. hushscript/generated/models/purchase_response.py +76 -0
  133. hushscript/generated/models/schedule_org_custody_body.py +66 -0
  134. hushscript/generated/models/schedule_org_custody_body_custody.py +17 -0
  135. hushscript/generated/models/schedule_org_custody_response_200.py +69 -0
  136. hushscript/generated/models/set_default_card_body.py +61 -0
  137. hushscript/generated/models/set_default_card_response_200.py +61 -0
  138. hushscript/generated/models/setup_session_response.py +77 -0
  139. hushscript/generated/models/transaction.py +183 -0
  140. hushscript/generated/models/transactions_response.py +98 -0
  141. hushscript/generated/models/transcript_detail.py +194 -0
  142. hushscript/generated/models/transcript_detail_speaker_names.py +47 -0
  143. hushscript/generated/models/transcript_envelope.py +89 -0
  144. hushscript/generated/models/transcript_envelope_translations.py +62 -0
  145. hushscript/generated/models/transcript_language.py +75 -0
  146. hushscript/generated/models/transcript_list.py +90 -0
  147. hushscript/generated/models/transcript_list_row.py +152 -0
  148. hushscript/generated/models/transcript_list_row_insights_state.py +20 -0
  149. hushscript/generated/models/transcription_context_response.py +95 -0
  150. hushscript/generated/models/upload_complete_response.py +100 -0
  151. hushscript/generated/models/upload_create_response.py +148 -0
  152. hushscript/generated/models/upload_create_response_funding.py +16 -0
  153. hushscript/generated/models/upload_create_response_upload_type_0.py +108 -0
  154. hushscript/generated/models/upload_limits.py +86 -0
  155. hushscript/generated/models/upload_part_response_200.py +69 -0
  156. hushscript/generated/models/utterance.py +85 -0
  157. hushscript/generated/scopes.py +42 -0
  158. hushscript/generated/types.py +54 -0
  159. hushscript/money.py +79 -0
  160. hushscript/paginate.py +78 -0
  161. hushscript/py.typed +0 -0
  162. hushscript/resources/__init__.py +1 -0
  163. hushscript/resources/_params.py +33 -0
  164. hushscript/resources/account.py +121 -0
  165. hushscript/resources/agent.py +421 -0
  166. hushscript/resources/billing.py +567 -0
  167. hushscript/resources/jobs.py +105 -0
  168. hushscript/resources/transcripts.py +209 -0
  169. hushscript/transcribe/__init__.py +1 -0
  170. hushscript/transcribe/apipeline.py +234 -0
  171. hushscript/transcribe/aupload.py +197 -0
  172. hushscript/transcribe/heartbeat.py +78 -0
  173. hushscript/transcribe/pipeline.py +312 -0
  174. hushscript/transcribe/preflight.py +272 -0
  175. hushscript/transcribe/probe.py +185 -0
  176. hushscript/transcribe/resume.py +115 -0
  177. hushscript/transcribe/segment.py +23 -0
  178. hushscript/transcribe/session.py +34 -0
  179. hushscript/transcribe/sniff.py +30 -0
  180. hushscript/transcribe/source.py +218 -0
  181. hushscript/transcribe/upload.py +498 -0
  182. hushscript/transcribe/wait.py +124 -0
  183. hushscript/transcript.py +197 -0
  184. hushscript-1.0.0.dist-info/METADATA +502 -0
  185. hushscript-1.0.0.dist-info/RECORD +187 -0
  186. hushscript-1.0.0.dist-info/WHEEL +4 -0
  187. hushscript-1.0.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,118 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar
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
+ if TYPE_CHECKING:
12
+ from ..models.agent_signup_request_agent import AgentSignupRequestAgent
13
+
14
+
15
+ T = TypeVar("T", bound="AgentSignupRequest")
16
+
17
+
18
+ @_attrs_define
19
+ class AgentSignupRequest:
20
+ """The client must never supply amount: it is derived server side from pack.
21
+
22
+ Attributes:
23
+ contact_email (str): Address for receipts and notices only. Never used to sign in; the created account has no
24
+ login path of its own.
25
+ pack_id (str): Which minute pack to buy. See GET /v1/billing/packs for the catalogue.
26
+ accept_terms_version (str): Must equal the server's current policy version or the request is refused with
27
+ policy_version_stale, which names the current value.
28
+ agent (AgentSignupRequestAgent):
29
+ data_region (str | Unset): Optional region hint. Honored only when it agrees with the region derived from your
30
+ network location; otherwise the derived region is used silently.
31
+ dry_run (bool | Unset): Validate the request and return a synthetic response with no Stripe session and no
32
+ charge. Defaults to false.
33
+ """
34
+
35
+ contact_email: str
36
+ pack_id: str
37
+ accept_terms_version: str
38
+ agent: AgentSignupRequestAgent
39
+ data_region: str | Unset = UNSET
40
+ dry_run: bool | Unset = UNSET
41
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
42
+
43
+ def to_dict(self) -> dict[str, Any]:
44
+ contact_email = self.contact_email
45
+
46
+ pack_id = self.pack_id
47
+
48
+ accept_terms_version = self.accept_terms_version
49
+
50
+ agent = self.agent.to_dict()
51
+
52
+ data_region = self.data_region
53
+
54
+ dry_run = self.dry_run
55
+
56
+ field_dict: dict[str, Any] = {}
57
+ field_dict.update(self.additional_properties)
58
+ field_dict.update(
59
+ {
60
+ "contact_email": contact_email,
61
+ "pack_id": pack_id,
62
+ "accept_terms_version": accept_terms_version,
63
+ "agent": agent,
64
+ }
65
+ )
66
+ if data_region is not UNSET:
67
+ field_dict["data_region"] = data_region
68
+ if dry_run is not UNSET:
69
+ field_dict["dry_run"] = dry_run
70
+
71
+ return field_dict
72
+
73
+ @classmethod
74
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
75
+ from ..models.agent_signup_request_agent import (
76
+ AgentSignupRequestAgent, # noqa: PLC0415
77
+ )
78
+
79
+ d = dict(src_dict)
80
+ contact_email = d.pop("contact_email")
81
+
82
+ pack_id = d.pop("pack_id")
83
+
84
+ accept_terms_version = d.pop("accept_terms_version")
85
+
86
+ agent = AgentSignupRequestAgent.from_dict(d.pop("agent"))
87
+
88
+ data_region = d.pop("data_region", UNSET)
89
+
90
+ dry_run = d.pop("dry_run", UNSET)
91
+
92
+ agent_signup_request = cls(
93
+ contact_email=contact_email,
94
+ pack_id=pack_id,
95
+ accept_terms_version=accept_terms_version,
96
+ agent=agent,
97
+ data_region=data_region,
98
+ dry_run=dry_run,
99
+ )
100
+
101
+ agent_signup_request.additional_properties = d
102
+ return agent_signup_request
103
+
104
+ @property
105
+ def additional_keys(self) -> list[str]:
106
+ return list(self.additional_properties.keys())
107
+
108
+ def __getitem__(self, key: str) -> Any:
109
+ return self.additional_properties[key]
110
+
111
+ def __setitem__(self, key: str, value: Any) -> None:
112
+ self.additional_properties[key] = value
113
+
114
+ def __delitem__(self, key: str) -> None:
115
+ del self.additional_properties[key]
116
+
117
+ def __contains__(self, key: str) -> bool:
118
+ return key in self.additional_properties
@@ -0,0 +1,80 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
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
+ T = TypeVar("T", bound="AgentSignupRequestAgent")
12
+
13
+
14
+ @_attrs_define
15
+ class AgentSignupRequestAgent:
16
+ """
17
+ Attributes:
18
+ name (str):
19
+ platform (str):
20
+ contact_url (str | Unset):
21
+ """
22
+
23
+ name: str
24
+ platform: str
25
+ contact_url: str | Unset = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ name = self.name
30
+
31
+ platform = self.platform
32
+
33
+ contact_url = self.contact_url
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "name": name,
40
+ "platform": platform,
41
+ }
42
+ )
43
+ if contact_url is not UNSET:
44
+ field_dict["contact_url"] = contact_url
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
+ name = d.pop("name")
52
+
53
+ platform = d.pop("platform")
54
+
55
+ contact_url = d.pop("contact_url", UNSET)
56
+
57
+ agent_signup_request_agent = cls(
58
+ name=name,
59
+ platform=platform,
60
+ contact_url=contact_url,
61
+ )
62
+
63
+ agent_signup_request_agent.additional_properties = d
64
+ return agent_signup_request_agent
65
+
66
+ @property
67
+ def additional_keys(self) -> list[str]:
68
+ return list(self.additional_properties.keys())
69
+
70
+ def __getitem__(self, key: str) -> Any:
71
+ return self.additional_properties[key]
72
+
73
+ def __setitem__(self, key: str, value: Any) -> None:
74
+ self.additional_properties[key] = value
75
+
76
+ def __delitem__(self, key: str) -> None:
77
+ del self.additional_properties[key]
78
+
79
+ def __contains__(self, key: str) -> bool:
80
+ return key in self.additional_properties
@@ -0,0 +1,111 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="AgentSignupResponse")
10
+
11
+
12
+ @_attrs_define
13
+ class AgentSignupResponse:
14
+ """
15
+ Attributes:
16
+ signup_id (str): Region-prefixed (hsr1:<region>:<id>), e.g. hsr1:eu:4c3a1f9e7b2d4e6f8a0c1b2d3e4f5061. Present it
17
+ back verbatim as the path segment when claiming the account. A dry_run response's signup_id is prefixed dry_
18
+ instead and can never be claimed.
19
+ claim_secret (str): Returned exactly once. Only its hash is stored; there is no way to recover it later.
20
+ checkout_url (str): Open this URL in a browser you control to complete the hosted Checkout page.
21
+ pack (str):
22
+ amount (int): Charge amount in the currency's minor unit.
23
+ currency (str):
24
+ expires_at (int): Unix timestamp after which the Session stops accepting a card.
25
+ """
26
+
27
+ signup_id: str
28
+ claim_secret: str
29
+ checkout_url: str
30
+ pack: str
31
+ amount: int
32
+ currency: str
33
+ expires_at: int
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ signup_id = self.signup_id
38
+
39
+ claim_secret = self.claim_secret
40
+
41
+ checkout_url = self.checkout_url
42
+
43
+ pack = self.pack
44
+
45
+ amount = self.amount
46
+
47
+ currency = self.currency
48
+
49
+ expires_at = self.expires_at
50
+
51
+ field_dict: dict[str, Any] = {}
52
+ field_dict.update(self.additional_properties)
53
+ field_dict.update(
54
+ {
55
+ "signup_id": signup_id,
56
+ "claim_secret": claim_secret,
57
+ "checkout_url": checkout_url,
58
+ "pack": pack,
59
+ "amount": amount,
60
+ "currency": currency,
61
+ "expires_at": expires_at,
62
+ }
63
+ )
64
+
65
+ return field_dict
66
+
67
+ @classmethod
68
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
69
+ d = dict(src_dict)
70
+ signup_id = d.pop("signup_id")
71
+
72
+ claim_secret = d.pop("claim_secret")
73
+
74
+ checkout_url = d.pop("checkout_url")
75
+
76
+ pack = d.pop("pack")
77
+
78
+ amount = d.pop("amount")
79
+
80
+ currency = d.pop("currency")
81
+
82
+ expires_at = d.pop("expires_at")
83
+
84
+ agent_signup_response = cls(
85
+ signup_id=signup_id,
86
+ claim_secret=claim_secret,
87
+ checkout_url=checkout_url,
88
+ pack=pack,
89
+ amount=amount,
90
+ currency=currency,
91
+ expires_at=expires_at,
92
+ )
93
+
94
+ agent_signup_response.additional_properties = d
95
+ return agent_signup_response
96
+
97
+ @property
98
+ def additional_keys(self) -> list[str]:
99
+ return list(self.additional_properties.keys())
100
+
101
+ def __getitem__(self, key: str) -> Any:
102
+ return self.additional_properties[key]
103
+
104
+ def __setitem__(self, key: str, value: Any) -> None:
105
+ self.additional_properties[key] = value
106
+
107
+ def __delitem__(self, key: str) -> None:
108
+ del self.additional_properties[key]
109
+
110
+ def __contains__(self, key: str) -> bool:
111
+ return key in self.additional_properties
@@ -0,0 +1,89 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
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
+ T = TypeVar("T", bound="BuyMinutesBody")
12
+
13
+
14
+ @_attrs_define
15
+ class BuyMinutesBody:
16
+ """
17
+ Attributes:
18
+ pack (str): The id of a pack from list_packs.
19
+ idempotency_key (str): A client-minted key preventing a retried request from charging twice.
20
+ quick_payment_method_id (str): The id of a card from list_saved_cards, required on this API.
21
+ policy_ack (bool | Unset): Client attestation that the no-refund, instant-delivery notice was shown before this
22
+ call. Optional; absent is treated as false.
23
+ """
24
+
25
+ pack: str
26
+ idempotency_key: str
27
+ quick_payment_method_id: str
28
+ policy_ack: bool | Unset = UNSET
29
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
30
+
31
+ def to_dict(self) -> dict[str, Any]:
32
+ pack = self.pack
33
+
34
+ idempotency_key = self.idempotency_key
35
+
36
+ quick_payment_method_id = self.quick_payment_method_id
37
+
38
+ policy_ack = self.policy_ack
39
+
40
+ field_dict: dict[str, Any] = {}
41
+ field_dict.update(self.additional_properties)
42
+ field_dict.update(
43
+ {
44
+ "pack": pack,
45
+ "idempotency_key": idempotency_key,
46
+ "quick_payment_method_id": quick_payment_method_id,
47
+ }
48
+ )
49
+ if policy_ack is not UNSET:
50
+ field_dict["policy_ack"] = policy_ack
51
+
52
+ return field_dict
53
+
54
+ @classmethod
55
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
56
+ d = dict(src_dict)
57
+ pack = d.pop("pack")
58
+
59
+ idempotency_key = d.pop("idempotency_key")
60
+
61
+ quick_payment_method_id = d.pop("quick_payment_method_id")
62
+
63
+ policy_ack = d.pop("policy_ack", UNSET)
64
+
65
+ buy_minutes_body = cls(
66
+ pack=pack,
67
+ idempotency_key=idempotency_key,
68
+ quick_payment_method_id=quick_payment_method_id,
69
+ policy_ack=policy_ack,
70
+ )
71
+
72
+ buy_minutes_body.additional_properties = d
73
+ return buy_minutes_body
74
+
75
+ @property
76
+ def additional_keys(self) -> list[str]:
77
+ return list(self.additional_properties.keys())
78
+
79
+ def __getitem__(self, key: str) -> Any:
80
+ return self.additional_properties[key]
81
+
82
+ def __setitem__(self, key: str, value: Any) -> None:
83
+ self.additional_properties[key] = value
84
+
85
+ def __delitem__(self, key: str) -> None:
86
+ del self.additional_properties[key]
87
+
88
+ def __contains__(self, key: str) -> bool:
89
+ return key in self.additional_properties
@@ -0,0 +1,132 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ T = TypeVar("T", bound="Card")
10
+
11
+
12
+ @_attrs_define
13
+ class Card:
14
+ """
15
+ Attributes:
16
+ id (str): Use this value as quick_payment_method_id when it is is_default and fast_checkout_eligible. If
17
+ default_id is null, naming any fast_checkout_eligible card here also makes it the new default.
18
+ type_ (str):
19
+ brand (str):
20
+ last4 (str):
21
+ exp_month (int):
22
+ exp_year (int):
23
+ email (None | str):
24
+ is_default (bool):
25
+ fast_checkout_eligible (bool): Whether this method may be charged off-session by buy_minutes.
26
+ """
27
+
28
+ id: str
29
+ type_: str
30
+ brand: str
31
+ last4: str
32
+ exp_month: int
33
+ exp_year: int
34
+ email: None | str
35
+ is_default: bool
36
+ fast_checkout_eligible: bool
37
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
38
+
39
+ def to_dict(self) -> dict[str, Any]:
40
+ id = self.id
41
+
42
+ type_ = self.type_
43
+
44
+ brand = self.brand
45
+
46
+ last4 = self.last4
47
+
48
+ exp_month = self.exp_month
49
+
50
+ exp_year = self.exp_year
51
+
52
+ email: None | str
53
+ email = self.email
54
+
55
+ is_default = self.is_default
56
+
57
+ fast_checkout_eligible = self.fast_checkout_eligible
58
+
59
+ field_dict: dict[str, Any] = {}
60
+ field_dict.update(self.additional_properties)
61
+ field_dict.update(
62
+ {
63
+ "id": id,
64
+ "type": type_,
65
+ "brand": brand,
66
+ "last4": last4,
67
+ "exp_month": exp_month,
68
+ "exp_year": exp_year,
69
+ "email": email,
70
+ "is_default": is_default,
71
+ "fast_checkout_eligible": fast_checkout_eligible,
72
+ }
73
+ )
74
+
75
+ return field_dict
76
+
77
+ @classmethod
78
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
79
+ d = dict(src_dict)
80
+ id = d.pop("id")
81
+
82
+ type_ = d.pop("type")
83
+
84
+ brand = d.pop("brand")
85
+
86
+ last4 = d.pop("last4")
87
+
88
+ exp_month = d.pop("exp_month")
89
+
90
+ exp_year = d.pop("exp_year")
91
+
92
+ def _parse_email(data: object) -> None | str:
93
+ if data is None:
94
+ return data
95
+ return cast(None | str, data)
96
+
97
+ email = _parse_email(d.pop("email"))
98
+
99
+ is_default = d.pop("is_default")
100
+
101
+ fast_checkout_eligible = d.pop("fast_checkout_eligible")
102
+
103
+ card = cls(
104
+ id=id,
105
+ type_=type_,
106
+ brand=brand,
107
+ last4=last4,
108
+ exp_month=exp_month,
109
+ exp_year=exp_year,
110
+ email=email,
111
+ is_default=is_default,
112
+ fast_checkout_eligible=fast_checkout_eligible,
113
+ )
114
+
115
+ card.additional_properties = d
116
+ return card
117
+
118
+ @property
119
+ def additional_keys(self) -> list[str]:
120
+ return list(self.additional_properties.keys())
121
+
122
+ def __getitem__(self, key: str) -> Any:
123
+ return self.additional_properties[key]
124
+
125
+ def __setitem__(self, key: str, value: Any) -> None:
126
+ self.additional_properties[key] = value
127
+
128
+ def __delitem__(self, key: str) -> None:
129
+ del self.additional_properties[key]
130
+
131
+ def __contains__(self, key: str) -> bool:
132
+ return key in self.additional_properties
@@ -0,0 +1,90 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ if TYPE_CHECKING:
10
+ from ..models.card import Card
11
+
12
+
13
+ T = TypeVar("T", bound="CardsResponse")
14
+
15
+
16
+ @_attrs_define
17
+ class CardsResponse:
18
+ """
19
+ Attributes:
20
+ default_id (None | str):
21
+ methods (list[Card]):
22
+ """
23
+
24
+ default_id: None | str
25
+ methods: list[Card]
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ default_id: None | str
30
+ default_id = self.default_id
31
+
32
+ methods = []
33
+ for methods_item_data in self.methods:
34
+ methods_item = methods_item_data.to_dict()
35
+ methods.append(methods_item)
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update(
40
+ {
41
+ "default_id": default_id,
42
+ "methods": methods,
43
+ }
44
+ )
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
50
+ from ..models.card import Card # noqa: PLC0415
51
+
52
+ d = dict(src_dict)
53
+
54
+ def _parse_default_id(data: object) -> None | str:
55
+ if data is None:
56
+ return data
57
+ return cast(None | str, data)
58
+
59
+ default_id = _parse_default_id(d.pop("default_id"))
60
+
61
+ methods = []
62
+ _methods = d.pop("methods")
63
+ for methods_item_data in _methods:
64
+ methods_item = Card.from_dict(methods_item_data)
65
+
66
+ methods.append(methods_item)
67
+
68
+ cards_response = cls(
69
+ default_id=default_id,
70
+ methods=methods,
71
+ )
72
+
73
+ cards_response.additional_properties = d
74
+ return cards_response
75
+
76
+ @property
77
+ def additional_keys(self) -> list[str]:
78
+ return list(self.additional_properties.keys())
79
+
80
+ def __getitem__(self, key: str) -> Any:
81
+ return self.additional_properties[key]
82
+
83
+ def __setitem__(self, key: str, value: Any) -> None:
84
+ self.additional_properties[key] = value
85
+
86
+ def __delitem__(self, key: str) -> None:
87
+ del self.additional_properties[key]
88
+
89
+ def __contains__(self, key: str) -> bool:
90
+ return key in self.additional_properties