Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#328)
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 1740e2f commit dff460b
Show file tree
Hide file tree
Showing 18 changed files with 781 additions and 133 deletions.
6 changes: 3 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,7 @@ from cloudflare.types.logpush.datasets import JobGetResponse

Methods:

- <code title="get /{account_or_zone}/{account_or_zone_id}/logpush/datasets/{dataset_id}/jobs">client.logpush.datasets.jobs.<a href="./src/cloudflare/resources/logpush/datasets/jobs.py">get</a>(dataset_id, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/logpush/datasets/job_get_response.py">JobGetResponse</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/logpush/datasets/{dataset_id}/jobs">client.logpush.datasets.jobs.<a href="./src/cloudflare/resources/logpush/datasets/jobs.py">get</a>(dataset_id, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/logpush/datasets/job_get_response.py">Optional</a></code>

## Edge

Expand All @@ -2063,7 +2063,7 @@ from cloudflare.types.logpush import InstantLogpushJob, EdgeGetResponse
Methods:

- <code title="post /zones/{zone_id}/logpush/edge">client.logpush.edge.<a href="./src/cloudflare/resources/logpush/edge.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/logpush/edge_create_params.py">params</a>) -> <a href="./src/cloudflare/types/logpush/instant_logpush_job.py">Optional</a></code>
- <code title="get /zones/{zone_id}/logpush/edge">client.logpush.edge.<a href="./src/cloudflare/resources/logpush/edge.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/logpush/edge_get_response.py">EdgeGetResponse</a></code>
- <code title="get /zones/{zone_id}/logpush/edge">client.logpush.edge.<a href="./src/cloudflare/resources/logpush/edge.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/logpush/edge_get_response.py">Optional</a></code>

## Jobs

Expand All @@ -2078,7 +2078,7 @@ Methods:
- <code title="post /{account_or_zone}/{account_or_zone_id}/logpush/jobs">client.logpush.jobs.<a href="./src/cloudflare/resources/logpush/jobs.py">create</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logpush/job_create_params.py">params</a>) -> <a href="./src/cloudflare/types/logpush/logpush_job.py">Optional</a></code>
- <code title="put /{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}">client.logpush.jobs.<a href="./src/cloudflare/resources/logpush/jobs.py">update</a>(job_id, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logpush/job_update_params.py">params</a>) -> <a href="./src/cloudflare/types/logpush/logpush_job.py">Optional</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/logpush/jobs">client.logpush.jobs.<a href="./src/cloudflare/resources/logpush/jobs.py">list</a>(\*, account_id, zone_id) -> <a href="./src/cloudflare/types/logpush/logpush_job.py">SyncSinglePage[Optional]</a></code>
- <code title="delete /{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}">client.logpush.jobs.<a href="./src/cloudflare/resources/logpush/jobs.py">delete</a>(job_id, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logpush/job_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/logpush/job_delete_response.py">Optional</a></code>
- <code title="delete /{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}">client.logpush.jobs.<a href="./src/cloudflare/resources/logpush/jobs.py">delete</a>(job_id, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/logpush/job_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/logpush/job_delete_response.py">object</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}">client.logpush.jobs.<a href="./src/cloudflare/resources/logpush/jobs.py">get</a>(job_id, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/logpush/logpush_job.py">Optional</a></code>

## Ownership
Expand Down
38 changes: 32 additions & 6 deletions src/cloudflare/resources/hyperdrive/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ def create(
self,
*,
account_id: str,
name: object,
name: str,
origin: ConfigurationParam,
caching: config_create_params.Caching | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -75,6 +76,7 @@ def create(
{
"name": name,
"origin": origin,
"caching": caching,
},
config_create_params.ConfigCreateParams,
),
Expand All @@ -93,8 +95,9 @@ def update(
hyperdrive_id: str,
*,
account_id: str,
name: object,
name: str,
origin: ConfigurationParam,
caching: config_update_params.Caching | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -128,6 +131,7 @@ def update(
{
"name": name,
"origin": origin,
"caching": caching,
},
config_update_params.ConfigUpdateParams,
),
Expand Down Expand Up @@ -231,6 +235,8 @@ def edit(
hyperdrive_id: str,
*,
account_id: str,
caching: config_edit_params.Caching | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
origin: ConfigurationParam | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -263,7 +269,14 @@ def edit(
raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}")
return self._patch(
f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}",
body=maybe_transform({"origin": origin}, config_edit_params.ConfigEditParams),
body=maybe_transform(
{
"caching": caching,
"name": name,
"origin": origin,
},
config_edit_params.ConfigEditParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -332,8 +345,9 @@ async def create(
self,
*,
account_id: str,
name: object,
name: str,
origin: ConfigurationParam,
caching: config_create_params.Caching | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -363,6 +377,7 @@ async def create(
{
"name": name,
"origin": origin,
"caching": caching,
},
config_create_params.ConfigCreateParams,
),
Expand All @@ -381,8 +396,9 @@ async def update(
hyperdrive_id: str,
*,
account_id: str,
name: object,
name: str,
origin: ConfigurationParam,
caching: config_update_params.Caching | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -416,6 +432,7 @@ async def update(
{
"name": name,
"origin": origin,
"caching": caching,
},
config_update_params.ConfigUpdateParams,
),
Expand Down Expand Up @@ -519,6 +536,8 @@ async def edit(
hyperdrive_id: str,
*,
account_id: str,
caching: config_edit_params.Caching | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
origin: ConfigurationParam | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand Down Expand Up @@ -551,7 +570,14 @@ async def edit(
raise ValueError(f"Expected a non-empty value for `hyperdrive_id` but received {hyperdrive_id!r}")
return await self._patch(
f"/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}",
body=await async_maybe_transform({"origin": origin}, config_edit_params.ConfigEditParams),
body=await async_maybe_transform(
{
"caching": caching,
"name": name,
"origin": origin,
},
config_edit_params.ConfigEditParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/logpush/datasets/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> JobGetResponse:
) -> Optional[JobGetResponse]:
"""
Lists Logpush jobs for an account or zone for a dataset.
Expand Down Expand Up @@ -87,7 +87,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]),
cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]),
)


Expand All @@ -112,7 +112,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> JobGetResponse:
) -> Optional[JobGetResponse]:
"""
Lists Logpush jobs for an account or zone for a dataset.
Expand Down Expand Up @@ -154,7 +154,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]),
cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]),
)


Expand Down
8 changes: 4 additions & 4 deletions src/cloudflare/resources/logpush/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> EdgeGetResponse:
) -> Optional[EdgeGetResponse]:
"""
Lists Instant Logs jobs for a zone.
Expand All @@ -131,7 +131,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[EdgeGetResponse], ResultWrapper[EdgeGetResponse]),
cast_to=cast(Type[Optional[EdgeGetResponse]], ResultWrapper[EdgeGetResponse]),
)


Expand Down Expand Up @@ -212,7 +212,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> EdgeGetResponse:
) -> Optional[EdgeGetResponse]:
"""
Lists Instant Logs jobs for a zone.
Expand All @@ -238,7 +238,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[EdgeGetResponse], ResultWrapper[EdgeGetResponse]),
cast_to=cast(Type[Optional[EdgeGetResponse]], ResultWrapper[EdgeGetResponse]),
)


Expand Down
57 changes: 23 additions & 34 deletions src/cloudflare/resources/logpush/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Any, Type, Optional, cast
from typing import Type, Optional, cast
from typing_extensions import Literal

import httpx
Expand All @@ -28,7 +28,6 @@
)
from ...types.logpush import (
LogpushJob,
JobDeleteResponse,
OutputOptionsParam,
job_create_params,
job_delete_params,
Expand Down Expand Up @@ -302,7 +301,7 @@ def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[JobDeleteResponse]:
) -> object:
"""
Deletes a Logpush job.
Expand Down Expand Up @@ -333,22 +332,17 @@ def delete(

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Optional[JobDeleteResponse],
self._delete(
f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}",
body=maybe_transform(body, job_delete_params.JobDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[JobDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return self._delete(
f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}",
body=maybe_transform(body, job_delete_params.JobDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
)

def get(
Expand Down Expand Up @@ -671,7 +665,7 @@ async def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[JobDeleteResponse]:
) -> object:
"""
Deletes a Logpush job.
Expand Down Expand Up @@ -702,22 +696,17 @@ async def delete(

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Optional[JobDeleteResponse],
await self._delete(
f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}",
body=await async_maybe_transform(body, job_delete_params.JobDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[JobDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._delete(
f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs/{job_id}",
body=await async_maybe_transform(body, job_delete_params.JobDeleteParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[object], ResultWrapper[object]),
)

async def get(
Expand Down
Loading

0 comments on commit dff460b

Please sign in to comment.