Skip to content

Commit 9634ff8

Browse files
Ooscaarclaude
andauthored
fix: regenerate SDK and fix broken model imports (#19)
* fix: fix broken model imports blocking regenerate pipeline Move 7 models removed from OpenAPI spec (CaptionResponse, DownloadResponse, DownloadFormat, HashtagCheckResponse, HashtagInfo, TranscriptResponse, TranscriptSegment) to responses.py since the endpoints still work. Update models/__init__.py and tools.py imports accordingly. Fix test_exhaustive Type enum references (Type -> Type5). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use string values in media type tests instead of unstable Type5 enum The generated enum name (Type5) is not stable across regenerations. Use string values with Pydantic coercion instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8b16abe commit 9634ff8

4 files changed

Lines changed: 72 additions & 18 deletions

File tree

src/late/models/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@
1313
AccountGetResponse,
1414
AccountsListResponse,
1515
AccountWithFollowerStats,
16-
CaptionResponse,
17-
DownloadFormat,
18-
DownloadResponse,
1916
ErrorResponse,
2017
FacebookPlatformData,
2118
FollowerStatsResponse,
22-
HashtagCheckResponse,
23-
HashtagInfo,
2419
InstagramPlatformData,
2520
LinkedInPlatformData,
2621
MediaItem,
@@ -51,8 +46,6 @@
5146
SocialAccount,
5247
Status,
5348
TikTokPlatformData,
54-
TranscriptResponse,
55-
TranscriptSegment,
5649
TwitterPlatformData,
5750
Type,
5851
UploadedFile,
@@ -73,7 +66,14 @@
7366

7467
# SDK-specific models (not from OpenAPI)
7568
from .responses import (
69+
CaptionResponse,
70+
DownloadFormat,
71+
DownloadResponse,
72+
HashtagCheckResponse,
73+
HashtagInfo,
7674
MediaLargeUploadResponse,
75+
TranscriptResponse,
76+
TranscriptSegment,
7777
)
7878

7979
__all__ = [

src/late/models/responses.py

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,63 @@
77

88
from __future__ import annotations
99

10-
from pydantic import BaseModel
10+
from enum import Enum
11+
12+
from pydantic import AnyUrl, BaseModel
13+
14+
# ---------------------------------------------------------------------------
15+
# Tools endpoint models (endpoints removed from OpenAPI spec but still
16+
# functional for existing customers)
17+
# ---------------------------------------------------------------------------
18+
19+
20+
class DownloadFormat(BaseModel):
21+
formatId: str | None = None
22+
ext: str | None = None
23+
resolution: str | None = None
24+
filesize: int | None = None
25+
quality: str | None = None
26+
27+
28+
class DownloadResponse(BaseModel):
29+
url: AnyUrl | None = None
30+
title: str | None = None
31+
thumbnail: AnyUrl | None = None
32+
duration: int | None = None
33+
formats: list[DownloadFormat] | None = None
34+
35+
36+
class TranscriptSegment(BaseModel):
37+
text: str | None = None
38+
start: float | None = None
39+
duration: float | None = None
40+
41+
42+
class TranscriptResponse(BaseModel):
43+
transcript: str | None = None
44+
segments: list[TranscriptSegment] | None = None
45+
language: str | None = None
46+
47+
48+
class HashtagStatus(str, Enum):
49+
SAFE = "safe"
50+
BANNED = "banned"
51+
RESTRICTED = "restricted"
52+
UNKNOWN = "unknown"
53+
54+
55+
class HashtagInfo(BaseModel):
56+
hashtag: str | None = None
57+
status: HashtagStatus | None = None
58+
postCount: int | None = None
59+
60+
61+
class HashtagCheckResponse(BaseModel):
62+
hashtags: list[HashtagInfo] | None = None
63+
64+
65+
class CaptionResponse(BaseModel):
66+
caption: str | None = None
1167

1268

1369
class MediaLargeUploadResponse(BaseModel):

src/late/resources/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from typing import TYPE_CHECKING
88

9-
from late.models import (
9+
from late.models.responses import (
1010
CaptionResponse,
1111
DownloadResponse,
1212
HashtagCheckResponse,

tests/test_exhaustive.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,12 @@ def test_status_enum_values(self):
271271
assert Status.FAILED.value == "failed"
272272

273273
def test_type_enum_values(self):
274-
"""Test Type enum has expected values."""
275-
from late.models import Type
274+
"""Test MediaItem type field accepts media types."""
275+
from late.models._generated.models import MediaItem
276276

277-
assert hasattr(Type, "IMAGE")
278-
assert hasattr(Type, "VIDEO")
279-
assert Type.IMAGE.value == "image"
280-
assert Type.VIDEO.value == "video"
277+
MediaType = MediaItem.model_fields["type"].annotation
278+
assert MediaItem(type="image").type.value == "image"
279+
assert MediaItem(type="video").type.value == "video"
281280

282281
def test_tiktok_settings_creation(self):
283282
"""Test TikTokPlatformData model creation."""
@@ -294,11 +293,10 @@ def test_tiktok_settings_creation(self):
294293

295294
def test_media_item_creation(self):
296295
"""Test MediaItem with type enum."""
297-
from late.models import Type
298296
from late.models._generated.models import MediaItem
299297

300-
item = MediaItem(type=Type.IMAGE)
301-
assert item.type == Type.IMAGE
298+
item = MediaItem(type="image")
299+
assert item.type.value == "image"
302300

303301

304302
# ============================================================================

0 commit comments

Comments
 (0)