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,261 @@
|
|
|
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.agent_signup_request import AgentSignupRequest
|
|
9
|
+
from ...models.agent_signup_response import AgentSignupResponse
|
|
10
|
+
from ...models.error import Error
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: AgentSignupRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/agent/accounts",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
35
|
+
) -> AgentSignupResponse | Error | None:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = AgentSignupResponse.from_dict(response.json())
|
|
38
|
+
|
|
39
|
+
return response_200
|
|
40
|
+
|
|
41
|
+
if response.status_code == 201:
|
|
42
|
+
response_201 = AgentSignupResponse.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_201
|
|
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 == 403:
|
|
52
|
+
response_403 = Error.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_403
|
|
55
|
+
|
|
56
|
+
if response.status_code == 409:
|
|
57
|
+
response_409 = Error.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_409
|
|
60
|
+
|
|
61
|
+
if response.status_code == 422:
|
|
62
|
+
response_422 = Error.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_422
|
|
65
|
+
|
|
66
|
+
if response.status_code == 429:
|
|
67
|
+
response_429 = Error.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_429
|
|
70
|
+
|
|
71
|
+
if response.status_code == 500:
|
|
72
|
+
response_500 = Error.from_dict(response.json())
|
|
73
|
+
|
|
74
|
+
return response_500
|
|
75
|
+
|
|
76
|
+
if response.status_code == 502:
|
|
77
|
+
response_502 = Error.from_dict(response.json())
|
|
78
|
+
|
|
79
|
+
return response_502
|
|
80
|
+
|
|
81
|
+
if client.raise_on_unexpected_status:
|
|
82
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
83
|
+
else:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _build_response(
|
|
88
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
89
|
+
) -> Response[AgentSignupResponse | Error]:
|
|
90
|
+
return Response(
|
|
91
|
+
status_code=HTTPStatus(response.status_code),
|
|
92
|
+
content=response.content,
|
|
93
|
+
headers=response.headers,
|
|
94
|
+
parsed=_parse_response(client=client, response=response),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def sync_detailed(
|
|
99
|
+
*,
|
|
100
|
+
client: AuthenticatedClient | Client,
|
|
101
|
+
body: AgentSignupRequest,
|
|
102
|
+
) -> Response[AgentSignupResponse | Error]:
|
|
103
|
+
"""Start a headless, payment-first account signup
|
|
104
|
+
|
|
105
|
+
Opens a hosted Stripe Checkout Session for a payment-first, headless account signup. No account and
|
|
106
|
+
no session cookie exist yet: complete checkout_url with your own browser automation, then claim the
|
|
107
|
+
account with claim_secret at POST /v1/agent/accounts/{signup_id}/claim. Every field is validated
|
|
108
|
+
before any Stripe call, followed by the same restricted-jurisdiction and allowlist gates the human
|
|
109
|
+
signup paths apply. accept_terms_version must equal the server's current policy version, returned in
|
|
110
|
+
the policy_version_stale error when it does not match. pack selects a minute pack by id; amount and
|
|
111
|
+
currency come back server derived and must never be sent in the request. data_region is derived from
|
|
112
|
+
your network location and an optional hint is honored only when it agrees with that derivation.
|
|
113
|
+
signup_id is region-prefixed (hsr1:<region>:<id>) and must be presented back verbatim to the claim
|
|
114
|
+
route, so the request reaches the same regional backend that holds the row. Set dry_run to true to
|
|
115
|
+
validate the request and get back a synthetic 200 response with no Stripe session created and no
|
|
116
|
+
charge possible, for rehearsing the shape before spending real money; a dry run signup_id is never
|
|
117
|
+
region-prefixed and can never be claimed.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
body (AgentSignupRequest): The client must never supply amount: it is derived server side
|
|
121
|
+
from pack.
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
125
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
Response[AgentSignupResponse | Error]
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
kwargs = _get_kwargs(
|
|
132
|
+
body=body,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
response = client.get_httpx_client().request(
|
|
136
|
+
**kwargs,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
return _build_response(client=client, response=response)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def sync(
|
|
143
|
+
*,
|
|
144
|
+
client: AuthenticatedClient | Client,
|
|
145
|
+
body: AgentSignupRequest,
|
|
146
|
+
) -> AgentSignupResponse | Error | None:
|
|
147
|
+
"""Start a headless, payment-first account signup
|
|
148
|
+
|
|
149
|
+
Opens a hosted Stripe Checkout Session for a payment-first, headless account signup. No account and
|
|
150
|
+
no session cookie exist yet: complete checkout_url with your own browser automation, then claim the
|
|
151
|
+
account with claim_secret at POST /v1/agent/accounts/{signup_id}/claim. Every field is validated
|
|
152
|
+
before any Stripe call, followed by the same restricted-jurisdiction and allowlist gates the human
|
|
153
|
+
signup paths apply. accept_terms_version must equal the server's current policy version, returned in
|
|
154
|
+
the policy_version_stale error when it does not match. pack selects a minute pack by id; amount and
|
|
155
|
+
currency come back server derived and must never be sent in the request. data_region is derived from
|
|
156
|
+
your network location and an optional hint is honored only when it agrees with that derivation.
|
|
157
|
+
signup_id is region-prefixed (hsr1:<region>:<id>) and must be presented back verbatim to the claim
|
|
158
|
+
route, so the request reaches the same regional backend that holds the row. Set dry_run to true to
|
|
159
|
+
validate the request and get back a synthetic 200 response with no Stripe session created and no
|
|
160
|
+
charge possible, for rehearsing the shape before spending real money; a dry run signup_id is never
|
|
161
|
+
region-prefixed and can never be claimed.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
body (AgentSignupRequest): The client must never supply amount: it is derived server side
|
|
165
|
+
from pack.
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
169
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
AgentSignupResponse | Error
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
return sync_detailed(
|
|
176
|
+
client=client,
|
|
177
|
+
body=body,
|
|
178
|
+
).parsed
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
async def asyncio_detailed(
|
|
182
|
+
*,
|
|
183
|
+
client: AuthenticatedClient | Client,
|
|
184
|
+
body: AgentSignupRequest,
|
|
185
|
+
) -> Response[AgentSignupResponse | Error]:
|
|
186
|
+
"""Start a headless, payment-first account signup
|
|
187
|
+
|
|
188
|
+
Opens a hosted Stripe Checkout Session for a payment-first, headless account signup. No account and
|
|
189
|
+
no session cookie exist yet: complete checkout_url with your own browser automation, then claim the
|
|
190
|
+
account with claim_secret at POST /v1/agent/accounts/{signup_id}/claim. Every field is validated
|
|
191
|
+
before any Stripe call, followed by the same restricted-jurisdiction and allowlist gates the human
|
|
192
|
+
signup paths apply. accept_terms_version must equal the server's current policy version, returned in
|
|
193
|
+
the policy_version_stale error when it does not match. pack selects a minute pack by id; amount and
|
|
194
|
+
currency come back server derived and must never be sent in the request. data_region is derived from
|
|
195
|
+
your network location and an optional hint is honored only when it agrees with that derivation.
|
|
196
|
+
signup_id is region-prefixed (hsr1:<region>:<id>) and must be presented back verbatim to the claim
|
|
197
|
+
route, so the request reaches the same regional backend that holds the row. Set dry_run to true to
|
|
198
|
+
validate the request and get back a synthetic 200 response with no Stripe session created and no
|
|
199
|
+
charge possible, for rehearsing the shape before spending real money; a dry run signup_id is never
|
|
200
|
+
region-prefixed and can never be claimed.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
body (AgentSignupRequest): The client must never supply amount: it is derived server side
|
|
204
|
+
from pack.
|
|
205
|
+
|
|
206
|
+
Raises:
|
|
207
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
208
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
Response[AgentSignupResponse | Error]
|
|
212
|
+
"""
|
|
213
|
+
|
|
214
|
+
kwargs = _get_kwargs(
|
|
215
|
+
body=body,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
219
|
+
|
|
220
|
+
return _build_response(client=client, response=response)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
async def asyncio(
|
|
224
|
+
*,
|
|
225
|
+
client: AuthenticatedClient | Client,
|
|
226
|
+
body: AgentSignupRequest,
|
|
227
|
+
) -> AgentSignupResponse | Error | None:
|
|
228
|
+
"""Start a headless, payment-first account signup
|
|
229
|
+
|
|
230
|
+
Opens a hosted Stripe Checkout Session for a payment-first, headless account signup. No account and
|
|
231
|
+
no session cookie exist yet: complete checkout_url with your own browser automation, then claim the
|
|
232
|
+
account with claim_secret at POST /v1/agent/accounts/{signup_id}/claim. Every field is validated
|
|
233
|
+
before any Stripe call, followed by the same restricted-jurisdiction and allowlist gates the human
|
|
234
|
+
signup paths apply. accept_terms_version must equal the server's current policy version, returned in
|
|
235
|
+
the policy_version_stale error when it does not match. pack selects a minute pack by id; amount and
|
|
236
|
+
currency come back server derived and must never be sent in the request. data_region is derived from
|
|
237
|
+
your network location and an optional hint is honored only when it agrees with that derivation.
|
|
238
|
+
signup_id is region-prefixed (hsr1:<region>:<id>) and must be presented back verbatim to the claim
|
|
239
|
+
route, so the request reaches the same regional backend that holds the row. Set dry_run to true to
|
|
240
|
+
validate the request and get back a synthetic 200 response with no Stripe session created and no
|
|
241
|
+
charge possible, for rehearsing the shape before spending real money; a dry run signup_id is never
|
|
242
|
+
region-prefixed and can never be claimed.
|
|
243
|
+
|
|
244
|
+
Args:
|
|
245
|
+
body (AgentSignupRequest): The client must never supply amount: it is derived server side
|
|
246
|
+
from pack.
|
|
247
|
+
|
|
248
|
+
Raises:
|
|
249
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
250
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
251
|
+
|
|
252
|
+
Returns:
|
|
253
|
+
AgentSignupResponse | Error
|
|
254
|
+
"""
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
await asyncio_detailed(
|
|
258
|
+
client=client,
|
|
259
|
+
body=body,
|
|
260
|
+
)
|
|
261
|
+
).parsed
|
|
@@ -0,0 +1,244 @@
|
|
|
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.create_setup_session_body import CreateSetupSessionBody
|
|
9
|
+
from ...models.error import Error
|
|
10
|
+
from ...models.setup_session_response import SetupSessionResponse
|
|
11
|
+
from ...types import UNSET, Response, Unset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: CreateSetupSessionBody | Unset = UNSET,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v1/billing/setup-session",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if not isinstance(body, Unset):
|
|
26
|
+
_kwargs["json"] = body.to_dict()
|
|
27
|
+
|
|
28
|
+
headers["Content-Type"] = "application/json"
|
|
29
|
+
|
|
30
|
+
_kwargs["headers"] = headers
|
|
31
|
+
return _kwargs
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse_response(
|
|
35
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
36
|
+
) -> Error | SetupSessionResponse | None:
|
|
37
|
+
if response.status_code == 200:
|
|
38
|
+
response_200 = SetupSessionResponse.from_dict(response.json())
|
|
39
|
+
|
|
40
|
+
return response_200
|
|
41
|
+
|
|
42
|
+
if response.status_code == 400:
|
|
43
|
+
response_400 = Error.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_400
|
|
46
|
+
|
|
47
|
+
if response.status_code == 401:
|
|
48
|
+
response_401 = Error.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_401
|
|
51
|
+
|
|
52
|
+
if response.status_code == 403:
|
|
53
|
+
response_403 = Error.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_403
|
|
56
|
+
|
|
57
|
+
if response.status_code == 429:
|
|
58
|
+
response_429 = Error.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
return response_429
|
|
61
|
+
|
|
62
|
+
if response.status_code == 500:
|
|
63
|
+
response_500 = Error.from_dict(response.json())
|
|
64
|
+
|
|
65
|
+
return response_500
|
|
66
|
+
|
|
67
|
+
if response.status_code == 502:
|
|
68
|
+
response_502 = Error.from_dict(response.json())
|
|
69
|
+
|
|
70
|
+
return response_502
|
|
71
|
+
|
|
72
|
+
if client.raise_on_unexpected_status:
|
|
73
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
74
|
+
else:
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _build_response(
|
|
79
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
80
|
+
) -> Response[Error | SetupSessionResponse]:
|
|
81
|
+
return Response(
|
|
82
|
+
status_code=HTTPStatus(response.status_code),
|
|
83
|
+
content=response.content,
|
|
84
|
+
headers=response.headers,
|
|
85
|
+
parsed=_parse_response(client=client, response=response),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync_detailed(
|
|
90
|
+
*,
|
|
91
|
+
client: AuthenticatedClient,
|
|
92
|
+
body: CreateSetupSessionBody | Unset = UNSET,
|
|
93
|
+
) -> Response[Error | SetupSessionResponse]:
|
|
94
|
+
"""Open a hosted Checkout Session that saves a card with no charge
|
|
95
|
+
|
|
96
|
+
Creates a Stripe Checkout Session in setup mode and returns its checkout_url. Open that URL in a
|
|
97
|
+
browser you control (your own automation, not this API) so Stripe can render the card form and
|
|
98
|
+
handle any bank authentication itself; card details never pass through this API. No charge is made.
|
|
99
|
+
Once the caller completes the hosted page, the saved card becomes available from list_saved_cards
|
|
100
|
+
and can be set as the default with set_default_card; list_saved_cards can lag a just-completed
|
|
101
|
+
Session by up to 30 seconds, since nothing calls back into this API when the hosted page finishes,
|
|
102
|
+
so retry rather than concluding the save failed. expires_at is when the Session stops accepting a
|
|
103
|
+
card; call this endpoint again for a fresh link after that. idempotency_key is optional: omit it and
|
|
104
|
+
every call opens a new Session, which is safe since a setup Session is never charged and expires on
|
|
105
|
+
its own; supply your own key only if you want a retried call to land on the same Session instead.
|
|
106
|
+
Needs the billing scope AND machine billing switched on for the account in the Hushscript app;
|
|
107
|
+
either one off is a pat_scope_missing (code 2023) refusal, whichever it was.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
body (CreateSetupSessionBody | Unset):
|
|
111
|
+
|
|
112
|
+
Raises:
|
|
113
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
114
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Response[Error | SetupSessionResponse]
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
kwargs = _get_kwargs(
|
|
121
|
+
body=body,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
response = client.get_httpx_client().request(
|
|
125
|
+
**kwargs,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
return _build_response(client=client, response=response)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def sync(
|
|
132
|
+
*,
|
|
133
|
+
client: AuthenticatedClient,
|
|
134
|
+
body: CreateSetupSessionBody | Unset = UNSET,
|
|
135
|
+
) -> Error | SetupSessionResponse | None:
|
|
136
|
+
"""Open a hosted Checkout Session that saves a card with no charge
|
|
137
|
+
|
|
138
|
+
Creates a Stripe Checkout Session in setup mode and returns its checkout_url. Open that URL in a
|
|
139
|
+
browser you control (your own automation, not this API) so Stripe can render the card form and
|
|
140
|
+
handle any bank authentication itself; card details never pass through this API. No charge is made.
|
|
141
|
+
Once the caller completes the hosted page, the saved card becomes available from list_saved_cards
|
|
142
|
+
and can be set as the default with set_default_card; list_saved_cards can lag a just-completed
|
|
143
|
+
Session by up to 30 seconds, since nothing calls back into this API when the hosted page finishes,
|
|
144
|
+
so retry rather than concluding the save failed. expires_at is when the Session stops accepting a
|
|
145
|
+
card; call this endpoint again for a fresh link after that. idempotency_key is optional: omit it and
|
|
146
|
+
every call opens a new Session, which is safe since a setup Session is never charged and expires on
|
|
147
|
+
its own; supply your own key only if you want a retried call to land on the same Session instead.
|
|
148
|
+
Needs the billing scope AND machine billing switched on for the account in the Hushscript app;
|
|
149
|
+
either one off is a pat_scope_missing (code 2023) refusal, whichever it was.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
body (CreateSetupSessionBody | Unset):
|
|
153
|
+
|
|
154
|
+
Raises:
|
|
155
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
156
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
Error | SetupSessionResponse
|
|
160
|
+
"""
|
|
161
|
+
|
|
162
|
+
return sync_detailed(
|
|
163
|
+
client=client,
|
|
164
|
+
body=body,
|
|
165
|
+
).parsed
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
async def asyncio_detailed(
|
|
169
|
+
*,
|
|
170
|
+
client: AuthenticatedClient,
|
|
171
|
+
body: CreateSetupSessionBody | Unset = UNSET,
|
|
172
|
+
) -> Response[Error | SetupSessionResponse]:
|
|
173
|
+
"""Open a hosted Checkout Session that saves a card with no charge
|
|
174
|
+
|
|
175
|
+
Creates a Stripe Checkout Session in setup mode and returns its checkout_url. Open that URL in a
|
|
176
|
+
browser you control (your own automation, not this API) so Stripe can render the card form and
|
|
177
|
+
handle any bank authentication itself; card details never pass through this API. No charge is made.
|
|
178
|
+
Once the caller completes the hosted page, the saved card becomes available from list_saved_cards
|
|
179
|
+
and can be set as the default with set_default_card; list_saved_cards can lag a just-completed
|
|
180
|
+
Session by up to 30 seconds, since nothing calls back into this API when the hosted page finishes,
|
|
181
|
+
so retry rather than concluding the save failed. expires_at is when the Session stops accepting a
|
|
182
|
+
card; call this endpoint again for a fresh link after that. idempotency_key is optional: omit it and
|
|
183
|
+
every call opens a new Session, which is safe since a setup Session is never charged and expires on
|
|
184
|
+
its own; supply your own key only if you want a retried call to land on the same Session instead.
|
|
185
|
+
Needs the billing scope AND machine billing switched on for the account in the Hushscript app;
|
|
186
|
+
either one off is a pat_scope_missing (code 2023) refusal, whichever it was.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
body (CreateSetupSessionBody | Unset):
|
|
190
|
+
|
|
191
|
+
Raises:
|
|
192
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
193
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
Response[Error | SetupSessionResponse]
|
|
197
|
+
"""
|
|
198
|
+
|
|
199
|
+
kwargs = _get_kwargs(
|
|
200
|
+
body=body,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
204
|
+
|
|
205
|
+
return _build_response(client=client, response=response)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
async def asyncio(
|
|
209
|
+
*,
|
|
210
|
+
client: AuthenticatedClient,
|
|
211
|
+
body: CreateSetupSessionBody | Unset = UNSET,
|
|
212
|
+
) -> Error | SetupSessionResponse | None:
|
|
213
|
+
"""Open a hosted Checkout Session that saves a card with no charge
|
|
214
|
+
|
|
215
|
+
Creates a Stripe Checkout Session in setup mode and returns its checkout_url. Open that URL in a
|
|
216
|
+
browser you control (your own automation, not this API) so Stripe can render the card form and
|
|
217
|
+
handle any bank authentication itself; card details never pass through this API. No charge is made.
|
|
218
|
+
Once the caller completes the hosted page, the saved card becomes available from list_saved_cards
|
|
219
|
+
and can be set as the default with set_default_card; list_saved_cards can lag a just-completed
|
|
220
|
+
Session by up to 30 seconds, since nothing calls back into this API when the hosted page finishes,
|
|
221
|
+
so retry rather than concluding the save failed. expires_at is when the Session stops accepting a
|
|
222
|
+
card; call this endpoint again for a fresh link after that. idempotency_key is optional: omit it and
|
|
223
|
+
every call opens a new Session, which is safe since a setup Session is never charged and expires on
|
|
224
|
+
its own; supply your own key only if you want a retried call to land on the same Session instead.
|
|
225
|
+
Needs the billing scope AND machine billing switched on for the account in the Hushscript app;
|
|
226
|
+
either one off is a pat_scope_missing (code 2023) refusal, whichever it was.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
body (CreateSetupSessionBody | Unset):
|
|
230
|
+
|
|
231
|
+
Raises:
|
|
232
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
233
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
234
|
+
|
|
235
|
+
Returns:
|
|
236
|
+
Error | SetupSessionResponse
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
await asyncio_detailed(
|
|
241
|
+
client=client,
|
|
242
|
+
body=body,
|
|
243
|
+
)
|
|
244
|
+
).parsed
|