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 #726

Merged
merged 1 commit into from
May 31, 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
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1321
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-15197dfa1bffc0cc6e86526b7f3b95282aa7af4a5ea87406312e87f0586d2dfa.yml
configured_endpoints: 1274
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-14c9c9adbd65eee546c4f54d95b7627f10b02185348e334a68cbebbe3442733e.yml
182 changes: 24 additions & 158 deletions api.md

Large diffs are not rendered by default.

76 changes: 29 additions & 47 deletions src/cloudflare/resources/cloudforce_one/requests/message.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, Union, cast
from typing import Type, Union, Optional, cast
from datetime import datetime
from typing_extensions import Literal

Expand Down Expand Up @@ -54,7 +54,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Message:
) -> Optional[Message]:
"""
Creating a request adds the request into the Cloudforce One queue for analysis.
In addition to the content, a short title, type, priority, and releasability
Expand Down Expand Up @@ -87,9 +87,9 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Message]._unwrapper,
post_parser=ResultWrapper[Optional[Message]]._unwrapper,
),
cast_to=cast(Type[Message], ResultWrapper[Message]),
cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]),
)

def update(
Expand All @@ -109,7 +109,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Message:
) -> Optional[Message]:
"""
Update a Request Message

Expand Down Expand Up @@ -157,9 +157,9 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Message]._unwrapper,
post_parser=ResultWrapper[Optional[Message]]._unwrapper,
),
cast_to=cast(Type[Message], ResultWrapper[Message]),
cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]),
)

def delete(
Expand Down Expand Up @@ -195,21 +195,12 @@ def delete(
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
if not request_identifier:
raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}")
return cast(
MessageDeleteResponse,
self._delete(
f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[MessageDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return self._delete(
f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=MessageDeleteResponse,
)

def get(
Expand All @@ -229,7 +220,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> MessageGetResponse:
) -> Optional[MessageGetResponse]:
"""
List Request Messages

Expand Down Expand Up @@ -280,9 +271,9 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[MessageGetResponse]._unwrapper,
post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper,
),
cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]),
cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]),
)


Expand All @@ -307,7 +298,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Message:
) -> Optional[Message]:
"""
Creating a request adds the request into the Cloudforce One queue for analysis.
In addition to the content, a short title, type, priority, and releasability
Expand Down Expand Up @@ -340,9 +331,9 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Message]._unwrapper,
post_parser=ResultWrapper[Optional[Message]]._unwrapper,
),
cast_to=cast(Type[Message], ResultWrapper[Message]),
cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]),
)

async def update(
Expand All @@ -362,7 +353,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Message:
) -> Optional[Message]:
"""
Update a Request Message

Expand Down Expand Up @@ -410,9 +401,9 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Message]._unwrapper,
post_parser=ResultWrapper[Optional[Message]]._unwrapper,
),
cast_to=cast(Type[Message], ResultWrapper[Message]),
cast_to=cast(Type[Optional[Message]], ResultWrapper[Message]),
)

async def delete(
Expand Down Expand Up @@ -448,21 +439,12 @@ async def delete(
raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}")
if not request_identifier:
raise ValueError(f"Expected a non-empty value for `request_identifier` but received {request_identifier!r}")
return cast(
MessageDeleteResponse,
await self._delete(
f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[MessageDeleteResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[MessageDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._delete(
f"/accounts/{account_identifier}/cloudforce-one/requests/{request_identifier}/message/{message_identifer}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=MessageDeleteResponse,
)

async def get(
Expand All @@ -482,7 +464,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> MessageGetResponse:
) -> Optional[MessageGetResponse]:
"""
List Request Messages

Expand Down Expand Up @@ -533,9 +515,9 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[MessageGetResponse]._unwrapper,
post_parser=ResultWrapper[Optional[MessageGetResponse]]._unwrapper,
),
cast_to=cast(Type[MessageGetResponse], ResultWrapper[MessageGetResponse]),
cast_to=cast(Type[Optional[MessageGetResponse]], ResultWrapper[MessageGetResponse]),
)


Expand Down
Loading