Skip to content

Commit 4b25769

Browse files
feat(api): api update
1 parent 4386083 commit 4b25769

20 files changed

Lines changed: 533 additions & 349 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1775
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ac18a3d5dcd7820ecac9febb1237496d5e8c47ad800bea3e88a933f071286785.yml
3-
openapi_spec_hash: 633b0a64325e6d8f62e555641c93ea0d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-11f530e0accb1d6d9ee14a3a1fdf9e99ebff98e60ac7f59edbd17aafb11e2007.yml
3+
openapi_spec_hash: 185fb53ac70e4b381c40c7e8d291df98
44
config_hash: 4a37da9893560914a7ac1a75cc01202a

api.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8771,15 +8771,20 @@ Methods:
87718771
Types:
87728772

87738773
```python
8774-
from cloudflare.types.snippets import Snippet, SnippetDeleteResponse
8774+
from cloudflare.types.snippets import (
8775+
SnippetUpdateResponse,
8776+
SnippetListResponse,
8777+
SnippetDeleteResponse,
8778+
SnippetGetResponse,
8779+
)
87758780
```
87768781

87778782
Methods:
87788783

8779-
- <code title="put /zones/{zone_id}/snippets/{snippet_name}">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">update</a>(snippet_name, \*, zone_id, \*\*<a href="src/cloudflare/types/snippets/snippet_update_params.py">params</a>) -> <a href="./src/cloudflare/types/snippets/snippet.py">Optional[Snippet]</a></code>
8780-
- <code title="get /zones/{zone_id}/snippets">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">list</a>(\*, zone_id) -> <a href="./src/cloudflare/types/snippets/snippet.py">SyncSinglePage[Snippet]</a></code>
8781-
- <code title="delete /zones/{zone_id}/snippets/{snippet_name}">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">delete</a>(snippet_name, \*, zone_id) -> <a href="./src/cloudflare/types/snippets/snippet_delete_response.py">SnippetDeleteResponse</a></code>
8782-
- <code title="get /zones/{zone_id}/snippets/{snippet_name}">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">get</a>(snippet_name, \*, zone_id) -> <a href="./src/cloudflare/types/snippets/snippet.py">Optional[Snippet]</a></code>
8784+
- <code title="put /zones/{zone_id}/snippets/{snippet_name}">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">update</a>(snippet_name, \*, zone_id, \*\*<a href="src/cloudflare/types/snippets/snippet_update_params.py">params</a>) -> <a href="./src/cloudflare/types/snippets/snippet_update_response.py">SnippetUpdateResponse</a></code>
8785+
- <code title="get /zones/{zone_id}/snippets">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/snippets/snippet_list_params.py">params</a>) -> <a href="./src/cloudflare/types/snippets/snippet_list_response.py">SyncV4PagePaginationArray[SnippetListResponse]</a></code>
8786+
- <code title="delete /zones/{zone_id}/snippets/{snippet_name}">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">delete</a>(snippet_name, \*, zone_id) -> <a href="./src/cloudflare/types/snippets/snippet_delete_response.py">str</a></code>
8787+
- <code title="get /zones/{zone_id}/snippets/{snippet_name}">client.snippets.<a href="./src/cloudflare/resources/snippets/snippets.py">get</a>(snippet_name, \*, zone_id) -> <a href="./src/cloudflare/types/snippets/snippet_get_response.py">SnippetGetResponse</a></code>
87838788

87848789
## Content
87858790

@@ -8799,7 +8804,7 @@ Methods:
87998804

88008805
- <code title="put /zones/{zone_id}/snippets/snippet_rules">client.snippets.rules.<a href="./src/cloudflare/resources/snippets/rules.py">update</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/snippets/rule_update_params.py">params</a>) -> <a href="./src/cloudflare/types/snippets/rule_update_response.py">SyncSinglePage[RuleUpdateResponse]</a></code>
88018806
- <code title="get /zones/{zone_id}/snippets/snippet_rules">client.snippets.rules.<a href="./src/cloudflare/resources/snippets/rules.py">list</a>(\*, zone_id) -> <a href="./src/cloudflare/types/snippets/rule_list_response.py">SyncSinglePage[RuleListResponse]</a></code>
8802-
- <code title="delete /zones/{zone_id}/snippets/snippet_rules">client.snippets.rules.<a href="./src/cloudflare/resources/snippets/rules.py">delete</a>(\*, zone_id) -> <a href="./src/cloudflare/types/snippets/rule_delete_response.py">RuleDeleteResponse</a></code>
8807+
- <code title="delete /zones/{zone_id}/snippets/snippet_rules">client.snippets.rules.<a href="./src/cloudflare/resources/snippets/rules.py">delete</a>(\*, zone_id) -> <a href="./src/cloudflare/types/snippets/rule_delete_response.py">SyncSinglePage[RuleDeleteResponse]</a></code>
88038808

88048809
# Calls
88058810

src/cloudflare/resources/snippets/content.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def get(
5555
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
5656
) -> BinaryAPIResponse:
5757
"""
58-
Snippet Content
58+
Fetches the content of a snippet belonging to the zone.
5959
6060
Args:
61-
zone_id: Identifier
61+
zone_id: The unique ID of the zone.
6262
63-
snippet_name: Snippet identifying name
63+
snippet_name: The identifying name of the snippet.
6464
6565
extra_headers: Send extra headers
6666
@@ -117,12 +117,12 @@ async def get(
117117
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
118118
) -> AsyncBinaryAPIResponse:
119119
"""
120-
Snippet Content
120+
Fetches the content of a snippet belonging to the zone.
121121
122122
Args:
123-
zone_id: Identifier
123+
zone_id: The unique ID of the zone.
124124
125-
snippet_name: Snippet identifying name
125+
snippet_name: The identifying name of the snippet.
126126
127127
extra_headers: Send extra headers
128128

src/cloudflare/resources/snippets/rules.py

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def update(
5050
self,
5151
*,
5252
zone_id: str,
53-
rules: Iterable[rule_update_params.Rule] | NotGiven = NOT_GIVEN,
53+
body: Iterable[rule_update_params.Body],
5454
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5555
# The extra values given here take precedence over values defined on the client or passed to this method.
5656
extra_headers: Headers | None = None,
@@ -59,12 +59,12 @@ def update(
5959
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
6060
) -> SyncSinglePage[RuleUpdateResponse]:
6161
"""
62-
Put Rules
62+
Updates all snippet rules belonging to the zone.
6363
6464
Args:
65-
zone_id: Identifier
65+
zone_id: The unique ID of the zone.
6666
67-
rules: List of snippet rules
67+
body: A list of snippet rules.
6868
6969
extra_headers: Send extra headers
7070
@@ -79,7 +79,7 @@ def update(
7979
return self._get_api_list(
8080
f"/zones/{zone_id}/snippets/snippet_rules",
8181
page=SyncSinglePage[RuleUpdateResponse],
82-
body=maybe_transform({"rules": rules}, rule_update_params.RuleUpdateParams),
82+
body=maybe_transform(body, Iterable[rule_update_params.Body]),
8383
options=make_request_options(
8484
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
8585
),
@@ -99,10 +99,10 @@ def list(
9999
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
100100
) -> SyncSinglePage[RuleListResponse]:
101101
"""
102-
Rules
102+
Fetches all snippet rules belonging to the zone.
103103
104104
Args:
105-
zone_id: Identifier
105+
zone_id: The unique ID of the zone.
106106
107107
extra_headers: Send extra headers
108108
@@ -133,12 +133,12 @@ def delete(
133133
extra_query: Query | None = None,
134134
extra_body: Body | None = None,
135135
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
136-
) -> RuleDeleteResponse:
136+
) -> SyncSinglePage[RuleDeleteResponse]:
137137
"""
138-
Delete All Rules
138+
Deletes all snippet rules belonging to the zone.
139139
140140
Args:
141-
zone_id: Identifier
141+
zone_id: The unique ID of the zone.
142142
143143
extra_headers: Send extra headers
144144
@@ -150,12 +150,14 @@ def delete(
150150
"""
151151
if not zone_id:
152152
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
153-
return self._delete(
153+
return self._get_api_list(
154154
f"/zones/{zone_id}/snippets/snippet_rules",
155+
page=SyncSinglePage[RuleDeleteResponse],
155156
options=make_request_options(
156157
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
157158
),
158-
cast_to=RuleDeleteResponse,
159+
model=RuleDeleteResponse,
160+
method="delete",
159161
)
160162

161163

@@ -183,7 +185,7 @@ def update(
183185
self,
184186
*,
185187
zone_id: str,
186-
rules: Iterable[rule_update_params.Rule] | NotGiven = NOT_GIVEN,
188+
body: Iterable[rule_update_params.Body],
187189
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
188190
# The extra values given here take precedence over values defined on the client or passed to this method.
189191
extra_headers: Headers | None = None,
@@ -192,12 +194,12 @@ def update(
192194
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
193195
) -> AsyncPaginator[RuleUpdateResponse, AsyncSinglePage[RuleUpdateResponse]]:
194196
"""
195-
Put Rules
197+
Updates all snippet rules belonging to the zone.
196198
197199
Args:
198-
zone_id: Identifier
200+
zone_id: The unique ID of the zone.
199201
200-
rules: List of snippet rules
202+
body: A list of snippet rules.
201203
202204
extra_headers: Send extra headers
203205
@@ -212,7 +214,7 @@ def update(
212214
return self._get_api_list(
213215
f"/zones/{zone_id}/snippets/snippet_rules",
214216
page=AsyncSinglePage[RuleUpdateResponse],
215-
body=maybe_transform({"rules": rules}, rule_update_params.RuleUpdateParams),
217+
body=maybe_transform(body, Iterable[rule_update_params.Body]),
216218
options=make_request_options(
217219
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
218220
),
@@ -232,10 +234,10 @@ def list(
232234
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
233235
) -> AsyncPaginator[RuleListResponse, AsyncSinglePage[RuleListResponse]]:
234236
"""
235-
Rules
237+
Fetches all snippet rules belonging to the zone.
236238
237239
Args:
238-
zone_id: Identifier
240+
zone_id: The unique ID of the zone.
239241
240242
extra_headers: Send extra headers
241243
@@ -256,7 +258,7 @@ def list(
256258
model=RuleListResponse,
257259
)
258260

259-
async def delete(
261+
def delete(
260262
self,
261263
*,
262264
zone_id: str,
@@ -266,12 +268,12 @@ async def delete(
266268
extra_query: Query | None = None,
267269
extra_body: Body | None = None,
268270
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
269-
) -> RuleDeleteResponse:
271+
) -> AsyncPaginator[RuleDeleteResponse, AsyncSinglePage[RuleDeleteResponse]]:
270272
"""
271-
Delete All Rules
273+
Deletes all snippet rules belonging to the zone.
272274
273275
Args:
274-
zone_id: Identifier
276+
zone_id: The unique ID of the zone.
275277
276278
extra_headers: Send extra headers
277279
@@ -283,12 +285,14 @@ async def delete(
283285
"""
284286
if not zone_id:
285287
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
286-
return await self._delete(
288+
return self._get_api_list(
287289
f"/zones/{zone_id}/snippets/snippet_rules",
290+
page=AsyncSinglePage[RuleDeleteResponse],
288291
options=make_request_options(
289292
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
290293
),
291-
cast_to=RuleDeleteResponse,
294+
model=RuleDeleteResponse,
295+
method="delete",
292296
)
293297

294298

0 commit comments

Comments
 (0)