Skip to content

Commit

Permalink
chore(internal): codegen related update (#2230)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Nov 29, 2024
1 parent 76992e8 commit be2c6e9
Show file tree
Hide file tree
Showing 19 changed files with 105 additions and 260 deletions.
12 changes: 6 additions & 6 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3078,7 +3078,7 @@ Methods:

- <code title="post /zones/{zone_id}/spectrum/apps">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_create_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_create_response.py">Optional[AppCreateResponse]</a></code>
- <code title="put /zones/{zone_id}/spectrum/apps/{app_id}">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">update</a>(app_id, \*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_update_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_update_response.py">Optional[AppUpdateResponse]</a></code>
- <code title="get /zones/{zone_id}/spectrum/apps">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_list_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_list_response.py">SyncV4PagePaginationArray[AppListResponse]</a></code>
- <code title="get /zones/{zone_id}/spectrum/apps">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/spectrum/app_list_params.py">params</a>) -> <a href="./src/cloudflare/types/spectrum/app_list_response.py">SyncV4PagePaginationArray[Optional[AppListResponse]]</a></code>
- <code title="delete /zones/{zone_id}/spectrum/apps/{app_id}">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">delete</a>(app_id, \*, zone_id) -> <a href="./src/cloudflare/types/spectrum/app_delete_response.py">Optional[AppDeleteResponse]</a></code>
- <code title="get /zones/{zone_id}/spectrum/apps/{app_id}">client.spectrum.apps.<a href="./src/cloudflare/resources/spectrum/apps.py">get</a>(app_id, \*, zone_id) -> <a href="./src/cloudflare/types/spectrum/app_get_response.py">Optional[AppGetResponse]</a></code>

Expand Down Expand Up @@ -3457,12 +3457,12 @@ Methods:
Types:

```python
from cloudflare.types.intel import DNS, DNSListResponse
from cloudflare.types.intel import DNS
```

Methods:

- <code title="get /accounts/{account_id}/intel/dns">client.intel.dns.<a href="./src/cloudflare/resources/intel/dns.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/dns_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/dns_list_response.py">SyncV4PagePagination[DNSListResponse]</a></code>
- <code title="get /accounts/{account_id}/intel/dns">client.intel.dns.<a href="./src/cloudflare/resources/intel/dns.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/dns_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/dns.py">SyncV4PagePagination[Optional[DNS]]</a></code>

## Domains

Expand Down Expand Up @@ -3656,7 +3656,7 @@ from cloudflare.types.intel.attack_surface_report import (

Methods:

- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_list_response.py">SyncV4PagePagination[IssueListResponse]</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_list_response.py">SyncV4PagePagination[Optional[IssueListResponse]]</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/class">client.intel.attack*surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">class*</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_class_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_class_response.py">Optional[IssueClassResponse]</a></code>
- <code title="put /accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">dismiss</a>(issue_id, \*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_dismiss_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_dismiss_response.py">IssueDismissResponse</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/severity">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">severity</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_severity_response.py">Optional[IssueSeverityResponse]</a></code>
Expand Down Expand Up @@ -5662,12 +5662,12 @@ Methods:
Types:

```python
from cloudflare.types.zero_trust.dex import AggregateTimePeriod, Tests, TestListResponse
from cloudflare.types.zero_trust.dex import AggregateTimePeriod, Tests
```

Methods:

- <code title="get /accounts/{account_id}/dex/tests/overview">client.zero_trust.dex.tests.<a href="./src/cloudflare/resources/zero_trust/dex/tests/tests.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dex/test_list_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dex/test_list_response.py">SyncV4PagePagination[TestListResponse]</a></code>
- <code title="get /accounts/{account_id}/dex/tests/overview">client.zero_trust.dex.tests.<a href="./src/cloudflare/resources/zero_trust/dex/tests/tests.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/zero_trust/dex/test_list_params.py">params</a>) -> <a href="./src/cloudflare/types/zero_trust/dex/tests/tests.py">SyncV4PagePagination[Optional[Tests]]</a></code>

#### UniqueDevices

Expand Down
18 changes: 12 additions & 6 deletions src/cloudflare/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class SyncV4PagePagination(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
def _get_page_items(self) -> List[_T]:
items = None
if self.result is not None:
items = self.result.items
if self.result.items is not None:
items = self.result.items
if not items:
return []
return items
Expand All @@ -65,7 +66,8 @@ class AsyncV4PagePagination(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
def _get_page_items(self) -> List[_T]:
items = None
if self.result is not None:
items = self.result.items
if self.result.items is not None:
items = self.result.items
if not items:
return []
return items
Expand Down Expand Up @@ -142,7 +144,8 @@ def _get_page_items(self) -> List[_T]:
def next_page_info(self) -> Optional[PageInfo]:
cursor = None
if self.result_info is not None:
cursor = self.result_info.cursor
if self.result_info.cursor is not None:
cursor = self.result_info.cursor
if not cursor:
return None

Expand All @@ -164,7 +167,8 @@ def _get_page_items(self) -> List[_T]:
def next_page_info(self) -> Optional[PageInfo]:
cursor = None
if self.result_info is not None:
cursor = self.result_info.cursor
if self.result_info.cursor is not None:
cursor = self.result_info.cursor
if not cursor:
return None

Expand Down Expand Up @@ -194,7 +198,8 @@ def _get_page_items(self) -> List[_T]:
def next_page_info(self) -> Optional[PageInfo]:
cursor = None
if self.result_info is not None:
cursor = self.result_info.cursor
if self.result_info.cursor is not None:
cursor = self.result_info.cursor
if not cursor:
return None

Expand All @@ -216,7 +221,8 @@ def _get_page_items(self) -> List[_T]:
def next_page_info(self) -> Optional[PageInfo]:
cursor = None
if self.result_info is not None:
cursor = self.result_info.cursor
if self.result_info.cursor is not None:
cursor = self.result_info.cursor
if not cursor:
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncV4PagePagination[IssueListResponse]:
) -> SyncV4PagePagination[Optional[IssueListResponse]]:
"""
Get Security Center Issues
Expand All @@ -106,7 +106,7 @@ 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}/intel/attack-surface-report/issues",
page=SyncV4PagePagination[IssueListResponse],
page=SyncV4PagePagination[Optional[IssueListResponse]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -416,7 +416,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[IssueListResponse, AsyncV4PagePagination[IssueListResponse]]:
) -> AsyncPaginator[Optional[IssueListResponse], AsyncV4PagePagination[Optional[IssueListResponse]]]:
"""
Get Security Center Issues
Expand All @@ -439,7 +439,7 @@ 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}/intel/attack-surface-report/issues",
page=AsyncV4PagePagination[IssueListResponse],
page=AsyncV4PagePagination[Optional[IssueListResponse]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down
16 changes: 9 additions & 7 deletions src/cloudflare/resources/intel/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

from typing import Optional

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
Expand All @@ -17,7 +19,7 @@
from ...pagination import SyncV4PagePagination, AsyncV4PagePagination
from ...types.intel import dns_list_params
from ..._base_client import AsyncPaginator, make_request_options
from ...types.intel.dns_list_response import DNSListResponse
from ...types.intel.dns import DNS

__all__ = ["DNSResource", "AsyncDNSResource"]

Expand Down Expand Up @@ -56,7 +58,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncV4PagePagination[DNSListResponse]:
) -> SyncV4PagePagination[Optional[DNS]]:
"""
Gets a list of all the domains that have resolved to a specific IP address.
Expand All @@ -79,7 +81,7 @@ 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}/intel/dns",
page=SyncV4PagePagination[DNSListResponse],
page=SyncV4PagePagination[Optional[DNS]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -95,7 +97,7 @@ def list(
dns_list_params.DNSListParams,
),
),
model=DNSListResponse,
model=DNS,
)


Expand Down Expand Up @@ -133,7 +135,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[DNSListResponse, AsyncV4PagePagination[DNSListResponse]]:
) -> AsyncPaginator[Optional[DNS], AsyncV4PagePagination[Optional[DNS]]]:
"""
Gets a list of all the domains that have resolved to a specific IP address.
Expand All @@ -156,7 +158,7 @@ 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}/intel/dns",
page=AsyncV4PagePagination[DNSListResponse],
page=AsyncV4PagePagination[Optional[DNS]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -172,7 +174,7 @@ def list(
dns_list_params.DNSListParams,
),
),
model=DNSListResponse,
model=DNS,
)


Expand Down
12 changes: 6 additions & 6 deletions src/cloudflare/resources/spectrum/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncV4PagePaginationArray[AppListResponse]:
) -> SyncV4PagePaginationArray[Optional[AppListResponse]]:
"""
Retrieves a list of currently existing Spectrum applications inside a zone.
Expand Down Expand Up @@ -466,7 +466,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
f"/zones/{zone_id}/spectrum/apps",
page=SyncV4PagePaginationArray[AppListResponse],
page=SyncV4PagePaginationArray[Optional[AppListResponse]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -482,7 +482,7 @@ def list(
app_list_params.AppListParams,
),
),
model=AppListResponse,
model=cast(Any, AppListResponse), # Union types cannot be passed in as arguments in the type system
)

def delete(
Expand Down Expand Up @@ -978,7 +978,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[AppListResponse, AsyncV4PagePaginationArray[AppListResponse]]:
) -> AsyncPaginator[Optional[AppListResponse], AsyncV4PagePaginationArray[Optional[AppListResponse]]]:
"""
Retrieves a list of currently existing Spectrum applications inside a zone.
Expand Down Expand Up @@ -1007,7 +1007,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
f"/zones/{zone_id}/spectrum/apps",
page=AsyncV4PagePaginationArray[AppListResponse],
page=AsyncV4PagePaginationArray[Optional[AppListResponse]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -1023,7 +1023,7 @@ def list(
app_list_params.AppListParams,
),
),
model=AppListResponse,
model=cast(Any, AppListResponse), # Union types cannot be passed in as arguments in the type system
)

async def delete(
Expand Down
16 changes: 8 additions & 8 deletions src/cloudflare/resources/zero_trust/dex/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List
from typing import List, Optional

import httpx

Expand All @@ -27,7 +27,7 @@
)
from ....._base_client import AsyncPaginator, make_request_options
from .....types.zero_trust.dex import test_list_params
from .....types.zero_trust.dex.test_list_response import TestListResponse
from .....types.zero_trust.dex.tests.tests import Tests

__all__ = ["TestsResource", "AsyncTestsResource"]

Expand Down Expand Up @@ -73,7 +73,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncV4PagePagination[TestListResponse]:
) -> SyncV4PagePagination[Optional[Tests]]:
"""
List DEX tests with overview metrics
Expand Down Expand Up @@ -102,7 +102,7 @@ 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}/dex/tests/overview",
page=SyncV4PagePagination[TestListResponse],
page=SyncV4PagePagination[Optional[Tests]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -119,7 +119,7 @@ def list(
test_list_params.TestListParams,
),
),
model=TestListResponse,
model=Tests,
)


Expand Down Expand Up @@ -162,7 +162,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[TestListResponse, AsyncV4PagePagination[TestListResponse]]:
) -> AsyncPaginator[Optional[Tests], AsyncV4PagePagination[Optional[Tests]]]:
"""
List DEX tests with overview metrics
Expand Down Expand Up @@ -191,7 +191,7 @@ 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}/dex/tests/overview",
page=AsyncV4PagePagination[TestListResponse],
page=AsyncV4PagePagination[Optional[Tests]],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -208,7 +208,7 @@ def list(
test_list_params.TestListParams,
),
),
model=TestListResponse,
model=Tests,
)


Expand Down
17 changes: 2 additions & 15 deletions src/cloudflare/types/images/v1_list_response.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing_extensions import Literal

from .image import Image
from ..._models import BaseModel
from ..shared.response_info import ResponseInfo

__all__ = ["V1ListResponse", "Result"]


class Result(BaseModel):
images: Optional[List[Image]] = None
__all__ = ["V1ListResponse"]


class V1ListResponse(BaseModel):
errors: List[ResponseInfo]

messages: List[ResponseInfo]

result: Result

success: Literal[True]
"""Whether the API call was successful"""
images: Optional[List[Image]] = None
1 change: 0 additions & 1 deletion src/cloudflare/types/intel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from .dns_list_params import DNSListParams as DNSListParams
from .ip_get_response import IPGetResponse as IPGetResponse
from .whois_get_params import WhoisGetParams as WhoisGetParams
from .dns_list_response import DNSListResponse as DNSListResponse
from .domain_get_params import DomainGetParams as DomainGetParams
from .whois_get_response import WhoisGetResponse as WhoisGetResponse
from .ip_list_get_response import IPListGetResponse as IPListGetResponse
Expand Down
Loading

0 comments on commit be2c6e9

Please sign in to comment.