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.
- hushscript/__init__.py +97 -0
- hushscript/_client.py +687 -0
- hushscript/_clock.py +36 -0
- hushscript/_config.py +139 -0
- hushscript/_errors.py +563 -0
- hushscript/_guard.py +61 -0
- hushscript/_http.py +624 -0
- hushscript/_json.py +55 -0
- hushscript/_log.py +155 -0
- hushscript/_models.py +144 -0
- hushscript/_pacing.py +51 -0
- hushscript/_redact.py +140 -0
- hushscript/_response.py +67 -0
- hushscript/_retry.py +205 -0
- hushscript/_shape.py +197 -0
- hushscript/_shapes.py +248 -0
- hushscript/_version.py +1 -0
- hushscript/format.py +224 -0
- hushscript/generated/__init__.py +8 -0
- hushscript/generated/api/__init__.py +1 -0
- hushscript/generated/api/default/__init__.py +1 -0
- hushscript/generated/api/default/buy_minutes.py +248 -0
- hushscript/generated/api/default/claim_agent_account.py +238 -0
- hushscript/generated/api/default/complete_upload.py +238 -0
- hushscript/generated/api/default/create_agent_account_signup.py +261 -0
- hushscript/generated/api/default/create_setup_session.py +244 -0
- hushscript/generated/api/default/create_upload.py +225 -0
- hushscript/generated/api/default/get_account.py +169 -0
- hushscript/generated/api/default/get_job.py +198 -0
- hushscript/generated/api/default/get_org.py +169 -0
- hushscript/generated/api/default/get_transcript.py +226 -0
- hushscript/generated/api/default/get_transcription_context.py +173 -0
- hushscript/generated/api/default/get_upload_part_urls.py +246 -0
- hushscript/generated/api/default/heartbeat_upload.py +197 -0
- hushscript/generated/api/default/lift_transcript_hold.py +206 -0
- hushscript/generated/api/default/list_credit_ledger.py +229 -0
- hushscript/generated/api/default/list_deleted_transcripts.py +237 -0
- hushscript/generated/api/default/list_holds.py +233 -0
- hushscript/generated/api/default/list_jobs.py +249 -0
- hushscript/generated/api/default/list_org_audit.py +221 -0
- hushscript/generated/api/default/list_org_invoices.py +221 -0
- hushscript/generated/api/default/list_org_ledger.py +221 -0
- hushscript/generated/api/default/list_org_matters.py +247 -0
- hushscript/generated/api/default/list_org_members.py +221 -0
- hushscript/generated/api/default/list_org_transcripts.py +233 -0
- hushscript/generated/api/default/list_packs.py +169 -0
- hushscript/generated/api/default/list_saved_cards.py +169 -0
- hushscript/generated/api/default/list_transactions.py +225 -0
- hushscript/generated/api/default/list_transcripts.py +225 -0
- hushscript/generated/api/default/org_audit_csv.py +163 -0
- hushscript/generated/api/default/org_ledger_csv.py +163 -0
- hushscript/generated/api/default/org_usage_report.py +247 -0
- hushscript/generated/api/default/org_usage_report_csv.py +229 -0
- hushscript/generated/api/default/patch_org_member.py +237 -0
- hushscript/generated/api/default/place_transcript_hold.py +206 -0
- hushscript/generated/api/default/rotate_agent_credentials.py +177 -0
- hushscript/generated/api/default/schedule_org_custody.py +215 -0
- hushscript/generated/api/default/set_default_card.py +223 -0
- hushscript/generated/api/default/upload_part.py +249 -0
- hushscript/generated/catalog.py +138 -0
- hushscript/generated/client.py +282 -0
- hushscript/generated/errors.py +16 -0
- hushscript/generated/hints.py +28 -0
- hushscript/generated/models/__init__.py +193 -0
- hushscript/generated/models/account_response.py +114 -0
- hushscript/generated/models/active_hold.py +88 -0
- hushscript/generated/models/active_hold_kind.py +18 -0
- hushscript/generated/models/agent_claim_request.py +61 -0
- hushscript/generated/models/agent_claim_response.py +85 -0
- hushscript/generated/models/agent_credentials_rotate_response.py +101 -0
- hushscript/generated/models/agent_signup_request.py +118 -0
- hushscript/generated/models/agent_signup_request_agent.py +80 -0
- hushscript/generated/models/agent_signup_response.py +111 -0
- hushscript/generated/models/buy_minutes_body.py +89 -0
- hushscript/generated/models/card.py +132 -0
- hushscript/generated/models/cards_response.py +90 -0
- hushscript/generated/models/complete_upload_body.py +107 -0
- hushscript/generated/models/complete_upload_body_parts_type_0_item.py +69 -0
- hushscript/generated/models/context_dictionary.py +143 -0
- hushscript/generated/models/context_prompt_preset.py +118 -0
- hushscript/generated/models/create_setup_session_body.py +62 -0
- hushscript/generated/models/create_upload_body.py +254 -0
- hushscript/generated/models/create_upload_body_transcription_options_type_0.py +178 -0
- hushscript/generated/models/credit_ledger_entry.py +113 -0
- hushscript/generated/models/credit_ledger_response.py +90 -0
- hushscript/generated/models/deleted_transcript.py +148 -0
- hushscript/generated/models/deleted_transcript_cause.py +18 -0
- hushscript/generated/models/deleted_transcript_receipt_type_0.py +107 -0
- hushscript/generated/models/deleted_transcript_receipt_type_0_items_item.py +69 -0
- hushscript/generated/models/deleted_transcripts_response.py +90 -0
- hushscript/generated/models/dictionary_entry.py +123 -0
- hushscript/generated/models/dictionary_entry_category.py +37 -0
- hushscript/generated/models/error.py +155 -0
- hushscript/generated/models/error_details.py +94 -0
- hushscript/generated/models/get_upload_part_urls_response_200_type_0.py +108 -0
- hushscript/generated/models/heartbeat_upload_response_200.py +61 -0
- hushscript/generated/models/holds_response.py +90 -0
- hushscript/generated/models/job.py +309 -0
- hushscript/generated/models/job_failure_kind_type_1.py +16 -0
- hushscript/generated/models/job_failure_kind_type_2_type_1.py +16 -0
- hushscript/generated/models/job_failure_kind_type_3_type_1.py +16 -0
- hushscript/generated/models/job_list.py +90 -0
- hushscript/generated/models/lift_transcript_hold_response_200.py +61 -0
- hushscript/generated/models/list_jobs_active.py +17 -0
- hushscript/generated/models/list_org_matters_status.py +16 -0
- hushscript/generated/models/options_summary.py +135 -0
- hushscript/generated/models/org_audit_entry.py +105 -0
- hushscript/generated/models/org_audit_response.py +90 -0
- hushscript/generated/models/org_invoice.py +175 -0
- hushscript/generated/models/org_invoices_response.py +90 -0
- hushscript/generated/models/org_ledger_entry.py +155 -0
- hushscript/generated/models/org_ledger_response.py +90 -0
- hushscript/generated/models/org_matter.py +79 -0
- hushscript/generated/models/org_matter_status.py +16 -0
- hushscript/generated/models/org_matters_response.py +75 -0
- hushscript/generated/models/org_member.py +123 -0
- hushscript/generated/models/org_members_response.py +90 -0
- hushscript/generated/models/org_summary_response.py +482 -0
- hushscript/generated/models/org_transcript.py +103 -0
- hushscript/generated/models/org_transcripts_response.py +90 -0
- hushscript/generated/models/org_usage_report_csv_group_by.py +17 -0
- hushscript/generated/models/org_usage_report_group_by.py +17 -0
- hushscript/generated/models/org_usage_response.py +112 -0
- hushscript/generated/models/org_usage_response_group_by.py +17 -0
- hushscript/generated/models/org_usage_row.py +86 -0
- hushscript/generated/models/pack.py +107 -0
- hushscript/generated/models/packs_response.py +75 -0
- hushscript/generated/models/patch_org_member_body.py +102 -0
- hushscript/generated/models/patch_org_member_response_200.py +61 -0
- hushscript/generated/models/place_transcript_hold_response_200.py +61 -0
- hushscript/generated/models/presigned_part_url.py +69 -0
- hushscript/generated/models/purchase_response.py +76 -0
- hushscript/generated/models/schedule_org_custody_body.py +66 -0
- hushscript/generated/models/schedule_org_custody_body_custody.py +17 -0
- hushscript/generated/models/schedule_org_custody_response_200.py +69 -0
- hushscript/generated/models/set_default_card_body.py +61 -0
- hushscript/generated/models/set_default_card_response_200.py +61 -0
- hushscript/generated/models/setup_session_response.py +77 -0
- hushscript/generated/models/transaction.py +183 -0
- hushscript/generated/models/transactions_response.py +98 -0
- hushscript/generated/models/transcript_detail.py +194 -0
- hushscript/generated/models/transcript_detail_speaker_names.py +47 -0
- hushscript/generated/models/transcript_envelope.py +89 -0
- hushscript/generated/models/transcript_envelope_translations.py +62 -0
- hushscript/generated/models/transcript_language.py +75 -0
- hushscript/generated/models/transcript_list.py +90 -0
- hushscript/generated/models/transcript_list_row.py +152 -0
- hushscript/generated/models/transcript_list_row_insights_state.py +20 -0
- hushscript/generated/models/transcription_context_response.py +95 -0
- hushscript/generated/models/upload_complete_response.py +100 -0
- hushscript/generated/models/upload_create_response.py +148 -0
- hushscript/generated/models/upload_create_response_funding.py +16 -0
- hushscript/generated/models/upload_create_response_upload_type_0.py +108 -0
- hushscript/generated/models/upload_limits.py +86 -0
- hushscript/generated/models/upload_part_response_200.py +69 -0
- hushscript/generated/models/utterance.py +85 -0
- hushscript/generated/scopes.py +42 -0
- hushscript/generated/types.py +54 -0
- hushscript/money.py +79 -0
- hushscript/paginate.py +78 -0
- hushscript/py.typed +0 -0
- hushscript/resources/__init__.py +1 -0
- hushscript/resources/_params.py +33 -0
- hushscript/resources/account.py +121 -0
- hushscript/resources/agent.py +421 -0
- hushscript/resources/billing.py +567 -0
- hushscript/resources/jobs.py +105 -0
- hushscript/resources/transcripts.py +209 -0
- hushscript/transcribe/__init__.py +1 -0
- hushscript/transcribe/apipeline.py +234 -0
- hushscript/transcribe/aupload.py +197 -0
- hushscript/transcribe/heartbeat.py +78 -0
- hushscript/transcribe/pipeline.py +312 -0
- hushscript/transcribe/preflight.py +272 -0
- hushscript/transcribe/probe.py +185 -0
- hushscript/transcribe/resume.py +115 -0
- hushscript/transcribe/segment.py +23 -0
- hushscript/transcribe/session.py +34 -0
- hushscript/transcribe/sniff.py +30 -0
- hushscript/transcribe/source.py +218 -0
- hushscript/transcribe/upload.py +498 -0
- hushscript/transcribe/wait.py +124 -0
- hushscript/transcript.py +197 -0
- hushscript-1.0.0.dist-info/METADATA +502 -0
- hushscript-1.0.0.dist-info/RECORD +187 -0
- hushscript-1.0.0.dist-info/WHEEL +4 -0
- hushscript-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.agent_claim_request import AgentClaimRequest
|
|
10
|
+
from ...models.agent_claim_response import AgentClaimResponse
|
|
11
|
+
from ...models.error import Error
|
|
12
|
+
from ...types import Response
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
signup_id: str,
|
|
17
|
+
*,
|
|
18
|
+
body: AgentClaimRequest,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "post",
|
|
24
|
+
"url": "/v1/agent/accounts/{signup_id}/claim".format(
|
|
25
|
+
signup_id=quote(str(signup_id), safe=""),
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_kwargs["json"] = body.to_dict()
|
|
30
|
+
|
|
31
|
+
headers["Content-Type"] = "application/json"
|
|
32
|
+
|
|
33
|
+
_kwargs["headers"] = headers
|
|
34
|
+
return _kwargs
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _parse_response(
|
|
38
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
39
|
+
) -> AgentClaimResponse | Error | None:
|
|
40
|
+
if response.status_code == 201:
|
|
41
|
+
response_201 = AgentClaimResponse.from_dict(response.json())
|
|
42
|
+
|
|
43
|
+
return response_201
|
|
44
|
+
|
|
45
|
+
if response.status_code == 400:
|
|
46
|
+
response_400 = Error.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_400
|
|
49
|
+
|
|
50
|
+
if response.status_code == 401:
|
|
51
|
+
response_401 = Error.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_401
|
|
54
|
+
|
|
55
|
+
if response.status_code == 409:
|
|
56
|
+
response_409 = Error.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_409
|
|
59
|
+
|
|
60
|
+
if response.status_code == 429:
|
|
61
|
+
response_429 = Error.from_dict(response.json())
|
|
62
|
+
|
|
63
|
+
return response_429
|
|
64
|
+
|
|
65
|
+
if response.status_code == 500:
|
|
66
|
+
response_500 = Error.from_dict(response.json())
|
|
67
|
+
|
|
68
|
+
return response_500
|
|
69
|
+
|
|
70
|
+
if client.raise_on_unexpected_status:
|
|
71
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
72
|
+
else:
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _build_response(
|
|
77
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
78
|
+
) -> Response[AgentClaimResponse | Error]:
|
|
79
|
+
return Response(
|
|
80
|
+
status_code=HTTPStatus(response.status_code),
|
|
81
|
+
content=response.content,
|
|
82
|
+
headers=response.headers,
|
|
83
|
+
parsed=_parse_response(client=client, response=response),
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def sync_detailed(
|
|
88
|
+
signup_id: str,
|
|
89
|
+
*,
|
|
90
|
+
client: AuthenticatedClient | Client,
|
|
91
|
+
body: AgentClaimRequest,
|
|
92
|
+
) -> Response[AgentClaimResponse | Error]:
|
|
93
|
+
"""Claim a paid agent signup into a real account
|
|
94
|
+
|
|
95
|
+
Exchanges a paid, unclaimed agent signup for the account it pays for. Presents the claim_secret
|
|
96
|
+
returned once by POST /v1/agent/accounts; a wrong secret, an unknown signup_id, an already claimed
|
|
97
|
+
signup, a refunded signup, and an expired signup all answer the identical agent_claim_invalid error
|
|
98
|
+
so a caller can never learn which of those is true. Only once that secret checks out does payment
|
|
99
|
+
state matter: a signup whose Checkout Session has not settled to paid answers wrong_state instead. A
|
|
100
|
+
successful claim is single use; creates exactly one account with a synthetic, unresolvable login
|
|
101
|
+
identity; grants the paid pack once, never twice, even on a retried request; and mints exactly one
|
|
102
|
+
personal access token with the account's own agent scopes, returned only in this response.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
signup_id (str):
|
|
106
|
+
body (AgentClaimRequest):
|
|
107
|
+
|
|
108
|
+
Raises:
|
|
109
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
110
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
Response[AgentClaimResponse | Error]
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
kwargs = _get_kwargs(
|
|
117
|
+
signup_id=signup_id,
|
|
118
|
+
body=body,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
response = client.get_httpx_client().request(
|
|
122
|
+
**kwargs,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
return _build_response(client=client, response=response)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def sync(
|
|
129
|
+
signup_id: str,
|
|
130
|
+
*,
|
|
131
|
+
client: AuthenticatedClient | Client,
|
|
132
|
+
body: AgentClaimRequest,
|
|
133
|
+
) -> AgentClaimResponse | Error | None:
|
|
134
|
+
"""Claim a paid agent signup into a real account
|
|
135
|
+
|
|
136
|
+
Exchanges a paid, unclaimed agent signup for the account it pays for. Presents the claim_secret
|
|
137
|
+
returned once by POST /v1/agent/accounts; a wrong secret, an unknown signup_id, an already claimed
|
|
138
|
+
signup, a refunded signup, and an expired signup all answer the identical agent_claim_invalid error
|
|
139
|
+
so a caller can never learn which of those is true. Only once that secret checks out does payment
|
|
140
|
+
state matter: a signup whose Checkout Session has not settled to paid answers wrong_state instead. A
|
|
141
|
+
successful claim is single use; creates exactly one account with a synthetic, unresolvable login
|
|
142
|
+
identity; grants the paid pack once, never twice, even on a retried request; and mints exactly one
|
|
143
|
+
personal access token with the account's own agent scopes, returned only in this response.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
signup_id (str):
|
|
147
|
+
body (AgentClaimRequest):
|
|
148
|
+
|
|
149
|
+
Raises:
|
|
150
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
151
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
AgentClaimResponse | Error
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
return sync_detailed(
|
|
158
|
+
signup_id=signup_id,
|
|
159
|
+
client=client,
|
|
160
|
+
body=body,
|
|
161
|
+
).parsed
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
async def asyncio_detailed(
|
|
165
|
+
signup_id: str,
|
|
166
|
+
*,
|
|
167
|
+
client: AuthenticatedClient | Client,
|
|
168
|
+
body: AgentClaimRequest,
|
|
169
|
+
) -> Response[AgentClaimResponse | Error]:
|
|
170
|
+
"""Claim a paid agent signup into a real account
|
|
171
|
+
|
|
172
|
+
Exchanges a paid, unclaimed agent signup for the account it pays for. Presents the claim_secret
|
|
173
|
+
returned once by POST /v1/agent/accounts; a wrong secret, an unknown signup_id, an already claimed
|
|
174
|
+
signup, a refunded signup, and an expired signup all answer the identical agent_claim_invalid error
|
|
175
|
+
so a caller can never learn which of those is true. Only once that secret checks out does payment
|
|
176
|
+
state matter: a signup whose Checkout Session has not settled to paid answers wrong_state instead. A
|
|
177
|
+
successful claim is single use; creates exactly one account with a synthetic, unresolvable login
|
|
178
|
+
identity; grants the paid pack once, never twice, even on a retried request; and mints exactly one
|
|
179
|
+
personal access token with the account's own agent scopes, returned only in this response.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
signup_id (str):
|
|
183
|
+
body (AgentClaimRequest):
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
187
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
188
|
+
|
|
189
|
+
Returns:
|
|
190
|
+
Response[AgentClaimResponse | Error]
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
kwargs = _get_kwargs(
|
|
194
|
+
signup_id=signup_id,
|
|
195
|
+
body=body,
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
199
|
+
|
|
200
|
+
return _build_response(client=client, response=response)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
async def asyncio(
|
|
204
|
+
signup_id: str,
|
|
205
|
+
*,
|
|
206
|
+
client: AuthenticatedClient | Client,
|
|
207
|
+
body: AgentClaimRequest,
|
|
208
|
+
) -> AgentClaimResponse | Error | None:
|
|
209
|
+
"""Claim a paid agent signup into a real account
|
|
210
|
+
|
|
211
|
+
Exchanges a paid, unclaimed agent signup for the account it pays for. Presents the claim_secret
|
|
212
|
+
returned once by POST /v1/agent/accounts; a wrong secret, an unknown signup_id, an already claimed
|
|
213
|
+
signup, a refunded signup, and an expired signup all answer the identical agent_claim_invalid error
|
|
214
|
+
so a caller can never learn which of those is true. Only once that secret checks out does payment
|
|
215
|
+
state matter: a signup whose Checkout Session has not settled to paid answers wrong_state instead. A
|
|
216
|
+
successful claim is single use; creates exactly one account with a synthetic, unresolvable login
|
|
217
|
+
identity; grants the paid pack once, never twice, even on a retried request; and mints exactly one
|
|
218
|
+
personal access token with the account's own agent scopes, returned only in this response.
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
signup_id (str):
|
|
222
|
+
body (AgentClaimRequest):
|
|
223
|
+
|
|
224
|
+
Raises:
|
|
225
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
226
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
AgentClaimResponse | Error
|
|
230
|
+
"""
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
await asyncio_detailed(
|
|
234
|
+
signup_id=signup_id,
|
|
235
|
+
client=client,
|
|
236
|
+
body=body,
|
|
237
|
+
)
|
|
238
|
+
).parsed
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.complete_upload_body import CompleteUploadBody
|
|
10
|
+
from ...models.error import Error
|
|
11
|
+
from ...models.upload_complete_response import UploadCompleteResponse
|
|
12
|
+
from ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
job: str,
|
|
17
|
+
*,
|
|
18
|
+
body: CompleteUploadBody | Unset = UNSET,
|
|
19
|
+
) -> dict[str, Any]:
|
|
20
|
+
headers: dict[str, Any] = {}
|
|
21
|
+
|
|
22
|
+
_kwargs: dict[str, Any] = {
|
|
23
|
+
"method": "post",
|
|
24
|
+
"url": "/v1/uploads/{job}/complete".format(
|
|
25
|
+
job=quote(str(job), safe=""),
|
|
26
|
+
),
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if not isinstance(body, Unset):
|
|
30
|
+
_kwargs["json"] = body.to_dict()
|
|
31
|
+
|
|
32
|
+
headers["Content-Type"] = "application/json"
|
|
33
|
+
|
|
34
|
+
_kwargs["headers"] = headers
|
|
35
|
+
return _kwargs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _parse_response(
|
|
39
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
40
|
+
) -> Error | UploadCompleteResponse | None:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = UploadCompleteResponse.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_200
|
|
45
|
+
|
|
46
|
+
if response.status_code == 400:
|
|
47
|
+
response_400 = Error.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_400
|
|
50
|
+
|
|
51
|
+
if response.status_code == 401:
|
|
52
|
+
response_401 = Error.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_401
|
|
55
|
+
|
|
56
|
+
if response.status_code == 403:
|
|
57
|
+
response_403 = Error.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_403
|
|
60
|
+
|
|
61
|
+
if response.status_code == 404:
|
|
62
|
+
response_404 = Error.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_404
|
|
65
|
+
|
|
66
|
+
if response.status_code == 409:
|
|
67
|
+
response_409 = Error.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_409
|
|
70
|
+
|
|
71
|
+
if response.status_code == 422:
|
|
72
|
+
response_422 = Error.from_dict(response.json())
|
|
73
|
+
|
|
74
|
+
return response_422
|
|
75
|
+
|
|
76
|
+
if response.status_code == 429:
|
|
77
|
+
response_429 = Error.from_dict(response.json())
|
|
78
|
+
|
|
79
|
+
return response_429
|
|
80
|
+
|
|
81
|
+
if response.status_code == 500:
|
|
82
|
+
response_500 = Error.from_dict(response.json())
|
|
83
|
+
|
|
84
|
+
return response_500
|
|
85
|
+
|
|
86
|
+
if client.raise_on_unexpected_status:
|
|
87
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
88
|
+
else:
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _build_response(
|
|
93
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
94
|
+
) -> Response[Error | UploadCompleteResponse]:
|
|
95
|
+
return Response(
|
|
96
|
+
status_code=HTTPStatus(response.status_code),
|
|
97
|
+
content=response.content,
|
|
98
|
+
headers=response.headers,
|
|
99
|
+
parsed=_parse_response(client=client, response=response),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def sync_detailed(
|
|
104
|
+
job: str,
|
|
105
|
+
*,
|
|
106
|
+
client: AuthenticatedClient,
|
|
107
|
+
body: CompleteUploadBody | Unset = UNSET,
|
|
108
|
+
) -> Response[Error | UploadCompleteResponse]:
|
|
109
|
+
"""Finish an upload and start transcription
|
|
110
|
+
|
|
111
|
+
Marks every declared part as uploaded, probes the assembled object's exact duration, and reconciles
|
|
112
|
+
the credit hold to the verified billable seconds; if the balance cannot cover the verified total the
|
|
113
|
+
job is rejected and the hold released rather than run over budget. On success the job moves to
|
|
114
|
+
queued or processing (reported as queued while verification is still pending) for transcription.
|
|
115
|
+
|
|
116
|
+
Args:
|
|
117
|
+
job (str):
|
|
118
|
+
body (CompleteUploadBody | Unset):
|
|
119
|
+
|
|
120
|
+
Raises:
|
|
121
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
122
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
Response[Error | UploadCompleteResponse]
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
kwargs = _get_kwargs(
|
|
129
|
+
job=job,
|
|
130
|
+
body=body,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
response = client.get_httpx_client().request(
|
|
134
|
+
**kwargs,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
return _build_response(client=client, response=response)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def sync(
|
|
141
|
+
job: str,
|
|
142
|
+
*,
|
|
143
|
+
client: AuthenticatedClient,
|
|
144
|
+
body: CompleteUploadBody | Unset = UNSET,
|
|
145
|
+
) -> Error | UploadCompleteResponse | None:
|
|
146
|
+
"""Finish an upload and start transcription
|
|
147
|
+
|
|
148
|
+
Marks every declared part as uploaded, probes the assembled object's exact duration, and reconciles
|
|
149
|
+
the credit hold to the verified billable seconds; if the balance cannot cover the verified total the
|
|
150
|
+
job is rejected and the hold released rather than run over budget. On success the job moves to
|
|
151
|
+
queued or processing (reported as queued while verification is still pending) for transcription.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
job (str):
|
|
155
|
+
body (CompleteUploadBody | Unset):
|
|
156
|
+
|
|
157
|
+
Raises:
|
|
158
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
159
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Error | UploadCompleteResponse
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
return sync_detailed(
|
|
166
|
+
job=job,
|
|
167
|
+
client=client,
|
|
168
|
+
body=body,
|
|
169
|
+
).parsed
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
async def asyncio_detailed(
|
|
173
|
+
job: str,
|
|
174
|
+
*,
|
|
175
|
+
client: AuthenticatedClient,
|
|
176
|
+
body: CompleteUploadBody | Unset = UNSET,
|
|
177
|
+
) -> Response[Error | UploadCompleteResponse]:
|
|
178
|
+
"""Finish an upload and start transcription
|
|
179
|
+
|
|
180
|
+
Marks every declared part as uploaded, probes the assembled object's exact duration, and reconciles
|
|
181
|
+
the credit hold to the verified billable seconds; if the balance cannot cover the verified total the
|
|
182
|
+
job is rejected and the hold released rather than run over budget. On success the job moves to
|
|
183
|
+
queued or processing (reported as queued while verification is still pending) for transcription.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
job (str):
|
|
187
|
+
body (CompleteUploadBody | Unset):
|
|
188
|
+
|
|
189
|
+
Raises:
|
|
190
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
191
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
192
|
+
|
|
193
|
+
Returns:
|
|
194
|
+
Response[Error | UploadCompleteResponse]
|
|
195
|
+
"""
|
|
196
|
+
|
|
197
|
+
kwargs = _get_kwargs(
|
|
198
|
+
job=job,
|
|
199
|
+
body=body,
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
203
|
+
|
|
204
|
+
return _build_response(client=client, response=response)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
async def asyncio(
|
|
208
|
+
job: str,
|
|
209
|
+
*,
|
|
210
|
+
client: AuthenticatedClient,
|
|
211
|
+
body: CompleteUploadBody | Unset = UNSET,
|
|
212
|
+
) -> Error | UploadCompleteResponse | None:
|
|
213
|
+
"""Finish an upload and start transcription
|
|
214
|
+
|
|
215
|
+
Marks every declared part as uploaded, probes the assembled object's exact duration, and reconciles
|
|
216
|
+
the credit hold to the verified billable seconds; if the balance cannot cover the verified total the
|
|
217
|
+
job is rejected and the hold released rather than run over budget. On success the job moves to
|
|
218
|
+
queued or processing (reported as queued while verification is still pending) for transcription.
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
job (str):
|
|
222
|
+
body (CompleteUploadBody | Unset):
|
|
223
|
+
|
|
224
|
+
Raises:
|
|
225
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
226
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
Error | UploadCompleteResponse
|
|
230
|
+
"""
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
await asyncio_detailed(
|
|
234
|
+
job=job,
|
|
235
|
+
client=client,
|
|
236
|
+
body=body,
|
|
237
|
+
)
|
|
238
|
+
).parsed
|