Skip to content

Commit 2b072d1

Browse files
feat(api): api update
1 parent f2f2094 commit 2b072d1

20 files changed

Lines changed: 284 additions & 293 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 266
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/onlyfansapi/onlyfansapi-1694e31822508757f6dec4837f9442d42a1eafdf796b6f4ff368c80452050acf.yml
3-
openapi_spec_hash: 19fc90cabcac5a299d832b80e7518648
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/onlyfansapi/onlyfansapi-66432b705e73f5f3a80162c5a91d4f4f3216319c075d1e6491b80e0ec7c3a0bc.yml
3+
openapi_spec_hash: ae75154ff3e4cad180cd49f21f7c3edf
44
config_hash: 397c91e15c0024f8b5bbed9b82c2348c

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,12 @@ Methods:
520520
Types:
521521

522522
```python
523-
from onlyfansapi.types import MediaDownloadResponse, MediaScrapeResponse, MediaUploadResponse
523+
from onlyfansapi.types import MediaScrapeResponse, MediaUploadResponse
524524
```
525525

526526
Methods:
527527

528-
- <code title="get /api/{account}/media/download/{cdnUrl}">client.media.<a href="./src/onlyfansapi/resources/media/media.py">download</a>(cdn_url, \*, account) -> str</code>
528+
- <code title="get /api/{account}/media/download/{cdnUrl}">client.media.<a href="./src/onlyfansapi/resources/media/media.py">download</a>(cdn_url, \*, account) -> None</code>
529529
- <code title="post /api/{account}/media/scrape">client.media.<a href="./src/onlyfansapi/resources/media/media.py">scrape</a>(account, \*\*<a href="src/onlyfansapi/types/media_scrape_params.py">params</a>) -> <a href="./src/onlyfansapi/types/media_scrape_response.py">MediaScrapeResponse</a></code>
530530
- <code title="post /api/{account}/media/upload">client.media.<a href="./src/onlyfansapi/resources/media/media.py">upload</a>(account, \*\*<a href="src/onlyfansapi/types/media_upload_params.py">params</a>) -> <a href="./src/onlyfansapi/types/media_upload_response.py">MediaUploadResponse</a></code>
531531

src/onlyfansapi/resources/media/media.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
AsyncUploadsResourceWithStreamingResponse,
1818
)
1919
from ..._files import deepcopy_with_paths
20-
from ..._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
20+
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes, omit, not_given
2121
from ..._utils import extract_files, path_template, maybe_transform, async_maybe_transform
2222
from ..._compat import cached_property
2323
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -81,14 +81,15 @@ def download(
8181
extra_query: Query | None = None,
8282
extra_body: Body | None = None,
8383
timeout: float | httpx.Timeout | None | NotGiven = not_given,
84-
) -> str:
84+
) -> None:
8585
"""Downloads a file directly from a `https://cdn*.onlyfans.com/*` URL.
8686
8787
When the
8888
file is already cached on our CDN, this endpoint returns a `302` redirect to a
8989
`https://cdn.fansapi.com/*` URL. Most HTTP clients follow redirects
90-
automatically (`curl` requires `-L`). Otherwise, the file is streamed through
91-
our proxies and queued for caching.
90+
automatically (`curl` requires `-L`). Otherwise, the file is redirected to
91+
`dl.fansapi.com`, which streams it through the account proxy and reports billing
92+
back to the API.
9293
9394
Args:
9495
extra_headers: Send extra headers
@@ -103,13 +104,13 @@ def download(
103104
raise ValueError(f"Expected a non-empty value for `account` but received {account!r}")
104105
if not cdn_url:
105106
raise ValueError(f"Expected a non-empty value for `cdn_url` but received {cdn_url!r}")
106-
extra_headers = {"Accept": "text/plain", **(extra_headers or {})}
107+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
107108
return self._get(
108109
path_template("/api/{account}/media/download/{cdn_url}", account=account, cdn_url=cdn_url),
109110
options=make_request_options(
110111
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
111112
),
112-
cast_to=str,
113+
cast_to=NoneType,
113114
)
114115

115116
def scrape(
@@ -285,14 +286,15 @@ async def download(
285286
extra_query: Query | None = None,
286287
extra_body: Body | None = None,
287288
timeout: float | httpx.Timeout | None | NotGiven = not_given,
288-
) -> str:
289+
) -> None:
289290
"""Downloads a file directly from a `https://cdn*.onlyfans.com/*` URL.
290291
291292
When the
292293
file is already cached on our CDN, this endpoint returns a `302` redirect to a
293294
`https://cdn.fansapi.com/*` URL. Most HTTP clients follow redirects
294-
automatically (`curl` requires `-L`). Otherwise, the file is streamed through
295-
our proxies and queued for caching.
295+
automatically (`curl` requires `-L`). Otherwise, the file is redirected to
296+
`dl.fansapi.com`, which streams it through the account proxy and reports billing
297+
back to the API.
296298
297299
Args:
298300
extra_headers: Send extra headers
@@ -307,13 +309,13 @@ async def download(
307309
raise ValueError(f"Expected a non-empty value for `account` but received {account!r}")
308310
if not cdn_url:
309311
raise ValueError(f"Expected a non-empty value for `cdn_url` but received {cdn_url!r}")
310-
extra_headers = {"Accept": "text/plain", **(extra_headers or {})}
312+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
311313
return await self._get(
312314
path_template("/api/{account}/media/download/{cdn_url}", account=account, cdn_url=cdn_url),
313315
options=make_request_options(
314316
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
315317
),
316-
cast_to=str,
318+
cast_to=NoneType,
317319
)
318320

319321
async def scrape(

src/onlyfansapi/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
from .user_retrieve_response import UserRetrieveResponse as UserRetrieveResponse
6767
from .data_export_list_params import DataExportListParams as DataExportListParams
6868
from .fan_list_expired_params import FanListExpiredParams as FanListExpiredParams
69-
from .media_download_response import MediaDownloadResponse as MediaDownloadResponse
7069
from .post_unarchive_response import PostUnarchiveResponse as PostUnarchiveResponse
7170
from .profile_retrieve_params import ProfileRetrieveParams as ProfileRetrieveParams
7271
from .promotion_create_params import PromotionCreateParams as PromotionCreateParams

src/onlyfansapi/types/media_download_response.py

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/api_resources/engagement/test_messages.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TestMessages:
2424
@parametrize
2525
def test_method_get_message_buyers(self, client: OnlyFansAPI) -> None:
2626
message = client.engagement.messages.get_message_buyers(
27-
message_id="cupiditate",
27+
message_id="modi",
2828
account="acct_XXXXXXXXXXXXXXX",
2929
)
3030
assert_matches_type(MessageGetMessageBuyersResponse, message, path=["response"])
@@ -33,7 +33,7 @@ def test_method_get_message_buyers(self, client: OnlyFansAPI) -> None:
3333
@parametrize
3434
def test_method_get_message_buyers_with_all_params(self, client: OnlyFansAPI) -> None:
3535
message = client.engagement.messages.get_message_buyers(
36-
message_id="cupiditate",
36+
message_id="modi",
3737
account="acct_XXXXXXXXXXXXXXX",
3838
limit=10,
3939
marker=0,
@@ -47,7 +47,7 @@ def test_method_get_message_buyers_with_all_params(self, client: OnlyFansAPI) ->
4747
@parametrize
4848
def test_raw_response_get_message_buyers(self, client: OnlyFansAPI) -> None:
4949
response = client.engagement.messages.with_raw_response.get_message_buyers(
50-
message_id="cupiditate",
50+
message_id="modi",
5151
account="acct_XXXXXXXXXXXXXXX",
5252
)
5353

@@ -60,7 +60,7 @@ def test_raw_response_get_message_buyers(self, client: OnlyFansAPI) -> None:
6060
@parametrize
6161
def test_streaming_response_get_message_buyers(self, client: OnlyFansAPI) -> None:
6262
with client.engagement.messages.with_streaming_response.get_message_buyers(
63-
message_id="cupiditate",
63+
message_id="modi",
6464
account="acct_XXXXXXXXXXXXXXX",
6565
) as response:
6666
assert not response.is_closed
@@ -76,7 +76,7 @@ def test_streaming_response_get_message_buyers(self, client: OnlyFansAPI) -> Non
7676
def test_path_params_get_message_buyers(self, client: OnlyFansAPI) -> None:
7777
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account` but received ''"):
7878
client.engagement.messages.with_raw_response.get_message_buyers(
79-
message_id="cupiditate",
79+
message_id="modi",
8080
account="",
8181
)
8282

@@ -148,7 +148,7 @@ class TestAsyncMessages:
148148
@parametrize
149149
async def test_method_get_message_buyers(self, async_client: AsyncOnlyFansAPI) -> None:
150150
message = await async_client.engagement.messages.get_message_buyers(
151-
message_id="cupiditate",
151+
message_id="modi",
152152
account="acct_XXXXXXXXXXXXXXX",
153153
)
154154
assert_matches_type(MessageGetMessageBuyersResponse, message, path=["response"])
@@ -157,7 +157,7 @@ async def test_method_get_message_buyers(self, async_client: AsyncOnlyFansAPI) -
157157
@parametrize
158158
async def test_method_get_message_buyers_with_all_params(self, async_client: AsyncOnlyFansAPI) -> None:
159159
message = await async_client.engagement.messages.get_message_buyers(
160-
message_id="cupiditate",
160+
message_id="modi",
161161
account="acct_XXXXXXXXXXXXXXX",
162162
limit=10,
163163
marker=0,
@@ -171,7 +171,7 @@ async def test_method_get_message_buyers_with_all_params(self, async_client: Asy
171171
@parametrize
172172
async def test_raw_response_get_message_buyers(self, async_client: AsyncOnlyFansAPI) -> None:
173173
response = await async_client.engagement.messages.with_raw_response.get_message_buyers(
174-
message_id="cupiditate",
174+
message_id="modi",
175175
account="acct_XXXXXXXXXXXXXXX",
176176
)
177177

@@ -184,7 +184,7 @@ async def test_raw_response_get_message_buyers(self, async_client: AsyncOnlyFans
184184
@parametrize
185185
async def test_streaming_response_get_message_buyers(self, async_client: AsyncOnlyFansAPI) -> None:
186186
async with async_client.engagement.messages.with_streaming_response.get_message_buyers(
187-
message_id="cupiditate",
187+
message_id="modi",
188188
account="acct_XXXXXXXXXXXXXXX",
189189
) as response:
190190
assert not response.is_closed
@@ -200,7 +200,7 @@ async def test_streaming_response_get_message_buyers(self, async_client: AsyncOn
200200
async def test_path_params_get_message_buyers(self, async_client: AsyncOnlyFansAPI) -> None:
201201
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account` but received ''"):
202202
await async_client.engagement.messages.with_raw_response.get_message_buyers(
203-
message_id="cupiditate",
203+
message_id="modi",
204204
account="",
205205
)
206206

tests/api_resources/media/vault/lists/test_media.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TestMedia:
2424
@parametrize
2525
def test_method_add(self, client: OnlyFansAPI) -> None:
2626
media = client.media.vault.lists.media.add(
27-
list_id="molestiae",
27+
list_id="autem",
2828
account="acct_XXXXXXXXXXXXXXX",
2929
media_ids=["string"],
3030
)
@@ -34,7 +34,7 @@ def test_method_add(self, client: OnlyFansAPI) -> None:
3434
@parametrize
3535
def test_raw_response_add(self, client: OnlyFansAPI) -> None:
3636
response = client.media.vault.lists.media.with_raw_response.add(
37-
list_id="molestiae",
37+
list_id="autem",
3838
account="acct_XXXXXXXXXXXXXXX",
3939
media_ids=["string"],
4040
)
@@ -48,7 +48,7 @@ def test_raw_response_add(self, client: OnlyFansAPI) -> None:
4848
@parametrize
4949
def test_streaming_response_add(self, client: OnlyFansAPI) -> None:
5050
with client.media.vault.lists.media.with_streaming_response.add(
51-
list_id="molestiae",
51+
list_id="autem",
5252
account="acct_XXXXXXXXXXXXXXX",
5353
media_ids=["string"],
5454
) as response:
@@ -65,7 +65,7 @@ def test_streaming_response_add(self, client: OnlyFansAPI) -> None:
6565
def test_path_params_add(self, client: OnlyFansAPI) -> None:
6666
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account` but received ''"):
6767
client.media.vault.lists.media.with_raw_response.add(
68-
list_id="molestiae",
68+
list_id="autem",
6969
account="",
7070
media_ids=["string"],
7171
)
@@ -81,7 +81,7 @@ def test_path_params_add(self, client: OnlyFansAPI) -> None:
8181
@parametrize
8282
def test_method_remove(self, client: OnlyFansAPI) -> None:
8383
media = client.media.vault.lists.media.remove(
84-
list_id="molestiae",
84+
list_id="autem",
8585
account="acct_XXXXXXXXXXXXXXX",
8686
media_ids=["string"],
8787
)
@@ -91,7 +91,7 @@ def test_method_remove(self, client: OnlyFansAPI) -> None:
9191
@parametrize
9292
def test_raw_response_remove(self, client: OnlyFansAPI) -> None:
9393
response = client.media.vault.lists.media.with_raw_response.remove(
94-
list_id="molestiae",
94+
list_id="autem",
9595
account="acct_XXXXXXXXXXXXXXX",
9696
media_ids=["string"],
9797
)
@@ -105,7 +105,7 @@ def test_raw_response_remove(self, client: OnlyFansAPI) -> None:
105105
@parametrize
106106
def test_streaming_response_remove(self, client: OnlyFansAPI) -> None:
107107
with client.media.vault.lists.media.with_streaming_response.remove(
108-
list_id="molestiae",
108+
list_id="autem",
109109
account="acct_XXXXXXXXXXXXXXX",
110110
media_ids=["string"],
111111
) as response:
@@ -122,7 +122,7 @@ def test_streaming_response_remove(self, client: OnlyFansAPI) -> None:
122122
def test_path_params_remove(self, client: OnlyFansAPI) -> None:
123123
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account` but received ''"):
124124
client.media.vault.lists.media.with_raw_response.remove(
125-
list_id="molestiae",
125+
list_id="autem",
126126
account="",
127127
media_ids=["string"],
128128
)
@@ -144,7 +144,7 @@ class TestAsyncMedia:
144144
@parametrize
145145
async def test_method_add(self, async_client: AsyncOnlyFansAPI) -> None:
146146
media = await async_client.media.vault.lists.media.add(
147-
list_id="molestiae",
147+
list_id="autem",
148148
account="acct_XXXXXXXXXXXXXXX",
149149
media_ids=["string"],
150150
)
@@ -154,7 +154,7 @@ async def test_method_add(self, async_client: AsyncOnlyFansAPI) -> None:
154154
@parametrize
155155
async def test_raw_response_add(self, async_client: AsyncOnlyFansAPI) -> None:
156156
response = await async_client.media.vault.lists.media.with_raw_response.add(
157-
list_id="molestiae",
157+
list_id="autem",
158158
account="acct_XXXXXXXXXXXXXXX",
159159
media_ids=["string"],
160160
)
@@ -168,7 +168,7 @@ async def test_raw_response_add(self, async_client: AsyncOnlyFansAPI) -> None:
168168
@parametrize
169169
async def test_streaming_response_add(self, async_client: AsyncOnlyFansAPI) -> None:
170170
async with async_client.media.vault.lists.media.with_streaming_response.add(
171-
list_id="molestiae",
171+
list_id="autem",
172172
account="acct_XXXXXXXXXXXXXXX",
173173
media_ids=["string"],
174174
) as response:
@@ -185,7 +185,7 @@ async def test_streaming_response_add(self, async_client: AsyncOnlyFansAPI) -> N
185185
async def test_path_params_add(self, async_client: AsyncOnlyFansAPI) -> None:
186186
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account` but received ''"):
187187
await async_client.media.vault.lists.media.with_raw_response.add(
188-
list_id="molestiae",
188+
list_id="autem",
189189
account="",
190190
media_ids=["string"],
191191
)
@@ -201,7 +201,7 @@ async def test_path_params_add(self, async_client: AsyncOnlyFansAPI) -> None:
201201
@parametrize
202202
async def test_method_remove(self, async_client: AsyncOnlyFansAPI) -> None:
203203
media = await async_client.media.vault.lists.media.remove(
204-
list_id="molestiae",
204+
list_id="autem",
205205
account="acct_XXXXXXXXXXXXXXX",
206206
media_ids=["string"],
207207
)
@@ -211,7 +211,7 @@ async def test_method_remove(self, async_client: AsyncOnlyFansAPI) -> None:
211211
@parametrize
212212
async def test_raw_response_remove(self, async_client: AsyncOnlyFansAPI) -> None:
213213
response = await async_client.media.vault.lists.media.with_raw_response.remove(
214-
list_id="molestiae",
214+
list_id="autem",
215215
account="acct_XXXXXXXXXXXXXXX",
216216
media_ids=["string"],
217217
)
@@ -225,7 +225,7 @@ async def test_raw_response_remove(self, async_client: AsyncOnlyFansAPI) -> None
225225
@parametrize
226226
async def test_streaming_response_remove(self, async_client: AsyncOnlyFansAPI) -> None:
227227
async with async_client.media.vault.lists.media.with_streaming_response.remove(
228-
list_id="molestiae",
228+
list_id="autem",
229229
account="acct_XXXXXXXXXXXXXXX",
230230
media_ids=["string"],
231231
) as response:
@@ -242,7 +242,7 @@ async def test_streaming_response_remove(self, async_client: AsyncOnlyFansAPI) -
242242
async def test_path_params_remove(self, async_client: AsyncOnlyFansAPI) -> None:
243243
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account` but received ''"):
244244
await async_client.media.vault.lists.media.with_raw_response.remove(
245-
list_id="molestiae",
245+
list_id="autem",
246246
account="",
247247
media_ids=["string"],
248248
)

0 commit comments

Comments
 (0)