Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #268

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 46 additions & 71 deletions api.md

Large diffs are not rendered by default.

41 changes: 22 additions & 19 deletions src/cloudflare/resources/addressing/prefixes/prefixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
make_request_options,
)
from ....types.addressing import (
Prefix,
PrefixGetResponse,
PrefixEditResponse,
PrefixListResponse,
PrefixCreateResponse,
PrefixDeleteResponse,
prefix_edit_params,
prefix_create_params,
Expand Down Expand Up @@ -83,7 +86,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Prefix:
) -> PrefixCreateResponse:
"""
Add a new prefix under the account.

Expand Down Expand Up @@ -123,7 +126,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Prefix], ResultWrapper[Prefix]),
cast_to=cast(Type[PrefixCreateResponse], ResultWrapper[PrefixCreateResponse]),
)

def list(
Expand All @@ -136,7 +139,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Prefix]:
) -> SyncSinglePage[PrefixListResponse]:
"""
List all prefixes owned by the account.

Expand All @@ -155,11 +158,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}/addressing/prefixes",
page=SyncSinglePage[Prefix],
page=SyncSinglePage[PrefixListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Prefix,
model=PrefixListResponse,
)

def delete(
Expand Down Expand Up @@ -225,7 +228,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Prefix:
) -> PrefixEditResponse:
"""
Modify the description for a prefix owned by the account.

Expand Down Expand Up @@ -258,7 +261,7 @@ def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Prefix], ResultWrapper[Prefix]),
cast_to=cast(Type[PrefixEditResponse], ResultWrapper[PrefixEditResponse]),
)

def get(
Expand All @@ -272,7 +275,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Prefix:
) -> PrefixGetResponse:
"""
List a particular prefix owned by the account.

Expand Down Expand Up @@ -302,7 +305,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Prefix], ResultWrapper[Prefix]),
cast_to=cast(Type[PrefixGetResponse], ResultWrapper[PrefixGetResponse]),
)


Expand Down Expand Up @@ -336,7 +339,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Prefix:
) -> PrefixCreateResponse:
"""
Add a new prefix under the account.

Expand Down Expand Up @@ -376,7 +379,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Prefix], ResultWrapper[Prefix]),
cast_to=cast(Type[PrefixCreateResponse], ResultWrapper[PrefixCreateResponse]),
)

def list(
Expand All @@ -389,7 +392,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Prefix, AsyncSinglePage[Prefix]]:
) -> AsyncPaginator[PrefixListResponse, AsyncSinglePage[PrefixListResponse]]:
"""
List all prefixes owned by the account.

Expand All @@ -408,11 +411,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}/addressing/prefixes",
page=AsyncSinglePage[Prefix],
page=AsyncSinglePage[PrefixListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Prefix,
model=PrefixListResponse,
)

async def delete(
Expand Down Expand Up @@ -478,7 +481,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Prefix:
) -> PrefixEditResponse:
"""
Modify the description for a prefix owned by the account.

Expand Down Expand Up @@ -511,7 +514,7 @@ async def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Prefix], ResultWrapper[Prefix]),
cast_to=cast(Type[PrefixEditResponse], ResultWrapper[PrefixEditResponse]),
)

async def get(
Expand All @@ -525,7 +528,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Prefix:
) -> PrefixGetResponse:
"""
List a particular prefix owned by the account.

Expand Down Expand Up @@ -555,7 +558,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Prefix], ResultWrapper[Prefix]),
cast_to=cast(Type[PrefixGetResponse], ResultWrapper[PrefixGetResponse]),
)


Expand Down
49 changes: 29 additions & 20 deletions src/cloudflare/resources/logpush/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@
AsyncPaginator,
make_request_options,
)
from ...types.logpush import JobDeleteResponse, job_create_params, job_delete_params, job_update_params
from ...types.logpush.datasets import Job, OutputOptionsParam
from ...types.logpush import (
JobGetResponse,
JobListResponse,
JobCreateResponse,
JobDeleteResponse,
JobUpdateResponse,
OutputOptionsParam,
job_create_params,
job_delete_params,
job_update_params,
)

__all__ = ["Jobs", "AsyncJobs"]

Expand Down Expand Up @@ -60,7 +69,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Job]:
) -> Optional[JobCreateResponse]:
"""
Creates a new Logpush job for an account or zone.

Expand Down Expand Up @@ -141,7 +150,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[Job]], ResultWrapper[Job]),
cast_to=cast(Type[Optional[JobCreateResponse]], ResultWrapper[JobCreateResponse]),
)

def update(
Expand All @@ -162,7 +171,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Job]:
) -> Optional[JobUpdateResponse]:
"""
Updates a Logpush job.

Expand Down Expand Up @@ -237,7 +246,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[Job]], ResultWrapper[Job]),
cast_to=cast(Type[Optional[JobUpdateResponse]], ResultWrapper[JobUpdateResponse]),
)

def list(
Expand All @@ -251,7 +260,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Optional[Job]]:
) -> SyncSinglePage[Optional[JobListResponse]]:
"""
Lists Logpush jobs for an account or zone.

Expand Down Expand Up @@ -285,11 +294,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs",
page=SyncSinglePage[Optional[Job]],
page=SyncSinglePage[Optional[JobListResponse]],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Job,
model=JobListResponse,
)

def delete(
Expand Down Expand Up @@ -369,7 +378,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Job]:
) -> Optional[JobGetResponse]:
"""
Gets the details of a Logpush job.

Expand Down Expand Up @@ -412,7 +421,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[Job]], ResultWrapper[Job]),
cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]),
)


Expand Down Expand Up @@ -444,7 +453,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Job]:
) -> Optional[JobCreateResponse]:
"""
Creates a new Logpush job for an account or zone.

Expand Down Expand Up @@ -525,7 +534,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[Job]], ResultWrapper[Job]),
cast_to=cast(Type[Optional[JobCreateResponse]], ResultWrapper[JobCreateResponse]),
)

async def update(
Expand All @@ -546,7 +555,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Job]:
) -> Optional[JobUpdateResponse]:
"""
Updates a Logpush job.

Expand Down Expand Up @@ -621,7 +630,7 @@ async def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[Job]], ResultWrapper[Job]),
cast_to=cast(Type[Optional[JobUpdateResponse]], ResultWrapper[JobUpdateResponse]),
)

def list(
Expand All @@ -635,7 +644,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Optional[Job], AsyncSinglePage[Optional[Job]]]:
) -> AsyncPaginator[Optional[JobListResponse], AsyncSinglePage[Optional[JobListResponse]]]:
"""
Lists Logpush jobs for an account or zone.

Expand Down Expand Up @@ -669,11 +678,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs",
page=AsyncSinglePage[Optional[Job]],
page=AsyncSinglePage[Optional[JobListResponse]],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Job,
model=JobListResponse,
)

async def delete(
Expand Down Expand Up @@ -753,7 +762,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[Job]:
) -> Optional[JobGetResponse]:
"""
Gets the details of a Logpush job.

Expand Down Expand Up @@ -796,7 +805,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[Job]], ResultWrapper[Job]),
cast_to=cast(Type[Optional[JobGetResponse]], ResultWrapper[JobGetResponse]),
)


Expand Down
Loading