Skip to content

Commit f0ae816

Browse files
feat(api): api update
1 parent b8ee283 commit f0ae816

21 files changed

Lines changed: 625 additions & 285 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 265
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/onlyfansapi/onlyfansapi-5b7eaf3aea520bc245be9b93991257f9c1b5ad2ebad57eb17e80ac97fbdc66a4.yml
3-
openapi_spec_hash: c6cfa0dc8655e915bd8f945d84121803
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/onlyfansapi/onlyfansapi-edfaafe1957998ebfbda2d08eaaa72e8c2d00323ae5d025bd86083a71b7d6612.yml
3+
openapi_spec_hash: abf7eda561eb13076e85063eb92088ba
44
config_hash: 397c91e15c0024f8b5bbed9b82c2348c

src/onlyfansapi/resources/stories/stories.py

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Iterable, Optional
66

77
import httpx
88

@@ -70,6 +70,10 @@ def create(
7070
account: str,
7171
*,
7272
media_files: SequenceNotStr[str],
73+
canvas_height: int | Omit = omit,
74+
canvas_width: int | Omit = omit,
75+
question: story_create_params.Question | Omit = omit,
76+
texts: Iterable[story_create_params.Text] | Omit = omit,
7377
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7478
# The extra values given here take precedence over values defined on the client or passed to this method.
7579
extra_headers: Headers | None = None,
@@ -78,11 +82,20 @@ def create(
7882
timeout: float | httpx.Timeout | None | NotGiven = not_given,
7983
) -> StoryCreateResponse:
8084
"""
81-
Post a new media or vault file to your story.
85+
Post a new media or vault file to your story, optionally with text overlays,
86+
@mentions, and a question sticker. Overlay elements are rendered by OnlyFans on
87+
top of your story media at view time.
8288
8389
Args:
84-
media_files: Array of media file upload prefixed_ids, or OF media IDs (required if price is
85-
not 0).
90+
media_files: Array of media file upload prefixed_ids, or OF vault media IDs.
91+
92+
canvas_height: Canvas height overlay positions are relative to. Default `1920`.
93+
94+
canvas_width: Canvas width overlay positions are relative to. Default `1080`.
95+
96+
question: Interactive question sticker viewers can answer.
97+
98+
texts: Text and @mention overlays.
8699
87100
extra_headers: Send extra headers
88101
@@ -96,7 +109,16 @@ def create(
96109
raise ValueError(f"Expected a non-empty value for `account` but received {account!r}")
97110
return self._post(
98111
path_template("/api/{account}/stories", account=account),
99-
body=maybe_transform({"media_files": media_files}, story_create_params.StoryCreateParams),
112+
body=maybe_transform(
113+
{
114+
"media_files": media_files,
115+
"canvas_height": canvas_height,
116+
"canvas_width": canvas_width,
117+
"question": question,
118+
"texts": texts,
119+
},
120+
story_create_params.StoryCreateParams,
121+
),
100122
options=make_request_options(
101123
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
102124
),
@@ -405,6 +427,10 @@ async def create(
405427
account: str,
406428
*,
407429
media_files: SequenceNotStr[str],
430+
canvas_height: int | Omit = omit,
431+
canvas_width: int | Omit = omit,
432+
question: story_create_params.Question | Omit = omit,
433+
texts: Iterable[story_create_params.Text] | Omit = omit,
408434
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
409435
# The extra values given here take precedence over values defined on the client or passed to this method.
410436
extra_headers: Headers | None = None,
@@ -413,11 +439,20 @@ async def create(
413439
timeout: float | httpx.Timeout | None | NotGiven = not_given,
414440
) -> StoryCreateResponse:
415441
"""
416-
Post a new media or vault file to your story.
442+
Post a new media or vault file to your story, optionally with text overlays,
443+
@mentions, and a question sticker. Overlay elements are rendered by OnlyFans on
444+
top of your story media at view time.
417445
418446
Args:
419-
media_files: Array of media file upload prefixed_ids, or OF media IDs (required if price is
420-
not 0).
447+
media_files: Array of media file upload prefixed_ids, or OF vault media IDs.
448+
449+
canvas_height: Canvas height overlay positions are relative to. Default `1920`.
450+
451+
canvas_width: Canvas width overlay positions are relative to. Default `1080`.
452+
453+
question: Interactive question sticker viewers can answer.
454+
455+
texts: Text and @mention overlays.
421456
422457
extra_headers: Send extra headers
423458
@@ -431,7 +466,16 @@ async def create(
431466
raise ValueError(f"Expected a non-empty value for `account` but received {account!r}")
432467
return await self._post(
433468
path_template("/api/{account}/stories", account=account),
434-
body=await async_maybe_transform({"media_files": media_files}, story_create_params.StoryCreateParams),
469+
body=await async_maybe_transform(
470+
{
471+
"media_files": media_files,
472+
"canvas_height": canvas_height,
473+
"canvas_width": canvas_width,
474+
"question": question,
475+
"texts": texts,
476+
},
477+
story_create_params.StoryCreateParams,
478+
),
435479
options=make_request_options(
436480
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
437481
),

src/onlyfansapi/types/story_create_params.py

Lines changed: 108 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,121 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, Annotated, TypedDict
5+
from typing import Iterable
6+
from typing_extensions import Literal, Required, Annotated, TypedDict
67

78
from .._types import SequenceNotStr
89
from .._utils import PropertyInfo
910

10-
__all__ = ["StoryCreateParams"]
11+
__all__ = ["StoryCreateParams", "Question", "Text"]
1112

1213

1314
class StoryCreateParams(TypedDict, total=False):
1415
media_files: Required[Annotated[SequenceNotStr[str], PropertyInfo(alias="mediaFiles")]]
16+
"""Array of media file upload prefixed_ids, or OF vault media IDs."""
17+
18+
canvas_height: Annotated[int, PropertyInfo(alias="canvasHeight")]
19+
"""Canvas height overlay positions are relative to. Default `1920`."""
20+
21+
canvas_width: Annotated[int, PropertyInfo(alias="canvasWidth")]
22+
"""Canvas width overlay positions are relative to. Default `1080`."""
23+
24+
question: Question
25+
"""Interactive question sticker viewers can answer."""
26+
27+
texts: Iterable[Text]
28+
"""Text and @mention overlays."""
29+
30+
31+
class Question(TypedDict, total=False):
32+
"""Interactive question sticker viewers can answer."""
33+
34+
color: str
35+
"""Sticker accent color (hex). Default `#FF51DC`."""
36+
37+
height: float
38+
"""Sticker height in canvas px. Default `160`."""
39+
40+
left: float
41+
"""Horizontal position as a percentage of the canvas width (0-100). Default `25`."""
42+
43+
text: str
44+
"""The question to ask."""
45+
46+
top: float
47+
"""Vertical position as a percentage of the canvas height (0-100). Default `30`."""
48+
49+
width: float
50+
"""Sticker width in canvas px. Default `257`."""
51+
52+
53+
class Text(TypedDict, total=False):
54+
text: Required[str]
55+
"""The overlay text.
56+
57+
For mentions this must be the `@username` to mention (OnlyFans resolves the user
58+
and adds them to the story's release forms).
59+
"""
60+
61+
angle: float
62+
"""Rotation in degrees. Default `0`."""
63+
64+
bg_color: Annotated[str, PropertyInfo(alias="bgColor")]
65+
"""Background color (hex, `#00000000` = transparent).
66+
67+
Native editor palette: #FFFFFF #000000 #69818C #FF51DC #FF4081 #FA3240 #FF8040
68+
#FCA800 #70CF27 #00C864 #00B1CC #2196F3 #7953F5 #A832BF. Default: transparent
69+
for texts, white for mentions.
1570
"""
16-
Array of media file upload prefixed_ids, or OF media IDs (required if price is
17-
not 0).
71+
72+
color: str
73+
"""Text color (hex).
74+
75+
Defaults to the native editor behavior: white on a colored background, black on
76+
a white background (mentions: OnlyFans blue `#0091EA` on white).
77+
"""
78+
79+
font_family: Annotated[
80+
Literal["Roboto", "PTMono", "ShantellSans", "SofiaSans", "YanoneKaffeesatz", "RubikMedium", "RubikBlack"],
81+
PropertyInfo(alias="fontFamily"),
82+
]
83+
"""Font family.
84+
85+
Families support specific weights only: Roboto (400/500/700), PTMono (400),
86+
ShantellSans (400), SofiaSans (400, renders uppercase), YanoneKaffeesatz (700),
87+
RubikMedium (500), RubikBlack (700). Default `Roboto`. Ignored for mentions
88+
(always Roboto 500).
89+
"""
90+
91+
font_size: Annotated[float, PropertyInfo(alias="fontSize")]
92+
"""Font size in canvas px (8-100). The native editor uses 9-36. Default `20`."""
93+
94+
font_weight: Annotated[Literal[400, 500, 700], PropertyInfo(alias="fontWeight")]
95+
"""Font weight; must match the chosen family (see `fontFamily`)."""
96+
97+
left: float
98+
"""Horizontal position as a percentage of the canvas width (0-100). Default `25`."""
99+
100+
scale: float
101+
"""Scale factor. Default `1`."""
102+
103+
text_align: Annotated[Literal["left", "center", "right"], PropertyInfo(alias="textAlign")]
104+
"""Text alignment. Default `left`."""
105+
106+
text_height: Annotated[float, PropertyInfo(alias="textHeight")]
107+
"""Rendered text box height in canvas px. Estimated automatically when omitted."""
108+
109+
text_width: Annotated[float, PropertyInfo(alias="textWidth")]
110+
"""Rendered text box width in canvas px. Estimated automatically when omitted."""
111+
112+
top: float
113+
"""Vertical position as a percentage of the canvas height (0-100).
114+
115+
Defaults stagger each overlay below the previous one.
18116
"""
117+
118+
type: Literal["text", "mention"]
119+
"""Overlay type. Default `text`."""
120+
121+
z_index: Annotated[int, PropertyInfo(alias="zIndex")]
122+
"""Stacking order. Defaults to placement order."""

src/onlyfansapi/types/story_create_response.py

Lines changed: 118 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
"DataMedia",
1717
"DataMediaFiles",
1818
"DataMediaFilesFull",
19+
"DataQuestion",
20+
"DataQuestionEntity",
21+
"DataQuestionPositions",
22+
"DataReleaseForm",
23+
"DataReleaseFormUser",
24+
"DataText",
1925
]
2026

2127

@@ -97,11 +103,119 @@ class DataMedia(BaseModel):
97103
type: Optional[str] = None
98104

99105

106+
class DataQuestionEntity(BaseModel):
107+
id: Optional[int] = None
108+
109+
created_at: Optional[str] = FieldInfo(alias="createdAt", default=None)
110+
111+
text: Optional[str] = None
112+
113+
114+
class DataQuestionPositions(BaseModel):
115+
angle: Optional[int] = None
116+
117+
color: Optional[str] = None
118+
119+
height: Optional[int] = None
120+
121+
left: Optional[int] = None
122+
123+
top: Optional[int] = None
124+
125+
width: Optional[int] = None
126+
127+
x: Optional[str] = None
128+
129+
y: Optional[str] = None
130+
131+
z_index: Optional[int] = FieldInfo(alias="zIndex", default=None)
132+
133+
134+
class DataQuestion(BaseModel):
135+
entity: Optional[DataQuestionEntity] = None
136+
137+
positions: Optional[DataQuestionPositions] = None
138+
139+
type: Optional[str] = None
140+
141+
142+
class DataReleaseFormUser(BaseModel):
143+
id: Optional[int] = None
144+
145+
avatar: Optional[str] = None
146+
147+
avatar_thumbs: Optional[str] = FieldInfo(alias="avatarThumbs", default=None)
148+
149+
is_from_guest: Optional[bool] = FieldInfo(alias="isFromGuest", default=None)
150+
151+
is_identity_verified: Optional[bool] = FieldInfo(alias="isIdentityVerified", default=None)
152+
153+
iv_status: Optional[str] = FieldInfo(alias="ivStatus", default=None)
154+
155+
name: Optional[str] = None
156+
157+
username: Optional[str] = None
158+
159+
view: Optional[str] = None
160+
161+
162+
class DataReleaseForm(BaseModel):
163+
id: Optional[int] = None
164+
165+
name: Optional[str] = None
166+
167+
partner_source: Optional[str] = FieldInfo(alias="partnerSource", default=None)
168+
169+
type: Optional[str] = None
170+
171+
user: Optional[DataReleaseFormUser] = None
172+
173+
174+
class DataText(BaseModel):
175+
angle: Optional[int] = None
176+
177+
bg_color: Optional[str] = FieldInfo(alias="bgColor", default=None)
178+
179+
color: Optional[str] = None
180+
181+
font_family: Optional[str] = FieldInfo(alias="fontFamily", default=None)
182+
183+
font_size: Optional[str] = FieldInfo(alias="fontSize", default=None)
184+
185+
font_style: Optional[str] = FieldInfo(alias="fontStyle", default=None)
186+
187+
font_weight: Optional[int] = FieldInfo(alias="fontWeight", default=None)
188+
189+
left: Optional[int] = None
190+
191+
scale: Optional[int] = None
192+
193+
text: Optional[str] = None
194+
195+
text_align: Optional[str] = FieldInfo(alias="textAlign", default=None)
196+
197+
text_height: Optional[float] = FieldInfo(alias="textHeight", default=None)
198+
199+
text_width: Optional[int] = FieldInfo(alias="textWidth", default=None)
200+
201+
top: Optional[int] = None
202+
203+
type: Optional[str] = None
204+
205+
users: Optional[List[object]] = None
206+
207+
z_index: Optional[int] = FieldInfo(alias="zIndex", default=None)
208+
209+
100210
class Data(BaseModel):
101211
id: Optional[int] = None
102212

103213
can_delete: Optional[bool] = FieldInfo(alias="canDelete", default=None)
104214

215+
canvas_height: Optional[int] = FieldInfo(alias="canvasHeight", default=None)
216+
217+
canvas_width: Optional[int] = FieldInfo(alias="canvasWidth", default=None)
218+
105219
comments_count: Optional[int] = FieldInfo(alias="commentsCount", default=None)
106220

107221
created_at: Optional[str] = FieldInfo(alias="createdAt", default=None)
@@ -120,9 +234,11 @@ class Data(BaseModel):
120234

121235
media: Optional[List[DataMedia]] = None
122236

123-
question: Optional[str] = None
237+
question: Optional[DataQuestion] = None
238+
239+
release_forms: Optional[List[DataReleaseForm]] = FieldInfo(alias="releaseForms", default=None)
124240

125-
release_forms: Optional[List[object]] = FieldInfo(alias="releaseForms", default=None)
241+
texts: Optional[List[DataText]] = None
126242

127243
tips_amount: Optional[str] = FieldInfo(alias="tipsAmount", default=None)
128244

0 commit comments

Comments
 (0)