Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent f3e3ce8 commit 192ef64
Show file tree
Hide file tree
Showing 23 changed files with 847 additions and 128 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1250
configured_endpoints: 1251
26 changes: 10 additions & 16 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2900,26 +2900,16 @@ Methods:
Types:

```python
from cloudflare.types import (
Queue,
QueueCreated,
QueueSettings,
QueueUpdated,
QueueCreateResponse,
QueueUpdateResponse,
QueueListResponse,
QueueDeleteResponse,
QueueGetResponse,
)
from cloudflare.types import Queue, QueueCreated, QueueUpdated, QueueDeleteResponse
```

Methods:

- <code title="post /accounts/{account_id}/queues">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/queue_create_params.py">params</a>) -> <a href="./src/cloudflare/types/queue_create_response.py">Optional</a></code>
- <code title="put /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">update</a>(queue_id, \*, account_id, \*\*<a href="src/cloudflare/types/queue_update_params.py">params</a>) -> <a href="./src/cloudflare/types/queue_update_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/queues">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/queue_list_response.py">SyncSinglePage[QueueListResponse]</a></code>
- <code title="post /accounts/{account_id}/queues">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/queue_create_params.py">params</a>) -> <a href="./src/cloudflare/types/queue_created.py">Optional</a></code>
- <code title="put /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">update</a>(queue_id, \*, account_id, \*\*<a href="src/cloudflare/types/queue_update_params.py">params</a>) -> <a href="./src/cloudflare/types/queue_updated.py">Optional</a></code>
- <code title="get /accounts/{account_id}/queues">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/queue.py">SyncSinglePage[Queue]</a></code>
- <code title="delete /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">delete</a>(queue_id, \*, account_id, \*\*<a href="src/cloudflare/types/queue_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/queue_delete_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">get</a>(queue_id, \*, account_id) -> <a href="./src/cloudflare/types/queue_get_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">get</a>(queue_id, \*, account_id) -> <a href="./src/cloudflare/types/queue.py">Optional</a></code>

## Consumers

Expand Down Expand Up @@ -4174,9 +4164,13 @@ Methods:
Types:

```python
from cloudflare.types.request_tracers import Trace, TraceItem
from cloudflare.types.request_tracers import Trace, TraceItem, TraceCreateResponse
```

Methods:

- <code title="post /accounts/{account_id}/request-tracer/trace">client.request_tracers.traces.<a href="./src/cloudflare/resources/request_tracers/traces.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/request_tracers/trace_create_params.py">params</a>) -> <a href="./src/cloudflare/types/request_tracers/trace_create_response.py">TraceCreateResponse</a></code>

# Rules

## Lists
Expand Down
8 changes: 8 additions & 0 deletions src/cloudflare/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class Cloudflare(SyncAPIClient):
pages: resources.Pages
pcaps: resources.PCAPs
registrar: resources.Registrar
request_tracers: resources.RequestTracers
rules: resources.Rules
storage: resources.Storage
stream: resources.Stream
Expand Down Expand Up @@ -257,6 +258,7 @@ def __init__(
self.pages = resources.Pages(self)
self.pcaps = resources.PCAPs(self)
self.registrar = resources.Registrar(self)
self.request_tracers = resources.RequestTracers(self)
self.rules = resources.Rules(self)
self.storage = resources.Storage(self)
self.stream = resources.Stream(self)
Expand Down Expand Up @@ -514,6 +516,7 @@ class AsyncCloudflare(AsyncAPIClient):
pages: resources.AsyncPages
pcaps: resources.AsyncPCAPs
registrar: resources.AsyncRegistrar
request_tracers: resources.AsyncRequestTracers
rules: resources.AsyncRules
storage: resources.AsyncStorage
stream: resources.AsyncStream
Expand Down Expand Up @@ -668,6 +671,7 @@ def __init__(
self.pages = resources.AsyncPages(self)
self.pcaps = resources.AsyncPCAPs(self)
self.registrar = resources.AsyncRegistrar(self)
self.request_tracers = resources.AsyncRequestTracers(self)
self.rules = resources.AsyncRules(self)
self.storage = resources.AsyncStorage(self)
self.stream = resources.AsyncStream(self)
Expand Down Expand Up @@ -926,6 +930,7 @@ def __init__(self, client: Cloudflare) -> None:
self.pages = resources.PagesWithRawResponse(client.pages)
self.pcaps = resources.PCAPsWithRawResponse(client.pcaps)
self.registrar = resources.RegistrarWithRawResponse(client.registrar)
self.request_tracers = resources.RequestTracersWithRawResponse(client.request_tracers)
self.rules = resources.RulesWithRawResponse(client.rules)
self.storage = resources.StorageWithRawResponse(client.storage)
self.stream = resources.StreamWithRawResponse(client.stream)
Expand Down Expand Up @@ -1015,6 +1020,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.pages = resources.AsyncPagesWithRawResponse(client.pages)
self.pcaps = resources.AsyncPCAPsWithRawResponse(client.pcaps)
self.registrar = resources.AsyncRegistrarWithRawResponse(client.registrar)
self.request_tracers = resources.AsyncRequestTracersWithRawResponse(client.request_tracers)
self.rules = resources.AsyncRulesWithRawResponse(client.rules)
self.storage = resources.AsyncStorageWithRawResponse(client.storage)
self.stream = resources.AsyncStreamWithRawResponse(client.stream)
Expand Down Expand Up @@ -1104,6 +1110,7 @@ def __init__(self, client: Cloudflare) -> None:
self.pages = resources.PagesWithStreamingResponse(client.pages)
self.pcaps = resources.PCAPsWithStreamingResponse(client.pcaps)
self.registrar = resources.RegistrarWithStreamingResponse(client.registrar)
self.request_tracers = resources.RequestTracersWithStreamingResponse(client.request_tracers)
self.rules = resources.RulesWithStreamingResponse(client.rules)
self.storage = resources.StorageWithStreamingResponse(client.storage)
self.stream = resources.StreamWithStreamingResponse(client.stream)
Expand Down Expand Up @@ -1197,6 +1204,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.pages = resources.AsyncPagesWithStreamingResponse(client.pages)
self.pcaps = resources.AsyncPCAPsWithStreamingResponse(client.pcaps)
self.registrar = resources.AsyncRegistrarWithStreamingResponse(client.registrar)
self.request_tracers = resources.AsyncRequestTracersWithStreamingResponse(client.request_tracers)
self.rules = resources.AsyncRulesWithStreamingResponse(client.rules)
self.storage = resources.AsyncStorageWithStreamingResponse(client.storage)
self.stream = resources.AsyncStreamWithStreamingResponse(client.stream)
Expand Down
14 changes: 14 additions & 0 deletions src/cloudflare/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,14 @@
ManagedHeadersWithStreamingResponse,
AsyncManagedHeadersWithStreamingResponse,
)
from .request_tracers import (
RequestTracers,
AsyncRequestTracers,
RequestTracersWithRawResponse,
AsyncRequestTracersWithRawResponse,
RequestTracersWithStreamingResponse,
AsyncRequestTracersWithStreamingResponse,
)
from .brand_protection import (
BrandProtection,
AsyncBrandProtection,
Expand Down Expand Up @@ -970,6 +978,12 @@
"AsyncRegistrarWithRawResponse",
"RegistrarWithStreamingResponse",
"AsyncRegistrarWithStreamingResponse",
"RequestTracers",
"AsyncRequestTracers",
"RequestTracersWithRawResponse",
"AsyncRequestTracersWithRawResponse",
"RequestTracersWithStreamingResponse",
"AsyncRequestTracersWithStreamingResponse",
"Rules",
"AsyncRules",
"RulesWithRawResponse",
Expand Down
43 changes: 21 additions & 22 deletions src/cloudflare/resources/queues/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
import httpx

from ...types import (
QueueGetResponse,
QueueListResponse,
QueueCreateResponse,
Queue,
QueueCreated,
QueueUpdated,
QueueDeleteResponse,
QueueUpdateResponse,
queue_create_params,
queue_delete_params,
queue_update_params,
Expand Down Expand Up @@ -83,7 +82,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[QueueCreateResponse]:
) -> Optional[QueueCreated]:
"""
Creates a new queue.
Expand All @@ -110,7 +109,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[QueueCreateResponse]], ResultWrapper[QueueCreateResponse]),
cast_to=cast(Type[Optional[QueueCreated]], ResultWrapper[QueueCreated]),
)

def update(
Expand All @@ -125,7 +124,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[QueueUpdateResponse]:
) -> Optional[QueueUpdated]:
"""
Updates a queue.
Expand Down Expand Up @@ -156,7 +155,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]),
cast_to=cast(Type[Optional[QueueUpdated]], ResultWrapper[QueueUpdated]),
)

def list(
Expand All @@ -169,7 +168,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[QueueListResponse]:
) -> SyncSinglePage[Queue]:
"""
Returns the queues owned by an account.
Expand All @@ -188,11 +187,11 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/queues",
page=SyncSinglePage[QueueListResponse],
page=SyncSinglePage[Queue],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=QueueListResponse,
model=Queue,
)

def delete(
Expand Down Expand Up @@ -257,7 +256,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[QueueGetResponse]:
) -> Optional[Queue]:
"""
Get information about a specific queue.
Expand Down Expand Up @@ -287,7 +286,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[QueueGetResponse]], ResultWrapper[QueueGetResponse]),
cast_to=cast(Type[Optional[Queue]], ResultWrapper[Queue]),
)


Expand Down Expand Up @@ -319,7 +318,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[QueueCreateResponse]:
) -> Optional[QueueCreated]:
"""
Creates a new queue.
Expand All @@ -346,7 +345,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[QueueCreateResponse]], ResultWrapper[QueueCreateResponse]),
cast_to=cast(Type[Optional[QueueCreated]], ResultWrapper[QueueCreated]),
)

async def update(
Expand All @@ -361,7 +360,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[QueueUpdateResponse]:
) -> Optional[QueueUpdated]:
"""
Updates a queue.
Expand Down Expand Up @@ -392,7 +391,7 @@ async def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]),
cast_to=cast(Type[Optional[QueueUpdated]], ResultWrapper[QueueUpdated]),
)

def list(
Expand All @@ -405,7 +404,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[QueueListResponse, AsyncSinglePage[QueueListResponse]]:
) -> AsyncPaginator[Queue, AsyncSinglePage[Queue]]:
"""
Returns the queues owned by an account.
Expand All @@ -424,11 +423,11 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/queues",
page=AsyncSinglePage[QueueListResponse],
page=AsyncSinglePage[Queue],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=QueueListResponse,
model=Queue,
)

async def delete(
Expand Down Expand Up @@ -493,7 +492,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[QueueGetResponse]:
) -> Optional[Queue]:
"""
Get information about a specific queue.
Expand Down Expand Up @@ -523,7 +522,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[QueueGetResponse]], ResultWrapper[QueueGetResponse]),
cast_to=cast(Type[Optional[Queue]], ResultWrapper[Queue]),
)


Expand Down
33 changes: 33 additions & 0 deletions src/cloudflare/resources/request_tracers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .traces import (
Traces,
AsyncTraces,
TracesWithRawResponse,
AsyncTracesWithRawResponse,
TracesWithStreamingResponse,
AsyncTracesWithStreamingResponse,
)
from .request_tracers import (
RequestTracers,
AsyncRequestTracers,
RequestTracersWithRawResponse,
AsyncRequestTracersWithRawResponse,
RequestTracersWithStreamingResponse,
AsyncRequestTracersWithStreamingResponse,
)

__all__ = [
"Traces",
"AsyncTraces",
"TracesWithRawResponse",
"AsyncTracesWithRawResponse",
"TracesWithStreamingResponse",
"AsyncTracesWithStreamingResponse",
"RequestTracers",
"AsyncRequestTracers",
"RequestTracersWithRawResponse",
"AsyncRequestTracersWithRawResponse",
"RequestTracersWithStreamingResponse",
"AsyncRequestTracersWithStreamingResponse",
]
Loading

0 comments on commit 192ef64

Please sign in to comment.