vocalstack 1.0.0a14__tar.gz → 1.1.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: vocalstack
3
- Version: 1.0.0a14
3
+ Version: 1.1.0
4
4
  Summary: VocalStack speech API SDK (asyncio): one client grouped by resource, typed models from the API contract, realtime WebSocket streaming.
5
5
  Project-URL: Homepage, https://vocalstack.com
6
6
  License-Expression: MIT
@@ -45,8 +45,9 @@ for that transcription, so print the text without a speaker.
45
45
  real usage on the account's tier and quotas.
46
46
  - Keys are for servers. Never put a key in browser code or in a URL. The API
47
47
  refuses a key sent from a web page (`Origin` header) or in a query string.
48
- - Scopes: `read` (read transcripts, search, export), `write` and
49
- `recordings:publish` (create transcriptions, stream live audio), or `*`.
48
+ - Scopes: `read` (read transcripts, search, export), `write` (transcribe
49
+ files and links, open realtime sessions, change things), `recordings:publish`
50
+ (start, pause and stop a stored live transcription and send it audio), or `*`.
50
51
  - Base URL: `https://api.vocalstack.com` (the default). Override it with
51
52
  `VOCALSTACK_BASE_URL` (for example, a local or staging server).
52
53
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vocalstack"
7
- version = "1.0.0a14"
7
+ version = "1.1.0"
8
8
  description = "VocalStack speech API SDK (asyncio): one client grouped by resource, typed models from the API contract, realtime WebSocket streaming."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -45,8 +45,9 @@ for that transcription, so print the text without a speaker.
45
45
  real usage on the account's tier and quotas.
46
46
  - Keys are for servers. Never put a key in browser code or in a URL. The API
47
47
  refuses a key sent from a web page (`Origin` header) or in a query string.
48
- - Scopes: `read` (read transcripts, search, export), `write` and
49
- `recordings:publish` (create transcriptions, stream live audio), or `*`.
48
+ - Scopes: `read` (read transcripts, search, export), `write` (transcribe
49
+ files and links, open realtime sessions, change things), `recordings:publish`
50
+ (start, pause and stop a stored live transcription and send it audio), or `*`.
50
51
  - Base URL: `https://api.vocalstack.com` (the default). Override it with
51
52
  `VOCALSTACK_BASE_URL` (for example, a local or staging server).
52
53
 
@@ -29,7 +29,7 @@ from .errors import VocalStackError
29
29
  from .realtime import RealtimeTranscript
30
30
  from .realtime import RealtimeSession, pace_realtime
31
31
 
32
- __version__ = "1.0.0a14"
32
+ __version__ = "1.1.0"
33
33
 
34
34
  __all__ = [
35
35
  "DEFAULT_BASE_URL",
@@ -2,9 +2,12 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import json
5
+ import logging
5
6
  from typing import Annotated, Any, Dict, List, Literal, Optional, Union
6
7
 
7
- from pydantic import BaseModel, ConfigDict, Field, TypeAdapter
8
+ from pydantic import BaseModel, ConfigDict, Field, TypeAdapter, ValidationError
9
+
10
+ _log = logging.getLogger("vocalstack")
8
11
 
9
12
 
10
13
  class _Base(BaseModel):
@@ -12,75 +15,75 @@ class _Base(BaseModel):
12
15
  model_config = ConfigDict(populate_by_name=True, extra="ignore")
13
16
 
14
17
 
15
- Access = Literal["public", "private"]
18
+ Access = Union[Literal["public", "private"], str]
16
19
 
17
- ErrorCode = Literal["invalid_audio", "invalid_options", "invalid_token", "capacity_exceeded", "slow_consumer", "engine_unavailable", "internal", "session_expired", "engine_lost", "forbidden", "broadcast_archived", "not_found", "conflict", "invalid_state", "password_required", "rate_limited", "preview_pending", "language_unavailable", "suspended", "key_expired", "key_revoked", "key_from_browser", "insufficient_credit", "usage_cap_reached", "payment_method_required", "terms_acceptance_required", "payment_method_in_use", "billing_details_required", "promo_code_invalid", "auto_top_up_off", "range_too_long", "quota_exceeded", "idempotency_key_reused", "method_not_allowed", "payload_too_large", "unsupported_media_type", "invalid_body", "timeout", "language_limit_reached", "unavailable"]
20
+ ErrorCode = Union[Literal["invalid_audio", "invalid_options", "invalid_token", "capacity_exceeded", "slow_consumer", "engine_unavailable", "internal", "session_expired", "engine_lost", "forbidden", "broadcast_archived", "not_found", "conflict", "invalid_state", "password_required", "rate_limited", "preview_pending", "language_unavailable", "suspended", "key_expired", "key_revoked", "key_from_browser", "insufficient_credit", "usage_cap_reached", "payment_method_required", "terms_acceptance_required", "payment_method_in_use", "billing_details_required", "promo_code_invalid", "auto_top_up_off", "range_too_long", "quota_exceeded", "idempotency_key_reused", "method_not_allowed", "payload_too_large", "unsupported_media_type", "invalid_body", "timeout", "language_limit_reached", "unavailable"], str]
18
21
 
19
- SampleWarning = Literal["overlaps", "noisy", "weak_voice", "unclear", "cut_off"]
22
+ SampleWarning = Union[Literal["overlaps", "noisy", "weak_voice", "unclear", "cut_off"], str]
20
23
 
21
- AudioEncoding = Literal["pcm_f32le"]
24
+ AudioEncoding = Union[Literal["pcm_f32le"], str]
22
25
 
23
- FixKind = Literal["extension", "scheme", "page_stream"]
26
+ FixKind = Union[Literal["extension", "scheme", "page_stream"], str]
24
27
 
25
- SourceProblem = Literal["not_found", "refused", "server_error", "unknown_host", "unreachable", "private_address", "timeout", "web_page", "bad_playlist", "not_audio", "unsupported", "youtube_upcoming", "youtube_not_live", "youtube_unavailable", "youtube_busy"]
28
+ SourceProblem = Union[Literal["not_found", "refused", "server_error", "unknown_host", "unreachable", "private_address", "timeout", "web_page", "bad_playlist", "not_audio", "unsupported", "youtube_upcoming", "youtube_not_live", "youtube_unavailable", "youtube_busy"], str]
26
29
 
27
- AudioSourceState = Literal["ready", "error"]
30
+ AudioSourceState = Union[Literal["ready", "error"], str]
28
31
 
29
- TranscriptionState = Literal["idle", "pending", "live", "paused", "processing", "ended", "finalized"]
32
+ TranscriptionState = Union[Literal["idle", "pending", "live", "paused", "processing", "ended", "finalized"], str]
30
33
 
31
- Lifecycle = Literal["active", "archived", "purged"]
34
+ Lifecycle = Union[Literal["active", "archived", "purged"], str]
32
35
 
33
- LatencyMode = Literal["auto", "fast", "accuracy"]
36
+ LatencyMode = Union[Literal["auto", "fast", "accuracy"], str]
34
37
 
35
- SpeakerLabels = Literal["auto", "on", "off"]
38
+ SpeakerLabels = Union[Literal["auto", "on", "off"], str]
36
39
 
37
- ClientApp = Literal["mac_app"]
40
+ ClientApp = Union[Literal["mac_app"], str]
38
41
 
39
- ClientKind = Literal["dashboard", "chrome_extension", "mac_app", "obs_plugin", "sdk", "other"]
42
+ ClientKind = Union[Literal["dashboard", "chrome_extension", "mac_app", "obs_plugin", "sdk", "other"], str]
40
43
 
41
- Decoder = Literal["fast", "accuracy"]
44
+ Decoder = Union[Literal["fast", "accuracy"], str]
42
45
 
43
- Consent = Literal["pending", "granted", "refused"]
46
+ Consent = Union[Literal["pending", "granted", "refused"], str]
44
47
 
45
- NotVoicedReason = Literal["rewrite"]
48
+ NotVoicedReason = Union[Literal["rewrite"], str]
46
49
 
47
- DoneReason = Literal["eof", "max_duration", "cancelled"]
50
+ DoneReason = Union[Literal["eof", "max_duration", "cancelled"], str]
48
51
 
49
- ExportFormat = Literal["json", "srt", "vtt", "txt", "md", "xlsx", "pdf"]
52
+ ExportFormat = Union[Literal["json", "srt", "vtt", "txt", "md", "xlsx", "pdf"], str]
50
53
 
51
- ExportTimestamps = Literal["off", "paragraph", "line"]
54
+ ExportTimestamps = Union[Literal["off", "paragraph", "line"], str]
52
55
 
53
- FileUploadState = Literal["uploading", "complete"]
56
+ FileUploadState = Union[Literal["uploading", "complete"], str]
54
57
 
55
- HealthStatus = Literal["ok"]
58
+ HealthStatus = Union[Literal["ok"], str]
56
59
 
57
- IngestState = Literal["connecting", "streaming", "reconnecting", "stopped", "failed"]
60
+ IngestState = Union[Literal["connecting", "streaming", "reconnecting", "stopped", "failed"], str]
58
61
 
59
- InputKind = Literal["live", "file", "url", "stream"]
62
+ InputKind = Union[Literal["live", "file", "url", "stream"], str]
60
63
 
61
- InviteState = Literal["pending", "expired"]
64
+ InviteState = Union[Literal["pending", "expired"], str]
62
65
 
63
- QueueReason = Literal["concurrency"]
66
+ QueueReason = Union[Literal["concurrency"], str]
64
67
 
65
- JobState = Literal["queued", "fetching", "transcribing", "done", "failed", "cropping", "stopped"]
68
+ JobState = Union[Literal["queued", "fetching", "transcribing", "done", "failed", "cropping", "stopped"], str]
66
69
 
67
- LanguageStatusState = Literal["matches", "mismatch", "unknown", "change_unsupported"]
70
+ LanguageStatusState = Union[Literal["matches", "mismatch", "unknown", "change_unsupported"], str]
68
71
 
69
- LinkKind = Literal["live", "file", "unknown"]
72
+ LinkKind = Union[Literal["live", "file", "unknown"], str]
70
73
 
71
- ProbeReason = Literal["web_page", "site_not_fetched", "meeting", "not_found", "unreachable", "forbidden", "not_media", "copy_protected", "too_long", "unknown"]
74
+ ProbeReason = Union[Literal["web_page", "site_not_fetched", "meeting", "not_found", "unreachable", "forbidden", "not_media", "copy_protected", "too_long", "empty", "unknown"], str]
72
75
 
73
- LoadingStage = Literal["download", "model"]
76
+ LoadingStage = Union[Literal["download", "model"], str]
74
77
 
75
- SourceKind = Literal["file", "url"]
78
+ SourceKind = Union[Literal["file", "url"], str]
76
79
 
77
- PullState = Literal["connecting", "streaming", "reconnecting", "failed"]
80
+ PullState = Union[Literal["connecting", "streaming", "reconnecting", "failed"], str]
78
81
 
79
- RecordingState = Literal["pending", "live", "paused", "processing", "ended", "finalized"]
82
+ RecordingState = Union[Literal["pending", "live", "paused", "processing", "ended", "finalized"], str]
80
83
 
81
- SentenceStatus = Literal["open", "closed", "dropped"]
84
+ SentenceStatus = Union[Literal["open", "closed", "dropped"], str]
82
85
 
83
- VoiceStatusState = Literal["preparing", "unavailable"]
86
+ VoiceStatusState = Union[Literal["preparing", "unavailable"], str]
84
87
 
85
88
 
86
89
  class AccountClosing(_Base):
@@ -124,7 +127,7 @@ class AmendTail(_Base):
124
127
 
125
128
 
126
129
  class ErrorData(_Base):
127
- details: Optional[Any] = None
130
+ details: Optional[Dict[str, Any]] = None
128
131
  retryable: bool
129
132
 
130
133
 
@@ -411,6 +414,22 @@ class PlanRef(_Base):
411
414
  name: str
412
415
 
413
416
 
417
+ class StorePrice(_Base):
418
+ """A price paid at an app store."""
419
+
420
+ amount: float
421
+ currency: str
422
+
423
+
424
+ class StorePurchases(_Base):
425
+ """Credit packs bought in an app store."""
426
+
427
+ count: int
428
+ credit: float
429
+ paid: List["StorePrice"]
430
+ store: str
431
+
432
+
414
433
  class NextPayment(_Base):
415
434
  amount: float
416
435
  at: str
@@ -447,6 +466,7 @@ class SubscriptionView(_Base):
447
466
  return_plan: Optional[str] = Field(default=None, alias="returnPlan")
448
467
  scheduled_end: Optional["ScheduledEnd"] = Field(default=None, alias="scheduledEnd")
449
468
  status: str
469
+ store: str
450
470
  switch_prices: "SwitchPrices" = Field(alias="switchPrices")
451
471
  yearly_opt_in: bool = Field(alias="yearlyOptIn")
452
472
 
@@ -482,6 +502,7 @@ running transcriptions go on below zero, never how far."""
482
502
  retention_deadline: Optional[str] = Field(default=None, alias="retentionDeadline")
483
503
  start_block: Optional[str] = Field(default=None, alias="startBlock")
484
504
  start_block_live: Optional[str] = Field(default=None, alias="startBlockLive")
505
+ store_purchases: Optional["StorePurchases"] = Field(default=None, alias="storePurchases")
485
506
  subscription: Optional["SubscriptionView"] = None
486
507
  top_up_url: str = Field(alias="topUpUrl")
487
508
 
@@ -518,6 +539,7 @@ class ConfidencePolicy(_Base):
518
539
 
519
540
  hide_below: Optional[float] = Field(default=None, alias="hideBelow")
520
541
  low_threshold: Optional[float] = Field(default=None, alias="lowThreshold")
542
+ # This many low-confidence words suppress a line for listeners.
521
543
  suppress_count: Optional[int] = Field(default=None, alias="suppressCount")
522
544
 
523
545
 
@@ -536,6 +558,7 @@ design's settings sheet): what a recording made in it starts with."""
536
558
  summary_translations: Optional[bool] = Field(default=None, alias="summaryTranslations")
537
559
  title: Optional[bool] = None
538
560
  translation_tts: Optional[bool] = Field(default=None, alias="translationTts")
561
+ # Accepted for compatibility and ignored: VocalStack picks the voice that reads each speaker, and the only choice is whether cloned voices are used (`voiceCloning`).
539
562
  voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
540
563
  voice_cloning: Optional[bool] = Field(default=None, alias="voiceCloning")
541
564
  voice_cloning_consent: Optional[bool] = Field(default=None, alias="voiceCloningConsent")
@@ -608,6 +631,13 @@ class Capabilities(_Base):
608
631
  speaker_label_modes: List[SpeakerLabels] = Field(alias="speakerLabelModes")
609
632
 
610
633
 
634
+ class CapturePage(_Base):
635
+ """The captured browser tab's address and title (`page`)."""
636
+
637
+ title: Optional[str] = None
638
+ url: Optional[str] = None
639
+
640
+
611
641
  class CaptureSpan(_Base):
612
642
  idx: int
613
643
  media_end: Optional[float] = Field(default=None, alias="mediaEnd")
@@ -707,6 +737,7 @@ Its id is the speaker's, so `clone:<id>` names it as a voice."""
707
737
 
708
738
 
709
739
  class CommittedSegment(_Base):
740
+ # `true` when the segment was decoded by the fast model: the `auto` transcription method catching up after falling behind real time, or the `fast` method.
710
741
  catchup: Optional[bool] = None
711
742
  confidence: Optional[float] = None
712
743
  decoder: Optional[Decoder] = None
@@ -829,6 +860,7 @@ It is created idle; `POST /v1/transcriptions/{id}/start` starts it."""
829
860
 
830
861
  broadcasts: Optional[List[str]] = None
831
862
  name: str
863
+ page: Optional["CapturePage"] = None
832
864
  settings: Optional["Settings"] = None
833
865
  source: Optional["CaptureSource"] = None
834
866
 
@@ -879,7 +911,7 @@ class CreateSpeakerInvite(_Base):
879
911
 
880
912
 
881
913
  class CreateTag(_Base):
882
- color: Optional[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]] = None
914
+ color: Optional[Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]] = None
883
915
  name: str
884
916
 
885
917
 
@@ -898,6 +930,7 @@ class SettingsPatch(_Base):
898
930
  summary_translations: Optional[bool] = Field(default=None, alias="summaryTranslations")
899
931
  title: Optional[bool] = None
900
932
  translation_tts: Optional[bool] = Field(default=None, alias="translationTts")
933
+ # Accepted for compatibility and ignored: VocalStack picks the voice (see `Settings.voiceByLang`).
901
934
  voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
902
935
  voice_cloning: Optional[bool] = Field(default=None, alias="voiceCloning")
903
936
  voice_cloning_consent: Optional[bool] = Field(default=None, alias="voiceCloningConsent")
@@ -1107,6 +1140,7 @@ class LinkProbe(_Base):
1107
1140
  source: str
1108
1141
  thumbnail_url: Optional[str] = Field(default=None, alias="thumbnailUrl")
1109
1142
  title: Optional[str] = None
1143
+ viewer_only: Optional[bool] = Field(default=None, alias="viewerOnly")
1110
1144
 
1111
1145
 
1112
1146
  class LowBalanceAlertChoices(_Base):
@@ -1191,6 +1225,8 @@ class Payment(_Base):
1191
1225
  id: str
1192
1226
  kind: str
1193
1227
  status: str
1228
+ store: Optional[str] = None
1229
+ store_price: Optional["StorePrice"] = Field(default=None, alias="storePrice")
1194
1230
  tax_id: Optional[str] = Field(default=None, alias="taxId")
1195
1231
 
1196
1232
 
@@ -1327,6 +1363,7 @@ class TranscriptionJob(_Base):
1327
1363
  started_at: Optional[str] = Field(default=None, alias="startedAt")
1328
1364
  state: JobState
1329
1365
  transcription_id: str = Field(alias="transcriptionId")
1366
+ video_not_kept: Optional[bool] = Field(default=None, alias="videoNotKept")
1330
1367
 
1331
1368
 
1332
1369
  class TranscriptionMetrics(_Base):
@@ -1346,7 +1383,7 @@ class PublisherInfo(_Base):
1346
1383
  class TagRef(_Base):
1347
1384
  """A tag as a transcription lists it."""
1348
1385
 
1349
- color: Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]
1386
+ color: Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]
1350
1387
  id: str
1351
1388
  name: str
1352
1389
 
@@ -1380,7 +1417,7 @@ stream, an RTMP encoder), which may feed broadcasts (`broadcasts`)."""
1380
1417
  media: Optional[List["MediaSummary"]] = None
1381
1418
  metrics: Optional["TranscriptionMetrics"] = None
1382
1419
  name: str
1383
- origin: Literal["dashboard", "api", "extension", "desktop_app", "obs", "wordpress", "payload", "strapi", "sanity", "contentful", "mcp", "broadcast", "unknown"]
1420
+ origin: Union[Literal["dashboard", "api", "extension", "desktop_app", "ios_app", "obs", "wordpress", "payload", "strapi", "sanity", "contentful", "mcp", "broadcast", "unknown"], str]
1384
1421
  owner_principal_id: str = Field(alias="ownerPrincipalId")
1385
1422
  peak_latency_s: Optional[float] = Field(default=None, alias="peakLatencyS")
1386
1423
  peak_listeners: Optional[int] = Field(default=None, alias="peakListeners")
@@ -1477,6 +1514,7 @@ class SearchResults(_Base):
1477
1514
 
1478
1515
 
1479
1516
  class SegmentView(_Base):
1517
+ # Deprecated: read `decoder` (`fast`), which says the same.
1480
1518
  catchup: bool
1481
1519
  confidence: Optional[float] = None
1482
1520
  corrected: bool
@@ -1559,11 +1597,13 @@ class SessionOptions(_Base):
1559
1597
  identify_speakers: Optional[List["KnownSpeaker"]] = Field(default=None, alias="identifySpeakers")
1560
1598
  input: Optional["InputOptions"] = None
1561
1599
  latency_mode: Optional[LatencyMode] = Field(default=None, alias="latencyMode")
1600
+ page: Optional["CapturePage"] = None
1562
1601
  sentences: Optional["SentenceOptions"] = None
1563
1602
  speaker_labels: Optional[SpeakerLabels] = Field(default=None, alias="speakerLabels")
1564
1603
  spoken_language: Optional[str] = Field(default=None, alias="spokenLanguage")
1565
1604
  translate: Optional[List[str]] = None
1566
1605
  voice: Optional[List[str]] = None
1606
+ # Accepted for compatibility and ignored: VocalStack picks the voice (see `voice`).
1567
1607
  voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
1568
1608
  voice_cloning: Optional[bool] = Field(default=None, alias="voiceCloning")
1569
1609
 
@@ -1671,6 +1711,7 @@ file and its end."""
1671
1711
  class StartLiveTranscription(_Base):
1672
1712
  audio_source: Optional[str] = Field(default=None, alias="audioSource")
1673
1713
  device_id: Optional[str] = Field(default=None, alias="deviceId")
1714
+ page: Optional["CapturePage"] = None
1674
1715
  script_id: Optional[str] = Field(default=None, alias="scriptId")
1675
1716
  script_text: Optional[str] = Field(default=None, alias="scriptText")
1676
1717
  settings: Optional["SettingsPatch"] = None
@@ -1696,13 +1737,14 @@ class SummaryStatus(_Base):
1696
1737
 
1697
1738
 
1698
1739
  class Tag(_Base):
1699
- color: Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]
1740
+ color: Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]
1700
1741
  created_at: str = Field(alias="createdAt")
1701
1742
  id: str
1702
1743
  name: str
1703
1744
 
1704
1745
 
1705
1746
  class TagList(_Base):
1747
+ next_cursor: Optional[str] = Field(default=None, alias="nextCursor")
1706
1748
  tags: List["Tag"]
1707
1749
 
1708
1750
 
@@ -1763,7 +1805,7 @@ class UpdateShareLink(_Base):
1763
1805
 
1764
1806
 
1765
1807
  class UpdateTag(_Base):
1766
- color: Optional[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"]] = None
1808
+ color: Optional[Union[Literal["coral", "amber", "lime", "green", "teal", "blue", "violet", "pink"], str]] = None
1767
1809
  name: Optional[str] = None
1768
1810
 
1769
1811
 
@@ -1927,7 +1969,7 @@ class CaptureSourceStream(_Base):
1927
1969
  url: str
1928
1970
 
1929
1971
 
1930
- CaptureSource = Annotated[Union[CaptureSourceMic, CaptureSourceStream], Field(discriminator="kind")]
1972
+ CaptureSource = Annotated[Union[Annotated[Union[CaptureSourceMic, CaptureSourceStream], Field(discriminator="kind")], Dict[str, Any]], Field(union_mode="left_to_right")]
1931
1973
 
1932
1974
  class Eof(_Base):
1933
1975
  type: Literal["eof"] = "eof"
@@ -1944,6 +1986,7 @@ class SessionUpdate(_Base):
1944
1986
  translate: Optional[List[str]] = None
1945
1987
  type: Literal["session.update"] = "session.update"
1946
1988
  voice: Optional[List[str]] = None
1989
+ # Accepted for compatibility and ignored: VocalStack picks the voice.
1947
1990
  voice_by_lang: Optional[Dict[str, str]] = Field(default=None, alias="voiceByLang")
1948
1991
 
1949
1992
 
@@ -2114,8 +2157,8 @@ class StreamPull(_Base):
2114
2157
  error: Optional[str] = None
2115
2158
  failures: int
2116
2159
  media_s: float = Field(alias="mediaS")
2117
- program_at_ms: Optional[int] = Field(default=None, alias="programAtMs")
2118
- sequence_offset_ms: Optional[int] = Field(default=None, alias="sequenceOffsetMs")
2160
+ program_at: Optional[str] = Field(default=None, alias="programAt")
2161
+ sequence_offset_s: Optional[float] = Field(default=None, alias="sequenceOffsetS")
2119
2162
  state: PullState
2120
2163
  type: Literal["stream.pull"] = "stream.pull"
2121
2164
 
@@ -2304,14 +2347,22 @@ SERVER_FRAME_TYPES = frozenset(["session.loading", "session.queued", "session.re
2304
2347
 
2305
2348
  _server_frame_adapter: TypeAdapter[ServerFrame] = TypeAdapter(ServerFrame)
2306
2349
 
2350
+ _SERVER_FRAME_CLASSES: Dict[str, Any] = {"session.loading": SessionLoading, "session.queued": SessionQueued, "session.ready": SessionReady, "transcript.committed": TranscriptCommitted, "transcript.draft": TranscriptDraft, "transcript.words": TranscriptWords, "transcript.amended": TranscriptAmended, "transcript.latency": TranscriptLatency, "transcript.speaker": TranscriptSpeaker, "transcript.speakerGender": TranscriptSpeakerGender, "transcript.speakerIdentified": TranscriptSpeakerIdentified, "transcript.speakerNumbers": TranscriptSpeakerNumbers, "transcript.sentence": TranscriptSentence, "transcript.translated": TranscriptTranslated, "transcript.voice": TranscriptVoice, "transcript.voiceStatus": TranscriptVoiceStatus, "transcript.languageStatus": TranscriptLanguageStatus, "transcript.retracted": TranscriptRetracted, "transcript.held": TranscriptHeld, "transcript.progress": TranscriptProgress, "stream.pull": StreamPull, "source.progress": SourceProgress, "source.prepared": SourcePrepared, "session.done": SessionDone, "error": ErrorFrame}
2351
+
2307
2352
 
2308
2353
  TranscriptEvent = Union[TranscriptCommitted, TranscriptDraft, TranscriptWords, TranscriptAmended, TranscriptLatency, TranscriptSpeaker, TranscriptSpeakerGender, TranscriptSpeakerIdentified, TranscriptSpeakerNumbers, TranscriptSentence, TranscriptTranslated, TranscriptVoice, TranscriptVoiceStatus, TranscriptLanguageStatus, TranscriptRetracted, TranscriptHeld, TranscriptProgress]
2309
2354
 
2310
2355
 
2311
2356
  def parse_server_frame(text: str) -> Optional[ServerFrame]:
2312
2357
  """Parse one WS text frame. Returns None for unknown frame types
2313
- (forward compatibility)."""
2358
+ (forward compatibility); a known frame that does not match its model
2359
+ is still returned, built from its fields unchecked."""
2314
2360
  raw = json.loads(text)
2315
2361
  if not isinstance(raw, dict) or raw.get("type") not in SERVER_FRAME_TYPES:
2362
+ _log.debug("ignoring server frame of unknown type %r", raw.get("type") if isinstance(raw, dict) else None)
2316
2363
  return None
2317
- return _server_frame_adapter.validate_python(raw)
2364
+ try:
2365
+ return _server_frame_adapter.validate_python(raw)
2366
+ except ValidationError as e:
2367
+ _log.debug("server frame %r does not match the contract: %s", raw["type"], e)
2368
+ return _SERVER_FRAME_CLASSES[raw["type"]].model_construct(**raw)
@@ -122,7 +122,8 @@ class _ParentResource(_Group):
122
122
  return _one(m.ManyResult, await self._t.json("POST", f"{self._base}/purge", json_body={"ids": ids}))
123
123
 
124
124
  async def list_share_links(self, id: str) -> List[m.ShareLink]:
125
- return _many(m.ShareLink, await self._t.json("GET", self._path(id, "/share-links")), "links")
125
+ items = await _all_pages(lambda c: self._t.json("GET", self._path(id, "/share-links"), query={"cursor": c}), "links")
126
+ return [m.ShareLink.model_validate(x) for x in items]
126
127
 
127
128
  async def list_scripts(self, id: str) -> List[m.Script]:
128
129
  return _many(m.Script, await self._t.json("GET", self._path(id, "/scripts")), "scripts")
@@ -680,7 +681,8 @@ class Tags(_Group):
680
681
  transcription lists its own in ``tags``."""
681
682
 
682
683
  async def list(self) -> List[m.Tag]:
683
- return _many(m.Tag, await self._t.json("GET", "/v1/tags"), "tags")
684
+ items = await _all_pages(lambda c: self._t.json("GET", "/v1/tags", query={"cursor": c}), "tags")
685
+ return [m.Tag.model_validate(x) for x in items]
684
686
 
685
687
  async def create(self, name: str, **fields: Any) -> m.Tag:
686
688
  body = _body(m.CreateTag, {"name": name, **fields})
@@ -806,7 +808,8 @@ class Speakers(_Group):
806
808
  cloned voice (``voice``) built from their sample."""
807
809
 
808
810
  async def list(self, *, lifecycle: Optional[str] = None) -> List[m.Speaker]:
809
- return _many(m.Speaker, await self._t.json("GET", "/v1/speakers", query={"lifecycle": lifecycle}), "speakers")
811
+ items = await _all_pages(lambda c: self._t.json("GET", "/v1/speakers", query={"lifecycle": lifecycle, "cursor": c}), "speakers")
812
+ return [m.Speaker.model_validate(x) for x in items]
810
813
 
811
814
  async def get(self, id: str) -> m.Speaker:
812
815
  return _one(m.Speaker, await self._t.json("GET", f"/v1/speakers/{_p(id)}"))
@@ -898,7 +901,7 @@ class Speakers(_Group):
898
901
  data = await self._t.json(
899
902
  "GET",
900
903
  "/v1/speakers/from-appearance/samples",
901
- query={"transcriptionId": transcription_id, "appearance": appearance, "spans": picked},
904
+ query={"transcription": transcription_id, "appearance": appearance, "spans": picked},
902
905
  )
903
906
  return _one(m.AppearanceSamples, data)
904
907
 
@@ -1091,6 +1094,12 @@ class Connect(_Group):
1091
1094
  "POST", "/v1/connect/token", data=form, anonymous=True, no_retry=True, oauth_errors=True
1092
1095
  )
1093
1096
 
1097
+ async def revoke(self) -> None:
1098
+ """Revoke the API key this client is using, and only that one: sign
1099
+ out of the app or switch workspace. Every later call with the key
1100
+ raises ``invalid_token``. Never retried."""
1101
+ await self._t.json("POST", "/v1/connect/revoke", no_retry=True)
1102
+
1094
1103
 
1095
1104
  class Billing(_Group):
1096
1105
  """``vs.billing``: the account's plan, credit balance and limits, the
@@ -1240,7 +1249,8 @@ class Rtmp(_Group):
1240
1249
 
1241
1250
  async def list_keys(self) -> List[m.AppStreamKey]:
1242
1251
  """The account's app stream keys, oldest first: masked, each with whether an encoder is sending on it (``live``, ``audio``)."""
1243
- return _many(m.AppStreamKey, await self._t.json("GET", "/v1/rtmp/keys"), "keys")
1252
+ items = await _all_pages(lambda c: self._t.json("GET", "/v1/rtmp/keys", query={"cursor": c}), "keys")
1253
+ return [m.AppStreamKey.model_validate(x) for x in items]
1244
1254
 
1245
1255
  async def delete_key(self, id: str) -> None:
1246
1256
  """Delete an app stream key: an encoder publishing on it is dropped within seconds."""
File without changes
File without changes
File without changes