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,152 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..models.transcript_list_row_insights_state import (
|
|
10
|
+
TranscriptListRowInsightsState,
|
|
11
|
+
check_transcript_list_row_insights_state,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from ..models.options_summary import OptionsSummary
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
T = TypeVar("T", bound="TranscriptListRow")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@_attrs_define
|
|
22
|
+
class TranscriptListRow:
|
|
23
|
+
"""
|
|
24
|
+
Attributes:
|
|
25
|
+
id (str):
|
|
26
|
+
title (str):
|
|
27
|
+
language_detected (None | str):
|
|
28
|
+
duration_seconds (int):
|
|
29
|
+
created_at (int):
|
|
30
|
+
auto_delete_at (int | None):
|
|
31
|
+
tags (list[str]):
|
|
32
|
+
options (OptionsSummary): A content-free summary of the transcription options a job was submitted with: what was
|
|
33
|
+
requested, never the free-text content itself.
|
|
34
|
+
insights_state (TranscriptListRowInsightsState): A display hint only, never an authority on whether Insights may
|
|
35
|
+
be generated or charged for.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
id: str
|
|
39
|
+
title: str
|
|
40
|
+
language_detected: None | str
|
|
41
|
+
duration_seconds: int
|
|
42
|
+
created_at: int
|
|
43
|
+
auto_delete_at: int | None
|
|
44
|
+
tags: list[str]
|
|
45
|
+
options: OptionsSummary
|
|
46
|
+
insights_state: TranscriptListRowInsightsState
|
|
47
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
48
|
+
|
|
49
|
+
def to_dict(self) -> dict[str, Any]:
|
|
50
|
+
id = self.id
|
|
51
|
+
|
|
52
|
+
title = self.title
|
|
53
|
+
|
|
54
|
+
language_detected: None | str
|
|
55
|
+
language_detected = self.language_detected
|
|
56
|
+
|
|
57
|
+
duration_seconds = self.duration_seconds
|
|
58
|
+
|
|
59
|
+
created_at = self.created_at
|
|
60
|
+
|
|
61
|
+
auto_delete_at: int | None
|
|
62
|
+
auto_delete_at = self.auto_delete_at
|
|
63
|
+
|
|
64
|
+
tags = self.tags
|
|
65
|
+
|
|
66
|
+
options = self.options.to_dict()
|
|
67
|
+
|
|
68
|
+
insights_state: str = self.insights_state
|
|
69
|
+
|
|
70
|
+
field_dict: dict[str, Any] = {}
|
|
71
|
+
field_dict.update(self.additional_properties)
|
|
72
|
+
field_dict.update(
|
|
73
|
+
{
|
|
74
|
+
"id": id,
|
|
75
|
+
"title": title,
|
|
76
|
+
"language_detected": language_detected,
|
|
77
|
+
"duration_seconds": duration_seconds,
|
|
78
|
+
"created_at": created_at,
|
|
79
|
+
"auto_delete_at": auto_delete_at,
|
|
80
|
+
"tags": tags,
|
|
81
|
+
"options": options,
|
|
82
|
+
"insights_state": insights_state,
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
return field_dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
90
|
+
from ..models.options_summary import OptionsSummary # noqa: PLC0415
|
|
91
|
+
|
|
92
|
+
d = dict(src_dict)
|
|
93
|
+
id = d.pop("id")
|
|
94
|
+
|
|
95
|
+
title = d.pop("title")
|
|
96
|
+
|
|
97
|
+
def _parse_language_detected(data: object) -> None | str:
|
|
98
|
+
if data is None:
|
|
99
|
+
return data
|
|
100
|
+
return cast(None | str, data)
|
|
101
|
+
|
|
102
|
+
language_detected = _parse_language_detected(d.pop("language_detected"))
|
|
103
|
+
|
|
104
|
+
duration_seconds = d.pop("duration_seconds")
|
|
105
|
+
|
|
106
|
+
created_at = d.pop("created_at")
|
|
107
|
+
|
|
108
|
+
def _parse_auto_delete_at(data: object) -> int | None:
|
|
109
|
+
if data is None:
|
|
110
|
+
return data
|
|
111
|
+
return cast(int | None, data)
|
|
112
|
+
|
|
113
|
+
auto_delete_at = _parse_auto_delete_at(d.pop("auto_delete_at"))
|
|
114
|
+
|
|
115
|
+
tags = cast(list[str], d.pop("tags"))
|
|
116
|
+
|
|
117
|
+
options = OptionsSummary.from_dict(d.pop("options"))
|
|
118
|
+
|
|
119
|
+
insights_state = check_transcript_list_row_insights_state(
|
|
120
|
+
d.pop("insights_state")
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
transcript_list_row = cls(
|
|
124
|
+
id=id,
|
|
125
|
+
title=title,
|
|
126
|
+
language_detected=language_detected,
|
|
127
|
+
duration_seconds=duration_seconds,
|
|
128
|
+
created_at=created_at,
|
|
129
|
+
auto_delete_at=auto_delete_at,
|
|
130
|
+
tags=tags,
|
|
131
|
+
options=options,
|
|
132
|
+
insights_state=insights_state,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
transcript_list_row.additional_properties = d
|
|
136
|
+
return transcript_list_row
|
|
137
|
+
|
|
138
|
+
@property
|
|
139
|
+
def additional_keys(self) -> list[str]:
|
|
140
|
+
return list(self.additional_properties.keys())
|
|
141
|
+
|
|
142
|
+
def __getitem__(self, key: str) -> Any:
|
|
143
|
+
return self.additional_properties[key]
|
|
144
|
+
|
|
145
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
146
|
+
self.additional_properties[key] = value
|
|
147
|
+
|
|
148
|
+
def __delitem__(self, key: str) -> None:
|
|
149
|
+
del self.additional_properties[key]
|
|
150
|
+
|
|
151
|
+
def __contains__(self, key: str) -> bool:
|
|
152
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
TranscriptListRowInsightsState = Literal["failed", "generating", "none", "ready"]
|
|
4
|
+
|
|
5
|
+
TRANSCRIPT_LIST_ROW_INSIGHTS_STATE_VALUES: set[TranscriptListRowInsightsState] = {
|
|
6
|
+
"failed",
|
|
7
|
+
"generating",
|
|
8
|
+
"none",
|
|
9
|
+
"ready",
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def check_transcript_list_row_insights_state(
|
|
14
|
+
value: str,
|
|
15
|
+
) -> TranscriptListRowInsightsState:
|
|
16
|
+
if value in TRANSCRIPT_LIST_ROW_INSIGHTS_STATE_VALUES:
|
|
17
|
+
return value
|
|
18
|
+
raise TypeError(
|
|
19
|
+
f"Unexpected value {value!r}. Expected one of {TRANSCRIPT_LIST_ROW_INSIGHTS_STATE_VALUES!r}"
|
|
20
|
+
)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.context_dictionary import ContextDictionary
|
|
11
|
+
from ..models.context_prompt_preset import ContextPromptPreset
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="TranscriptionContextResponse")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class TranscriptionContextResponse:
|
|
19
|
+
"""Not paginated and carrying no cursor: both collections are capped when they are written (50 dictionaries, 20 prompt
|
|
20
|
+
presets), so this response is always complete.
|
|
21
|
+
|
|
22
|
+
Attributes:
|
|
23
|
+
dictionaries (list[ContextDictionary]):
|
|
24
|
+
prompts (list[ContextPromptPreset]):
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
dictionaries: list[ContextDictionary]
|
|
28
|
+
prompts: list[ContextPromptPreset]
|
|
29
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
dictionaries = []
|
|
33
|
+
for dictionaries_item_data in self.dictionaries:
|
|
34
|
+
dictionaries_item = dictionaries_item_data.to_dict()
|
|
35
|
+
dictionaries.append(dictionaries_item)
|
|
36
|
+
|
|
37
|
+
prompts = []
|
|
38
|
+
for prompts_item_data in self.prompts:
|
|
39
|
+
prompts_item = prompts_item_data.to_dict()
|
|
40
|
+
prompts.append(prompts_item)
|
|
41
|
+
|
|
42
|
+
field_dict: dict[str, Any] = {}
|
|
43
|
+
field_dict.update(self.additional_properties)
|
|
44
|
+
field_dict.update(
|
|
45
|
+
{
|
|
46
|
+
"dictionaries": dictionaries,
|
|
47
|
+
"prompts": prompts,
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
return field_dict
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
55
|
+
from ..models.context_dictionary import ContextDictionary # noqa: PLC0415
|
|
56
|
+
from ..models.context_prompt_preset import ContextPromptPreset # noqa: PLC0415
|
|
57
|
+
|
|
58
|
+
d = dict(src_dict)
|
|
59
|
+
dictionaries = []
|
|
60
|
+
_dictionaries = d.pop("dictionaries")
|
|
61
|
+
for dictionaries_item_data in _dictionaries:
|
|
62
|
+
dictionaries_item = ContextDictionary.from_dict(dictionaries_item_data)
|
|
63
|
+
|
|
64
|
+
dictionaries.append(dictionaries_item)
|
|
65
|
+
|
|
66
|
+
prompts = []
|
|
67
|
+
_prompts = d.pop("prompts")
|
|
68
|
+
for prompts_item_data in _prompts:
|
|
69
|
+
prompts_item = ContextPromptPreset.from_dict(prompts_item_data)
|
|
70
|
+
|
|
71
|
+
prompts.append(prompts_item)
|
|
72
|
+
|
|
73
|
+
transcription_context_response = cls(
|
|
74
|
+
dictionaries=dictionaries,
|
|
75
|
+
prompts=prompts,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
transcription_context_response.additional_properties = d
|
|
79
|
+
return transcription_context_response
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def additional_keys(self) -> list[str]:
|
|
83
|
+
return list(self.additional_properties.keys())
|
|
84
|
+
|
|
85
|
+
def __getitem__(self, key: str) -> Any:
|
|
86
|
+
return self.additional_properties[key]
|
|
87
|
+
|
|
88
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
89
|
+
self.additional_properties[key] = value
|
|
90
|
+
|
|
91
|
+
def __delitem__(self, key: str) -> None:
|
|
92
|
+
del self.additional_properties[key]
|
|
93
|
+
|
|
94
|
+
def __contains__(self, key: str) -> bool:
|
|
95
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="UploadCompleteResponse")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class UploadCompleteResponse:
|
|
14
|
+
"""
|
|
15
|
+
Attributes:
|
|
16
|
+
ok (bool):
|
|
17
|
+
state (str): The job's state immediately after completion, e.g. queued, processing or done.
|
|
18
|
+
verified_seconds (int | None): The probed exact duration, once verification has run; null while verification is
|
|
19
|
+
still pending.
|
|
20
|
+
balance_seconds (int): The account's net balance after the hold was reconciled to the verified duration.
|
|
21
|
+
held_seconds (int):
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
ok: bool
|
|
25
|
+
state: str
|
|
26
|
+
verified_seconds: int | None
|
|
27
|
+
balance_seconds: int
|
|
28
|
+
held_seconds: int
|
|
29
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
ok = self.ok
|
|
33
|
+
|
|
34
|
+
state = self.state
|
|
35
|
+
|
|
36
|
+
verified_seconds: int | None
|
|
37
|
+
verified_seconds = self.verified_seconds
|
|
38
|
+
|
|
39
|
+
balance_seconds = self.balance_seconds
|
|
40
|
+
|
|
41
|
+
held_seconds = self.held_seconds
|
|
42
|
+
|
|
43
|
+
field_dict: dict[str, Any] = {}
|
|
44
|
+
field_dict.update(self.additional_properties)
|
|
45
|
+
field_dict.update(
|
|
46
|
+
{
|
|
47
|
+
"ok": ok,
|
|
48
|
+
"state": state,
|
|
49
|
+
"verified_seconds": verified_seconds,
|
|
50
|
+
"balance_seconds": balance_seconds,
|
|
51
|
+
"held_seconds": held_seconds,
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
return field_dict
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
59
|
+
d = dict(src_dict)
|
|
60
|
+
ok = d.pop("ok")
|
|
61
|
+
|
|
62
|
+
state = d.pop("state")
|
|
63
|
+
|
|
64
|
+
def _parse_verified_seconds(data: object) -> int | None:
|
|
65
|
+
if data is None:
|
|
66
|
+
return data
|
|
67
|
+
return cast(int | None, data)
|
|
68
|
+
|
|
69
|
+
verified_seconds = _parse_verified_seconds(d.pop("verified_seconds"))
|
|
70
|
+
|
|
71
|
+
balance_seconds = d.pop("balance_seconds")
|
|
72
|
+
|
|
73
|
+
held_seconds = d.pop("held_seconds")
|
|
74
|
+
|
|
75
|
+
upload_complete_response = cls(
|
|
76
|
+
ok=ok,
|
|
77
|
+
state=state,
|
|
78
|
+
verified_seconds=verified_seconds,
|
|
79
|
+
balance_seconds=balance_seconds,
|
|
80
|
+
held_seconds=held_seconds,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
upload_complete_response.additional_properties = d
|
|
84
|
+
return upload_complete_response
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def additional_keys(self) -> list[str]:
|
|
88
|
+
return list(self.additional_properties.keys())
|
|
89
|
+
|
|
90
|
+
def __getitem__(self, key: str) -> Any:
|
|
91
|
+
return self.additional_properties[key]
|
|
92
|
+
|
|
93
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
94
|
+
self.additional_properties[key] = value
|
|
95
|
+
|
|
96
|
+
def __delitem__(self, key: str) -> None:
|
|
97
|
+
del self.additional_properties[key]
|
|
98
|
+
|
|
99
|
+
def __contains__(self, key: str) -> bool:
|
|
100
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..models.upload_create_response_funding import (
|
|
10
|
+
UploadCreateResponseFunding,
|
|
11
|
+
check_upload_create_response_funding,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from ..models.upload_create_response_upload_type_0 import (
|
|
16
|
+
UploadCreateResponseUploadType0,
|
|
17
|
+
)
|
|
18
|
+
from ..models.upload_limits import UploadLimits
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
T = TypeVar("T", bound="UploadCreateResponse")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@_attrs_define
|
|
25
|
+
class UploadCreateResponse:
|
|
26
|
+
"""
|
|
27
|
+
Attributes:
|
|
28
|
+
job_id (str):
|
|
29
|
+
balance_seconds (int): The account's net balance after this upload's hold was placed.
|
|
30
|
+
held_seconds (int):
|
|
31
|
+
limits (UploadLimits): The caller's current upload admission limits, shared by every response that carries them.
|
|
32
|
+
upload (None | UploadCreateResponseUploadType0): One page of presigned direct-to-R2 PUT URLs, or null when
|
|
33
|
+
direct-to-R2 uploads are not available for this job and parts must be sent to upload_part instead.
|
|
34
|
+
funding (UploadCreateResponseFunding): Which balance this upload's hold was placed against.
|
|
35
|
+
state (str): The job's initial state, typically uploading.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
job_id: str
|
|
39
|
+
balance_seconds: int
|
|
40
|
+
held_seconds: int
|
|
41
|
+
limits: UploadLimits
|
|
42
|
+
upload: None | UploadCreateResponseUploadType0
|
|
43
|
+
funding: UploadCreateResponseFunding
|
|
44
|
+
state: str
|
|
45
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
46
|
+
|
|
47
|
+
def to_dict(self) -> dict[str, Any]:
|
|
48
|
+
from ..models.upload_create_response_upload_type_0 import (
|
|
49
|
+
UploadCreateResponseUploadType0, # noqa: PLC0415
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
job_id = self.job_id
|
|
53
|
+
|
|
54
|
+
balance_seconds = self.balance_seconds
|
|
55
|
+
|
|
56
|
+
held_seconds = self.held_seconds
|
|
57
|
+
|
|
58
|
+
limits = self.limits.to_dict()
|
|
59
|
+
|
|
60
|
+
upload: dict[str, Any] | None
|
|
61
|
+
if isinstance(self.upload, UploadCreateResponseUploadType0):
|
|
62
|
+
upload = self.upload.to_dict()
|
|
63
|
+
else:
|
|
64
|
+
upload = self.upload
|
|
65
|
+
|
|
66
|
+
funding: str = self.funding
|
|
67
|
+
|
|
68
|
+
state = self.state
|
|
69
|
+
|
|
70
|
+
field_dict: dict[str, Any] = {}
|
|
71
|
+
field_dict.update(self.additional_properties)
|
|
72
|
+
field_dict.update(
|
|
73
|
+
{
|
|
74
|
+
"job_id": job_id,
|
|
75
|
+
"balance_seconds": balance_seconds,
|
|
76
|
+
"held_seconds": held_seconds,
|
|
77
|
+
"limits": limits,
|
|
78
|
+
"upload": upload,
|
|
79
|
+
"funding": funding,
|
|
80
|
+
"state": state,
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
return field_dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
88
|
+
from ..models.upload_create_response_upload_type_0 import (
|
|
89
|
+
UploadCreateResponseUploadType0, # noqa: PLC0415
|
|
90
|
+
)
|
|
91
|
+
from ..models.upload_limits import UploadLimits # noqa: PLC0415
|
|
92
|
+
|
|
93
|
+
d = dict(src_dict)
|
|
94
|
+
job_id = d.pop("job_id")
|
|
95
|
+
|
|
96
|
+
balance_seconds = d.pop("balance_seconds")
|
|
97
|
+
|
|
98
|
+
held_seconds = d.pop("held_seconds")
|
|
99
|
+
|
|
100
|
+
limits = UploadLimits.from_dict(d.pop("limits"))
|
|
101
|
+
|
|
102
|
+
def _parse_upload(data: object) -> None | UploadCreateResponseUploadType0:
|
|
103
|
+
if data is None:
|
|
104
|
+
return data
|
|
105
|
+
try:
|
|
106
|
+
if not isinstance(data, dict):
|
|
107
|
+
raise TypeError()
|
|
108
|
+
upload_type_0 = UploadCreateResponseUploadType0.from_dict(data)
|
|
109
|
+
|
|
110
|
+
return upload_type_0
|
|
111
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
112
|
+
pass
|
|
113
|
+
return cast(None | UploadCreateResponseUploadType0, data)
|
|
114
|
+
|
|
115
|
+
upload = _parse_upload(d.pop("upload"))
|
|
116
|
+
|
|
117
|
+
funding = check_upload_create_response_funding(d.pop("funding"))
|
|
118
|
+
|
|
119
|
+
state = d.pop("state")
|
|
120
|
+
|
|
121
|
+
upload_create_response = cls(
|
|
122
|
+
job_id=job_id,
|
|
123
|
+
balance_seconds=balance_seconds,
|
|
124
|
+
held_seconds=held_seconds,
|
|
125
|
+
limits=limits,
|
|
126
|
+
upload=upload,
|
|
127
|
+
funding=funding,
|
|
128
|
+
state=state,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
upload_create_response.additional_properties = d
|
|
132
|
+
return upload_create_response
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def additional_keys(self) -> list[str]:
|
|
136
|
+
return list(self.additional_properties.keys())
|
|
137
|
+
|
|
138
|
+
def __getitem__(self, key: str) -> Any:
|
|
139
|
+
return self.additional_properties[key]
|
|
140
|
+
|
|
141
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
142
|
+
self.additional_properties[key] = value
|
|
143
|
+
|
|
144
|
+
def __delitem__(self, key: str) -> None:
|
|
145
|
+
del self.additional_properties[key]
|
|
146
|
+
|
|
147
|
+
def __contains__(self, key: str) -> bool:
|
|
148
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
UploadCreateResponseFunding = Literal["org", "personal"]
|
|
4
|
+
|
|
5
|
+
UPLOAD_CREATE_RESPONSE_FUNDING_VALUES: set[UploadCreateResponseFunding] = {
|
|
6
|
+
"org",
|
|
7
|
+
"personal",
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def check_upload_create_response_funding(value: str) -> UploadCreateResponseFunding:
|
|
12
|
+
if value in UPLOAD_CREATE_RESPONSE_FUNDING_VALUES:
|
|
13
|
+
return value
|
|
14
|
+
raise TypeError(
|
|
15
|
+
f"Unexpected value {value!r}. Expected one of {UPLOAD_CREATE_RESPONSE_FUNDING_VALUES!r}"
|
|
16
|
+
)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.presigned_part_url import PresignedPartUrl
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="UploadCreateResponseUploadType0")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class UploadCreateResponseUploadType0:
|
|
18
|
+
"""One page of presigned direct-to-R2 PUT URLs, or null when direct-to-R2 uploads are not available for this job and
|
|
19
|
+
parts must be sent to upload_part instead.
|
|
20
|
+
|
|
21
|
+
Attributes:
|
|
22
|
+
part_size_bytes (int): The byte size of every part except the last.
|
|
23
|
+
total_parts (int): The total number of parts this upload is split into.
|
|
24
|
+
part_urls (list[PresignedPartUrl]): Presigned URLs for this page's parts, starting at the requested (or first)
|
|
25
|
+
part number.
|
|
26
|
+
next_part_number (int | None): The next part number not covered by this page, or null once every part has a URL.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
part_size_bytes: int
|
|
30
|
+
total_parts: int
|
|
31
|
+
part_urls: list[PresignedPartUrl]
|
|
32
|
+
next_part_number: int | None
|
|
33
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
34
|
+
|
|
35
|
+
def to_dict(self) -> dict[str, Any]:
|
|
36
|
+
part_size_bytes = self.part_size_bytes
|
|
37
|
+
|
|
38
|
+
total_parts = self.total_parts
|
|
39
|
+
|
|
40
|
+
part_urls = []
|
|
41
|
+
for part_urls_item_data in self.part_urls:
|
|
42
|
+
part_urls_item = part_urls_item_data.to_dict()
|
|
43
|
+
part_urls.append(part_urls_item)
|
|
44
|
+
|
|
45
|
+
next_part_number: int | None
|
|
46
|
+
next_part_number = self.next_part_number
|
|
47
|
+
|
|
48
|
+
field_dict: dict[str, Any] = {}
|
|
49
|
+
field_dict.update(self.additional_properties)
|
|
50
|
+
field_dict.update(
|
|
51
|
+
{
|
|
52
|
+
"part_size_bytes": part_size_bytes,
|
|
53
|
+
"total_parts": total_parts,
|
|
54
|
+
"part_urls": part_urls,
|
|
55
|
+
"next_part_number": next_part_number,
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
return field_dict
|
|
60
|
+
|
|
61
|
+
@classmethod
|
|
62
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
63
|
+
from ..models.presigned_part_url import PresignedPartUrl # noqa: PLC0415
|
|
64
|
+
|
|
65
|
+
d = dict(src_dict)
|
|
66
|
+
part_size_bytes = d.pop("part_size_bytes")
|
|
67
|
+
|
|
68
|
+
total_parts = d.pop("total_parts")
|
|
69
|
+
|
|
70
|
+
part_urls = []
|
|
71
|
+
_part_urls = d.pop("part_urls")
|
|
72
|
+
for part_urls_item_data in _part_urls:
|
|
73
|
+
part_urls_item = PresignedPartUrl.from_dict(part_urls_item_data)
|
|
74
|
+
|
|
75
|
+
part_urls.append(part_urls_item)
|
|
76
|
+
|
|
77
|
+
def _parse_next_part_number(data: object) -> int | None:
|
|
78
|
+
if data is None:
|
|
79
|
+
return data
|
|
80
|
+
return cast(int | None, data)
|
|
81
|
+
|
|
82
|
+
next_part_number = _parse_next_part_number(d.pop("next_part_number"))
|
|
83
|
+
|
|
84
|
+
upload_create_response_upload_type_0 = cls(
|
|
85
|
+
part_size_bytes=part_size_bytes,
|
|
86
|
+
total_parts=total_parts,
|
|
87
|
+
part_urls=part_urls,
|
|
88
|
+
next_part_number=next_part_number,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
upload_create_response_upload_type_0.additional_properties = d
|
|
92
|
+
return upload_create_response_upload_type_0
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def additional_keys(self) -> list[str]:
|
|
96
|
+
return list(self.additional_properties.keys())
|
|
97
|
+
|
|
98
|
+
def __getitem__(self, key: str) -> Any:
|
|
99
|
+
return self.additional_properties[key]
|
|
100
|
+
|
|
101
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
102
|
+
self.additional_properties[key] = value
|
|
103
|
+
|
|
104
|
+
def __delitem__(self, key: str) -> None:
|
|
105
|
+
del self.additional_properties[key]
|
|
106
|
+
|
|
107
|
+
def __contains__(self, key: str) -> bool:
|
|
108
|
+
return key in self.additional_properties
|