Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#343)
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 91dbab3 commit ac1e643
Show file tree
Hide file tree
Showing 41 changed files with 2,944 additions and 365 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 1259
configured_endpoints: 1266
70 changes: 66 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4389,14 +4389,38 @@ Methods:
Types:

```python
from cloudflare.types.stream import Caption, CaptionDeleteResponse, CaptionGetResponse
from cloudflare.types.stream import Caption, CaptionGetResponse
```

Methods:

- <code title="put /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.<a href="./src/cloudflare/resources/stream/captions.py">update</a>(language, \*, account_id, identifier, \*\*<a href="src/cloudflare/types/stream/caption_update_params.py">params</a>) -> <a href="./src/cloudflare/types/stream/caption.py">Optional</a></code>
- <code title="delete /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.<a href="./src/cloudflare/resources/stream/captions.py">delete</a>(language, \*, account_id, identifier, \*\*<a href="src/cloudflare/types/stream/caption_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/stream/caption_delete_response.py">str</a></code>
- <code title="get /accounts/{account_id}/stream/{identifier}/captions">client.stream.captions.<a href="./src/cloudflare/resources/stream/captions.py">get</a>(identifier, \*, account_id) -> <a href="./src/cloudflare/types/stream/caption_get_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/stream/{identifier}/captions">client.stream.captions.<a href="./src/cloudflare/resources/stream/captions/captions.py">get</a>(identifier, \*, account_id) -> <a href="./src/cloudflare/types/stream/caption_get_response.py">Optional</a></code>

### Language

Types:

```python
from cloudflare.types.stream.captions import LanguageDeleteResponse
```

Methods:

- <code title="put /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.language.<a href="./src/cloudflare/resources/stream/captions/language/language.py">update</a>(language, \*, account_id, identifier, \*\*<a href="src/cloudflare/types/stream/captions/language_update_params.py">params</a>) -> <a href="./src/cloudflare/types/stream/caption.py">Optional</a></code>
- <code title="delete /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.language.<a href="./src/cloudflare/resources/stream/captions/language/language.py">delete</a>(language, \*, account_id, identifier, \*\*<a href="src/cloudflare/types/stream/captions/language_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/stream/captions/language_delete_response.py">str</a></code>
- <code title="get /accounts/{account_id}/stream/{identifier}/captions/{language}">client.stream.captions.language.<a href="./src/cloudflare/resources/stream/captions/language/language.py">get</a>(language, \*, account_id, identifier) -> <a href="./src/cloudflare/types/stream/caption.py">Optional</a></code>

#### Vtt

Types:

```python
from cloudflare.types.stream.captions.language import VttGetResponse
```

Methods:

- <code title="get /accounts/{account_id}/stream/{identifier}/captions/{language}/vtt">client.stream.captions.language.vtt.<a href="./src/cloudflare/resources/stream/captions/language/vtt.py">get</a>(language, \*, account_id, identifier, \*\*<a href="src/cloudflare/types/stream/captions/language/vtt_get_params.py">params</a>) -> str</code>

## Downloads

Expand Down Expand Up @@ -5920,6 +5944,44 @@ Methods:
- <code title="delete /accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}">client.zero_trust.networks.virtual_networks.<a href="./src/cloudflare/resources/zero_trust/networks/virtual_networks.py">delete</a>(virtual_network_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/networks/virtual_network_delete_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/networks/virtual_network_delete_response.py">VirtualNetworkDeleteResponse</a></code>
- <code title="patch /accounts/{account_id}/teamnet/virtual_networks/{virtual_network_id}">client.zero_trust.networks.virtual_networks.<a href="./src/cloudflare/resources/zero_trust/networks/virtual_networks.py">edit</a>(virtual_network_id, \*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/networks/virtual_network_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/networks/virtual_network_edit_response.py">VirtualNetworkEditResponse</a></code>

## RiskScoring

Types:

```python
from cloudflare.types.zero_trust import RiskScoringGetResponse, RiskScoringResetResponse
```

Methods:

- <code title="get /accounts/{account_identifier}/zt_risk_scoring/{user_id}">client.zero_trust.risk_scoring.<a href="./src/cloudflare/resources/zero_trust/risk_scoring/risk_scoring.py">get</a>(user_id, \*, account_identifier, \*\*<a href="src/cloudflare/types/zero_trust/risk_scoring_get_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/risk_scoring_get_response.py">RiskScoringGetResponse</a></code>
- <code title="post /accounts/{account_identifier}/zt_risk_scoring/{user_id}/reset">client.zero_trust.risk_scoring.<a href="./src/cloudflare/resources/zero_trust/risk_scoring/risk_scoring.py">reset</a>(user_id, \*, account_identifier) -> <a href="./src/cloudflare/types/zero_trust/risk_scoring_reset_response.py">RiskScoringResetResponse</a></code>

### Behaviours

Types:

```python
from cloudflare.types.zero_trust.risk_scoring import BehaviourUpdateResponse, BehaviourGetResponse
```

Methods:

- <code title="put /accounts/{account_identifier}/zt_risk_scoring/behaviors">client.zero_trust.risk_scoring.behaviours.<a href="./src/cloudflare/resources/zero_trust/risk_scoring/behaviours.py">update</a>(account_identifier, \*\*<a href="src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/risk_scoring/behaviour_update_response.py">BehaviourUpdateResponse</a></code>
- <code title="get /accounts/{account_identifier}/zt_risk_scoring/behaviors">client.zero_trust.risk_scoring.behaviours.<a href="./src/cloudflare/resources/zero_trust/risk_scoring/behaviours.py">get</a>(account_identifier) -> <a href="./src/cloudflare/types/zero_trust/risk_scoring/behaviour_get_response.py">BehaviourGetResponse</a></code>

### Summary

Types:

```python
from cloudflare.types.zero_trust.risk_scoring import SummaryGetResponse
```

Methods:

- <code title="get /accounts/{account_identifier}/zt_risk_scoring/summary">client.zero_trust.risk_scoring.summary.<a href="./src/cloudflare/resources/zero_trust/risk_scoring/summary.py">get</a>(account_identifier, \*\*<a href="src/cloudflare/types/zero_trust/risk_scoring/summary_get_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/risk_scoring/summary_get_response.py">SummaryGetResponse</a></code>

# Challenges

## Widgets
Expand Down
33 changes: 33 additions & 0 deletions src/cloudflare/resources/stream/captions/__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 .captions import (
Captions,
AsyncCaptions,
CaptionsWithRawResponse,
AsyncCaptionsWithRawResponse,
CaptionsWithStreamingResponse,
AsyncCaptionsWithStreamingResponse,
)
from .language import (
Language,
AsyncLanguage,
LanguageWithRawResponse,
AsyncLanguageWithRawResponse,
LanguageWithStreamingResponse,
AsyncLanguageWithStreamingResponse,
)

__all__ = [
"Language",
"AsyncLanguage",
"LanguageWithRawResponse",
"AsyncLanguageWithRawResponse",
"LanguageWithStreamingResponse",
"AsyncLanguageWithStreamingResponse",
"Captions",
"AsyncCaptions",
"CaptionsWithRawResponse",
"AsyncCaptionsWithRawResponse",
"CaptionsWithStreamingResponse",
"AsyncCaptionsWithStreamingResponse",
]
201 changes: 201 additions & 0 deletions src/cloudflare/resources/stream/captions/captions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Type, Optional, cast

import httpx

from .language import (
Language,
AsyncLanguage,
LanguageWithRawResponse,
AsyncLanguageWithRawResponse,
LanguageWithStreamingResponse,
AsyncLanguageWithStreamingResponse,
)
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ...._wrappers import ResultWrapper
from ...._base_client import (
make_request_options,
)
from ....types.stream import CaptionGetResponse
from .language.language import Language, AsyncLanguage

__all__ = ["Captions", "AsyncCaptions"]


class Captions(SyncAPIResource):
@cached_property
def language(self) -> Language:
return Language(self._client)

@cached_property
def with_raw_response(self) -> CaptionsWithRawResponse:
return CaptionsWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> CaptionsWithStreamingResponse:
return CaptionsWithStreamingResponse(self)

def get(
self,
identifier: str,
*,
account_id: str,
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[CaptionGetResponse]:
"""
Lists the available captions or subtitles for a specific video.
Args:
account_id: Identifier
identifier: A Cloudflare-generated unique identifier for a media item.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not identifier:
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
return self._get(
f"/accounts/{account_id}/stream/{identifier}/captions",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[CaptionGetResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[CaptionGetResponse]], ResultWrapper[CaptionGetResponse]),
)


class AsyncCaptions(AsyncAPIResource):
@cached_property
def language(self) -> AsyncLanguage:
return AsyncLanguage(self._client)

@cached_property
def with_raw_response(self) -> AsyncCaptionsWithRawResponse:
return AsyncCaptionsWithRawResponse(self)

@cached_property
def with_streaming_response(self) -> AsyncCaptionsWithStreamingResponse:
return AsyncCaptionsWithStreamingResponse(self)

async def get(
self,
identifier: str,
*,
account_id: str,
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[CaptionGetResponse]:
"""
Lists the available captions or subtitles for a specific video.
Args:
account_id: Identifier
identifier: A Cloudflare-generated unique identifier for a media item.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not identifier:
raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}")
return await self._get(
f"/accounts/{account_id}/stream/{identifier}/captions",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[CaptionGetResponse]]._unwrapper,
),
cast_to=cast(Type[Optional[CaptionGetResponse]], ResultWrapper[CaptionGetResponse]),
)


class CaptionsWithRawResponse:
def __init__(self, captions: Captions) -> None:
self._captions = captions

self.get = to_raw_response_wrapper(
captions.get,
)

@cached_property
def language(self) -> LanguageWithRawResponse:
return LanguageWithRawResponse(self._captions.language)


class AsyncCaptionsWithRawResponse:
def __init__(self, captions: AsyncCaptions) -> None:
self._captions = captions

self.get = async_to_raw_response_wrapper(
captions.get,
)

@cached_property
def language(self) -> AsyncLanguageWithRawResponse:
return AsyncLanguageWithRawResponse(self._captions.language)


class CaptionsWithStreamingResponse:
def __init__(self, captions: Captions) -> None:
self._captions = captions

self.get = to_streamed_response_wrapper(
captions.get,
)

@cached_property
def language(self) -> LanguageWithStreamingResponse:
return LanguageWithStreamingResponse(self._captions.language)


class AsyncCaptionsWithStreamingResponse:
def __init__(self, captions: AsyncCaptions) -> None:
self._captions = captions

self.get = async_to_streamed_response_wrapper(
captions.get,
)

@cached_property
def language(self) -> AsyncLanguageWithStreamingResponse:
return AsyncLanguageWithStreamingResponse(self._captions.language)
33 changes: 33 additions & 0 deletions src/cloudflare/resources/stream/captions/language/__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 .vtt import (
Vtt,
AsyncVtt,
VttWithRawResponse,
AsyncVttWithRawResponse,
VttWithStreamingResponse,
AsyncVttWithStreamingResponse,
)
from .language import (
Language,
AsyncLanguage,
LanguageWithRawResponse,
AsyncLanguageWithRawResponse,
LanguageWithStreamingResponse,
AsyncLanguageWithStreamingResponse,
)

__all__ = [
"Vtt",
"AsyncVtt",
"VttWithRawResponse",
"AsyncVttWithRawResponse",
"VttWithStreamingResponse",
"AsyncVttWithStreamingResponse",
"Language",
"AsyncLanguage",
"LanguageWithRawResponse",
"AsyncLanguageWithRawResponse",
"LanguageWithStreamingResponse",
"AsyncLanguageWithStreamingResponse",
]
Loading

0 comments on commit ac1e643

Please sign in to comment.