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,229 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.credit_ledger_response import CreditLedgerResponse
9
+ from ...models.error import Error
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ cursor: str | Unset = UNSET,
16
+ limit: int | Unset = 50,
17
+ ) -> dict[str, Any]:
18
+
19
+ params: dict[str, Any] = {}
20
+
21
+ params["cursor"] = cursor
22
+
23
+ params["limit"] = limit
24
+
25
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
26
+
27
+ _kwargs: dict[str, Any] = {
28
+ "method": "get",
29
+ "url": "/v1/billing/ledger",
30
+ "params": params,
31
+ }
32
+
33
+ return _kwargs
34
+
35
+
36
+ def _parse_response(
37
+ *, client: AuthenticatedClient | Client, response: httpx.Response
38
+ ) -> CreditLedgerResponse | Error | None:
39
+ if response.status_code == 200:
40
+ response_200 = CreditLedgerResponse.from_dict(response.json())
41
+
42
+ return response_200
43
+
44
+ if response.status_code == 400:
45
+ response_400 = Error.from_dict(response.json())
46
+
47
+ return response_400
48
+
49
+ if response.status_code == 401:
50
+ response_401 = Error.from_dict(response.json())
51
+
52
+ return response_401
53
+
54
+ if response.status_code == 403:
55
+ response_403 = Error.from_dict(response.json())
56
+
57
+ return response_403
58
+
59
+ if response.status_code == 429:
60
+ response_429 = Error.from_dict(response.json())
61
+
62
+ return response_429
63
+
64
+ if response.status_code == 500:
65
+ response_500 = Error.from_dict(response.json())
66
+
67
+ return response_500
68
+
69
+ if client.raise_on_unexpected_status:
70
+ raise errors.UnexpectedStatus(response.status_code, response.content)
71
+ else:
72
+ return None
73
+
74
+
75
+ def _build_response(
76
+ *, client: AuthenticatedClient | Client, response: httpx.Response
77
+ ) -> Response[CreditLedgerResponse | Error]:
78
+ return Response(
79
+ status_code=HTTPStatus(response.status_code),
80
+ content=response.content,
81
+ headers=response.headers,
82
+ parsed=_parse_response(client=client, response=response),
83
+ )
84
+
85
+
86
+ def sync_detailed(
87
+ *,
88
+ client: AuthenticatedClient,
89
+ cursor: str | Unset = UNSET,
90
+ limit: int | Unset = 50,
91
+ ) -> Response[CreditLedgerResponse | Error]:
92
+ """List the account's credit ledger
93
+
94
+ Returns a page of the append-only credit ledger, newest first: every hold, settle, release, purchase
95
+ and refund that has moved the account's second balance, with the job that spent them where there is
96
+ one. Pass the next_cursor value from one page as the cursor parameter of the next request to page
97
+ further back; the cursor is opaque and this API refuses one it did not mint rather than silently
98
+ restarting at page one, since a caller that trusted a silent restart would believe it had paged
99
+ forward when it had not.
100
+
101
+ Args:
102
+ cursor (str | Unset):
103
+ limit (int | Unset): Default: 50.
104
+
105
+ Raises:
106
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
107
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
108
+
109
+ Returns:
110
+ Response[CreditLedgerResponse | Error]
111
+ """
112
+
113
+ kwargs = _get_kwargs(
114
+ cursor=cursor,
115
+ limit=limit,
116
+ )
117
+
118
+ response = client.get_httpx_client().request(
119
+ **kwargs,
120
+ )
121
+
122
+ return _build_response(client=client, response=response)
123
+
124
+
125
+ def sync(
126
+ *,
127
+ client: AuthenticatedClient,
128
+ cursor: str | Unset = UNSET,
129
+ limit: int | Unset = 50,
130
+ ) -> CreditLedgerResponse | Error | None:
131
+ """List the account's credit ledger
132
+
133
+ Returns a page of the append-only credit ledger, newest first: every hold, settle, release, purchase
134
+ and refund that has moved the account's second balance, with the job that spent them where there is
135
+ one. Pass the next_cursor value from one page as the cursor parameter of the next request to page
136
+ further back; the cursor is opaque and this API refuses one it did not mint rather than silently
137
+ restarting at page one, since a caller that trusted a silent restart would believe it had paged
138
+ forward when it had not.
139
+
140
+ Args:
141
+ cursor (str | Unset):
142
+ limit (int | Unset): Default: 50.
143
+
144
+ Raises:
145
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
146
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
147
+
148
+ Returns:
149
+ CreditLedgerResponse | Error
150
+ """
151
+
152
+ return sync_detailed(
153
+ client=client,
154
+ cursor=cursor,
155
+ limit=limit,
156
+ ).parsed
157
+
158
+
159
+ async def asyncio_detailed(
160
+ *,
161
+ client: AuthenticatedClient,
162
+ cursor: str | Unset = UNSET,
163
+ limit: int | Unset = 50,
164
+ ) -> Response[CreditLedgerResponse | Error]:
165
+ """List the account's credit ledger
166
+
167
+ Returns a page of the append-only credit ledger, newest first: every hold, settle, release, purchase
168
+ and refund that has moved the account's second balance, with the job that spent them where there is
169
+ one. Pass the next_cursor value from one page as the cursor parameter of the next request to page
170
+ further back; the cursor is opaque and this API refuses one it did not mint rather than silently
171
+ restarting at page one, since a caller that trusted a silent restart would believe it had paged
172
+ forward when it had not.
173
+
174
+ Args:
175
+ cursor (str | Unset):
176
+ limit (int | Unset): Default: 50.
177
+
178
+ Raises:
179
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
180
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
181
+
182
+ Returns:
183
+ Response[CreditLedgerResponse | Error]
184
+ """
185
+
186
+ kwargs = _get_kwargs(
187
+ cursor=cursor,
188
+ limit=limit,
189
+ )
190
+
191
+ response = await client.get_async_httpx_client().request(**kwargs)
192
+
193
+ return _build_response(client=client, response=response)
194
+
195
+
196
+ async def asyncio(
197
+ *,
198
+ client: AuthenticatedClient,
199
+ cursor: str | Unset = UNSET,
200
+ limit: int | Unset = 50,
201
+ ) -> CreditLedgerResponse | Error | None:
202
+ """List the account's credit ledger
203
+
204
+ Returns a page of the append-only credit ledger, newest first: every hold, settle, release, purchase
205
+ and refund that has moved the account's second balance, with the job that spent them where there is
206
+ one. Pass the next_cursor value from one page as the cursor parameter of the next request to page
207
+ further back; the cursor is opaque and this API refuses one it did not mint rather than silently
208
+ restarting at page one, since a caller that trusted a silent restart would believe it had paged
209
+ forward when it had not.
210
+
211
+ Args:
212
+ cursor (str | Unset):
213
+ limit (int | Unset): Default: 50.
214
+
215
+ Raises:
216
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
217
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
218
+
219
+ Returns:
220
+ CreditLedgerResponse | Error
221
+ """
222
+
223
+ return (
224
+ await asyncio_detailed(
225
+ client=client,
226
+ cursor=cursor,
227
+ limit=limit,
228
+ )
229
+ ).parsed
@@ -0,0 +1,237 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.deleted_transcripts_response import DeletedTranscriptsResponse
9
+ from ...models.error import Error
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ cursor: str | Unset = UNSET,
16
+ limit: int | Unset = 50,
17
+ ) -> dict[str, Any]:
18
+
19
+ params: dict[str, Any] = {}
20
+
21
+ params["cursor"] = cursor
22
+
23
+ params["limit"] = limit
24
+
25
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
26
+
27
+ _kwargs: dict[str, Any] = {
28
+ "method": "get",
29
+ "url": "/v1/transcripts/deleted",
30
+ "params": params,
31
+ }
32
+
33
+ return _kwargs
34
+
35
+
36
+ def _parse_response(
37
+ *, client: AuthenticatedClient | Client, response: httpx.Response
38
+ ) -> DeletedTranscriptsResponse | Error | None:
39
+ if response.status_code == 200:
40
+ response_200 = DeletedTranscriptsResponse.from_dict(response.json())
41
+
42
+ return response_200
43
+
44
+ if response.status_code == 400:
45
+ response_400 = Error.from_dict(response.json())
46
+
47
+ return response_400
48
+
49
+ if response.status_code == 401:
50
+ response_401 = Error.from_dict(response.json())
51
+
52
+ return response_401
53
+
54
+ if response.status_code == 403:
55
+ response_403 = Error.from_dict(response.json())
56
+
57
+ return response_403
58
+
59
+ if response.status_code == 429:
60
+ response_429 = Error.from_dict(response.json())
61
+
62
+ return response_429
63
+
64
+ if response.status_code == 500:
65
+ response_500 = Error.from_dict(response.json())
66
+
67
+ return response_500
68
+
69
+ if client.raise_on_unexpected_status:
70
+ raise errors.UnexpectedStatus(response.status_code, response.content)
71
+ else:
72
+ return None
73
+
74
+
75
+ def _build_response(
76
+ *, client: AuthenticatedClient | Client, response: httpx.Response
77
+ ) -> Response[DeletedTranscriptsResponse | Error]:
78
+ return Response(
79
+ status_code=HTTPStatus(response.status_code),
80
+ content=response.content,
81
+ headers=response.headers,
82
+ parsed=_parse_response(client=client, response=response),
83
+ )
84
+
85
+
86
+ def sync_detailed(
87
+ *,
88
+ client: AuthenticatedClient,
89
+ cursor: str | Unset = UNSET,
90
+ limit: int | Unset = 50,
91
+ ) -> Response[DeletedTranscriptsResponse | Error]:
92
+ """List deletion records for removed transcripts
93
+
94
+ Returns a page of the deletion records kept after a transcript is removed, whichever path removed
95
+ it: an explicit delete, a scheduled deletion, the retention sweep or account deletion. Each record
96
+ carries the transcript's title, duration and upload time, when and why it was deleted, and the
97
+ stored deletion receipt. The transcript content itself is gone and cannot be recovered. Records are
98
+ ordered by the deleted transcript's original upload time, newest first, so they interleave with GET
99
+ /v1/transcripts by the same key. Pass the next_cursor value from one page as the cursor parameter of
100
+ the next request to page further back; the cursor is opaque and this API refuses one it did not
101
+ mint, including a cursor minted by GET /v1/transcripts.
102
+
103
+ Args:
104
+ cursor (str | Unset):
105
+ limit (int | Unset): Default: 50.
106
+
107
+ Raises:
108
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
109
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
110
+
111
+ Returns:
112
+ Response[DeletedTranscriptsResponse | Error]
113
+ """
114
+
115
+ kwargs = _get_kwargs(
116
+ cursor=cursor,
117
+ limit=limit,
118
+ )
119
+
120
+ response = client.get_httpx_client().request(
121
+ **kwargs,
122
+ )
123
+
124
+ return _build_response(client=client, response=response)
125
+
126
+
127
+ def sync(
128
+ *,
129
+ client: AuthenticatedClient,
130
+ cursor: str | Unset = UNSET,
131
+ limit: int | Unset = 50,
132
+ ) -> DeletedTranscriptsResponse | Error | None:
133
+ """List deletion records for removed transcripts
134
+
135
+ Returns a page of the deletion records kept after a transcript is removed, whichever path removed
136
+ it: an explicit delete, a scheduled deletion, the retention sweep or account deletion. Each record
137
+ carries the transcript's title, duration and upload time, when and why it was deleted, and the
138
+ stored deletion receipt. The transcript content itself is gone and cannot be recovered. Records are
139
+ ordered by the deleted transcript's original upload time, newest first, so they interleave with GET
140
+ /v1/transcripts by the same key. Pass the next_cursor value from one page as the cursor parameter of
141
+ the next request to page further back; the cursor is opaque and this API refuses one it did not
142
+ mint, including a cursor minted by GET /v1/transcripts.
143
+
144
+ Args:
145
+ cursor (str | Unset):
146
+ limit (int | Unset): Default: 50.
147
+
148
+ Raises:
149
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
150
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
151
+
152
+ Returns:
153
+ DeletedTranscriptsResponse | Error
154
+ """
155
+
156
+ return sync_detailed(
157
+ client=client,
158
+ cursor=cursor,
159
+ limit=limit,
160
+ ).parsed
161
+
162
+
163
+ async def asyncio_detailed(
164
+ *,
165
+ client: AuthenticatedClient,
166
+ cursor: str | Unset = UNSET,
167
+ limit: int | Unset = 50,
168
+ ) -> Response[DeletedTranscriptsResponse | Error]:
169
+ """List deletion records for removed transcripts
170
+
171
+ Returns a page of the deletion records kept after a transcript is removed, whichever path removed
172
+ it: an explicit delete, a scheduled deletion, the retention sweep or account deletion. Each record
173
+ carries the transcript's title, duration and upload time, when and why it was deleted, and the
174
+ stored deletion receipt. The transcript content itself is gone and cannot be recovered. Records are
175
+ ordered by the deleted transcript's original upload time, newest first, so they interleave with GET
176
+ /v1/transcripts by the same key. Pass the next_cursor value from one page as the cursor parameter of
177
+ the next request to page further back; the cursor is opaque and this API refuses one it did not
178
+ mint, including a cursor minted by GET /v1/transcripts.
179
+
180
+ Args:
181
+ cursor (str | Unset):
182
+ limit (int | Unset): Default: 50.
183
+
184
+ Raises:
185
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
186
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
187
+
188
+ Returns:
189
+ Response[DeletedTranscriptsResponse | Error]
190
+ """
191
+
192
+ kwargs = _get_kwargs(
193
+ cursor=cursor,
194
+ limit=limit,
195
+ )
196
+
197
+ response = await client.get_async_httpx_client().request(**kwargs)
198
+
199
+ return _build_response(client=client, response=response)
200
+
201
+
202
+ async def asyncio(
203
+ *,
204
+ client: AuthenticatedClient,
205
+ cursor: str | Unset = UNSET,
206
+ limit: int | Unset = 50,
207
+ ) -> DeletedTranscriptsResponse | Error | None:
208
+ """List deletion records for removed transcripts
209
+
210
+ Returns a page of the deletion records kept after a transcript is removed, whichever path removed
211
+ it: an explicit delete, a scheduled deletion, the retention sweep or account deletion. Each record
212
+ carries the transcript's title, duration and upload time, when and why it was deleted, and the
213
+ stored deletion receipt. The transcript content itself is gone and cannot be recovered. Records are
214
+ ordered by the deleted transcript's original upload time, newest first, so they interleave with GET
215
+ /v1/transcripts by the same key. Pass the next_cursor value from one page as the cursor parameter of
216
+ the next request to page further back; the cursor is opaque and this API refuses one it did not
217
+ mint, including a cursor minted by GET /v1/transcripts.
218
+
219
+ Args:
220
+ cursor (str | Unset):
221
+ limit (int | Unset): Default: 50.
222
+
223
+ Raises:
224
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
225
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
226
+
227
+ Returns:
228
+ DeletedTranscriptsResponse | Error
229
+ """
230
+
231
+ return (
232
+ await asyncio_detailed(
233
+ client=client,
234
+ cursor=cursor,
235
+ limit=limit,
236
+ )
237
+ ).parsed
@@ -0,0 +1,233 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error import Error
9
+ from ...models.holds_response import HoldsResponse
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ *,
15
+ cursor: str | Unset = UNSET,
16
+ limit: int | Unset = 50,
17
+ ) -> dict[str, Any]:
18
+
19
+ params: dict[str, Any] = {}
20
+
21
+ params["cursor"] = cursor
22
+
23
+ params["limit"] = limit
24
+
25
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
26
+
27
+ _kwargs: dict[str, Any] = {
28
+ "method": "get",
29
+ "url": "/v1/billing/holds",
30
+ "params": params,
31
+ }
32
+
33
+ return _kwargs
34
+
35
+
36
+ def _parse_response(
37
+ *, client: AuthenticatedClient | Client, response: httpx.Response
38
+ ) -> Error | HoldsResponse | None:
39
+ if response.status_code == 200:
40
+ response_200 = HoldsResponse.from_dict(response.json())
41
+
42
+ return response_200
43
+
44
+ if response.status_code == 400:
45
+ response_400 = Error.from_dict(response.json())
46
+
47
+ return response_400
48
+
49
+ if response.status_code == 401:
50
+ response_401 = Error.from_dict(response.json())
51
+
52
+ return response_401
53
+
54
+ if response.status_code == 403:
55
+ response_403 = Error.from_dict(response.json())
56
+
57
+ return response_403
58
+
59
+ if response.status_code == 429:
60
+ response_429 = Error.from_dict(response.json())
61
+
62
+ return response_429
63
+
64
+ if response.status_code == 500:
65
+ response_500 = Error.from_dict(response.json())
66
+
67
+ return response_500
68
+
69
+ if client.raise_on_unexpected_status:
70
+ raise errors.UnexpectedStatus(response.status_code, response.content)
71
+ else:
72
+ return None
73
+
74
+
75
+ def _build_response(
76
+ *, client: AuthenticatedClient | Client, response: httpx.Response
77
+ ) -> Response[Error | HoldsResponse]:
78
+ return Response(
79
+ status_code=HTTPStatus(response.status_code),
80
+ content=response.content,
81
+ headers=response.headers,
82
+ parsed=_parse_response(client=client, response=response),
83
+ )
84
+
85
+
86
+ def sync_detailed(
87
+ *,
88
+ client: AuthenticatedClient,
89
+ cursor: str | Unset = UNSET,
90
+ limit: int | Unset = 50,
91
+ ) -> Response[Error | HoldsResponse]:
92
+ """List the account's active credit holds
93
+
94
+ Returns a page of the seconds currently reserved by in-flight work: transcription jobs still running
95
+ plus unresolved translation, insights and question holds, newest first. Held seconds are not spent
96
+ yet and are already excluded from the account balance. This is not the ledger: a historical hold
97
+ entry there may since have been settled or released, while every row here is still outstanding. Pass
98
+ the next_cursor value from one page as the cursor parameter of the next request to page further
99
+ back; the cursor is opaque and this API refuses one it did not mint rather than silently restarting
100
+ at page one.
101
+
102
+ Args:
103
+ cursor (str | Unset):
104
+ limit (int | Unset): Default: 50.
105
+
106
+ Raises:
107
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
108
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
109
+
110
+ Returns:
111
+ Response[Error | HoldsResponse]
112
+ """
113
+
114
+ kwargs = _get_kwargs(
115
+ cursor=cursor,
116
+ limit=limit,
117
+ )
118
+
119
+ response = client.get_httpx_client().request(
120
+ **kwargs,
121
+ )
122
+
123
+ return _build_response(client=client, response=response)
124
+
125
+
126
+ def sync(
127
+ *,
128
+ client: AuthenticatedClient,
129
+ cursor: str | Unset = UNSET,
130
+ limit: int | Unset = 50,
131
+ ) -> Error | HoldsResponse | None:
132
+ """List the account's active credit holds
133
+
134
+ Returns a page of the seconds currently reserved by in-flight work: transcription jobs still running
135
+ plus unresolved translation, insights and question holds, newest first. Held seconds are not spent
136
+ yet and are already excluded from the account balance. This is not the ledger: a historical hold
137
+ entry there may since have been settled or released, while every row here is still outstanding. Pass
138
+ the next_cursor value from one page as the cursor parameter of the next request to page further
139
+ back; the cursor is opaque and this API refuses one it did not mint rather than silently restarting
140
+ at page one.
141
+
142
+ Args:
143
+ cursor (str | Unset):
144
+ limit (int | Unset): Default: 50.
145
+
146
+ Raises:
147
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
148
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
149
+
150
+ Returns:
151
+ Error | HoldsResponse
152
+ """
153
+
154
+ return sync_detailed(
155
+ client=client,
156
+ cursor=cursor,
157
+ limit=limit,
158
+ ).parsed
159
+
160
+
161
+ async def asyncio_detailed(
162
+ *,
163
+ client: AuthenticatedClient,
164
+ cursor: str | Unset = UNSET,
165
+ limit: int | Unset = 50,
166
+ ) -> Response[Error | HoldsResponse]:
167
+ """List the account's active credit holds
168
+
169
+ Returns a page of the seconds currently reserved by in-flight work: transcription jobs still running
170
+ plus unresolved translation, insights and question holds, newest first. Held seconds are not spent
171
+ yet and are already excluded from the account balance. This is not the ledger: a historical hold
172
+ entry there may since have been settled or released, while every row here is still outstanding. Pass
173
+ the next_cursor value from one page as the cursor parameter of the next request to page further
174
+ back; the cursor is opaque and this API refuses one it did not mint rather than silently restarting
175
+ at page one.
176
+
177
+ Args:
178
+ cursor (str | Unset):
179
+ limit (int | Unset): Default: 50.
180
+
181
+ Raises:
182
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
183
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
184
+
185
+ Returns:
186
+ Response[Error | HoldsResponse]
187
+ """
188
+
189
+ kwargs = _get_kwargs(
190
+ cursor=cursor,
191
+ limit=limit,
192
+ )
193
+
194
+ response = await client.get_async_httpx_client().request(**kwargs)
195
+
196
+ return _build_response(client=client, response=response)
197
+
198
+
199
+ async def asyncio(
200
+ *,
201
+ client: AuthenticatedClient,
202
+ cursor: str | Unset = UNSET,
203
+ limit: int | Unset = 50,
204
+ ) -> Error | HoldsResponse | None:
205
+ """List the account's active credit holds
206
+
207
+ Returns a page of the seconds currently reserved by in-flight work: transcription jobs still running
208
+ plus unresolved translation, insights and question holds, newest first. Held seconds are not spent
209
+ yet and are already excluded from the account balance. This is not the ledger: a historical hold
210
+ entry there may since have been settled or released, while every row here is still outstanding. Pass
211
+ the next_cursor value from one page as the cursor parameter of the next request to page further
212
+ back; the cursor is opaque and this API refuses one it did not mint rather than silently restarting
213
+ at page one.
214
+
215
+ Args:
216
+ cursor (str | Unset):
217
+ limit (int | Unset): Default: 50.
218
+
219
+ Raises:
220
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
221
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
222
+
223
+ Returns:
224
+ Error | HoldsResponse
225
+ """
226
+
227
+ return (
228
+ await asyncio_detailed(
229
+ client=client,
230
+ cursor=cursor,
231
+ limit=limit,
232
+ )
233
+ ).parsed