diff --git a/.stats.yml b/.stats.yml index b047b943714..51ad3fa0ce1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2041 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9ba099b7936091cc984d2a24fc4d32c3ffcb1d71d86412c8c9084d201e16b3ac.yml -openapi_spec_hash: 45edc9a107cf5a5e3b204b230b0d336d -config_hash: be3f6e9410db673744447f9dbe92d922 +configured_endpoints: 2063 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-33d37f2ed84298196a44a165e47c25b58a775770e4f24f6e4008c336547aabaa.yml +openapi_spec_hash: bad503bd605d9e3fc814f6fa7dc4dd90 +config_hash: 436dbbeb18db3b6d221f37bf7054a839 diff --git a/api.md b/api.md index 3f5cd6f421a..aa9df5324e0 100644 --- a/api.md +++ b/api.md @@ -2672,6 +2672,26 @@ Methods: - client.workers.observability.telemetry.query(\*, account_id, \*\*params) -> TelemetryQueryResponse - client.workers.observability.telemetry.values(\*, account_id, \*\*params) -> SyncSinglePage[TelemetryValuesResponse] +### Destinations + +Types: + +```python +from cloudflare.types.workers.observability import ( + DestinationCreateResponse, + DestinationUpdateResponse, + DestinationListResponse, + DestinationDeleteResponse, +) +``` + +Methods: + +- client.workers.observability.destinations.create(\*, account_id, \*\*params) -> DestinationCreateResponse +- client.workers.observability.destinations.update(slug, \*, account_id, \*\*params) -> DestinationUpdateResponse +- client.workers.observability.destinations.list(\*, account_id, \*\*params) -> SyncSinglePage[DestinationListResponse] +- client.workers.observability.destinations.delete(slug, \*, account_id) -> Optional[DestinationDeleteResponse] + # KV ## Namespaces @@ -3528,6 +3548,18 @@ Methods: - client.billing.profiles.get(\*, account_id) -> ProfileGetResponse +## Usage + +Types: + +```python +from cloudflare.types.billing import UsagePaygoResponse +``` + +Methods: + +- client.billing.usage.paygo(\*, account_id, \*\*params) -> UsagePaygoResponse + # BrandProtection Types: @@ -5617,6 +5649,22 @@ Methods: - client.zero_trust.devices.dex_tests.delete(dex_test_id, \*, account_id) -> Optional[DEXTestDeleteResponse] - client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional[DEXTestGetResponse] +### IPProfiles + +Types: + +```python +from cloudflare.types.zero_trust.devices import IPProfile, IPProfileDeleteResponse +``` + +Methods: + +- client.zero_trust.devices.ip_profiles.create(\*, account_id, \*\*params) -> IPProfile +- client.zero_trust.devices.ip_profiles.update(profile_id, \*, account_id, \*\*params) -> IPProfile +- client.zero_trust.devices.ip_profiles.list(\*, account_id, \*\*params) -> SyncSinglePage[IPProfile] +- client.zero_trust.devices.ip_profiles.delete(profile_id, \*, account_id) -> IPProfileDeleteResponse +- client.zero_trust.devices.ip_profiles.get(profile_id, \*, account_id) -> IPProfile + ### Networks Types: @@ -7320,47 +7368,30 @@ Methods: ### Subnets -Types: - -```python -from cloudflare.types.zero_trust.networks import SubnetListResponse -``` - Methods: -- client.zero_trust.networks.subnets.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[SubnetListResponse] +- client.zero_trust.networks.subnets.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Subnet] #### WARP Types: ```python -from cloudflare.types.zero_trust.networks.subnets import ( - WARPCreateResponse, - WARPDeleteResponse, - WARPEditResponse, - WARPGetResponse, -) +from cloudflare.types.zero_trust.networks.subnets import Subnet, WARPDeleteResponse ``` Methods: -- client.zero_trust.networks.subnets.warp.create(\*, account_id, \*\*params) -> WARPCreateResponse +- client.zero_trust.networks.subnets.warp.create(\*, account_id, \*\*params) -> Subnet - client.zero_trust.networks.subnets.warp.delete(subnet_id, \*, account_id) -> Optional[WARPDeleteResponse] -- client.zero_trust.networks.subnets.warp.edit(subnet_id, \*, account_id, \*\*params) -> WARPEditResponse -- client.zero_trust.networks.subnets.warp.get(subnet_id, \*, account_id) -> WARPGetResponse +- client.zero_trust.networks.subnets.warp.edit(subnet_id, \*, account_id, \*\*params) -> Subnet +- client.zero_trust.networks.subnets.warp.get(subnet_id, \*, account_id) -> Subnet #### CloudflareSource -Types: - -```python -from cloudflare.types.zero_trust.networks.subnets import CloudflareSourceUpdateResponse -``` - Methods: -- client.zero_trust.networks.subnets.cloudflare_source.update(address_family, \*, account_id, \*\*params) -> CloudflareSourceUpdateResponse +- client.zero_trust.networks.subnets.cloudflare_source.update(address_family, \*, account_id, \*\*params) -> Subnet ### HostnameRoutes @@ -9303,6 +9334,21 @@ Methods: - client.origin_post_quantum_encryption.update(\*, zone_id, \*\*params) -> Optional[OriginPostQuantumEncryptionUpdateResponse] - client.origin_post_quantum_encryption.get(\*, zone_id) -> Optional[OriginPostQuantumEncryptionGetResponse] +# GoogleTagGateway + +## Config + +Types: + +```python +from cloudflare.types.google_tag_gateway import Config +``` + +Methods: + +- client.google_tag_gateway.config.update(\*, zone_id, \*\*params) -> Optional[Config] +- client.google_tag_gateway.config.get(\*, zone_id) -> Optional[Config] + # Zaraz Types: @@ -10424,7 +10470,7 @@ Methods: - client.workflows.instances.create(workflow_name, \*, account_id, \*\*params) -> InstanceCreateResponse - client.workflows.instances.list(workflow_name, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[InstanceListResponse] - client.workflows.instances.bulk(workflow_name, \*, account_id, \*\*params) -> SyncSinglePage[InstanceBulkResponse] -- client.workflows.instances.get(instance_id, \*, account_id, workflow_name) -> InstanceGetResponse +- client.workflows.instances.get(instance_id, \*, account_id, workflow_name, \*\*params) -> InstanceGetResponse ### Status @@ -10521,6 +10567,70 @@ Methods: - client.resource_sharing.resources.delete(resource_id, \*, account_id, share_id) -> Optional[ResourceDeleteResponse] - client.resource_sharing.resources.get(resource_id, \*, account_id, share_id) -> Optional[ResourceGetResponse] +# ResourceTagging + +Types: + +```python +from cloudflare.types.resource_tagging import ResourceTaggingListResponse +``` + +Methods: + +- client.resource_tagging.list(\*, account_id, \*\*params) -> SyncCursorPaginationAfter[ResourceTaggingListResponse] + +## AccountTags + +Types: + +```python +from cloudflare.types.resource_tagging import AccountTagUpdateResponse, AccountTagGetResponse +``` + +Methods: + +- client.resource_tagging.account_tags.update(\*, account_id, \*\*params) -> Optional[AccountTagUpdateResponse] +- client.resource_tagging.account_tags.delete(\*, account_id) -> None +- client.resource_tagging.account_tags.get(\*, account_id, \*\*params) -> Optional[AccountTagGetResponse] + +## ZoneTags + +Types: + +```python +from cloudflare.types.resource_tagging import ZoneTagUpdateResponse, ZoneTagGetResponse +``` + +Methods: + +- client.resource_tagging.zone_tags.update(\*, zone_id, \*\*params) -> Optional[ZoneTagUpdateResponse] +- client.resource_tagging.zone_tags.delete(\*, zone_id) -> None +- client.resource_tagging.zone_tags.get(\*, zone_id, \*\*params) -> Optional[ZoneTagGetResponse] + +## Keys + +Types: + +```python +from cloudflare.types.resource_tagging import KeyListResponse +``` + +Methods: + +- client.resource_tagging.keys.list(\*, account_id, \*\*params) -> SyncCursorPaginationAfter[KeyListResponse] + +## Values + +Types: + +```python +from cloudflare.types.resource_tagging import ValueListResponse +``` + +Methods: + +- client.resource_tagging.values.list(tag_key, \*, account_id, \*\*params) -> SyncCursorPaginationAfter[ValueListResponse] + # LeakedCredentialChecks Types: @@ -10761,19 +10871,6 @@ Methods: - client.aisearch.instances.search(id, \*, account_id, \*\*params) -> InstanceSearchResponse - client.aisearch.instances.stats(id, \*, account_id) -> InstanceStatsResponse -### Items - -Types: - -```python -from cloudflare.types.aisearch.instances import ItemListResponse, ItemGetResponse -``` - -Methods: - -- client.aisearch.instances.items.list(id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[ItemListResponse] -- client.aisearch.instances.items.get(item_id, \*, account_id, id) -> ItemGetResponse - ### Jobs Types: @@ -10789,7 +10886,7 @@ from cloudflare.types.aisearch.instances import ( Methods: -- client.aisearch.instances.jobs.create(id, \*, account_id) -> JobCreateResponse +- client.aisearch.instances.jobs.create(id, \*, account_id, \*\*params) -> JobCreateResponse - client.aisearch.instances.jobs.list(id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[JobListResponse] - client.aisearch.instances.jobs.get(job_id, \*, account_id, id) -> JobGetResponse - client.aisearch.instances.jobs.logs(job_id, \*, account_id, id, \*\*params) -> JobLogsResponse @@ -10959,6 +11056,24 @@ Methods: - client.browser_rendering.markdown.create(\*, account_id, \*\*params) -> str +## Crawl + +Types: + +```python +from cloudflare.types.browser_rendering import ( + CrawlCreateResponse, + CrawlDeleteResponse, + CrawlGetResponse, +) +``` + +Methods: + +- client.browser_rendering.crawl.create(\*, account_id, \*\*params) -> str +- client.browser_rendering.crawl.delete(job_id, \*, account_id) -> CrawlDeleteResponse +- client.browser_rendering.crawl.get(job_id, \*, account_id, \*\*params) -> CrawlGetResponse + # CustomPages Types: diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index edc473185de..46b975fa01f 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -117,12 +117,14 @@ content_scanning, custom_hostnames, resource_sharing, + resource_tagging, token_validation, browser_rendering, mtls_certificates, schema_validation, url_normalization, custom_nameservers, + google_tag_gateway, managed_transforms, client_certificates, custom_certificates, @@ -230,10 +232,12 @@ from .resources.content_scanning.content_scanning import ContentScanningResource, AsyncContentScanningResource from .resources.custom_hostnames.custom_hostnames import CustomHostnamesResource, AsyncCustomHostnamesResource from .resources.resource_sharing.resource_sharing import ResourceSharingResource, AsyncResourceSharingResource + from .resources.resource_tagging.resource_tagging import ResourceTaggingResource, AsyncResourceTaggingResource from .resources.token_validation.token_validation import TokenValidationResource, AsyncTokenValidationResource from .resources.browser_rendering.browser_rendering import BrowserRenderingResource, AsyncBrowserRenderingResource from .resources.mtls_certificates.mtls_certificates import MTLSCertificatesResource, AsyncMTLSCertificatesResource from .resources.schema_validation.schema_validation import SchemaValidationResource, AsyncSchemaValidationResource + from .resources.google_tag_gateway.google_tag_gateway import GoogleTagGatewayResource, AsyncGoogleTagGatewayResource from .resources.custom_certificates.custom_certificates import ( CustomCertificatesResource, AsyncCustomCertificatesResource, @@ -807,6 +811,12 @@ def origin_post_quantum_encryption(self) -> OriginPostQuantumEncryptionResource: return OriginPostQuantumEncryptionResource(self) + @cached_property + def google_tag_gateway(self) -> GoogleTagGatewayResource: + from .resources.google_tag_gateway import GoogleTagGatewayResource + + return GoogleTagGatewayResource(self) + @cached_property def zaraz(self) -> ZarazResource: from .resources.zaraz import ZarazResource @@ -897,6 +907,12 @@ def resource_sharing(self) -> ResourceSharingResource: return ResourceSharingResource(self) + @cached_property + def resource_tagging(self) -> ResourceTaggingResource: + from .resources.resource_tagging import ResourceTaggingResource + + return ResourceTaggingResource(self) + @cached_property def leaked_credential_checks(self) -> LeakedCredentialChecksResource: from .resources.leaked_credential_checks import LeakedCredentialChecksResource @@ -1673,6 +1689,12 @@ def origin_post_quantum_encryption(self) -> AsyncOriginPostQuantumEncryptionReso return AsyncOriginPostQuantumEncryptionResource(self) + @cached_property + def google_tag_gateway(self) -> AsyncGoogleTagGatewayResource: + from .resources.google_tag_gateway import AsyncGoogleTagGatewayResource + + return AsyncGoogleTagGatewayResource(self) + @cached_property def zaraz(self) -> AsyncZarazResource: from .resources.zaraz import AsyncZarazResource @@ -1763,6 +1785,12 @@ def resource_sharing(self) -> AsyncResourceSharingResource: return AsyncResourceSharingResource(self) + @cached_property + def resource_tagging(self) -> AsyncResourceTaggingResource: + from .resources.resource_tagging import AsyncResourceTaggingResource + + return AsyncResourceTaggingResource(self) + @cached_property def leaked_credential_checks(self) -> AsyncLeakedCredentialChecksResource: from .resources.leaked_credential_checks import AsyncLeakedCredentialChecksResource @@ -2469,6 +2497,12 @@ def origin_post_quantum_encryption( return OriginPostQuantumEncryptionResourceWithRawResponse(self._client.origin_post_quantum_encryption) + @cached_property + def google_tag_gateway(self) -> google_tag_gateway.GoogleTagGatewayResourceWithRawResponse: + from .resources.google_tag_gateway import GoogleTagGatewayResourceWithRawResponse + + return GoogleTagGatewayResourceWithRawResponse(self._client.google_tag_gateway) + @cached_property def zaraz(self) -> zaraz.ZarazResourceWithRawResponse: from .resources.zaraz import ZarazResourceWithRawResponse @@ -2559,6 +2593,12 @@ def resource_sharing(self) -> resource_sharing.ResourceSharingResourceWithRawRes return ResourceSharingResourceWithRawResponse(self._client.resource_sharing) + @cached_property + def resource_tagging(self) -> resource_tagging.ResourceTaggingResourceWithRawResponse: + from .resources.resource_tagging import ResourceTaggingResourceWithRawResponse + + return ResourceTaggingResourceWithRawResponse(self._client.resource_tagging) + @cached_property def leaked_credential_checks(self) -> leaked_credential_checks.LeakedCredentialChecksResourceWithRawResponse: from .resources.leaked_credential_checks import LeakedCredentialChecksResourceWithRawResponse @@ -3090,6 +3130,12 @@ def origin_post_quantum_encryption( return AsyncOriginPostQuantumEncryptionResourceWithRawResponse(self._client.origin_post_quantum_encryption) + @cached_property + def google_tag_gateway(self) -> google_tag_gateway.AsyncGoogleTagGatewayResourceWithRawResponse: + from .resources.google_tag_gateway import AsyncGoogleTagGatewayResourceWithRawResponse + + return AsyncGoogleTagGatewayResourceWithRawResponse(self._client.google_tag_gateway) + @cached_property def zaraz(self) -> zaraz.AsyncZarazResourceWithRawResponse: from .resources.zaraz import AsyncZarazResourceWithRawResponse @@ -3180,6 +3226,12 @@ def resource_sharing(self) -> resource_sharing.AsyncResourceSharingResourceWithR return AsyncResourceSharingResourceWithRawResponse(self._client.resource_sharing) + @cached_property + def resource_tagging(self) -> resource_tagging.AsyncResourceTaggingResourceWithRawResponse: + from .resources.resource_tagging import AsyncResourceTaggingResourceWithRawResponse + + return AsyncResourceTaggingResourceWithRawResponse(self._client.resource_tagging) + @cached_property def leaked_credential_checks(self) -> leaked_credential_checks.AsyncLeakedCredentialChecksResourceWithRawResponse: from .resources.leaked_credential_checks import AsyncLeakedCredentialChecksResourceWithRawResponse @@ -3711,6 +3763,12 @@ def origin_post_quantum_encryption( return OriginPostQuantumEncryptionResourceWithStreamingResponse(self._client.origin_post_quantum_encryption) + @cached_property + def google_tag_gateway(self) -> google_tag_gateway.GoogleTagGatewayResourceWithStreamingResponse: + from .resources.google_tag_gateway import GoogleTagGatewayResourceWithStreamingResponse + + return GoogleTagGatewayResourceWithStreamingResponse(self._client.google_tag_gateway) + @cached_property def zaraz(self) -> zaraz.ZarazResourceWithStreamingResponse: from .resources.zaraz import ZarazResourceWithStreamingResponse @@ -3801,6 +3859,12 @@ def resource_sharing(self) -> resource_sharing.ResourceSharingResourceWithStream return ResourceSharingResourceWithStreamingResponse(self._client.resource_sharing) + @cached_property + def resource_tagging(self) -> resource_tagging.ResourceTaggingResourceWithStreamingResponse: + from .resources.resource_tagging import ResourceTaggingResourceWithStreamingResponse + + return ResourceTaggingResourceWithStreamingResponse(self._client.resource_tagging) + @cached_property def leaked_credential_checks(self) -> leaked_credential_checks.LeakedCredentialChecksResourceWithStreamingResponse: from .resources.leaked_credential_checks import LeakedCredentialChecksResourceWithStreamingResponse @@ -4340,6 +4404,12 @@ def origin_post_quantum_encryption( self._client.origin_post_quantum_encryption ) + @cached_property + def google_tag_gateway(self) -> google_tag_gateway.AsyncGoogleTagGatewayResourceWithStreamingResponse: + from .resources.google_tag_gateway import AsyncGoogleTagGatewayResourceWithStreamingResponse + + return AsyncGoogleTagGatewayResourceWithStreamingResponse(self._client.google_tag_gateway) + @cached_property def zaraz(self) -> zaraz.AsyncZarazResourceWithStreamingResponse: from .resources.zaraz import AsyncZarazResourceWithStreamingResponse @@ -4430,6 +4500,12 @@ def resource_sharing(self) -> resource_sharing.AsyncResourceSharingResourceWithS return AsyncResourceSharingResourceWithStreamingResponse(self._client.resource_sharing) + @cached_property + def resource_tagging(self) -> resource_tagging.AsyncResourceTaggingResourceWithStreamingResponse: + from .resources.resource_tagging import AsyncResourceTaggingResourceWithStreamingResponse + + return AsyncResourceTaggingResourceWithStreamingResponse(self._client.resource_tagging) + @cached_property def leaked_credential_checks( self, diff --git a/src/cloudflare/resources/abuse_reports/abuse_reports.py b/src/cloudflare/resources/abuse_reports/abuse_reports.py index 9cf0a64aa03..0766fbdbf26 100644 --- a/src/cloudflare/resources/abuse_reports/abuse_reports.py +++ b/src/cloudflare/resources/abuse_reports/abuse_reports.py @@ -273,7 +273,7 @@ def create( host_notification: Literal["send", "send-anon"], justification: str, name: str, - owner_notification: Literal["send", "send-anon", "none"], + owner_notification: Literal["send", "send-anon"], urls: str, comments: str | Omit = omit, company: str | Omit = omit, @@ -866,7 +866,7 @@ def create( host_notification: Literal["send"] | Literal["send", "send-anon"] | Omit = omit, name: str, original_work: str | Omit = omit, - owner_notification: Literal["send"] | Literal["send", "send-anon", "none"] | Literal["send", "send-anon"], + owner_notification: Literal["send"] | Literal["send", "send-anon"] | Literal["send", "send-anon", "none"], signature: str | Omit = omit, state: str | Omit = omit, urls: str, @@ -1299,7 +1299,7 @@ async def create( host_notification: Literal["send", "send-anon"], justification: str, name: str, - owner_notification: Literal["send", "send-anon", "none"], + owner_notification: Literal["send", "send-anon"], urls: str, comments: str | Omit = omit, company: str | Omit = omit, @@ -1892,7 +1892,7 @@ async def create( host_notification: Literal["send"] | Literal["send", "send-anon"] | Omit = omit, name: str, original_work: str | Omit = omit, - owner_notification: Literal["send"] | Literal["send", "send-anon", "none"] | Literal["send", "send-anon"], + owner_notification: Literal["send"] | Literal["send", "send-anon"] | Literal["send", "send-anon", "none"], signature: str | Omit = omit, state: str | Omit = omit, urls: str, diff --git a/src/cloudflare/resources/abuse_reports/mitigations.py b/src/cloudflare/resources/abuse_reports/mitigations.py index 298b58d4143..854d18824d2 100644 --- a/src/cloudflare/resources/abuse_reports/mitigations.py +++ b/src/cloudflare/resources/abuse_reports/mitigations.py @@ -70,6 +70,7 @@ def list( status: Literal["pending", "active", "in_review", "cancelled", "removed"] | Omit = omit, type: Literal[ "legal_block", + "misleading_interstitial", "phishing_interstitial", "network_block", "rate_limit_cache", @@ -230,6 +231,7 @@ def list( status: Literal["pending", "active", "in_review", "cancelled", "removed"] | Omit = omit, type: Literal[ "legal_block", + "misleading_interstitial", "phishing_interstitial", "network_block", "rate_limit_cache", diff --git a/src/cloudflare/resources/ai/models/schema.py b/src/cloudflare/resources/ai/models/schema.py index d555ab98627..a041d762955 100644 --- a/src/cloudflare/resources/ai/models/schema.py +++ b/src/cloudflare/resources/ai/models/schema.py @@ -57,7 +57,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SchemaGetResponse: """ - Get Model Schema + Retrieves the input and output JSON schema definition for a Workers AI model. Args: model: Model Name @@ -119,7 +119,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SchemaGetResponse: """ - Get Model Schema + Retrieves the input and output JSON schema definition for a Workers AI model. Args: model: Model Name diff --git a/src/cloudflare/resources/ai/to_markdown.py b/src/cloudflare/resources/ai/to_markdown.py index 15cab8aa9e4..a4792606100 100644 --- a/src/cloudflare/resources/ai/to_markdown.py +++ b/src/cloudflare/resources/ai/to_markdown.py @@ -57,7 +57,7 @@ def supported( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncSinglePage[ToMarkdownSupportedResponse]: """ - Get all converted formats supported + Lists all file formats supported for conversion to Markdown. Args: extra_headers: Send extra headers @@ -92,7 +92,7 @@ def transform( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncSinglePage[ToMarkdownTransformResponse]: """ - Convert Files into Markdown + Converts uploaded files into Markdown format using Workers AI. Args: extra_headers: Send extra headers @@ -156,7 +156,7 @@ def supported( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ToMarkdownSupportedResponse, AsyncSinglePage[ToMarkdownSupportedResponse]]: """ - Get all converted formats supported + Lists all file formats supported for conversion to Markdown. Args: extra_headers: Send extra headers @@ -191,7 +191,7 @@ def transform( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ToMarkdownTransformResponse, AsyncSinglePage[ToMarkdownTransformResponse]]: """ - Convert Files into Markdown + Converts uploaded files into Markdown format using Workers AI. Args: extra_headers: Send extra headers diff --git a/src/cloudflare/resources/ai_gateway/ai_gateway.py b/src/cloudflare/resources/ai_gateway/ai_gateway.py index 545ad9b28e6..43c3b00b118 100644 --- a/src/cloudflare/resources/ai_gateway/ai_gateway.py +++ b/src/cloudflare/resources/ai_gateway/ai_gateway.py @@ -146,11 +146,11 @@ def create( rate_limiting_limit: Optional[int], rate_limiting_technique: Literal["fixed", "sliding"], authentication: bool | Omit = omit, - is_default: bool | Omit = omit, log_management: Optional[int] | Omit = omit, log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit, logpush: bool | Omit = omit, logpush_public_key: Optional[str] | Omit = omit, + workers_ai_billing_mode: Literal["postpaid", "unified"] | Omit = omit, zdr: bool | Omit = omit, # 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. @@ -160,11 +160,13 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayCreateResponse: """ - Create a new Gateway + Creates a new AI Gateway. Args: id: gateway id + workers_ai_billing_mode: Controls how Workers AI inference calls routed through this gateway are billed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -187,11 +189,11 @@ def create( "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, "authentication": authentication, - "is_default": is_default, "log_management": log_management, "log_management_strategy": log_management_strategy, "logpush": logpush, "logpush_public_key": logpush_public_key, + "workers_ai_billing_mode": workers_ai_billing_mode, "zdr": zdr, }, ai_gateway_create_params.AIGatewayCreateParams, @@ -219,7 +221,6 @@ def update( rate_limiting_technique: Literal["fixed", "sliding"], authentication: bool | Omit = omit, dlp: ai_gateway_update_params.DLP | Omit = omit, - is_default: bool | Omit = omit, log_management: Optional[int] | Omit = omit, log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit, logpush: bool | Omit = omit, @@ -227,6 +228,7 @@ def update( otel: Optional[Iterable[ai_gateway_update_params.Otel]] | Omit = omit, store_id: Optional[str] | Omit = omit, stripe: Optional[ai_gateway_update_params.Stripe] | Omit = omit, + workers_ai_billing_mode: Literal["postpaid", "unified"] | Omit = omit, zdr: bool | Omit = omit, # 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. @@ -236,11 +238,13 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayUpdateResponse: """ - Update a Gateway + Updates an existing AI Gateway dataset. Args: id: gateway id + workers_ai_billing_mode: Controls how Workers AI inference calls routed through this gateway are billed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -265,7 +269,6 @@ def update( "rate_limiting_technique": rate_limiting_technique, "authentication": authentication, "dlp": dlp, - "is_default": is_default, "log_management": log_management, "log_management_strategy": log_management_strategy, "logpush": logpush, @@ -273,6 +276,7 @@ def update( "otel": otel, "store_id": store_id, "stripe": stripe, + "workers_ai_billing_mode": workers_ai_billing_mode, "zdr": zdr, }, ai_gateway_update_params.AIGatewayUpdateParams, @@ -302,7 +306,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncV4PagePaginationArray[AIGatewayListResponse]: """ - List Gateways + Lists all AI Gateway evaluator types configured for the account. Args: search: Search by id @@ -350,7 +354,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayDeleteResponse: """ - Delete a Gateway + Deletes an AI Gateway dataset. Args: id: gateway id @@ -392,7 +396,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayGetResponse: """ - Fetch a Gateway + Retrieves details for a specific AI Gateway dataset. Args: id: gateway id @@ -482,11 +486,11 @@ async def create( rate_limiting_limit: Optional[int], rate_limiting_technique: Literal["fixed", "sliding"], authentication: bool | Omit = omit, - is_default: bool | Omit = omit, log_management: Optional[int] | Omit = omit, log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit, logpush: bool | Omit = omit, logpush_public_key: Optional[str] | Omit = omit, + workers_ai_billing_mode: Literal["postpaid", "unified"] | Omit = omit, zdr: bool | Omit = omit, # 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. @@ -496,11 +500,13 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayCreateResponse: """ - Create a new Gateway + Creates a new AI Gateway. Args: id: gateway id + workers_ai_billing_mode: Controls how Workers AI inference calls routed through this gateway are billed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -523,11 +529,11 @@ async def create( "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, "authentication": authentication, - "is_default": is_default, "log_management": log_management, "log_management_strategy": log_management_strategy, "logpush": logpush, "logpush_public_key": logpush_public_key, + "workers_ai_billing_mode": workers_ai_billing_mode, "zdr": zdr, }, ai_gateway_create_params.AIGatewayCreateParams, @@ -555,7 +561,6 @@ async def update( rate_limiting_technique: Literal["fixed", "sliding"], authentication: bool | Omit = omit, dlp: ai_gateway_update_params.DLP | Omit = omit, - is_default: bool | Omit = omit, log_management: Optional[int] | Omit = omit, log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit, logpush: bool | Omit = omit, @@ -563,6 +568,7 @@ async def update( otel: Optional[Iterable[ai_gateway_update_params.Otel]] | Omit = omit, store_id: Optional[str] | Omit = omit, stripe: Optional[ai_gateway_update_params.Stripe] | Omit = omit, + workers_ai_billing_mode: Literal["postpaid", "unified"] | Omit = omit, zdr: bool | Omit = omit, # 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. @@ -572,11 +578,13 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayUpdateResponse: """ - Update a Gateway + Updates an existing AI Gateway dataset. Args: id: gateway id + workers_ai_billing_mode: Controls how Workers AI inference calls routed through this gateway are billed + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -601,7 +609,6 @@ async def update( "rate_limiting_technique": rate_limiting_technique, "authentication": authentication, "dlp": dlp, - "is_default": is_default, "log_management": log_management, "log_management_strategy": log_management_strategy, "logpush": logpush, @@ -609,6 +616,7 @@ async def update( "otel": otel, "store_id": store_id, "stripe": stripe, + "workers_ai_billing_mode": workers_ai_billing_mode, "zdr": zdr, }, ai_gateway_update_params.AIGatewayUpdateParams, @@ -638,7 +646,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AIGatewayListResponse, AsyncV4PagePaginationArray[AIGatewayListResponse]]: """ - List Gateways + Lists all AI Gateway evaluator types configured for the account. Args: search: Search by id @@ -686,7 +694,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayDeleteResponse: """ - Delete a Gateway + Deletes an AI Gateway dataset. Args: id: gateway id @@ -728,7 +736,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AIGatewayGetResponse: """ - Fetch a Gateway + Retrieves details for a specific AI Gateway dataset. Args: id: gateway id diff --git a/src/cloudflare/resources/ai_gateway/datasets.py b/src/cloudflare/resources/ai_gateway/datasets.py index bb256a33205..91601b7a385 100644 --- a/src/cloudflare/resources/ai_gateway/datasets.py +++ b/src/cloudflare/resources/ai_gateway/datasets.py @@ -65,7 +65,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetCreateResponse: """ - Create a new Dataset + Creates a new AI Gateway. Args: gateway_id: gateway id @@ -119,7 +119,7 @@ def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetUpdateResponse: """ - Update a Dataset + Updates an existing AI Gateway dataset. Args: gateway_id: gateway id @@ -176,7 +176,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncV4PagePaginationArray[DatasetListResponse]: """ - List Datasets + Lists all AI Gateway evaluator types configured for the account. Args: gateway_id: gateway id @@ -231,7 +231,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetDeleteResponse: """ - Delete a Dataset + Deletes an AI Gateway dataset. Args: gateway_id: gateway id @@ -276,7 +276,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetGetResponse: """ - Fetch a Dataset + Retrieves details for a specific AI Gateway dataset. Args: gateway_id: gateway id @@ -344,7 +344,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetCreateResponse: """ - Create a new Dataset + Creates a new AI Gateway. Args: gateway_id: gateway id @@ -398,7 +398,7 @@ async def update( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetUpdateResponse: """ - Update a Dataset + Updates an existing AI Gateway dataset. Args: gateway_id: gateway id @@ -455,7 +455,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[DatasetListResponse, AsyncV4PagePaginationArray[DatasetListResponse]]: """ - List Datasets + Lists all AI Gateway evaluator types configured for the account. Args: gateway_id: gateway id @@ -510,7 +510,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetDeleteResponse: """ - Delete a Dataset + Deletes an AI Gateway dataset. Args: gateway_id: gateway id @@ -555,7 +555,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetGetResponse: """ - Fetch a Dataset + Retrieves details for a specific AI Gateway dataset. Args: gateway_id: gateway id diff --git a/src/cloudflare/resources/ai_gateway/evaluations.py b/src/cloudflare/resources/ai_gateway/evaluations.py index e3d9fd87309..b466e084495 100644 --- a/src/cloudflare/resources/ai_gateway/evaluations.py +++ b/src/cloudflare/resources/ai_gateway/evaluations.py @@ -64,7 +64,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EvaluationCreateResponse: """ - Create a new Evaluation + Creates a new AI Gateway. Args: gateway_id: gateway id @@ -119,7 +119,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncV4PagePaginationArray[EvaluationListResponse]: """ - List Evaluations + Lists all AI Gateway evaluator types configured for the account. Args: gateway_id: gateway id @@ -174,7 +174,7 @@ def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EvaluationDeleteResponse: """ - Delete a Evaluation + Deletes an AI Gateway dataset. Args: gateway_id: gateway id @@ -219,7 +219,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EvaluationGetResponse: """ - Fetch a Evaluation + Retrieves details for a specific AI Gateway dataset. Args: gateway_id: gateway id @@ -287,7 +287,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EvaluationCreateResponse: """ - Create a new Evaluation + Creates a new AI Gateway. Args: gateway_id: gateway id @@ -342,7 +342,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[EvaluationListResponse, AsyncV4PagePaginationArray[EvaluationListResponse]]: """ - List Evaluations + Lists all AI Gateway evaluator types configured for the account. Args: gateway_id: gateway id @@ -397,7 +397,7 @@ async def delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EvaluationDeleteResponse: """ - Delete a Evaluation + Deletes an AI Gateway dataset. Args: gateway_id: gateway id @@ -442,7 +442,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EvaluationGetResponse: """ - Fetch a Evaluation + Retrieves details for a specific AI Gateway dataset. Args: gateway_id: gateway id diff --git a/src/cloudflare/resources/ai_gateway/logs.py b/src/cloudflare/resources/ai_gateway/logs.py index 8518d36781c..0ea6559c96b 100644 --- a/src/cloudflare/resources/ai_gateway/logs.py +++ b/src/cloudflare/resources/ai_gateway/logs.py @@ -236,7 +236,7 @@ def edit( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - Patch Gateway Log + Updates metadata for an AI Gateway log entry. Args: gateway_id: gateway id @@ -289,7 +289,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LogGetResponse: """ - Get Gateway Log Detail + Retrieves detailed information for a specific AI Gateway log entry. Args: gateway_id: gateway id @@ -334,7 +334,7 @@ def request( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - Get Gateway Log Request + Retrieves the original request payload for an AI Gateway log entry. Args: gateway_id: gateway id @@ -375,7 +375,7 @@ def response( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - Get Gateway Log Response + Retrieves the response payload for an AI Gateway log entry. Args: gateway_id: gateway id @@ -610,7 +610,7 @@ async def edit( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - Patch Gateway Log + Updates metadata for an AI Gateway log entry. Args: gateway_id: gateway id @@ -663,7 +663,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> LogGetResponse: """ - Get Gateway Log Detail + Retrieves detailed information for a specific AI Gateway log entry. Args: gateway_id: gateway id @@ -708,7 +708,7 @@ async def request( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - Get Gateway Log Request + Retrieves the original request payload for an AI Gateway log entry. Args: gateway_id: gateway id @@ -749,7 +749,7 @@ async def response( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: """ - Get Gateway Log Response + Retrieves the response payload for an AI Gateway log entry. Args: gateway_id: gateway id diff --git a/src/cloudflare/resources/ai_gateway/provider_configs.py b/src/cloudflare/resources/ai_gateway/provider_configs.py index 60c7fc5f891..2e75c14bdc3 100644 --- a/src/cloudflare/resources/ai_gateway/provider_configs.py +++ b/src/cloudflare/resources/ai_gateway/provider_configs.py @@ -66,7 +66,7 @@ def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProviderConfigCreateResponse: """ - Create a new Provider Configs + Creates a new AI Gateway. Args: gateway_id: gateway id @@ -122,7 +122,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncV4PagePaginationArray[ProviderConfigListResponse]: """ - List Provider Configs + Lists all AI Gateway evaluator types configured for the account. Args: gateway_id: gateway id @@ -199,7 +199,7 @@ async def create( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProviderConfigCreateResponse: """ - Create a new Provider Configs + Creates a new AI Gateway. Args: gateway_id: gateway id @@ -255,7 +255,7 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ProviderConfigListResponse, AsyncV4PagePaginationArray[ProviderConfigListResponse]]: """ - List Provider Configs + Lists all AI Gateway evaluator types configured for the account. Args: gateway_id: gateway id diff --git a/src/cloudflare/resources/ai_gateway/urls.py b/src/cloudflare/resources/ai_gateway/urls.py index 8f660faa164..988e21ecc24 100644 --- a/src/cloudflare/resources/ai_gateway/urls.py +++ b/src/cloudflare/resources/ai_gateway/urls.py @@ -56,7 +56,7 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> str: """ - Get Gateway URL + Retrieves the endpoint URL for an AI Gateway. Args: gateway_id: gateway id @@ -122,7 +122,7 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> str: """ - Get Gateway URL + Retrieves the endpoint URL for an AI Gateway. Args: gateway_id: gateway id diff --git a/src/cloudflare/resources/aisearch/instances/__init__.py b/src/cloudflare/resources/aisearch/instances/__init__.py index bcd3fe82f43..f07262e470e 100644 --- a/src/cloudflare/resources/aisearch/instances/__init__.py +++ b/src/cloudflare/resources/aisearch/instances/__init__.py @@ -8,14 +8,6 @@ JobsResourceWithStreamingResponse, AsyncJobsResourceWithStreamingResponse, ) -from .items import ( - ItemsResource, - AsyncItemsResource, - ItemsResourceWithRawResponse, - AsyncItemsResourceWithRawResponse, - ItemsResourceWithStreamingResponse, - AsyncItemsResourceWithStreamingResponse, -) from .instances import ( InstancesResource, AsyncInstancesResource, @@ -26,12 +18,6 @@ ) __all__ = [ - "ItemsResource", - "AsyncItemsResource", - "ItemsResourceWithRawResponse", - "AsyncItemsResourceWithRawResponse", - "ItemsResourceWithStreamingResponse", - "AsyncItemsResourceWithStreamingResponse", "JobsResource", "AsyncJobsResource", "JobsResourceWithRawResponse", diff --git a/src/cloudflare/resources/aisearch/instances/instances.py b/src/cloudflare/resources/aisearch/instances/instances.py index 256d55b0ba3..4c7637ead72 100644 --- a/src/cloudflare/resources/aisearch/instances/instances.py +++ b/src/cloudflare/resources/aisearch/instances/instances.py @@ -15,14 +15,6 @@ JobsResourceWithStreamingResponse, AsyncJobsResourceWithStreamingResponse, ) -from .items import ( - ItemsResource, - AsyncItemsResource, - ItemsResourceWithRawResponse, - AsyncItemsResourceWithRawResponse, - ItemsResourceWithStreamingResponse, - AsyncItemsResourceWithStreamingResponse, -) from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property @@ -56,10 +48,6 @@ class InstancesResource(SyncAPIResource): - @cached_property - def items(self) -> ItemsResource: - return ItemsResource(self._client) - @cached_property def jobs(self) -> JobsResource: return JobsResource(self._client) @@ -88,8 +76,6 @@ def create( *, account_id: str, id: str, - source: str, - type: Literal["r2", "web-crawler"], ai_gateway_id: Optional[str] | Omit = omit, aisearch_model: Literal[ "@cf/meta/llama-3.3-70b-instruct-fp8-fast", @@ -122,6 +108,9 @@ def create( "", ] | Omit = omit, + cache: bool | Omit = omit, + cache_threshold: Literal["super_strict_match", "close_enough", "flexible_friend", "anything_goes"] + | Omit = omit, chunk: bool | Omit = omit, chunk_overlap: int | Omit = omit, chunk_size: int | Omit = omit, @@ -178,8 +167,10 @@ def create( | Omit = omit, rewrite_query: bool | Omit = omit, score_threshold: float | Omit = omit, + source: str | Omit = omit, source_params: Optional[instance_create_params.SourceParams] | Omit = omit, token_id: str | Omit = omit, + type: Literal["r2", "web-crawler"] | Omit = omit, # 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, @@ -208,10 +199,10 @@ def create( body=maybe_transform( { "id": id, - "source": source, - "type": type, "ai_gateway_id": ai_gateway_id, "aisearch_model": aisearch_model, + "cache": cache, + "cache_threshold": cache_threshold, "chunk": chunk, "chunk_overlap": chunk_overlap, "chunk_size": chunk_size, @@ -228,8 +219,10 @@ def create( "rewrite_model": rewrite_model, "rewrite_query": rewrite_query, "score_threshold": score_threshold, + "source": source, "source_params": source_params, "token_id": token_id, + "type": type, }, instance_create_params.InstanceCreateParams, ), @@ -451,6 +444,8 @@ def list( self, *, account_id: str, + order_by: Literal["created_at"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, page: int | Omit = omit, per_page: int | Omit = omit, search: str | Omit = omit, @@ -465,6 +460,10 @@ def list( List instances. Args: + order_by: Order By Column Name + + order_by_direction: Order By Direction + search: Search by id extra_headers: Send extra headers @@ -487,6 +486,8 @@ def list( timeout=timeout, query=maybe_transform( { + "order_by": order_by, + "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "search": search, @@ -759,10 +760,6 @@ def stats( class AsyncInstancesResource(AsyncAPIResource): - @cached_property - def items(self) -> AsyncItemsResource: - return AsyncItemsResource(self._client) - @cached_property def jobs(self) -> AsyncJobsResource: return AsyncJobsResource(self._client) @@ -791,8 +788,6 @@ async def create( *, account_id: str, id: str, - source: str, - type: Literal["r2", "web-crawler"], ai_gateway_id: Optional[str] | Omit = omit, aisearch_model: Literal[ "@cf/meta/llama-3.3-70b-instruct-fp8-fast", @@ -825,6 +820,9 @@ async def create( "", ] | Omit = omit, + cache: bool | Omit = omit, + cache_threshold: Literal["super_strict_match", "close_enough", "flexible_friend", "anything_goes"] + | Omit = omit, chunk: bool | Omit = omit, chunk_overlap: int | Omit = omit, chunk_size: int | Omit = omit, @@ -881,8 +879,10 @@ async def create( | Omit = omit, rewrite_query: bool | Omit = omit, score_threshold: float | Omit = omit, + source: str | Omit = omit, source_params: Optional[instance_create_params.SourceParams] | Omit = omit, token_id: str | Omit = omit, + type: Literal["r2", "web-crawler"] | Omit = omit, # 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, @@ -911,10 +911,10 @@ async def create( body=await async_maybe_transform( { "id": id, - "source": source, - "type": type, "ai_gateway_id": ai_gateway_id, "aisearch_model": aisearch_model, + "cache": cache, + "cache_threshold": cache_threshold, "chunk": chunk, "chunk_overlap": chunk_overlap, "chunk_size": chunk_size, @@ -931,8 +931,10 @@ async def create( "rewrite_model": rewrite_model, "rewrite_query": rewrite_query, "score_threshold": score_threshold, + "source": source, "source_params": source_params, "token_id": token_id, + "type": type, }, instance_create_params.InstanceCreateParams, ), @@ -1154,6 +1156,8 @@ def list( self, *, account_id: str, + order_by: Literal["created_at"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, page: int | Omit = omit, per_page: int | Omit = omit, search: str | Omit = omit, @@ -1168,6 +1172,10 @@ def list( List instances. Args: + order_by: Order By Column Name + + order_by_direction: Order By Direction + search: Search by id extra_headers: Send extra headers @@ -1190,6 +1198,8 @@ def list( timeout=timeout, query=maybe_transform( { + "order_by": order_by, + "order_by_direction": order_by_direction, "page": page, "per_page": per_page, "search": search, @@ -1490,10 +1500,6 @@ def __init__(self, instances: InstancesResource) -> None: instances.stats, ) - @cached_property - def items(self) -> ItemsResourceWithRawResponse: - return ItemsResourceWithRawResponse(self._instances.items) - @cached_property def jobs(self) -> JobsResourceWithRawResponse: return JobsResourceWithRawResponse(self._instances.jobs) @@ -1528,10 +1534,6 @@ def __init__(self, instances: AsyncInstancesResource) -> None: instances.stats, ) - @cached_property - def items(self) -> AsyncItemsResourceWithRawResponse: - return AsyncItemsResourceWithRawResponse(self._instances.items) - @cached_property def jobs(self) -> AsyncJobsResourceWithRawResponse: return AsyncJobsResourceWithRawResponse(self._instances.jobs) @@ -1566,10 +1568,6 @@ def __init__(self, instances: InstancesResource) -> None: instances.stats, ) - @cached_property - def items(self) -> ItemsResourceWithStreamingResponse: - return ItemsResourceWithStreamingResponse(self._instances.items) - @cached_property def jobs(self) -> JobsResourceWithStreamingResponse: return JobsResourceWithStreamingResponse(self._instances.jobs) @@ -1604,10 +1602,6 @@ def __init__(self, instances: AsyncInstancesResource) -> None: instances.stats, ) - @cached_property - def items(self) -> AsyncItemsResourceWithStreamingResponse: - return AsyncItemsResourceWithStreamingResponse(self._instances.items) - @cached_property def jobs(self) -> AsyncJobsResourceWithStreamingResponse: return AsyncJobsResourceWithStreamingResponse(self._instances.jobs) diff --git a/src/cloudflare/resources/aisearch/instances/items.py b/src/cloudflare/resources/aisearch/instances/items.py deleted file mode 100644 index eaa492c2593..00000000000 --- a/src/cloudflare/resources/aisearch/instances/items.py +++ /dev/null @@ -1,317 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Type, cast -from typing_extensions import Literal - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ...._utils import maybe_transform -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 ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray -from ...._base_client import AsyncPaginator, make_request_options -from ....types.aisearch.instances import item_list_params -from ....types.aisearch.instances.item_get_response import ItemGetResponse -from ....types.aisearch.instances.item_list_response import ItemListResponse - -__all__ = ["ItemsResource", "AsyncItemsResource"] - - -class ItemsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ItemsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return ItemsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ItemsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return ItemsResourceWithStreamingResponse(self) - - def list( - self, - id: str, - *, - account_id: str, - page: int | Omit = omit, - per_page: int | Omit = omit, - search: str | Omit = omit, - status: Literal["queued", "running", "completed", "error", "skipped"] | Omit = omit, - # 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, - ) -> SyncV4PagePaginationArray[ItemListResponse]: - """ - Lists indexed items in an AI Search instance. - - Args: - id: Use your AI Search ID. - - 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 id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get_api_list( - f"/accounts/{account_id}/ai-search/instances/{id}/items", - page=SyncV4PagePaginationArray[ItemListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "page": page, - "per_page": per_page, - "search": search, - "status": status, - }, - item_list_params.ItemListParams, - ), - ), - model=ItemListResponse, - ) - - def get( - self, - item_id: str, - *, - account_id: str, - 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, - ) -> ItemGetResponse: - """ - Retrieves a specific indexed item from an AI Search instance. - - Args: - id: Use your AI Search ID. - - 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 id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not item_id: - raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return self._get( - f"/accounts/{account_id}/ai-search/instances/{id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, - ), - cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), - ) - - -class AsyncItemsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncItemsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers - """ - return AsyncItemsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncItemsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response - """ - return AsyncItemsResourceWithStreamingResponse(self) - - def list( - self, - id: str, - *, - account_id: str, - page: int | Omit = omit, - per_page: int | Omit = omit, - search: str | Omit = omit, - status: Literal["queued", "running", "completed", "error", "skipped"] | Omit = omit, - # 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, - ) -> AsyncPaginator[ItemListResponse, AsyncV4PagePaginationArray[ItemListResponse]]: - """ - Lists indexed items in an AI Search instance. - - Args: - id: Use your AI Search ID. - - 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 id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get_api_list( - f"/accounts/{account_id}/ai-search/instances/{id}/items", - page=AsyncV4PagePaginationArray[ItemListResponse], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "page": page, - "per_page": per_page, - "search": search, - "status": status, - }, - item_list_params.ItemListParams, - ), - ), - model=ItemListResponse, - ) - - async def get( - self, - item_id: str, - *, - account_id: str, - 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, - ) -> ItemGetResponse: - """ - Retrieves a specific indexed item from an AI Search instance. - - Args: - id: Use your AI Search ID. - - 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 id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not item_id: - raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return await self._get( - f"/accounts/{account_id}/ai-search/instances/{id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[ItemGetResponse]._unwrapper, - ), - cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]), - ) - - -class ItemsResourceWithRawResponse: - def __init__(self, items: ItemsResource) -> None: - self._items = items - - self.list = to_raw_response_wrapper( - items.list, - ) - self.get = to_raw_response_wrapper( - items.get, - ) - - -class AsyncItemsResourceWithRawResponse: - def __init__(self, items: AsyncItemsResource) -> None: - self._items = items - - self.list = async_to_raw_response_wrapper( - items.list, - ) - self.get = async_to_raw_response_wrapper( - items.get, - ) - - -class ItemsResourceWithStreamingResponse: - def __init__(self, items: ItemsResource) -> None: - self._items = items - - self.list = to_streamed_response_wrapper( - items.list, - ) - self.get = to_streamed_response_wrapper( - items.get, - ) - - -class AsyncItemsResourceWithStreamingResponse: - def __init__(self, items: AsyncItemsResource) -> None: - self._items = items - - self.list = async_to_streamed_response_wrapper( - items.list, - ) - self.get = async_to_streamed_response_wrapper( - items.get, - ) diff --git a/src/cloudflare/resources/aisearch/instances/jobs.py b/src/cloudflare/resources/aisearch/instances/jobs.py index d5c03bf6e7a..24ef439a64c 100644 --- a/src/cloudflare/resources/aisearch/instances/jobs.py +++ b/src/cloudflare/resources/aisearch/instances/jobs.py @@ -19,7 +19,7 @@ from ...._wrappers import ResultWrapper from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options -from ....types.aisearch.instances import job_list_params, job_logs_params +from ....types.aisearch.instances import job_list_params, job_logs_params, job_create_params from ....types.aisearch.instances.job_get_response import JobGetResponse from ....types.aisearch.instances.job_list_response import JobListResponse from ....types.aisearch.instances.job_logs_response import JobLogsResponse @@ -53,6 +53,7 @@ def create( id: str, *, account_id: str, + description: str | Omit = omit, # 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, @@ -80,6 +81,7 @@ def create( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return self._post( f"/accounts/{account_id}/ai-search/instances/{id}/jobs", + body=maybe_transform({"description": description}, job_create_params.JobCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -266,6 +268,7 @@ async def create( id: str, *, account_id: str, + description: str | Omit = omit, # 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, @@ -293,6 +296,7 @@ async def create( raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") return await self._post( f"/accounts/{account_id}/ai-search/instances/{id}/jobs", + body=await async_maybe_transform({"description": description}, job_create_params.JobCreateParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/cloudflare/resources/aisearch/tokens.py b/src/cloudflare/resources/aisearch/tokens.py index 8916dfecec0..94654a58c85 100644 --- a/src/cloudflare/resources/aisearch/tokens.py +++ b/src/cloudflare/resources/aisearch/tokens.py @@ -3,6 +3,7 @@ from __future__ import annotations from typing import Type, cast +from typing_extensions import Literal import httpx @@ -152,6 +153,8 @@ def list( self, *, account_id: str, + order_by: Literal["created_at"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, page: int | Omit = omit, per_page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -165,6 +168,10 @@ def list( List tokens. Args: + order_by: Order By Column Name + + order_by_direction: Order By Direction + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -185,6 +192,8 @@ def list( timeout=timeout, query=maybe_transform( { + "order_by": order_by, + "order_by_direction": order_by_direction, "page": page, "per_page": per_page, }, @@ -398,6 +407,8 @@ def list( self, *, account_id: str, + order_by: Literal["created_at"] | Omit = omit, + order_by_direction: Literal["asc", "desc"] | Omit = omit, page: int | Omit = omit, per_page: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -411,6 +422,10 @@ def list( List tokens. Args: + order_by: Order By Column Name + + order_by_direction: Order By Direction + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -431,6 +446,8 @@ def list( timeout=timeout, query=maybe_transform( { + "order_by": order_by, + "order_by_direction": order_by_direction, "page": page, "per_page": per_page, }, diff --git a/src/cloudflare/resources/api_gateway/configurations.py b/src/cloudflare/resources/api_gateway/configurations.py index 96cebe13223..bd62e5e568b 100644 --- a/src/cloudflare/resources/api_gateway/configurations.py +++ b/src/cloudflare/resources/api_gateway/configurations.py @@ -57,8 +57,10 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Configuration: - """ - Update configuration properties + """Updates API Shield configuration settings for a zone. + + Can modify validation + strictness, enforcement mode, and other global settings. Args: zone_id: Identifier. @@ -105,7 +107,8 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Configuration: """ - Retrieve information about specific configuration properties + Gets the current API Shield configuration settings for a zone, including + validation behavior and enforcement mode. Args: zone_id: Identifier. @@ -169,8 +172,10 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Configuration: - """ - Update configuration properties + """Updates API Shield configuration settings for a zone. + + Can modify validation + strictness, enforcement mode, and other global settings. Args: zone_id: Identifier. @@ -219,7 +224,8 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Configuration: """ - Retrieve information about specific configuration properties + Gets the current API Shield configuration settings for a zone, including + validation behavior and enforcement mode. Args: zone_id: Identifier. diff --git a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py index 1434470cfad..8f4d2735cd0 100644 --- a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py +++ b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py @@ -56,8 +56,10 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FallthroughCreateResponse: - """ - Generate fallthrough WAF expression template from a set of API hosts + """Creates an expression template fallthrough rule for API Shield. + + Used for + configuring default behavior when no other expression templates match. Args: zone_id: Identifier. @@ -120,8 +122,10 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> FallthroughCreateResponse: - """ - Generate fallthrough WAF expression template from a set of API hosts + """Creates an expression template fallthrough rule for API Shield. + + Used for + configuring default behavior when no other expression templates match. Args: zone_id: Identifier. diff --git a/src/cloudflare/resources/api_gateway/operations/operations.py b/src/cloudflare/resources/api_gateway/operations/operations.py index 1a6038c3688..f69385e3dd9 100644 --- a/src/cloudflare/resources/api_gateway/operations/operations.py +++ b/src/cloudflare/resources/api_gateway/operations/operations.py @@ -152,7 +152,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncV4PagePaginationArray[OperationListResponse]: """ - Retrieve information about all operations on a zone + Lists all API operations tracked by API Shield for a zone with pagination. + Returns operation details including method, path, and feature configurations. Args: zone_id: Identifier. @@ -223,8 +224,10 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OperationDeleteResponse: - """ - Delete an operation + """Removes a single API operation from API Shield endpoint management. + + The + operation will no longer be tracked or protected by API Shield rules. Args: zone_id: Identifier. @@ -307,7 +310,8 @@ def bulk_delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OperationBulkDeleteResponse: """ - Delete multiple operations + Bulk removes multiple API operations from API Shield endpoint management in a + single request. Efficient for cleaning up unused endpoints. Args: zone_id: Identifier. @@ -344,7 +348,8 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OperationGetResponse: """ - Retrieve information about an operation + Gets detailed information about a specific API operation in API Shield, + including its schema validation settings and traffic statistics. Args: zone_id: Identifier. @@ -489,7 +494,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[OperationListResponse, AsyncV4PagePaginationArray[OperationListResponse]]: """ - Retrieve information about all operations on a zone + Lists all API operations tracked by API Shield for a zone with pagination. + Returns operation details including method, path, and feature configurations. Args: zone_id: Identifier. @@ -560,8 +566,10 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OperationDeleteResponse: - """ - Delete an operation + """Removes a single API operation from API Shield endpoint management. + + The + operation will no longer be tracked or protected by API Shield rules. Args: zone_id: Identifier. @@ -644,7 +652,8 @@ async def bulk_delete( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OperationBulkDeleteResponse: """ - Delete multiple operations + Bulk removes multiple API operations from API Shield endpoint management in a + single request. Efficient for cleaning up unused endpoints. Args: zone_id: Identifier. @@ -681,7 +690,8 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OperationGetResponse: """ - Retrieve information about an operation + Gets detailed information about a specific API operation in API Shield, + including its schema validation settings and traffic statistics. Args: zone_id: Identifier. diff --git a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py index 01861b64473..d193678ec7d 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py @@ -60,8 +60,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncV4PagePaginationArray[HostListResponse]: - """ - Retrieve schema hosts in a zone + """Lists all unique hosts found in uploaded OpenAPI schemas for the zone. + + Useful + for understanding which domains have schema coverage. Args: zone_id: Identifier. @@ -136,8 +138,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[HostListResponse, AsyncV4PagePaginationArray[HostListResponse]]: - """ - Retrieve schema hosts in a zone + """Lists all unique hosts found in uploaded OpenAPI schemas for the zone. + + Useful + for understanding which domains have schema coverage. Args: zone_id: Identifier. diff --git a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py index e7d9626a705..346db5396d5 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py @@ -166,7 +166,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncV4PagePaginationArray[OldPublicSchema]: """ - Retrieve information about all schemas on a zone + Lists all OpenAPI schemas uploaded to API Shield for the zone, including their + validation status and associated operations. Args: zone_id: Identifier. @@ -225,8 +226,10 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserSchemaDeleteResponse: - """ - Delete a schema + """Permanently removes an uploaded OpenAPI schema from API Shield schema + validation. + + Operations using this schema will lose their validation rules. Args: zone_id: Identifier. @@ -267,8 +270,10 @@ def edit( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OldPublicSchema: - """ - Enable validation for a schema + """Activates schema validation for an uploaded OpenAPI schema. + + Requests to matching + endpoints will be validated against the schema definitions. Args: zone_id: Identifier. @@ -319,7 +324,8 @@ def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OldPublicSchema: """ - Retrieve information about a specific schema on a zone + Gets detailed information about a specific uploaded OpenAPI schema, including + its contents and validation configuration. Args: zone_id: Identifier. @@ -468,7 +474,8 @@ def list( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[OldPublicSchema, AsyncV4PagePaginationArray[OldPublicSchema]]: """ - Retrieve information about all schemas on a zone + Lists all OpenAPI schemas uploaded to API Shield for the zone, including their + validation status and associated operations. Args: zone_id: Identifier. @@ -527,8 +534,10 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> UserSchemaDeleteResponse: - """ - Delete a schema + """Permanently removes an uploaded OpenAPI schema from API Shield schema + validation. + + Operations using this schema will lose their validation rules. Args: zone_id: Identifier. @@ -569,8 +578,10 @@ async def edit( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OldPublicSchema: - """ - Enable validation for a schema + """Activates schema validation for an uploaded OpenAPI schema. + + Requests to matching + endpoints will be validated against the schema definitions. Args: zone_id: Identifier. @@ -621,7 +632,8 @@ async def get( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OldPublicSchema: """ - Retrieve information about a specific schema on a zone + Gets detailed information about a specific uploaded OpenAPI schema, including + its contents and validation configuration. Args: zone_id: Identifier. diff --git a/src/cloudflare/resources/billing/__init__.py b/src/cloudflare/resources/billing/__init__.py index c16ec03c4dc..a0005fa8305 100644 --- a/src/cloudflare/resources/billing/__init__.py +++ b/src/cloudflare/resources/billing/__init__.py @@ -1,5 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .usage import ( + UsageResource, + AsyncUsageResource, + UsageResourceWithRawResponse, + AsyncUsageResourceWithRawResponse, + UsageResourceWithStreamingResponse, + AsyncUsageResourceWithStreamingResponse, +) from .billing import ( BillingResource, AsyncBillingResource, @@ -24,6 +32,12 @@ "AsyncProfilesResourceWithRawResponse", "ProfilesResourceWithStreamingResponse", "AsyncProfilesResourceWithStreamingResponse", + "UsageResource", + "AsyncUsageResource", + "UsageResourceWithRawResponse", + "AsyncUsageResourceWithRawResponse", + "UsageResourceWithStreamingResponse", + "AsyncUsageResourceWithStreamingResponse", "BillingResource", "AsyncBillingResource", "BillingResourceWithRawResponse", diff --git a/src/cloudflare/resources/billing/billing.py b/src/cloudflare/resources/billing/billing.py index d57c019144e..5d7a8e1d11a 100644 --- a/src/cloudflare/resources/billing/billing.py +++ b/src/cloudflare/resources/billing/billing.py @@ -2,6 +2,14 @@ from __future__ import annotations +from .usage import ( + UsageResource, + AsyncUsageResource, + UsageResourceWithRawResponse, + AsyncUsageResourceWithRawResponse, + UsageResourceWithStreamingResponse, + AsyncUsageResourceWithStreamingResponse, +) from .profiles import ( ProfilesResource, AsyncProfilesResource, @@ -21,6 +29,10 @@ class BillingResource(SyncAPIResource): def profiles(self) -> ProfilesResource: return ProfilesResource(self._client) + @cached_property + def usage(self) -> UsageResource: + return UsageResource(self._client) + @cached_property def with_raw_response(self) -> BillingResourceWithRawResponse: """ @@ -46,6 +58,10 @@ class AsyncBillingResource(AsyncAPIResource): def profiles(self) -> AsyncProfilesResource: return AsyncProfilesResource(self._client) + @cached_property + def usage(self) -> AsyncUsageResource: + return AsyncUsageResource(self._client) + @cached_property def with_raw_response(self) -> AsyncBillingResourceWithRawResponse: """ @@ -74,6 +90,10 @@ def __init__(self, billing: BillingResource) -> None: def profiles(self) -> ProfilesResourceWithRawResponse: return ProfilesResourceWithRawResponse(self._billing.profiles) + @cached_property + def usage(self) -> UsageResourceWithRawResponse: + return UsageResourceWithRawResponse(self._billing.usage) + class AsyncBillingResourceWithRawResponse: def __init__(self, billing: AsyncBillingResource) -> None: @@ -83,6 +103,10 @@ def __init__(self, billing: AsyncBillingResource) -> None: def profiles(self) -> AsyncProfilesResourceWithRawResponse: return AsyncProfilesResourceWithRawResponse(self._billing.profiles) + @cached_property + def usage(self) -> AsyncUsageResourceWithRawResponse: + return AsyncUsageResourceWithRawResponse(self._billing.usage) + class BillingResourceWithStreamingResponse: def __init__(self, billing: BillingResource) -> None: @@ -92,6 +116,10 @@ def __init__(self, billing: BillingResource) -> None: def profiles(self) -> ProfilesResourceWithStreamingResponse: return ProfilesResourceWithStreamingResponse(self._billing.profiles) + @cached_property + def usage(self) -> UsageResourceWithStreamingResponse: + return UsageResourceWithStreamingResponse(self._billing.usage) + class AsyncBillingResourceWithStreamingResponse: def __init__(self, billing: AsyncBillingResource) -> None: @@ -100,3 +128,7 @@ def __init__(self, billing: AsyncBillingResource) -> None: @cached_property def profiles(self) -> AsyncProfilesResourceWithStreamingResponse: return AsyncProfilesResourceWithStreamingResponse(self._billing.profiles) + + @cached_property + def usage(self) -> AsyncUsageResourceWithStreamingResponse: + return AsyncUsageResourceWithStreamingResponse(self._billing.usage) diff --git a/src/cloudflare/resources/billing/usage.py b/src/cloudflare/resources/billing/usage.py new file mode 100644 index 00000000000..7e68c5f15ec --- /dev/null +++ b/src/cloudflare/resources/billing/usage.py @@ -0,0 +1,251 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Type, Union, cast +from datetime import date + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +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.billing import usage_paygo_params +from ...types.billing.usage_paygo_response import UsagePaygoResponse + +__all__ = ["UsageResource", "AsyncUsageResource"] + + +class UsageResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> UsageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return UsageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> UsageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return UsageResourceWithStreamingResponse(self) + + def paygo( + self, + *, + account_id: str, + from_: Union[str, date] | Omit = omit, + last_month_period_start: int | Omit = omit, + last_year_period_start: int | Omit = omit, + to: Union[str, date] | Omit = omit, + # 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, + ) -> UsagePaygoResponse: + """Returns billable usage data for PayGo (self-serve) accounts. + + When no query + parameters are provided, returns usage for the current billing period. + + Supports two mutually exclusive query modes: + + **Billing period mode:** Use `last_year_period_start` and + `last_month_period_start` to query a specific billing period. + + **Date range mode:** Use `from` and `to` to query a custom date range (maximum + 62 days). + + This endpoint is currently in beta and access is restricted to select accounts. + + Args: + account_id: Represents a Cloudflare resource identifier tag. + + from_: Defines the start date for the usage query (e.g., 2025-02-01). + + last_month_period_start: Specifies the month of the billing period to query (1-12). Must be provided + together with last_year_period_start. Mutually exclusive with from/to. + + last_year_period_start: Specifies the year of the billing period to query (e.g., 2025). Must be provided + together with last_month_period_start. Mutually exclusive with from/to. + + to: Defines the end date for the usage query (e.g., 2025-03-01). + + 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}") + return self._get( + f"/accounts/{account_id}/billing/usage/paygo", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "from_": from_, + "last_month_period_start": last_month_period_start, + "last_year_period_start": last_year_period_start, + "to": to, + }, + usage_paygo_params.UsagePaygoParams, + ), + post_parser=ResultWrapper[UsagePaygoResponse]._unwrapper, + ), + cast_to=cast(Type[UsagePaygoResponse], ResultWrapper[UsagePaygoResponse]), + ) + + +class AsyncUsageResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncUsageResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncUsageResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncUsageResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncUsageResourceWithStreamingResponse(self) + + async def paygo( + self, + *, + account_id: str, + from_: Union[str, date] | Omit = omit, + last_month_period_start: int | Omit = omit, + last_year_period_start: int | Omit = omit, + to: Union[str, date] | Omit = omit, + # 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, + ) -> UsagePaygoResponse: + """Returns billable usage data for PayGo (self-serve) accounts. + + When no query + parameters are provided, returns usage for the current billing period. + + Supports two mutually exclusive query modes: + + **Billing period mode:** Use `last_year_period_start` and + `last_month_period_start` to query a specific billing period. + + **Date range mode:** Use `from` and `to` to query a custom date range (maximum + 62 days). + + This endpoint is currently in beta and access is restricted to select accounts. + + Args: + account_id: Represents a Cloudflare resource identifier tag. + + from_: Defines the start date for the usage query (e.g., 2025-02-01). + + last_month_period_start: Specifies the month of the billing period to query (1-12). Must be provided + together with last_year_period_start. Mutually exclusive with from/to. + + last_year_period_start: Specifies the year of the billing period to query (e.g., 2025). Must be provided + together with last_month_period_start. Mutually exclusive with from/to. + + to: Defines the end date for the usage query (e.g., 2025-03-01). + + 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}") + return await self._get( + f"/accounts/{account_id}/billing/usage/paygo", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=await async_maybe_transform( + { + "from_": from_, + "last_month_period_start": last_month_period_start, + "last_year_period_start": last_year_period_start, + "to": to, + }, + usage_paygo_params.UsagePaygoParams, + ), + post_parser=ResultWrapper[UsagePaygoResponse]._unwrapper, + ), + cast_to=cast(Type[UsagePaygoResponse], ResultWrapper[UsagePaygoResponse]), + ) + + +class UsageResourceWithRawResponse: + def __init__(self, usage: UsageResource) -> None: + self._usage = usage + + self.paygo = to_raw_response_wrapper( + usage.paygo, + ) + + +class AsyncUsageResourceWithRawResponse: + def __init__(self, usage: AsyncUsageResource) -> None: + self._usage = usage + + self.paygo = async_to_raw_response_wrapper( + usage.paygo, + ) + + +class UsageResourceWithStreamingResponse: + def __init__(self, usage: UsageResource) -> None: + self._usage = usage + + self.paygo = to_streamed_response_wrapper( + usage.paygo, + ) + + +class AsyncUsageResourceWithStreamingResponse: + def __init__(self, usage: AsyncUsageResource) -> None: + self._usage = usage + + self.paygo = async_to_streamed_response_wrapper( + usage.paygo, + ) diff --git a/src/cloudflare/resources/browser_rendering/__init__.py b/src/cloudflare/resources/browser_rendering/__init__.py index ca6102ced41..9b2fe570bdb 100644 --- a/src/cloudflare/resources/browser_rendering/__init__.py +++ b/src/cloudflare/resources/browser_rendering/__init__.py @@ -16,6 +16,14 @@ JsonResourceWithStreamingResponse, AsyncJsonResourceWithStreamingResponse, ) +from .crawl import ( + CrawlResource, + AsyncCrawlResource, + CrawlResourceWithRawResponse, + AsyncCrawlResourceWithRawResponse, + CrawlResourceWithStreamingResponse, + AsyncCrawlResourceWithStreamingResponse, +) from .links import ( LinksResource, AsyncLinksResource, @@ -122,6 +130,12 @@ "AsyncMarkdownResourceWithRawResponse", "MarkdownResourceWithStreamingResponse", "AsyncMarkdownResourceWithStreamingResponse", + "CrawlResource", + "AsyncCrawlResource", + "CrawlResourceWithRawResponse", + "AsyncCrawlResourceWithRawResponse", + "CrawlResourceWithStreamingResponse", + "AsyncCrawlResourceWithStreamingResponse", "BrowserRenderingResource", "AsyncBrowserRenderingResource", "BrowserRenderingResourceWithRawResponse", diff --git a/src/cloudflare/resources/browser_rendering/browser_rendering.py b/src/cloudflare/resources/browser_rendering/browser_rendering.py index bee931f57df..608d0c027d3 100644 --- a/src/cloudflare/resources/browser_rendering/browser_rendering.py +++ b/src/cloudflare/resources/browser_rendering/browser_rendering.py @@ -18,6 +18,14 @@ JsonResourceWithStreamingResponse, AsyncJsonResourceWithStreamingResponse, ) +from .crawl import ( + CrawlResource, + AsyncCrawlResource, + CrawlResourceWithRawResponse, + AsyncCrawlResourceWithRawResponse, + CrawlResourceWithStreamingResponse, + AsyncCrawlResourceWithStreamingResponse, +) from .links import ( LinksResource, AsyncLinksResource, @@ -105,6 +113,10 @@ def links(self) -> LinksResource: def markdown(self) -> MarkdownResource: return MarkdownResource(self._client) + @cached_property + def crawl(self) -> CrawlResource: + return CrawlResource(self._client) + @cached_property def with_raw_response(self) -> BrowserRenderingResourceWithRawResponse: """ @@ -158,6 +170,10 @@ def links(self) -> AsyncLinksResource: def markdown(self) -> AsyncMarkdownResource: return AsyncMarkdownResource(self._client) + @cached_property + def crawl(self) -> AsyncCrawlResource: + return AsyncCrawlResource(self._client) + @cached_property def with_raw_response(self) -> AsyncBrowserRenderingResourceWithRawResponse: """ @@ -214,6 +230,10 @@ def links(self) -> LinksResourceWithRawResponse: def markdown(self) -> MarkdownResourceWithRawResponse: return MarkdownResourceWithRawResponse(self._browser_rendering.markdown) + @cached_property + def crawl(self) -> CrawlResourceWithRawResponse: + return CrawlResourceWithRawResponse(self._browser_rendering.crawl) + class AsyncBrowserRenderingResourceWithRawResponse: def __init__(self, browser_rendering: AsyncBrowserRenderingResource) -> None: @@ -251,6 +271,10 @@ def links(self) -> AsyncLinksResourceWithRawResponse: def markdown(self) -> AsyncMarkdownResourceWithRawResponse: return AsyncMarkdownResourceWithRawResponse(self._browser_rendering.markdown) + @cached_property + def crawl(self) -> AsyncCrawlResourceWithRawResponse: + return AsyncCrawlResourceWithRawResponse(self._browser_rendering.crawl) + class BrowserRenderingResourceWithStreamingResponse: def __init__(self, browser_rendering: BrowserRenderingResource) -> None: @@ -288,6 +312,10 @@ def links(self) -> LinksResourceWithStreamingResponse: def markdown(self) -> MarkdownResourceWithStreamingResponse: return MarkdownResourceWithStreamingResponse(self._browser_rendering.markdown) + @cached_property + def crawl(self) -> CrawlResourceWithStreamingResponse: + return CrawlResourceWithStreamingResponse(self._browser_rendering.crawl) + class AsyncBrowserRenderingResourceWithStreamingResponse: def __init__(self, browser_rendering: AsyncBrowserRenderingResource) -> None: @@ -324,3 +352,7 @@ def links(self) -> AsyncLinksResourceWithStreamingResponse: @cached_property def markdown(self) -> AsyncMarkdownResourceWithStreamingResponse: return AsyncMarkdownResourceWithStreamingResponse(self._browser_rendering.markdown) + + @cached_property + def crawl(self) -> AsyncCrawlResourceWithStreamingResponse: + return AsyncCrawlResourceWithStreamingResponse(self._browser_rendering.crawl) diff --git a/src/cloudflare/resources/browser_rendering/crawl.py b/src/cloudflare/resources/browser_rendering/crawl.py new file mode 100644 index 00000000000..43363383004 --- /dev/null +++ b/src/cloudflare/resources/browser_rendering/crawl.py @@ -0,0 +1,1091 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Type, Iterable, cast +from typing_extensions import Literal, overload + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ..._utils import required_args, maybe_transform, async_maybe_transform +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.browser_rendering import crawl_get_params, crawl_create_params +from ...types.browser_rendering.crawl_get_response import CrawlGetResponse +from ...types.browser_rendering.crawl_create_response import CrawlCreateResponse +from ...types.browser_rendering.crawl_delete_response import CrawlDeleteResponse + +__all__ = ["CrawlResource", "AsyncCrawlResource"] + + +class CrawlResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CrawlResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return CrawlResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CrawlResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return CrawlResourceWithStreamingResponse(self) + + @overload + def create( + self, + *, + account_id: str, + url: str, + cache_ttl: float | Omit = omit, + action_timeout: float | Omit = omit, + add_script_tag: Iterable[crawl_create_params.Variant0AddScriptTag] | Omit = omit, + add_style_tag: Iterable[crawl_create_params.Variant0AddStyleTag] | Omit = omit, + allow_request_pattern: SequenceNotStr[str] | Omit = omit, + allow_resource_types: List[ + Literal[ + "document", + "stylesheet", + "image", + "media", + "font", + "script", + "texttrack", + "xhr", + "fetch", + "prefetch", + "eventsource", + "websocket", + "manifest", + "signedexchange", + "ping", + "cspviolationreport", + "preflight", + "other", + ] + ] + | Omit = omit, + authenticate: crawl_create_params.Variant0Authenticate | Omit = omit, + best_attempt: bool | Omit = omit, + cookies: Iterable[crawl_create_params.Variant0Cookie] | Omit = omit, + depth: float | Omit = omit, + emulate_media_type: str | Omit = omit, + formats: List[Literal["html", "markdown", "json"]] | Omit = omit, + goto_options: crawl_create_params.Variant0GotoOptions | Omit = omit, + json_options: crawl_create_params.Variant0JsonOptions | Omit = omit, + limit: float | Omit = omit, + max_age: float | Omit = omit, + modified_since: int | Omit = omit, + options: crawl_create_params.Variant0Options | Omit = omit, + reject_request_pattern: SequenceNotStr[str] | Omit = omit, + reject_resource_types: List[ + Literal[ + "document", + "stylesheet", + "image", + "media", + "font", + "script", + "texttrack", + "xhr", + "fetch", + "prefetch", + "eventsource", + "websocket", + "manifest", + "signedexchange", + "ping", + "cspviolationreport", + "preflight", + "other", + ] + ] + | Omit = omit, + render: Literal[True] | Omit = omit, + set_extra_http_headers: Dict[str, str] | Omit = omit, + set_java_script_enabled: bool | Omit = omit, + source: Literal["sitemaps", "links", "all"] | Omit = omit, + viewport: crawl_create_params.Variant0Viewport | Omit = omit, + wait_for_selector: crawl_create_params.Variant0WaitForSelector | Omit = omit, + wait_for_timeout: float | Omit = omit, + # 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, + ) -> str: + """Starts a crawl job for the provided URL and its children. + + Check available + options like `gotoOptions` and `waitFor*` to control page load behaviour. + + Args: + account_id: Account ID. + + url: URL to navigate to, eg. `https://example.com`. + + cache_ttl: Cache TTL default is 5s. Set to 0 to disable. + + action_timeout: The maximum duration allowed for the browser action to complete after the page + has loaded (such as taking screenshots, extracting content, or generating PDFs). + If this time limit is exceeded, the action stops and returns a timeout error. + + add_script_tag: Adds a `