diff --git a/api.md b/api.md index c6ef7011bf4..bbbeb5a3bad 100644 --- a/api.md +++ b/api.md @@ -44,12 +44,12 @@ Methods: Types: ```python -from cloudflare.types.accounts import Role, RoleListResponse, RoleGetResponse +from cloudflare.types.accounts import Role, RoleGetResponse ``` Methods: -- client.accounts.roles.list(\*, account_id) -> Optional +- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role] - client.accounts.roles.get(role_id, \*, account_id) -> RoleGetResponse # OriginCACertificates @@ -60,7 +60,6 @@ Types: from cloudflare.types import ( OriginCACertificate, OriginCACertificateCreateResponse, - OriginCACertificateListResponse, OriginCACertificateDeleteResponse, OriginCACertificateGetResponse, ) @@ -69,7 +68,7 @@ from cloudflare.types import ( Methods: - client.origin_ca_certificates.create(\*\*params) -> OriginCACertificateCreateResponse -- client.origin_ca_certificates.list() -> Optional +- client.origin_ca_certificates.list() -> SyncSinglePage[OriginCACertificate] - client.origin_ca_certificates.delete(certificate_id) -> OriginCACertificateDeleteResponse - client.origin_ca_certificates.get(certificate_id) -> OriginCACertificateGetResponse @@ -188,7 +187,7 @@ from cloudflare.types.user import ( Methods: -- client.user.invites.list() -> Optional +- client.user.invites.list() -> SyncSinglePage[InviteListResponse] - client.user.invites.edit(invite_id, \*\*params) -> InviteEditResponse - client.user.invites.get(invite_id) -> InviteGetResponse @@ -201,7 +200,6 @@ Types: ```python from cloudflare.types.user.load_balancers import ( LoadBalancingMonitor, - MonitorListResponse, MonitorDeleteResponse, MonitorPreviewResponse, MonitorReferencesResponse, @@ -212,7 +210,7 @@ Methods: - client.user.load_balancers.monitors.create(\*\*params) -> LoadBalancingMonitor - client.user.load_balancers.monitors.update(monitor_id, \*\*params) -> LoadBalancingMonitor -- client.user.load_balancers.monitors.list() -> Optional +- client.user.load_balancers.monitors.list() -> SyncSinglePage[LoadBalancingMonitor] - client.user.load_balancers.monitors.delete(monitor_id) -> MonitorDeleteResponse - client.user.load_balancers.monitors.edit(monitor_id, \*\*params) -> LoadBalancingMonitor - client.user.load_balancers.monitors.get(monitor_id) -> LoadBalancingMonitor @@ -226,7 +224,6 @@ Types: ```python from cloudflare.types.user.load_balancers import ( LoadBalancingPool, - PoolListResponse, PoolDeleteResponse, PoolHealthResponse, PoolPreviewResponse, @@ -238,7 +235,7 @@ Methods: - client.user.load_balancers.pools.create(\*\*params) -> LoadBalancingPool - client.user.load_balancers.pools.update(pool_id, \*\*params) -> LoadBalancingPool -- client.user.load_balancers.pools.list(\*\*params) -> Optional +- client.user.load_balancers.pools.list(\*\*params) -> SyncSinglePage[LoadBalancingPool] - client.user.load_balancers.pools.delete(pool_id) -> PoolDeleteResponse - client.user.load_balancers.pools.edit(pool_id, \*\*params) -> LoadBalancingPool - client.user.load_balancers.pools.get(pool_id) -> LoadBalancingPool @@ -265,12 +262,12 @@ Methods: Types: ```python -from cloudflare.types.user.load_balancers.analytics import LoadBalancingAnalytics, EventListResponse +from cloudflare.types.user.load_balancers.analytics import LoadBalancingAnalytics ``` Methods: -- client.user.load_balancers.analytics.events.list(\*\*params) -> Optional +- client.user.load_balancers.analytics.events.list(\*\*params) -> SyncSinglePage[LoadBalancingAnalytics] ## Organizations @@ -341,7 +338,7 @@ from cloudflare.types.user.tokens import PermissionGroupListResponse Methods: -- client.user.tokens.permission_groups.list() -> Optional +- client.user.tokens.permission_groups.list() -> SyncSinglePage[object] ### Value @@ -1132,7 +1129,7 @@ from cloudflare.types.zones import ( Methods: - client.zones.subscriptions.create(identifier, \*\*params) -> SubscriptionCreateResponse -- client.zones.subscriptions.list(account_identifier) -> Optional +- client.zones.subscriptions.list(account_identifier) -> SyncSinglePage[SubscriptionListResponse] - client.zones.subscriptions.get(identifier) -> SubscriptionGetResponse # LoadBalancers @@ -1140,14 +1137,14 @@ Methods: Types: ```python -from cloudflare.types import LoadBalancer, LoadBalancerListResponse, LoadBalancerDeleteResponse +from cloudflare.types import LoadBalancer, LoadBalancerDeleteResponse ``` Methods: - client.load_balancers.create(\*, zone_id, \*\*params) -> LoadBalancer - client.load_balancers.update(load_balancer_id, \*, zone_id, \*\*params) -> LoadBalancer -- client.load_balancers.list(\*, zone_id) -> Optional +- client.load_balancers.list(\*, zone_id) -> SyncSinglePage[LoadBalancer] - client.load_balancers.delete(load_balancer_id, \*, zone_id) -> LoadBalancerDeleteResponse - client.load_balancers.edit(load_balancer_id, \*, zone_id, \*\*params) -> LoadBalancer - client.load_balancers.get(load_balancer_id, \*, zone_id) -> LoadBalancer @@ -1157,14 +1154,14 @@ Methods: Types: ```python -from cloudflare.types.load_balancers import MonitorListResponse, MonitorDeleteResponse +from cloudflare.types.load_balancers import MonitorDeleteResponse ``` Methods: - client.load_balancers.monitors.create(\*, account_id, \*\*params) -> LoadBalancingMonitor - client.load_balancers.monitors.update(monitor_id, \*, account_id, \*\*params) -> LoadBalancingMonitor -- client.load_balancers.monitors.list(\*, account_id) -> Optional +- client.load_balancers.monitors.list(\*, account_id) -> SyncSinglePage[LoadBalancingMonitor] - client.load_balancers.monitors.delete(monitor_id, \*, account_id) -> MonitorDeleteResponse - client.load_balancers.monitors.edit(monitor_id, \*, account_id, \*\*params) -> LoadBalancingMonitor - client.load_balancers.monitors.get(monitor_id, \*, account_id) -> LoadBalancingMonitor @@ -1198,14 +1195,14 @@ Methods: Types: ```python -from cloudflare.types.load_balancers import PoolListResponse, PoolDeleteResponse +from cloudflare.types.load_balancers import PoolDeleteResponse ``` Methods: - client.load_balancers.pools.create(\*, account_id, \*\*params) -> LoadBalancingPool - client.load_balancers.pools.update(pool_id, \*, account_id, \*\*params) -> LoadBalancingPool -- client.load_balancers.pools.list(\*, account_id, \*\*params) -> Optional +- client.load_balancers.pools.list(\*, account_id, \*\*params) -> SyncSinglePage[LoadBalancingPool] - client.load_balancers.pools.delete(pool_id, \*, account_id) -> PoolDeleteResponse - client.load_balancers.pools.edit(pool_id, \*, account_id, \*\*params) -> LoadBalancingPool - client.load_balancers.pools.get(pool_id, \*, account_id) -> LoadBalancingPool @@ -1372,7 +1369,7 @@ from cloudflare.types.ssl import ( Methods: -- client.ssl.certificate_packs.list(\*, zone_id, \*\*params) -> Optional +- client.ssl.certificate_packs.list(\*, zone_id, \*\*params) -> SyncSinglePage[object] - client.ssl.certificate_packs.delete(certificate_pack_id, \*, zone_id) -> CertificatePackDeleteResponse - client.ssl.certificate_packs.edit(certificate_pack_id, \*, zone_id) -> CertificatePackEditResponse - client.ssl.certificate_packs.get(certificate_pack_id, \*, zone_id) -> CertificatePackGetResponse @@ -1463,7 +1460,7 @@ Methods: - client.subscriptions.create(identifier, \*\*params) -> SubscriptionCreateResponse - client.subscriptions.update(subscription_identifier, \*, account_identifier, \*\*params) -> SubscriptionUpdateResponse -- client.subscriptions.list(account_identifier) -> Optional +- client.subscriptions.list(account_identifier) -> SyncSinglePage[SubscriptionListResponse] - client.subscriptions.delete(subscription_identifier, \*, account_identifier) -> SubscriptionDeleteResponse - client.subscriptions.get(identifier) -> SubscriptionGetResponse @@ -1515,12 +1512,12 @@ Methods: Types: ```python -from cloudflare.types import AvailableRatePlan, PlanListResponse +from cloudflare.types import AvailableRatePlan ``` Methods: -- client.plans.list(zone_identifier) -> Optional +- client.plans.list(zone_identifier) -> SyncSinglePage[AvailableRatePlan] - client.plans.get(plan_identifier, \*, zone_identifier) -> AvailableRatePlan # RatePlans @@ -2017,14 +2014,14 @@ Methods: Types: ```python -from cloudflare.types import Healthcheck, HealthcheckListResponse, HealthcheckDeleteResponse +from cloudflare.types import Healthcheck, HealthcheckDeleteResponse ``` Methods: - client.healthchecks.create(\*, zone_id, \*\*params) -> Healthcheck - client.healthchecks.update(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck -- client.healthchecks.list(\*, zone_id) -> Optional +- client.healthchecks.list(\*, zone_id) -> SyncSinglePage[Healthcheck] - client.healthchecks.delete(healthcheck_id, \*, zone_id) -> HealthcheckDeleteResponse - client.healthchecks.edit(healthcheck_id, \*, zone_id, \*\*params) -> Healthcheck - client.healthchecks.get(healthcheck_id, \*, zone_id) -> Healthcheck @@ -2051,7 +2048,6 @@ Types: from cloudflare.types import ( KeylessCertificate, KeylessCertificateHostname, - KeylessCertificateListResponse, KeylessCertificateDeleteResponse, ) ``` @@ -2059,7 +2055,7 @@ from cloudflare.types import ( Methods: - client.keyless_certificates.create(\*, zone_id, \*\*params) -> KeylessCertificateHostname -- client.keyless_certificates.list(\*, zone_id) -> Optional +- client.keyless_certificates.list(\*, zone_id) -> SyncSinglePage[KeylessCertificateHostname] - client.keyless_certificates.delete(keyless_certificate_id, \*, zone_id) -> KeylessCertificateDeleteResponse - client.keyless_certificates.edit(keyless_certificate_id, \*, zone_id, \*\*params) -> KeylessCertificateHostname - client.keyless_certificates.get(keyless_certificate_id, \*, zone_id) -> KeylessCertificateHostname @@ -2110,14 +2106,14 @@ Methods: Types: ```python -from cloudflare.types.logpush import JobListResponse, JobDeleteResponse +from cloudflare.types.logpush import JobDeleteResponse ``` Methods: - client.logpush.jobs.create(\*, account_id, zone_id, \*\*params) -> Optional - client.logpush.jobs.update(job_id, \*, account_id, zone_id, \*\*params) -> Optional -- client.logpush.jobs.list(\*, account_id, zone_id) -> JobListResponse +- client.logpush.jobs.list(\*, account_id, zone_id) -> SyncSinglePage[Optional] - client.logpush.jobs.delete(job_id, \*, account_id, zone_id) -> Optional - client.logpush.jobs.get(job_id, \*, account_id, zone_id) -> Optional @@ -2235,7 +2231,7 @@ from cloudflare.types import ( Methods: - client.origin_tls_client_auth.create(\*, zone_id, \*\*params) -> OriginTLSClientAuthCreateResponse -- client.origin_tls_client_auth.list(\*, zone_id) -> Optional +- client.origin_tls_client_auth.list(\*, zone_id) -> SyncSinglePage[OriginTLSClientAuthListResponse] - client.origin_tls_client_auth.delete(certificate_id, \*, zone_id) -> OriginTLSClientAuthDeleteResponse - client.origin_tls_client_auth.get(certificate_id, \*, zone_id) -> OriginTLSClientAuthGetResponse @@ -2261,16 +2257,13 @@ Methods: Types: ```python -from cloudflare.types.origin_tls_client_auth.hostnames import ( - OriginTLSClientCertificate, - CertificateListResponse, -) +from cloudflare.types.origin_tls_client_auth.hostnames import OriginTLSClientCertificate ``` Methods: - client.origin_tls_client_auth.hostnames.certificates.create(\*, zone_id, \*\*params) -> OriginTLSClientCertificate -- client.origin_tls_client_auth.hostnames.certificates.list(\*, zone_id) -> Optional +- client.origin_tls_client_auth.hostnames.certificates.list(\*, zone_id) -> SyncSinglePage[OriginTLSClientCertificateID] - client.origin_tls_client_auth.hostnames.certificates.delete(certificate_id, \*, zone_id) -> OriginTLSClientCertificate - client.origin_tls_client_auth.hostnames.certificates.get(certificate_id, \*, zone_id) -> OriginTLSClientCertificate @@ -2418,14 +2411,14 @@ Methods: Types: ```python -from cloudflare.types.secondary_dns import SecondaryDNSACL, ACLListResponse, ACLDeleteResponse +from cloudflare.types.secondary_dns import SecondaryDNSACL, ACLDeleteResponse ``` Methods: - client.secondary_dns.acls.create(\*, account_id, \*\*params) -> SecondaryDNSACL - client.secondary_dns.acls.update(acl_id, \*, account_id, \*\*params) -> SecondaryDNSACL -- client.secondary_dns.acls.list(\*, account_id) -> Optional +- client.secondary_dns.acls.list(\*, account_id) -> SyncSinglePage[SecondaryDNSACL] - client.secondary_dns.acls.delete(acl_id, \*, account_id) -> ACLDeleteResponse - client.secondary_dns.acls.get(acl_id, \*, account_id) -> SecondaryDNSACL @@ -2434,14 +2427,14 @@ Methods: Types: ```python -from cloudflare.types.secondary_dns import SecondaryDNSPeer, PeerListResponse, PeerDeleteResponse +from cloudflare.types.secondary_dns import SecondaryDNSPeer, PeerDeleteResponse ``` Methods: - client.secondary_dns.peers.create(\*, account_id, \*\*params) -> SecondaryDNSPeer - client.secondary_dns.peers.update(peer_id, \*, account_id, \*\*params) -> SecondaryDNSPeer -- client.secondary_dns.peers.list(\*, account_id) -> Optional +- client.secondary_dns.peers.list(\*, account_id) -> SyncSinglePage[SecondaryDNSPeer] - client.secondary_dns.peers.delete(peer_id, \*, account_id) -> PeerDeleteResponse - client.secondary_dns.peers.get(peer_id, \*, account_id) -> SecondaryDNSPeer @@ -2450,14 +2443,14 @@ Methods: Types: ```python -from cloudflare.types.secondary_dns import SecondaryDNSTSIG, TSIGListResponse, TSIGDeleteResponse +from cloudflare.types.secondary_dns import SecondaryDNSTSIG, TSIGDeleteResponse ``` Methods: - client.secondary_dns.tsigs.create(\*, account_id, \*\*params) -> SecondaryDNSTSIG - client.secondary_dns.tsigs.update(tsig_id, \*, account_id, \*\*params) -> SecondaryDNSTSIG -- client.secondary_dns.tsigs.list(\*, account_id) -> Optional +- client.secondary_dns.tsigs.list(\*, account_id) -> SyncSinglePage[SecondaryDNSTSIG] - client.secondary_dns.tsigs.delete(tsig_id, \*, account_id) -> TSIGDeleteResponse - client.secondary_dns.tsigs.get(tsig_id, \*, account_id) -> SecondaryDNSTSIG @@ -2466,14 +2459,14 @@ Methods: Types: ```python -from cloudflare.types import WaitingRoom, WaitingRoomListResponse, WaitingRoomDeleteResponse +from cloudflare.types import WaitingRoom, WaitingRoomDeleteResponse ``` Methods: - client.waiting_rooms.create(zone_identifier, \*\*params) -> WaitingRoom - client.waiting_rooms.update(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingRoom -- client.waiting_rooms.list(zone_identifier) -> Optional +- client.waiting_rooms.list(zone_identifier) -> SyncSinglePage[WaitingRoom] - client.waiting_rooms.delete(waiting_room_id, \*, zone_identifier) -> WaitingRoomDeleteResponse - client.waiting_rooms.edit(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingRoom - client.waiting_rooms.get(waiting_room_id, \*, zone_identifier) -> WaitingRoom @@ -2495,14 +2488,14 @@ Methods: Types: ```python -from cloudflare.types.waiting_rooms import WaitingroomEvent, EventListResponse, EventDeleteResponse +from cloudflare.types.waiting_rooms import WaitingroomEvent, EventDeleteResponse ``` Methods: - client.waiting_rooms.events.create(waiting_room_id, \*, zone_identifier, \*\*params) -> WaitingroomEvent - client.waiting_rooms.events.update(event_id, \*, zone_identifier, waiting_room_id, \*\*params) -> WaitingroomEvent -- client.waiting_rooms.events.list(waiting_room_id, \*, zone_identifier) -> Optional +- client.waiting_rooms.events.list(waiting_room_id, \*, zone_identifier) -> SyncSinglePage[WaitingroomEvent] - client.waiting_rooms.events.delete(event_id, \*, zone_identifier, waiting_room_id) -> EventDeleteResponse - client.waiting_rooms.events.edit(event_id, \*, zone_identifier, waiting_room_id, \*\*params) -> WaitingroomEvent - client.waiting_rooms.events.get(event_id, \*, zone_identifier, waiting_room_id) -> WaitingroomEvent @@ -2528,7 +2521,6 @@ from cloudflare.types.waiting_rooms import ( WaitingroomRule, RuleCreateResponse, RuleUpdateResponse, - RuleListResponse, RuleDeleteResponse, RuleEditResponse, ) @@ -2538,7 +2530,7 @@ Methods: - client.waiting_rooms.rules.create(waiting_room_id, \*, zone_identifier, \*\*params) -> Optional - client.waiting_rooms.rules.update(waiting_room_id, \*, zone_identifier, \*\*params) -> Optional -- client.waiting_rooms.rules.list(waiting_room_id, \*, zone_identifier) -> Optional +- client.waiting_rooms.rules.list(waiting_room_id, \*, zone_identifier) -> SyncSinglePage[WaitingroomRule] - client.waiting_rooms.rules.delete(rule_id, \*, zone_identifier, waiting_room_id) -> Optional - client.waiting_rooms.rules.edit(rule_id, \*, zone_identifier, waiting_room_id, \*\*params) -> Optional @@ -2579,17 +2571,13 @@ Methods: Types: ```python -from cloudflare.types.web3 import ( - DistributedWebHostname, - HostnameListResponse, - HostnameDeleteResponse, -) +from cloudflare.types.web3 import DistributedWebHostname, HostnameDeleteResponse ``` Methods: - client.web3.hostnames.create(zone_identifier, \*\*params) -> DistributedWebHostname -- client.web3.hostnames.list(zone_identifier) -> Optional +- client.web3.hostnames.list(zone_identifier) -> SyncSinglePage[DistributedWebHostname] - client.web3.hostnames.delete(identifier, \*, zone_identifier) -> Optional - client.web3.hostnames.edit(identifier, \*, zone_identifier, \*\*params) -> DistributedWebHostname - client.web3.hostnames.get(identifier, \*, zone_identifier) -> DistributedWebHostname @@ -2648,13 +2636,13 @@ Methods: Types: ```python -from cloudflare.types.workers import WorkersScript, ScriptListResponse +from cloudflare.types.workers import WorkersScript ``` Methods: - client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> WorkersScript -- client.workers.scripts.list(\*, account_id) -> ScriptListResponse +- client.workers.scripts.list(\*, account_id) -> SyncSinglePage[WorkersScript] - client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> None - client.workers.scripts.get(script_name, \*, account_id) -> BinaryAPIResponse @@ -2740,19 +2728,14 @@ Methods: Types: ```python -from cloudflare.types.workers import ( - WorkersFilter, - FilterCreateResponse, - FilterListResponse, - FilterDeleteResponse, -) +from cloudflare.types.workers import WorkersFilter, FilterCreateResponse, FilterDeleteResponse ``` Methods: - client.workers.filters.create(\*, zone_id, \*\*params) -> Optional - client.workers.filters.update(filter_id, \*, zone_id, \*\*params) -> WorkersFilter -- client.workers.filters.list(\*, zone_id) -> FilterListResponse +- client.workers.filters.list(\*, zone_id) -> SyncSinglePage[WorkersFilter] - client.workers.filters.delete(filter_id, \*, zone_id) -> Optional ## Routes @@ -2760,19 +2743,14 @@ Methods: Types: ```python -from cloudflare.types.workers import ( - WorkersRoute, - RouteCreateResponse, - RouteListResponse, - RouteDeleteResponse, -) +from cloudflare.types.workers import WorkersRoute, RouteCreateResponse, RouteDeleteResponse ``` Methods: - client.workers.routes.create(\*, zone_id, \*\*params) -> RouteCreateResponse - client.workers.routes.update(route_id, \*, zone_id, \*\*params) -> WorkersRoute -- client.workers.routes.list(\*, zone_id) -> RouteListResponse +- client.workers.routes.list(\*, zone_id) -> SyncSinglePage[WorkersRoute] - client.workers.routes.delete(route_id, \*, zone_id) -> RouteDeleteResponse - client.workers.routes.get(route_id, \*, zone_id) -> WorkersRoute @@ -2820,13 +2798,13 @@ Methods: Types: ```python -from cloudflare.types.workers import WorkersDomain, DomainListResponse +from cloudflare.types.workers import WorkersDomain ``` Methods: - client.workers.domains.update(\*, account_id, \*\*params) -> WorkersDomain -- client.workers.domains.list(\*, account_id, \*\*params) -> DomainListResponse +- client.workers.domains.list(\*, account_id, \*\*params) -> SyncSinglePage[WorkersDomain] - client.workers.domains.delete(domain_id, \*, account_id) -> None - client.workers.domains.get(domain_id, \*, account_id) -> WorkersDomain @@ -2946,12 +2924,12 @@ Methods: Types: ```python -from cloudflare.types.durable_objects import DurableObjectNamespace, NamespaceListResponse +from cloudflare.types.durable_objects import DurableObjectNamespace ``` Methods: -- client.durable_objects.namespaces.list(\*, account_id) -> Optional +- client.durable_objects.namespaces.list(\*, account_id) -> SyncSinglePage[DurableObjectNamespace] ### Objects @@ -2986,7 +2964,7 @@ Methods: - client.queues.create(\*, account_id, \*\*params) -> Optional - client.queues.update(queue_id, \*, account_id, \*\*params) -> Optional -- client.queues.list(\*, account_id) -> Optional +- client.queues.list(\*, account_id) -> SyncSinglePage[QueueListResponse] - client.queues.delete(queue_id, \*, account_id) -> Optional - client.queues.get(queue_id, \*, account_id) -> Optional @@ -3060,14 +3038,14 @@ Methods: Types: ```python -from cloudflare.types.page_shield import PageShieldPolicy, PolicyListResponse +from cloudflare.types.page_shield import PageShieldPolicy ``` Methods: - client.page_shield.policies.create(\*, zone_id, \*\*params) -> PageShieldPolicy - client.page_shield.policies.update(policy_id, \*, zone_id, \*\*params) -> PageShieldPolicy -- client.page_shield.policies.list(\*, zone_id) -> Optional +- client.page_shield.policies.list(\*, zone_id) -> SyncSinglePage[PageShieldPolicy] - client.page_shield.policies.delete(policy_id, \*, zone_id) -> None - client.page_shield.policies.get(policy_id, \*, zone_id) -> PageShieldPolicy @@ -3076,12 +3054,12 @@ Methods: Types: ```python -from cloudflare.types.page_shield import PageShieldConnection, ConnectionListResponse +from cloudflare.types.page_shield import PageShieldConnection ``` Methods: -- client.page_shield.connections.list(\*, zone_id, \*\*params) -> Optional +- client.page_shield.connections.list(\*, zone_id, \*\*params) -> SyncSinglePage[PageShieldConnection] - client.page_shield.connections.get(connection_id, \*, zone_id) -> PageShieldConnection ## Scripts @@ -3089,12 +3067,12 @@ Methods: Types: ```python -from cloudflare.types.page_shield import PageShieldScript, ScriptListResponse, ScriptGetResponse +from cloudflare.types.page_shield import PageShieldScript, ScriptGetResponse ``` Methods: -- client.page_shield.scripts.list(\*, zone_id, \*\*params) -> Optional +- client.page_shield.scripts.list(\*, zone_id, \*\*params) -> SyncSinglePage[PageShieldScript] - client.page_shield.scripts.get(script_id, \*, zone_id) -> ScriptGetResponse # Rulesets @@ -3102,14 +3080,14 @@ Methods: Types: ```python -from cloudflare.types import RulesetsRulesetResponse, RulesetsRulesetsResponse +from cloudflare.types import RulesetsRulesetResponse, RulesetsRulesetsResponse, RulesetListResponse ``` Methods: - client.rulesets.create(\*, account_id, zone_id, \*\*params) -> RulesetsRulesetResponse - client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> RulesetsRulesetResponse -- client.rulesets.list(\*, account_id, zone_id) -> RulesetsRulesetsResponse +- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[RulesetListResponse] - client.rulesets.delete(ruleset_id, \*, account_id, zone_id) -> None - client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetsRulesetResponse @@ -3122,9 +3100,15 @@ Methods: ### Versions +Types: + +```python +from cloudflare.types.rulesets.phases import VersionListResponse +``` + Methods: -- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> RulesetsRulesetsResponse +- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] - client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> RulesetsRulesetResponse ## Rules @@ -3137,9 +3121,15 @@ Methods: ## Versions +Types: + +```python +from cloudflare.types.rulesets import VersionListResponse +``` + Methods: -- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> RulesetsRulesetsResponse +- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] - client.rulesets.versions.delete(ruleset_version, \*, ruleset_id, account_id, zone_id) -> None - client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> RulesetsRulesetResponse @@ -3240,7 +3230,7 @@ from cloudflare.types.addressing import ServiceListResponse Methods: -- client.addressing.services.list(\*, account_id) -> ServiceListResponse +- client.addressing.services.list(\*, account_id) -> SyncSinglePage[ServiceListResponse] ## AddressMaps @@ -3250,7 +3240,6 @@ Types: from cloudflare.types.addressing import ( AddressingAddressMaps, AddressMapCreateResponse, - AddressMapListResponse, AddressMapDeleteResponse, AddressMapGetResponse, ) @@ -3259,7 +3248,7 @@ from cloudflare.types.addressing import ( Methods: - client.addressing.address_maps.create(\*, account_id, \*\*params) -> AddressMapCreateResponse -- client.addressing.address_maps.list(\*, account_id) -> Optional +- client.addressing.address_maps.list(\*, account_id) -> SyncSinglePage[AddressingAddressMaps] - client.addressing.address_maps.delete(address_map_id, \*, account_id) -> Optional - client.addressing.address_maps.edit(address_map_id, \*, account_id, \*\*params) -> AddressingAddressMaps - client.addressing.address_maps.get(address_map_id, \*, account_id) -> AddressMapGetResponse @@ -3332,17 +3321,13 @@ Methods: Types: ```python -from cloudflare.types.addressing import ( - AddressingIpamPrefixes, - PrefixListResponse, - PrefixDeleteResponse, -) +from cloudflare.types.addressing import AddressingIpamPrefixes, PrefixDeleteResponse ``` Methods: - client.addressing.prefixes.create(\*, account_id, \*\*params) -> AddressingIpamPrefixes -- client.addressing.prefixes.list(\*, account_id) -> Optional +- client.addressing.prefixes.list(\*, account_id) -> SyncSinglePage[AddressingIpamPrefixes] - client.addressing.prefixes.delete(prefix_id, \*, account_id) -> Optional - client.addressing.prefixes.edit(prefix_id, \*, account_id, \*\*params) -> AddressingIpamPrefixes - client.addressing.prefixes.get(prefix_id, \*, account_id) -> AddressingIpamPrefixes @@ -3354,17 +3339,13 @@ Methods: Types: ```python -from cloudflare.types.addressing.prefixes.bgp import ( - AddressingServiceBinding, - BindingListResponse, - BindingDeleteResponse, -) +from cloudflare.types.addressing.prefixes.bgp import AddressingServiceBinding, BindingDeleteResponse ``` Methods: - client.addressing.prefixes.bgp.bindings.create(prefix_id, \*, account_id, \*\*params) -> AddressingServiceBinding -- client.addressing.prefixes.bgp.bindings.list(prefix_id, \*, account_id) -> BindingListResponse +- client.addressing.prefixes.bgp.bindings.list(prefix_id, \*, account_id) -> SyncSinglePage[AddressingServiceBinding] - client.addressing.prefixes.bgp.bindings.delete(binding_id, \*, account_id, prefix_id) -> BindingDeleteResponse - client.addressing.prefixes.bgp.bindings.get(binding_id, \*, account_id, prefix_id) -> AddressingServiceBinding @@ -3373,12 +3354,12 @@ Methods: Types: ```python -from cloudflare.types.addressing.prefixes.bgp import AddressingIpamBGPPrefixes, PrefixListResponse +from cloudflare.types.addressing.prefixes.bgp import AddressingIpamBGPPrefixes ``` Methods: -- client.addressing.prefixes.bgp.prefixes.list(prefix_id, \*, account_id) -> Optional +- client.addressing.prefixes.bgp.prefixes.list(prefix_id, \*, account_id) -> SyncSinglePage[AddressingIpamBGPPrefixes] - client.addressing.prefixes.bgp.prefixes.edit(bgp_prefix_id, \*, account_id, prefix_id, \*\*params) -> AddressingIpamBGPPrefixes - client.addressing.prefixes.bgp.prefixes.get(bgp_prefix_id, \*, account_id, prefix_id) -> AddressingIpamBGPPrefixes @@ -3400,17 +3381,13 @@ Methods: Types: ```python -from cloudflare.types.addressing.prefixes import ( - AddressingIpamDelegations, - DelegationListResponse, - DelegationDeleteResponse, -) +from cloudflare.types.addressing.prefixes import AddressingIpamDelegations, DelegationDeleteResponse ``` Methods: - client.addressing.prefixes.delegations.create(prefix_id, \*, account_id, \*\*params) -> AddressingIpamDelegations -- client.addressing.prefixes.delegations.list(prefix_id, \*, account_id) -> Optional +- client.addressing.prefixes.delegations.list(prefix_id, \*, account_id) -> SyncSinglePage[AddressingIpamDelegations] - client.addressing.prefixes.delegations.delete(delegation_id, \*, account_id, prefix_id) -> DelegationDeleteResponse # AuditLogs @@ -3696,7 +3673,7 @@ Methods: - client.intel.indicator_feeds.create(\*, account_id, \*\*params) -> IndicatorFeedCreateResponse - client.intel.indicator_feeds.update(feed_id, \*, account_id, \*\*params) -> IndicatorFeedUpdateResponse -- client.intel.indicator_feeds.list(\*, account_id) -> IndicatorFeedListResponse +- client.intel.indicator_feeds.list(\*, account_id) -> SyncSinglePage[IndicatorFeedListResponse] - client.intel.indicator_feeds.data(feed_id, \*, account_id) -> str - client.intel.indicator_feeds.get(feed_id, \*, account_id) -> IndicatorFeedGetResponse @@ -3723,12 +3700,12 @@ Methods: Types: ```python -from cloudflare.types.intel import IntelSinkholeItem, SinkholeListResponse +from cloudflare.types.intel import IntelSinkholeItem ``` Methods: -- client.intel.sinkholes.list(\*, account_id) -> SinkholeListResponse +- client.intel.sinkholes.list(\*, account_id) -> SyncSinglePage[IntelSinkholeItem] ## AttackSurfaceReport @@ -3973,14 +3950,14 @@ Methods: Types: ```python -from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringRule, RuleListResponse +from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringRule ``` Methods: - client.magic_network_monitoring.rules.create(\*, account_id) -> Optional - client.magic_network_monitoring.rules.update(\*, account_id) -> Optional -- client.magic_network_monitoring.rules.list(\*, account_id) -> Optional +- client.magic_network_monitoring.rules.list(\*, account_id) -> SyncSinglePage[Optional] - client.magic_network_monitoring.rules.delete(rule_id, \*, account_id) -> Optional - client.magic_network_monitoring.rules.edit(rule_id, \*, account_id) -> Optional - client.magic_network_monitoring.rules.get(rule_id, \*, account_id) -> Optional @@ -4002,13 +3979,13 @@ Methods: Types: ```python -from cloudflare.types import MTLSCertificate, MTLSCertificateUpdate, MTLSCertificateListResponse +from cloudflare.types import MTLSCertificate, MTLSCertificateUpdate ``` Methods: - client.mtls_certificates.create(\*, account_id, \*\*params) -> MTLSCertificateUpdate -- client.mtls_certificates.list(\*, account_id) -> Optional +- client.mtls_certificates.list(\*, account_id) -> SyncSinglePage[MTLSCertificate] - client.mtls_certificates.delete(mtls_certificate_id, \*, account_id) -> MTLSCertificate - client.mtls_certificates.get(mtls_certificate_id, \*, account_id) -> MTLSCertificate @@ -4035,7 +4012,6 @@ from cloudflare.types.pages import ( PagesDeployments, PagesProjects, ProjectCreateResponse, - ProjectListResponse, ProjectDeleteResponse, ProjectEditResponse, ProjectPurgeBuildCacheResponse, @@ -4045,7 +4021,7 @@ from cloudflare.types.pages import ( Methods: - client.pages.projects.create(\*, account_id, \*\*params) -> ProjectCreateResponse -- client.pages.projects.list(\*, account_id) -> ProjectListResponse +- client.pages.projects.list(\*, account_id) -> SyncSinglePage[PagesDeployments] - client.pages.projects.delete(project_name, \*, account_id) -> object - client.pages.projects.edit(project_name, \*, account_id, \*\*params) -> ProjectEditResponse - client.pages.projects.get(project_name, \*, account_id) -> PagesProjects @@ -4056,13 +4032,13 @@ Methods: Types: ```python -from cloudflare.types.pages.projects import DeploymentListResponse, DeploymentDeleteResponse +from cloudflare.types.pages.projects import DeploymentDeleteResponse ``` Methods: - client.pages.projects.deployments.create(project_name, \*, account_id, \*\*params) -> PagesDeployments -- client.pages.projects.deployments.list(project_name, \*, account_id, \*\*params) -> DeploymentListResponse +- client.pages.projects.deployments.list(project_name, \*, account_id, \*\*params) -> SyncSinglePage[PagesDeployments] - client.pages.projects.deployments.delete(deployment_id, \*, account_id, project_name) -> object - client.pages.projects.deployments.get(deployment_id, \*, account_id, project_name) -> PagesDeployments - client.pages.projects.deployments.retry(deployment_id, \*, account_id, project_name) -> PagesDeployments @@ -4099,7 +4075,7 @@ from cloudflare.types.pages.projects import ( Methods: - client.pages.projects.domains.create(project_name, \*, account_id, \*\*params) -> Optional -- client.pages.projects.domains.list(project_name, \*, account_id) -> DomainListResponse +- client.pages.projects.domains.list(project_name, \*, account_id) -> SyncSinglePage[object] - client.pages.projects.domains.delete(domain_name, \*, account_id, project_name) -> object - client.pages.projects.domains.edit(domain_name, \*, account_id, project_name) -> Optional - client.pages.projects.domains.get(domain_name, \*, account_id, project_name) -> Optional @@ -4115,7 +4091,7 @@ from cloudflare.types import PCAPCreateResponse, PCAPListResponse, PCAPGetRespon Methods: - client.pcaps.create(\*, account_id, \*\*params) -> PCAPCreateResponse -- client.pcaps.list(\*, account_id) -> Optional +- client.pcaps.list(\*, account_id) -> SyncSinglePage[PCAPListResponse] - client.pcaps.get(pcap_id, \*, account_id) -> PCAPGetResponse ## Ownership @@ -4157,7 +4133,7 @@ from cloudflare.types.registrar import ( Methods: - client.registrar.domains.update(domain_name, \*, account_id, \*\*params) -> Optional -- client.registrar.domains.list(\*, account_id) -> Optional +- client.registrar.domains.list(\*, account_id) -> SyncSinglePage[DomainListResponse] - client.registrar.domains.get(domain_name, \*, account_id) -> Optional # RequestTracers @@ -4181,14 +4157,14 @@ Methods: Types: ```python -from cloudflare.types.rules import ListsList, ListListResponse, ListDeleteResponse +from cloudflare.types.rules import ListsList, ListDeleteResponse ``` Methods: - client.rules.lists.create(\*, account_id, \*\*params) -> Optional - client.rules.lists.update(list_id, \*, account_id, \*\*params) -> Optional -- client.rules.lists.list(\*, account_id) -> Optional +- client.rules.lists.list(\*, account_id) -> SyncSinglePage[ListsList] - client.rules.lists.delete(list_id, \*, account_id) -> Optional - client.rules.lists.get(list_id, \*, account_id) -> Optional @@ -4246,13 +4222,13 @@ Methods: Types: ```python -from cloudflare.types import StreamVideos, StreamListResponse +from cloudflare.types import StreamVideos ``` Methods: - client.stream.create(\*, account_id) -> None -- client.stream.list(\*, account_id, \*\*params) -> StreamListResponse +- client.stream.list(\*, account_id, \*\*params) -> SyncSinglePage[StreamVideos] - client.stream.delete(identifier, \*, account_id) -> None - client.stream.get(identifier, \*, account_id) -> StreamVideos @@ -4348,14 +4324,14 @@ Methods: Types: ```python -from cloudflare.types.stream.live_inputs import StreamOutput, OutputListResponse +from cloudflare.types.stream.live_inputs import StreamOutput ``` Methods: - client.stream.live_inputs.outputs.create(live_input_identifier, \*, account_id, \*\*params) -> StreamOutput - client.stream.live_inputs.outputs.update(output_identifier, \*, account_id, live_input_identifier, \*\*params) -> StreamOutput -- client.stream.live_inputs.outputs.list(live_input_identifier, \*, account_id) -> OutputListResponse +- client.stream.live_inputs.outputs.list(live_input_identifier, \*, account_id) -> SyncSinglePage[StreamOutput] - client.stream.live_inputs.outputs.delete(output_identifier, \*, account_id, live_input_identifier) -> None ## Watermarks @@ -4366,7 +4342,6 @@ Types: from cloudflare.types.stream import ( StreamWatermarks, WatermarkCreateResponse, - WatermarkListResponse, WatermarkDeleteResponse, WatermarkGetResponse, ) @@ -4375,7 +4350,7 @@ from cloudflare.types.stream import ( Methods: - client.stream.watermarks.create(\*, account_id, \*\*params) -> WatermarkCreateResponse -- client.stream.watermarks.list(\*, account_id) -> WatermarkListResponse +- client.stream.watermarks.list(\*, account_id) -> SyncSinglePage[StreamWatermarks] - client.stream.watermarks.delete(identifier, \*, account_id) -> WatermarkDeleteResponse - client.stream.watermarks.get(identifier, \*, account_id) -> WatermarkGetResponse @@ -4512,7 +4487,6 @@ from cloudflare.types.alerting.destinations import ( AlertingWebhooks, WebhookCreateResponse, WebhookUpdateResponse, - WebhookListResponse, WebhookDeleteResponse, ) ``` @@ -4521,7 +4495,7 @@ Methods: - client.alerting.destinations.webhooks.create(\*, account_id, \*\*params) -> WebhookCreateResponse - client.alerting.destinations.webhooks.update(webhook_id, \*, account_id, \*\*params) -> WebhookUpdateResponse -- client.alerting.destinations.webhooks.list(\*, account_id) -> Optional +- client.alerting.destinations.webhooks.list(\*, account_id) -> SyncSinglePage[AlertingWebhooks] - client.alerting.destinations.webhooks.delete(webhook_id, \*, account_id) -> Optional - client.alerting.destinations.webhooks.get(webhook_id, \*, account_id) -> AlertingWebhooks @@ -4546,7 +4520,6 @@ from cloudflare.types.alerting import ( AlertingPolicies, PolicyCreateResponse, PolicyUpdateResponse, - PolicyListResponse, PolicyDeleteResponse, ) ``` @@ -4555,7 +4528,7 @@ Methods: - client.alerting.policies.create(\*, account_id, \*\*params) -> PolicyCreateResponse - client.alerting.policies.update(policy_id, \*, account_id, \*\*params) -> PolicyUpdateResponse -- client.alerting.policies.list(\*, account_id) -> Optional +- client.alerting.policies.list(\*, account_id) -> SyncSinglePage[AlertingPolicies] - client.alerting.policies.delete(policy_id, \*, account_id) -> Optional - client.alerting.policies.get(policy_id, \*, account_id) -> AlertingPolicies @@ -4658,7 +4631,7 @@ from cloudflare.types.workers_for_platforms.dispatch import ( Methods: - client.workers_for_platforms.dispatch.namespaces.create(\*, account_id, \*\*params) -> NamespaceCreateResponse -- client.workers_for_platforms.dispatch.namespaces.list(\*, account_id) -> NamespaceListResponse +- client.workers_for_platforms.dispatch.namespaces.list(\*, account_id) -> SyncSinglePage[NamespaceListResponse] - client.workers_for_platforms.dispatch.namespaces.delete(dispatch_namespace, \*, account_id) -> object - client.workers_for_platforms.dispatch.namespaces.get(dispatch_namespace, \*, account_id) -> NamespaceGetResponse @@ -4720,12 +4693,12 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import ZeroTrustDevices, DeviceListResponse, DeviceGetResponse +from cloudflare.types.zero_trust import ZeroTrustDevices, DeviceGetResponse ``` Methods: -- client.zero_trust.devices.list(\*, account_id) -> Optional +- client.zero_trust.devices.list(\*, account_id) -> SyncSinglePage[ZeroTrustDevices] - client.zero_trust.devices.get(device_id, \*, account_id) -> Optional ### DEXTests @@ -4733,18 +4706,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import ( - DEXTestSchemasHTTP, - DEXTestListResponse, - DEXTestDeleteResponse, -) +from cloudflare.types.zero_trust.devices import DEXTestSchemasHTTP, DEXTestDeleteResponse ``` Methods: - client.zero_trust.devices.dex_tests.create(\*, account_id, \*\*params) -> Optional - client.zero_trust.devices.dex_tests.update(dex_test_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.dex_tests.list(\*, account_id) -> Optional +- client.zero_trust.devices.dex_tests.list(\*, account_id) -> SyncSinglePage[DEXTestSchemasHTTP] - client.zero_trust.devices.dex_tests.delete(dex_test_id, \*, account_id) -> Optional - client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional @@ -4753,18 +4722,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import ( - DeviceManagedNetworks, - NetworkListResponse, - NetworkDeleteResponse, -) +from cloudflare.types.zero_trust.devices import DeviceManagedNetworks, NetworkDeleteResponse ``` Methods: - client.zero_trust.devices.networks.create(\*, account_id, \*\*params) -> Optional - client.zero_trust.devices.networks.update(network_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.networks.list(\*, account_id) -> Optional +- client.zero_trust.devices.networks.list(\*, account_id) -> SyncSinglePage[DeviceManagedNetworks] - client.zero_trust.devices.networks.delete(network_id, \*, account_id) -> Optional - client.zero_trust.devices.networks.get(network_id, \*, account_id) -> Optional @@ -4773,17 +4738,13 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import ( - DevicesDeviceSettingsPolicy, - PolicyListResponse, - PolicyDeleteResponse, -) +from cloudflare.types.zero_trust.devices import DevicesDeviceSettingsPolicy, PolicyDeleteResponse ``` Methods: - client.zero_trust.devices.policies.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.list(\*, account_id) -> Optional +- client.zero_trust.devices.policies.list(\*, account_id) -> SyncSinglePage[DevicesDeviceSettingsPolicy] - client.zero_trust.devices.policies.delete(policy_id, \*, account_id) -> Optional - client.zero_trust.devices.policies.edit(policy_id, \*, account_id, \*\*params) -> Optional - client.zero_trust.devices.policies.get(policy_id, \*, account_id) -> Optional @@ -4808,7 +4769,6 @@ Types: from cloudflare.types.zero_trust.devices.policies import ( DevicesSplitTunnel, ExcludeUpdateResponse, - ExcludeListResponse, ExcludeGetResponse, ) ``` @@ -4816,7 +4776,7 @@ from cloudflare.types.zero_trust.devices.policies import ( Methods: - client.zero_trust.devices.policies.excludes.update(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.excludes.list(\*, account_id) -> Optional +- client.zero_trust.devices.policies.excludes.list(\*, account_id) -> SyncSinglePage[DevicesSplitTunnel] - client.zero_trust.devices.policies.excludes.get(policy_id, \*, account_id) -> Optional #### FallbackDomains @@ -4827,7 +4787,6 @@ Types: from cloudflare.types.zero_trust.devices.policies import ( DevicesFallbackDomain, FallbackDomainUpdateResponse, - FallbackDomainListResponse, FallbackDomainGetResponse, ) ``` @@ -4835,7 +4794,7 @@ from cloudflare.types.zero_trust.devices.policies import ( Methods: - client.zero_trust.devices.policies.fallback_domains.update(policy_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.fallback_domains.list(\*, account_id) -> Optional +- client.zero_trust.devices.policies.fallback_domains.list(\*, account_id) -> SyncSinglePage[DevicesFallbackDomain] - client.zero_trust.devices.policies.fallback_domains.get(policy_id, \*, account_id) -> Optional #### Includes @@ -4846,7 +4805,6 @@ Types: from cloudflare.types.zero_trust.devices.policies import ( DevicesSplitTunnelInclude, IncludeUpdateResponse, - IncludeListResponse, IncludeGetResponse, ) ``` @@ -4854,7 +4812,7 @@ from cloudflare.types.zero_trust.devices.policies import ( Methods: - client.zero_trust.devices.policies.includes.update(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.policies.includes.list(\*, account_id) -> Optional +- client.zero_trust.devices.policies.includes.list(\*, account_id) -> SyncSinglePage[DevicesSplitTunnelInclude] - client.zero_trust.devices.policies.includes.get(policy_id, \*, account_id) -> Optional ### Posture @@ -4862,18 +4820,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import ( - DevicePostureRules, - PostureListResponse, - PostureDeleteResponse, -) +from cloudflare.types.zero_trust.devices import DevicePostureRules, PostureDeleteResponse ``` Methods: - client.zero_trust.devices.posture.create(\*, account_id, \*\*params) -> Optional - client.zero_trust.devices.posture.update(rule_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.posture.list(\*, account_id) -> Optional +- client.zero_trust.devices.posture.list(\*, account_id) -> SyncSinglePage[DevicePostureRules] - client.zero_trust.devices.posture.delete(rule_id, \*, account_id) -> Optional - client.zero_trust.devices.posture.get(rule_id, \*, account_id) -> Optional @@ -4884,7 +4838,6 @@ Types: ```python from cloudflare.types.zero_trust.devices.posture import ( DevicePostureIntegrations, - IntegrationListResponse, IntegrationDeleteResponse, ) ``` @@ -4892,7 +4845,7 @@ from cloudflare.types.zero_trust.devices.posture import ( Methods: - client.zero_trust.devices.posture.integrations.create(\*, account_id, \*\*params) -> Optional -- client.zero_trust.devices.posture.integrations.list(\*, account_id) -> Optional +- client.zero_trust.devices.posture.integrations.list(\*, account_id) -> SyncSinglePage[DevicePostureIntegrations] - client.zero_trust.devices.posture.integrations.delete(integration_id, \*, account_id) -> Optional - client.zero_trust.devices.posture.integrations.edit(integration_id, \*, account_id, \*\*params) -> Optional - client.zero_trust.devices.posture.integrations.get(integration_id, \*, account_id) -> Optional @@ -4962,7 +4915,7 @@ Methods: - client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustIdentityProviders - client.zero_trust.identity_providers.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustIdentityProviders -- client.zero_trust.identity_providers.list(\*, account_id, zone_id) -> Optional +- client.zero_trust.identity_providers.list(\*, account_id, zone_id) -> SyncSinglePage[IdentityProviderListResponse] - client.zero_trust.identity_providers.delete(uuid, \*, account_id, zone_id) -> IdentityProviderDeleteResponse - client.zero_trust.identity_providers.get(uuid, \*, account_id, zone_id) -> ZeroTrustIdentityProviders @@ -5002,7 +4955,6 @@ Types: ```python from cloudflare.types.zero_trust.access import ( ZeroTrustApps, - ApplicationListResponse, ApplicationDeleteResponse, ApplicationRevokeTokensResponse, ) @@ -5012,7 +4964,7 @@ Methods: - client.zero_trust.access.applications.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustApps - client.zero_trust.access.applications.update(app_id, \*, account_id, zone_id, \*\*params) -> ZeroTrustApps -- client.zero_trust.access.applications.list(\*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustApps] - client.zero_trust.access.applications.delete(app_id, \*, account_id, zone_id) -> ApplicationDeleteResponse - client.zero_trust.access.applications.get(app_id, \*, account_id, zone_id) -> ZeroTrustApps - client.zero_trust.access.applications.revoke_tokens(app_id, \*, account_id, zone_id) -> object @@ -5025,7 +4977,6 @@ Types: from cloudflare.types.zero_trust.access.applications import ( ZeroTrustCA, CACreateResponse, - CAListResponse, CADeleteResponse, CAGetResponse, ) @@ -5034,7 +4985,7 @@ from cloudflare.types.zero_trust.access.applications import ( Methods: - client.zero_trust.access.applications.cas.create(uuid, \*, account_id, zone_id) -> CACreateResponse -- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustCA] - client.zero_trust.access.applications.cas.delete(uuid, \*, account_id, zone_id) -> CADeleteResponse - client.zero_trust.access.applications.cas.get(uuid, \*, account_id, zone_id) -> CAGetResponse @@ -5055,18 +5006,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access.applications import ( - ZeroTrustPolicies, - PolicyListResponse, - PolicyDeleteResponse, -) +from cloudflare.types.zero_trust.access.applications import ZeroTrustPolicies, PolicyDeleteResponse ``` Methods: - client.zero_trust.access.applications.policies.create(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustPolicies - client.zero_trust.access.applications.policies.update(uuid, \*, uuid1, account_id, zone_id, \*\*params) -> ZeroTrustPolicies -- client.zero_trust.access.applications.policies.list(uuid, \*, account_id, zone_id) -> Optional +- client.zero_trust.access.applications.policies.list(uuid, \*, account_id, zone_id) -> SyncSinglePage[ZeroTrustPolicies] - client.zero_trust.access.applications.policies.delete(uuid, \*, uuid1, account_id, zone_id) -> PolicyDeleteResponse - client.zero_trust.access.applications.policies.get(uuid, \*, uuid1, account_id, zone_id) -> ZeroTrustPolicies @@ -5075,18 +5022,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ( - ZeroTrustCertificates, - CertificateListResponse, - CertificateDeleteResponse, -) +from cloudflare.types.zero_trust.access import ZeroTrustCertificates, CertificateDeleteResponse ``` Methods: - client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustCertificates - client.zero_trust.access.certificates.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustCertificates -- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> Optional +- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustCertificates] - client.zero_trust.access.certificates.delete(uuid, \*, account_id, zone_id) -> CertificateDeleteResponse - client.zero_trust.access.certificates.get(uuid, \*, account_id, zone_id) -> ZeroTrustCertificates @@ -5112,18 +5055,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ( - ZeroTrustGroups, - GroupListResponse, - GroupDeleteResponse, -) +from cloudflare.types.zero_trust.access import ZeroTrustGroups, GroupDeleteResponse ``` Methods: - client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> ZeroTrustGroups - client.zero_trust.access.groups.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustGroups -- client.zero_trust.access.groups.list(\*, account_id, zone_id) -> Optional +- client.zero_trust.access.groups.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustGroups] - client.zero_trust.access.groups.delete(uuid, \*, account_id, zone_id) -> GroupDeleteResponse - client.zero_trust.access.groups.get(uuid, \*, account_id, zone_id) -> ZeroTrustGroups @@ -5135,7 +5074,6 @@ Types: from cloudflare.types.zero_trust.access import ( ZeroTrustServiceTokens, ServiceTokenCreateResponse, - ServiceTokenListResponse, ServiceTokenRotateResponse, ) ``` @@ -5144,7 +5082,7 @@ Methods: - client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> ServiceTokenCreateResponse - client.zero_trust.access.service_tokens.update(uuid, \*, account_id, zone_id, \*\*params) -> ZeroTrustServiceTokens -- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id) -> Optional +- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id) -> SyncSinglePage[ZeroTrustServiceTokens] - client.zero_trust.access.service_tokens.delete(uuid, \*, account_id, zone_id) -> ZeroTrustServiceTokens - client.zero_trust.access.service_tokens.refresh(uuid, \*, identifier) -> ZeroTrustServiceTokens - client.zero_trust.access.service_tokens.rotate(uuid, \*, identifier) -> ServiceTokenRotateResponse @@ -5154,18 +5092,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ( - ZeroTrustBookmarks, - BookmarkListResponse, - BookmarkDeleteResponse, -) +from cloudflare.types.zero_trust.access import ZeroTrustBookmarks, BookmarkDeleteResponse ``` Methods: - client.zero_trust.access.bookmarks.create(uuid, \*, identifier) -> ZeroTrustBookmarks - client.zero_trust.access.bookmarks.update(uuid, \*, identifier) -> ZeroTrustBookmarks -- client.zero_trust.access.bookmarks.list(identifier) -> Optional +- client.zero_trust.access.bookmarks.list(identifier) -> SyncSinglePage[ZeroTrustBookmarks] - client.zero_trust.access.bookmarks.delete(uuid, \*, identifier) -> BookmarkDeleteResponse - client.zero_trust.access.bookmarks.get(uuid, \*, identifier) -> ZeroTrustBookmarks @@ -5205,12 +5139,12 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustUsers, UserListResponse +from cloudflare.types.zero_trust.access import ZeroTrustUsers ``` Methods: -- client.zero_trust.access.users.list(identifier) -> Optional +- client.zero_trust.access.users.list(identifier) -> SyncSinglePage[ZeroTrustUsers] #### ActiveSessions @@ -5225,7 +5159,7 @@ from cloudflare.types.zero_trust.access.users import ( Methods: -- client.zero_trust.access.users.active_sessions.list(id, \*, identifier) -> Optional +- client.zero_trust.access.users.active_sessions.list(id, \*, identifier) -> SyncSinglePage[ActiveSessionListResponse] - client.zero_trust.access.users.active_sessions.get(nonce, \*, identifier, id) -> ActiveSessionGetResponse #### LastSeenIdentity @@ -5250,7 +5184,7 @@ from cloudflare.types.zero_trust.access.users import FailedLoginListResponse Methods: -- client.zero_trust.access.users.failed_logins.list(id, \*, identifier) -> Optional +- client.zero_trust.access.users.failed_logins.list(id, \*, identifier) -> SyncSinglePage[FailedLoginListResponse] ### CustomPages @@ -5260,7 +5194,6 @@ Types: from cloudflare.types.zero_trust.access import ( ZeroTrustCustomPage, ZeroTrustCustomPageWithoutHTML, - CustomPageListResponse, CustomPageDeleteResponse, ) ``` @@ -5269,7 +5202,7 @@ Methods: - client.zero_trust.access.custom_pages.create(identifier, \*\*params) -> ZeroTrustCustomPageWithoutHTML - client.zero_trust.access.custom_pages.update(uuid, \*, identifier, \*\*params) -> ZeroTrustCustomPageWithoutHTML -- client.zero_trust.access.custom_pages.list(identifier) -> Optional +- client.zero_trust.access.custom_pages.list(identifier) -> SyncSinglePage[ZeroTrustCustomPageWithoutHTML] - client.zero_trust.access.custom_pages.delete(uuid, \*, identifier) -> CustomPageDeleteResponse - client.zero_trust.access.custom_pages.get(uuid, \*, identifier) -> ZeroTrustCustomPage @@ -5278,14 +5211,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustTag, TagListResponse, TagDeleteResponse +from cloudflare.types.zero_trust.access import ZeroTrustTag, TagDeleteResponse ``` Methods: - client.zero_trust.access.tags.create(identifier, \*\*params) -> ZeroTrustTag - client.zero_trust.access.tags.update(tag_name, \*, identifier, \*\*params) -> ZeroTrustTag -- client.zero_trust.access.tags.list(identifier) -> Optional +- client.zero_trust.access.tags.list(identifier) -> SyncSinglePage[ZeroTrustTag] - client.zero_trust.access.tags.delete(name, \*, identifier) -> TagDeleteResponse - client.zero_trust.access.tags.get(name, \*, identifier) -> ZeroTrustTag @@ -5301,7 +5234,7 @@ from cloudflare.types.zero_trust.dex import ColoListResponse Methods: -- client.zero_trust.dex.colos.list(\*, account_id, \*\*params) -> Optional +- client.zero_trust.dex.colos.list(\*, account_id, \*\*params) -> SyncSinglePage[object] ### FleetStatus @@ -5521,7 +5454,7 @@ Methods: - client.zero_trust.dlp.datasets.create(\*, account_id, \*\*params) -> Optional - client.zero_trust.dlp.datasets.update(dataset_id, \*, account_id, \*\*params) -> Optional -- client.zero_trust.dlp.datasets.list(\*, account_id) -> Optional +- client.zero_trust.dlp.datasets.list(\*, account_id) -> SyncSinglePage[DLPDataset] - client.zero_trust.dlp.datasets.delete(dataset_id, \*, account_id) -> None - client.zero_trust.dlp.datasets.get(dataset_id, \*, account_id) -> Optional @@ -5568,12 +5501,12 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.dlp import DLPProfiles, ProfileListResponse, ProfileGetResponse +from cloudflare.types.zero_trust.dlp import DLPProfiles, ProfileGetResponse ``` Methods: -- client.zero_trust.dlp.profiles.list(\*, account_id) -> Optional +- client.zero_trust.dlp.profiles.list(\*, account_id) -> SyncSinglePage[DLPProfiles] - client.zero_trust.dlp.profiles.get(profile_id, \*, account_id) -> ProfileGetResponse #### Custom @@ -5639,24 +5572,24 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayCategories, CategoryListResponse +from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayCategories ``` Methods: -- client.zero_trust.gateway.categories.list(\*, account_id) -> Optional +- client.zero_trust.gateway.categories.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayCategories] ### AppTypes Types: ```python -from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayAppTypes, AppTypeListResponse +from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayAppTypes ``` Methods: -- client.zero_trust.gateway.app_types.list(\*, account_id) -> Optional +- client.zero_trust.gateway.app_types.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayAppTypes] ### Configurations @@ -5684,7 +5617,6 @@ Types: from cloudflare.types.zero_trust.gateway import ( ZeroTrustGatewayLists, ListCreateResponse, - ListListResponse, ListDeleteResponse, ) ``` @@ -5693,7 +5625,7 @@ Methods: - client.zero_trust.gateway.lists.create(\*, account_id, \*\*params) -> ListCreateResponse - client.zero_trust.gateway.lists.update(list_id, \*, account_id, \*\*params) -> ZeroTrustGatewayLists -- client.zero_trust.gateway.lists.list(\*, account_id) -> Optional +- client.zero_trust.gateway.lists.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayLists] - client.zero_trust.gateway.lists.delete(list_id, \*, account_id) -> ListDeleteResponse - client.zero_trust.gateway.lists.edit(list_id, \*, account_id, \*\*params) -> ZeroTrustGatewayLists - client.zero_trust.gateway.lists.get(list_id, \*, account_id) -> ZeroTrustGatewayLists @@ -5708,25 +5640,21 @@ from cloudflare.types.zero_trust.gateway.lists import ItemListResponse Methods: -- client.zero_trust.gateway.lists.items.list(list_id, \*, account_id) -> Optional +- client.zero_trust.gateway.lists.items.list(list_id, \*, account_id) -> SyncSinglePage[ItemListResponse] ### Locations Types: ```python -from cloudflare.types.zero_trust.gateway import ( - ZeroTrustGatewayLocations, - LocationListResponse, - LocationDeleteResponse, -) +from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayLocations, LocationDeleteResponse ``` Methods: - client.zero_trust.gateway.locations.create(\*, account_id, \*\*params) -> ZeroTrustGatewayLocations - client.zero_trust.gateway.locations.update(location_id, \*, account_id, \*\*params) -> ZeroTrustGatewayLocations -- client.zero_trust.gateway.locations.list(\*, account_id) -> Optional +- client.zero_trust.gateway.locations.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayLocations] - client.zero_trust.gateway.locations.delete(location_id, \*, account_id) -> LocationDeleteResponse - client.zero_trust.gateway.locations.get(location_id, \*, account_id) -> ZeroTrustGatewayLocations @@ -5750,7 +5678,6 @@ Types: ```python from cloudflare.types.zero_trust.gateway import ( ZeroTrustGatewayProxyEndpoints, - ProxyEndpointListResponse, ProxyEndpointDeleteResponse, ) ``` @@ -5758,7 +5685,7 @@ from cloudflare.types.zero_trust.gateway import ( Methods: - client.zero_trust.gateway.proxy_endpoints.create(\*, account_id, \*\*params) -> ZeroTrustGatewayProxyEndpoints -- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> Optional +- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayProxyEndpoints] - client.zero_trust.gateway.proxy_endpoints.delete(proxy_endpoint_id, \*, account_id) -> ProxyEndpointDeleteResponse - client.zero_trust.gateway.proxy_endpoints.edit(proxy_endpoint_id, \*, account_id, \*\*params) -> ZeroTrustGatewayProxyEndpoints - client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> ZeroTrustGatewayProxyEndpoints @@ -5768,18 +5695,14 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.gateway import ( - ZeroTrustGatewayRules, - RuleListResponse, - RuleDeleteResponse, -) +from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayRules, RuleDeleteResponse ``` Methods: - client.zero_trust.gateway.rules.create(\*, account_id, \*\*params) -> ZeroTrustGatewayRules - client.zero_trust.gateway.rules.update(rule_id, \*, account_id, \*\*params) -> ZeroTrustGatewayRules -- client.zero_trust.gateway.rules.list(\*, account_id) -> Optional +- client.zero_trust.gateway.rules.list(\*, account_id) -> SyncSinglePage[ZeroTrustGatewayRules] - client.zero_trust.gateway.rules.delete(rule_id, \*, account_id) -> RuleDeleteResponse - client.zero_trust.gateway.rules.get(rule_id, \*, account_id) -> ZeroTrustGatewayRules @@ -5822,7 +5745,6 @@ Types: from cloudflare.types.zero_trust.networks import ( TunnelVirtualNetwork, VirtualNetworkCreateResponse, - VirtualNetworkListResponse, VirtualNetworkDeleteResponse, VirtualNetworkEditResponse, ) @@ -5831,7 +5753,7 @@ from cloudflare.types.zero_trust.networks import ( Methods: - client.zero_trust.networks.virtual_networks.create(\*, account_id, \*\*params) -> VirtualNetworkCreateResponse -- client.zero_trust.networks.virtual_networks.list(\*, account_id, \*\*params) -> Optional +- client.zero_trust.networks.virtual_networks.list(\*, account_id, \*\*params) -> SyncSinglePage[TunnelVirtualNetwork] - client.zero_trust.networks.virtual_networks.delete(virtual_network_id, \*, account_id) -> VirtualNetworkDeleteResponse - client.zero_trust.networks.virtual_networks.edit(virtual_network_id, \*, account_id, \*\*params) -> VirtualNetworkEditResponse @@ -5876,7 +5798,7 @@ Methods: - client.hyperdrive.configs.create(\*, account_id, \*\*params) -> Optional - client.hyperdrive.configs.update(hyperdrive_id, \*, account_id, \*\*params) -> Optional -- client.hyperdrive.configs.list(\*, account_id) -> ConfigListResponse +- client.hyperdrive.configs.list(\*, account_id) -> SyncSinglePage[ConfigListResponse] - client.hyperdrive.configs.delete(hyperdrive_id, \*, account_id) -> Optional - client.hyperdrive.configs.edit(hyperdrive_id, \*, account_id, \*\*params) -> Optional - client.hyperdrive.configs.get(hyperdrive_id, \*, account_id) -> Optional @@ -5927,7 +5849,6 @@ from cloudflare.types.vectorize import ( VectorizeIndexInsert, VectorizeIndexQuery, VectorizeIndexUpsert, - IndexListResponse, IndexDeleteResponse, IndexGetByIDsResponse, ) @@ -5937,7 +5858,7 @@ Methods: - client.vectorize.indexes.create(account_identifier, \*\*params) -> Optional - client.vectorize.indexes.update(index_name, \*, account_identifier, \*\*params) -> Optional -- client.vectorize.indexes.list(account_identifier) -> IndexListResponse +- client.vectorize.indexes.list(account_identifier) -> SyncSinglePage[VectorizeCreateIndex] - client.vectorize.indexes.delete(index_name, \*, account_identifier) -> Optional - client.vectorize.indexes.delete_by_ids(index_name, \*, account_identifier, \*\*params) -> Optional - client.vectorize.indexes.get(index_name, \*, account_identifier) -> Optional @@ -7106,7 +7027,7 @@ from cloudflare.types.speed import PageListResponse Methods: -- client.speed.pages.list(\*, zone_id) -> Optional +- client.speed.pages.list(\*, zone_id) -> SyncSinglePage[PageListResponse] # DCVDelegation @@ -7149,13 +7070,13 @@ Methods: Types: ```python -from cloudflare.types import Snippet, SnippetListResponse, SnippetDeleteResponse +from cloudflare.types import Snippet, SnippetDeleteResponse ``` Methods: - client.snippets.update(snippet_name, \*, zone_identifier, \*\*params) -> Snippet -- client.snippets.list(zone_identifier) -> SnippetListResponse +- client.snippets.list(zone_identifier) -> SyncSinglePage[Snippet] - client.snippets.delete(snippet_name, \*, zone_identifier) -> SnippetDeleteResponse - client.snippets.get(snippet_name, \*, zone_identifier) -> Snippet @@ -7176,21 +7097,21 @@ from cloudflare.types.snippets import RuleUpdateResponse, RuleListResponse Methods: - client.snippets.rules.update(zone_identifier, \*\*params) -> RuleUpdateResponse -- client.snippets.rules.list(zone_identifier) -> RuleListResponse +- client.snippets.rules.list(zone_identifier) -> SyncSinglePage[RuleListResponse] # Calls Types: ```python -from cloudflare.types import CallsApp, CallsAppWithSecret, CallListResponse +from cloudflare.types import CallsApp, CallsAppWithSecret ``` Methods: - client.calls.create(\*, account_id, \*\*params) -> CallsAppWithSecret - client.calls.update(app_id, \*, account_id, \*\*params) -> CallsApp -- client.calls.list(\*, account_id) -> CallListResponse +- client.calls.list(\*, account_id) -> SyncSinglePage[CallsApp] - client.calls.delete(app_id, \*, account_id) -> CallsApp - client.calls.get(app_id, \*, account_id) -> CallsApp diff --git a/src/cloudflare/pagination.py b/src/cloudflare/pagination.py index 7382cf23d68..37e133da6f6 100644 --- a/src/cloudflare/pagination.py +++ b/src/cloudflare/pagination.py @@ -1,11 +1,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Any, List, Type, Generic, Mapping, TypeVar, Optional, cast +from typing import List, Generic, TypeVar, Optional, cast from typing_extensions import override -from httpx import Response - -from ._utils import is_mapping from ._models import BaseModel, GenericModel from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage @@ -27,8 +24,6 @@ "AsyncSinglePage", ] -_BaseModelT = TypeVar("_BaseModelT", bound=BaseModel) - _T = TypeVar("_T") @@ -257,14 +252,14 @@ def next_page_info(self) -> Optional[PageInfo]: class SyncSinglePage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): - items: List[_T] + result: List[_T] @override def _get_page_items(self) -> List[_T]: - items = self.items - if not items: + result = self.result + if not result: return [] - return items + return result @override def next_page_info(self) -> None: @@ -274,25 +269,16 @@ def next_page_info(self) -> None: """ return None - @classmethod - def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 - return cls.construct( - None, - **{ - **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), - }, - ) - class AsyncSinglePage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): - items: List[_T] + result: List[_T] @override def _get_page_items(self) -> List[_T]: - items = self.items - if not items: + result = self.result + if not result: return [] - return items + return result @override def next_page_info(self) -> None: @@ -301,12 +287,3 @@ def next_page_info(self) -> None: so there will never be a next page. """ return None - - @classmethod - def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003 - return cls.construct( - None, - **{ - **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}), - }, - ) diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py index 00196588ccd..0bfc6405723 100644 --- a/src/cloudflare/resources/accounts/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, cast import httpx @@ -16,10 +16,12 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.accounts import RoleGetResponse, RoleListResponse +from ...types.accounts import Role, RoleGetResponse __all__ = ["Roles", "AsyncRoles"] @@ -43,7 +45,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RoleListResponse]: + ) -> SyncSinglePage[Role]: """ Get all available roles for an account. @@ -56,16 +58,13 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( f"/accounts/{account_id}/roles", + page=SyncSinglePage[Role], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RoleListResponse]], ResultWrapper[RoleListResponse]), + model=Role, ) def get( @@ -119,7 +118,7 @@ def with_raw_response(self) -> AsyncRolesWithRawResponse: def with_streaming_response(self) -> AsyncRolesWithStreamingResponse: return AsyncRolesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: object, @@ -129,7 +128,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RoleListResponse]: + ) -> AsyncPaginator[Role, AsyncSinglePage[Role]]: """ Get all available roles for an account. @@ -142,16 +141,13 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/roles", + page=AsyncSinglePage[Role], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RoleListResponse]], ResultWrapper[RoleListResponse]), + model=Role, ) async def get( diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py index c60212fff0c..f892395f3cc 100644 --- a/src/cloudflare/resources/addressing/address_maps/address_maps.py +++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py @@ -44,13 +44,14 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.addressing import ( AddressingAddressMaps, AddressMapGetResponse, - AddressMapListResponse, AddressMapCreateResponse, AddressMapDeleteResponse, address_map_edit_params, @@ -145,7 +146,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AddressMapListResponse]: + ) -> SyncSinglePage[AddressingAddressMaps]: """ List all address maps owned by the account. @@ -162,16 +163,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/address_maps", + page=SyncSinglePage[AddressingAddressMaps], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[AddressMapListResponse]], ResultWrapper[AddressMapListResponse]), + model=AddressingAddressMaps, ) def delete( @@ -412,7 +410,7 @@ async def create( cast_to=cast(Type[AddressMapCreateResponse], ResultWrapper[AddressMapCreateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -422,7 +420,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AddressMapListResponse]: + ) -> AsyncPaginator[AddressingAddressMaps, AsyncSinglePage[AddressingAddressMaps]]: """ List all address maps owned by the account. @@ -439,16 +437,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/address_maps", + page=AsyncSinglePage[AddressingAddressMaps], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[AddressMapListResponse]], ResultWrapper[AddressMapListResponse]), + model=AddressingAddressMaps, ) async def delete( diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py b/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py index c28b159dfe3..46ce8e5e38d 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/bindings.py @@ -20,15 +20,12 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from .....types.addressing.prefixes.bgp import ( - BindingListResponse, - BindingDeleteResponse, - AddressingServiceBinding, - binding_create_params, -) +from .....types.addressing.prefixes.bgp import BindingDeleteResponse, AddressingServiceBinding, binding_create_params __all__ = ["Bindings", "AsyncBindings"] @@ -113,7 +110,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingListResponse: + ) -> SyncSinglePage[AddressingServiceBinding]: """List the Cloudflare services this prefix is currently bound to. Traffic sent to @@ -140,16 +137,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings", + page=SyncSinglePage[AddressingServiceBinding], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[BindingListResponse], ResultWrapper[BindingListResponse]), + model=AddressingServiceBinding, ) def delete( @@ -325,7 +319,7 @@ async def create( cast_to=cast(Type[AddressingServiceBinding], ResultWrapper[AddressingServiceBinding]), ) - async def list( + def list( self, prefix_id: str, *, @@ -336,7 +330,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> BindingListResponse: + ) -> AsyncPaginator[AddressingServiceBinding, AsyncSinglePage[AddressingServiceBinding]]: """List the Cloudflare services this prefix is currently bound to. Traffic sent to @@ -363,16 +357,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bindings", + page=AsyncSinglePage[AddressingServiceBinding], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[BindingListResponse], ResultWrapper[BindingListResponse]), + model=AddressingServiceBinding, ) async def delete( diff --git a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py b/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py index 25d953a8ed5..113ea0f6d3d 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp/prefixes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,10 +20,12 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from .....types.addressing.prefixes.bgp import PrefixListResponse, AddressingIpamBGPPrefixes, prefix_edit_params +from .....types.addressing.prefixes.bgp import AddressingIpamBGPPrefixes, prefix_edit_params __all__ = ["Prefixes", "AsyncPrefixes"] @@ -48,7 +50,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PrefixListResponse]: + ) -> SyncSinglePage[AddressingIpamBGPPrefixes]: """List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to @@ -73,16 +75,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes", + page=SyncSinglePage[AddressingIpamBGPPrefixes], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PrefixListResponse]], ResultWrapper[PrefixListResponse]), + model=AddressingIpamBGPPrefixes, ) def edit( @@ -196,7 +195,7 @@ def with_raw_response(self) -> AsyncPrefixesWithRawResponse: def with_streaming_response(self) -> AsyncPrefixesWithStreamingResponse: return AsyncPrefixesWithStreamingResponse(self) - async def list( + def list( self, prefix_id: str, *, @@ -207,7 +206,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PrefixListResponse]: + ) -> AsyncPaginator[AddressingIpamBGPPrefixes, AsyncSinglePage[AddressingIpamBGPPrefixes]]: """List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to @@ -232,16 +231,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/bgp/prefixes", + page=AsyncSinglePage[AddressingIpamBGPPrefixes], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PrefixListResponse]], ResultWrapper[PrefixListResponse]), + model=AddressingIpamBGPPrefixes, ) async def edit( diff --git a/src/cloudflare/resources/addressing/prefixes/delegations.py b/src/cloudflare/resources/addressing/prefixes/delegations.py index f84c4f7290a..128e96049de 100644 --- a/src/cloudflare/resources/addressing/prefixes/delegations.py +++ b/src/cloudflare/resources/addressing/prefixes/delegations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,15 +20,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.addressing.prefixes import ( - DelegationListResponse, - DelegationDeleteResponse, - AddressingIpamDelegations, - delegation_create_params, -) +from ....types.addressing.prefixes import DelegationDeleteResponse, AddressingIpamDelegations, delegation_create_params __all__ = ["Delegations", "AsyncDelegations"] @@ -110,7 +107,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DelegationListResponse]: + ) -> SyncSinglePage[AddressingIpamDelegations]: """ List all delegations for a given account IP prefix. @@ -131,16 +128,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations", + page=SyncSinglePage[AddressingIpamDelegations], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DelegationListResponse]], ResultWrapper[DelegationListResponse]), + model=AddressingIpamDelegations, ) def delete( @@ -259,7 +253,7 @@ async def create( cast_to=cast(Type[AddressingIpamDelegations], ResultWrapper[AddressingIpamDelegations]), ) - async def list( + def list( self, prefix_id: str, *, @@ -270,7 +264,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DelegationListResponse]: + ) -> AsyncPaginator[AddressingIpamDelegations, AsyncSinglePage[AddressingIpamDelegations]]: """ List all delegations for a given account IP prefix. @@ -291,16 +285,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not prefix_id: raise ValueError(f"Expected a non-empty value for `prefix_id` but received {prefix_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes/{prefix_id}/delegations", + page=AsyncSinglePage[AddressingIpamDelegations], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DelegationListResponse]], ResultWrapper[DelegationListResponse]), + model=AddressingIpamDelegations, ) async def delete( diff --git a/src/cloudflare/resources/addressing/prefixes/prefixes.py b/src/cloudflare/resources/addressing/prefixes/prefixes.py index 182c703144f..c93fbcd9ef6 100644 --- a/src/cloudflare/resources/addressing/prefixes/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/prefixes.py @@ -37,16 +37,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.addressing import ( - PrefixListResponse, - PrefixDeleteResponse, - AddressingIpamPrefixes, - prefix_edit_params, - prefix_create_params, -) +from ....types.addressing import PrefixDeleteResponse, AddressingIpamPrefixes, prefix_edit_params, prefix_create_params __all__ = ["Prefixes", "AsyncPrefixes"] @@ -134,7 +130,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PrefixListResponse]: + ) -> SyncSinglePage[AddressingIpamPrefixes]: """ List all prefixes owned by the account. @@ -151,16 +147,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes", + page=SyncSinglePage[AddressingIpamPrefixes], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PrefixListResponse]], ResultWrapper[PrefixListResponse]), + model=AddressingIpamPrefixes, ) def delete( @@ -378,7 +371,7 @@ async def create( cast_to=cast(Type[AddressingIpamPrefixes], ResultWrapper[AddressingIpamPrefixes]), ) - async def list( + def list( self, *, account_id: str, @@ -388,7 +381,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PrefixListResponse]: + ) -> AsyncPaginator[AddressingIpamPrefixes, AsyncSinglePage[AddressingIpamPrefixes]]: """ List all prefixes owned by the account. @@ -405,16 +398,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/prefixes", + page=AsyncSinglePage[AddressingIpamPrefixes], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PrefixListResponse]], ResultWrapper[PrefixListResponse]), + model=AddressingIpamPrefixes, ) async def delete( diff --git a/src/cloudflare/resources/addressing/services.py b/src/cloudflare/resources/addressing/services.py index 92e194808cd..13a93ebb865 100644 --- a/src/cloudflare/resources/addressing/services.py +++ b/src/cloudflare/resources/addressing/services.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, cast - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,8 +13,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.addressing import ServiceListResponse @@ -43,7 +42,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceListResponse: + ) -> SyncSinglePage[ServiceListResponse]: """ Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a service running on the Cloudflare network to enable a Cloudflare product on the @@ -63,16 +62,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/services", + page=SyncSinglePage[ServiceListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ServiceListResponse], ResultWrapper[ServiceListResponse]), + model=ServiceListResponse, ) @@ -85,7 +81,7 @@ def with_raw_response(self) -> AsyncServicesWithRawResponse: def with_streaming_response(self) -> AsyncServicesWithStreamingResponse: return AsyncServicesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -95,7 +91,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ServiceListResponse: + ) -> AsyncPaginator[ServiceListResponse, AsyncSinglePage[ServiceListResponse]]: """ Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a service running on the Cloudflare network to enable a Cloudflare product on the @@ -115,16 +111,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/addressing/services", + page=AsyncSinglePage[ServiceListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ServiceListResponse], ResultWrapper[ServiceListResponse]), + model=ServiceListResponse, ) diff --git a/src/cloudflare/resources/alerting/destinations/webhooks.py b/src/cloudflare/resources/alerting/destinations/webhooks.py index 62567e627bb..62528f9e741 100644 --- a/src/cloudflare/resources/alerting/destinations/webhooks.py +++ b/src/cloudflare/resources/alerting/destinations/webhooks.py @@ -20,12 +20,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.alerting.destinations import ( AlertingWebhooks, - WebhookListResponse, WebhookCreateResponse, WebhookDeleteResponse, WebhookUpdateResponse, @@ -178,7 +179,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WebhookListResponse]: + ) -> SyncSinglePage[AlertingWebhooks]: """ Gets a list of all configured webhook destinations. @@ -195,16 +196,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/alerting/v3/destinations/webhooks", + page=SyncSinglePage[AlertingWebhooks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[WebhookListResponse]], ResultWrapper[WebhookListResponse]), + model=AlertingWebhooks, ) def delete( @@ -433,7 +431,7 @@ async def update( cast_to=cast(Type[WebhookUpdateResponse], ResultWrapper[WebhookUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -443,7 +441,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WebhookListResponse]: + ) -> AsyncPaginator[AlertingWebhooks, AsyncSinglePage[AlertingWebhooks]]: """ Gets a list of all configured webhook destinations. @@ -460,16 +458,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/alerting/v3/destinations/webhooks", + page=AsyncSinglePage[AlertingWebhooks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[WebhookListResponse]], ResultWrapper[WebhookListResponse]), + model=AlertingWebhooks, ) async def delete( diff --git a/src/cloudflare/resources/alerting/policies.py b/src/cloudflare/resources/alerting/policies.py index 434a862f31c..a3372cb90f5 100644 --- a/src/cloudflare/resources/alerting/policies.py +++ b/src/cloudflare/resources/alerting/policies.py @@ -21,12 +21,13 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.alerting import ( AlertingPolicies, - PolicyListResponse, PolicyCreateResponse, PolicyDeleteResponse, PolicyUpdateResponse, @@ -320,7 +321,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> SyncSinglePage[AlertingPolicies]: """ Get a list of all Notification policies. @@ -337,16 +338,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/alerting/v3/policies", + page=SyncSinglePage[AlertingPolicies], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=AlertingPolicies, ) def delete( @@ -716,7 +714,7 @@ async def update( cast_to=cast(Type[PolicyUpdateResponse], ResultWrapper[PolicyUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -726,7 +724,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> AsyncPaginator[AlertingPolicies, AsyncSinglePage[AlertingPolicies]]: """ Get a list of all Notification policies. @@ -743,16 +741,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/alerting/v3/policies", + page=AsyncSinglePage[AlertingPolicies], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=AlertingPolicies, ) async def delete( diff --git a/src/cloudflare/resources/calls.py b/src/cloudflare/resources/calls.py index d9b7184ecb0..595b997a7e5 100644 --- a/src/cloudflare/resources/calls.py +++ b/src/cloudflare/resources/calls.py @@ -6,13 +6,7 @@ import httpx -from ..types import ( - CallsApp, - CallListResponse, - CallsAppWithSecret, - call_create_params, - call_update_params, -) +from ..types import CallsApp, CallsAppWithSecret, call_create_params, call_update_params from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._utils import ( maybe_transform, @@ -27,7 +21,9 @@ async_to_streamed_response_wrapper, ) from .._wrappers import ResultWrapper +from ..pagination import SyncSinglePage, AsyncSinglePage from .._base_client import ( + AsyncPaginator, make_request_options, ) @@ -146,7 +142,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallListResponse: + ) -> SyncSinglePage[CallsApp]: """ Lists all apps in the Cloudflare account @@ -163,16 +159,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/calls/apps", + page=SyncSinglePage[CallsApp], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[CallListResponse], ResultWrapper[CallListResponse]), + model=CallsApp, ) def delete( @@ -366,7 +359,7 @@ async def update( cast_to=cast(Type[CallsApp], ResultWrapper[CallsApp]), ) - async def list( + def list( self, *, account_id: str, @@ -376,7 +369,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> CallListResponse: + ) -> AsyncPaginator[CallsApp, AsyncSinglePage[CallsApp]]: """ Lists all apps in the Cloudflare account @@ -393,16 +386,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/calls/apps", + page=AsyncSinglePage[CallsApp], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[CallListResponse], ResultWrapper[CallListResponse]), + model=CallsApp, ) async def delete( diff --git a/src/cloudflare/resources/durable_objects/namespaces/namespaces.py b/src/cloudflare/resources/durable_objects/namespaces/namespaces.py index c6fc6f7e5dd..a46939676e7 100644 --- a/src/cloudflare/resources/durable_objects/namespaces/namespaces.py +++ b/src/cloudflare/resources/durable_objects/namespaces/namespaces.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast - import httpx from .objects import ( @@ -23,11 +21,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.durable_objects import NamespaceListResponse +from ....types.durable_objects import DurableObjectNamespace __all__ = ["Namespaces", "AsyncNamespaces"] @@ -55,7 +54,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NamespaceListResponse]: + ) -> SyncSinglePage[DurableObjectNamespace]: """ Returns the Durable Object namespaces owned by an account. @@ -72,16 +71,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/durable_objects/namespaces", + page=SyncSinglePage[DurableObjectNamespace], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[NamespaceListResponse]], ResultWrapper[NamespaceListResponse]), + model=DurableObjectNamespace, ) @@ -98,7 +94,7 @@ def with_raw_response(self) -> AsyncNamespacesWithRawResponse: def with_streaming_response(self) -> AsyncNamespacesWithStreamingResponse: return AsyncNamespacesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -108,7 +104,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NamespaceListResponse]: + ) -> AsyncPaginator[DurableObjectNamespace, AsyncSinglePage[DurableObjectNamespace]]: """ Returns the Durable Object namespaces owned by an account. @@ -125,16 +121,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/durable_objects/namespaces", + page=AsyncSinglePage[DurableObjectNamespace], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[NamespaceListResponse]], ResultWrapper[NamespaceListResponse]), + model=DurableObjectNamespace, ) diff --git a/src/cloudflare/resources/healthchecks/healthchecks.py b/src/cloudflare/resources/healthchecks/healthchecks.py index 113f89b83eb..5ceeb208130 100644 --- a/src/cloudflare/resources/healthchecks/healthchecks.py +++ b/src/cloudflare/resources/healthchecks/healthchecks.py @@ -9,7 +9,6 @@ from ...types import ( Healthcheck, - HealthcheckListResponse, HealthcheckDeleteResponse, healthcheck_edit_params, healthcheck_create_params, @@ -37,7 +36,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -320,7 +321,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HealthcheckListResponse]: + ) -> SyncSinglePage[Healthcheck]: """ List configured health checks. @@ -337,16 +338,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/healthchecks", + page=SyncSinglePage[Healthcheck], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[HealthcheckListResponse]], ResultWrapper[HealthcheckListResponse]), + model=Healthcheck, ) def delete( @@ -833,7 +831,7 @@ async def update( cast_to=cast(Type[Healthcheck], ResultWrapper[Healthcheck]), ) - async def list( + def list( self, *, zone_id: str, @@ -843,7 +841,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HealthcheckListResponse]: + ) -> AsyncPaginator[Healthcheck, AsyncSinglePage[Healthcheck]]: """ List configured health checks. @@ -860,16 +858,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/healthchecks", + page=AsyncSinglePage[Healthcheck], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[HealthcheckListResponse]], ResultWrapper[HealthcheckListResponse]), + model=Healthcheck, ) async def delete( diff --git a/src/cloudflare/resources/hyperdrive/configs.py b/src/cloudflare/resources/hyperdrive/configs.py index 31e96b71c10..451c1c4020c 100644 --- a/src/cloudflare/resources/hyperdrive/configs.py +++ b/src/cloudflare/resources/hyperdrive/configs.py @@ -20,7 +20,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.hyperdrive import ( @@ -144,7 +146,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigListResponse: + ) -> SyncSinglePage[ConfigListResponse]: """ Returns a list of Hyperdrives @@ -161,16 +163,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/hyperdrive/configs", + page=SyncSinglePage[ConfigListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ConfigListResponse], ResultWrapper[ConfigListResponse]), + model=ConfigListResponse, ) def delete( @@ -411,7 +410,7 @@ async def update( cast_to=cast(Type[Optional[ConfigUpdateResponse]], ResultWrapper[ConfigUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -421,7 +420,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ConfigListResponse: + ) -> AsyncPaginator[ConfigListResponse, AsyncSinglePage[ConfigListResponse]]: """ Returns a list of Hyperdrives @@ -438,16 +437,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/hyperdrive/configs", + page=AsyncSinglePage[ConfigListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ConfigListResponse], ResultWrapper[ConfigListResponse]), + model=ConfigListResponse, ) async def delete( diff --git a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py index 98e9e9e195e..add3191f331 100644 --- a/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py +++ b/src/cloudflare/resources/intel/indicator_feeds/indicator_feeds.py @@ -28,6 +28,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ....types.intel import ( IndicatorFeedGetResponse, IndicatorFeedListResponse, @@ -37,6 +38,7 @@ indicator_feed_update_params, ) from ...._base_client import ( + AsyncPaginator, make_request_options, ) @@ -164,7 +166,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndicatorFeedListResponse: + ) -> SyncSinglePage[IndicatorFeedListResponse]: """ Get indicator feeds owned by this account @@ -181,16 +183,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/intel/indicator-feeds", + page=SyncSinglePage[IndicatorFeedListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[IndicatorFeedListResponse], ResultWrapper[IndicatorFeedListResponse]), + model=IndicatorFeedListResponse, ) def data( @@ -388,7 +387,7 @@ async def update( cast_to=cast(Type[IndicatorFeedUpdateResponse], ResultWrapper[IndicatorFeedUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -398,7 +397,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndicatorFeedListResponse: + ) -> AsyncPaginator[IndicatorFeedListResponse, AsyncSinglePage[IndicatorFeedListResponse]]: """ Get indicator feeds owned by this account @@ -415,16 +414,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/intel/indicator-feeds", + page=AsyncSinglePage[IndicatorFeedListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[IndicatorFeedListResponse], ResultWrapper[IndicatorFeedListResponse]), + model=IndicatorFeedListResponse, ) async def data( diff --git a/src/cloudflare/resources/intel/sinkholes.py b/src/cloudflare/resources/intel/sinkholes.py index e29c60fbf81..ecd8c6c8e4e 100644 --- a/src/cloudflare/resources/intel/sinkholes.py +++ b/src/cloudflare/resources/intel/sinkholes.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, cast - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,9 +13,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper -from ...types.intel import SinkholeListResponse +from ...pagination import SyncSinglePage, AsyncSinglePage +from ...types.intel import IntelSinkholeItem from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -43,7 +42,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SinkholeListResponse: + ) -> SyncSinglePage[IntelSinkholeItem]: """ List sinkholes owned by this account @@ -60,16 +59,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/intel/sinkholes", + page=SyncSinglePage[IntelSinkholeItem], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[SinkholeListResponse], ResultWrapper[SinkholeListResponse]), + model=IntelSinkholeItem, ) @@ -82,7 +78,7 @@ def with_raw_response(self) -> AsyncSinkholesWithRawResponse: def with_streaming_response(self) -> AsyncSinkholesWithStreamingResponse: return AsyncSinkholesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -92,7 +88,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SinkholeListResponse: + ) -> AsyncPaginator[IntelSinkholeItem, AsyncSinglePage[IntelSinkholeItem]]: """ List sinkholes owned by this account @@ -109,16 +105,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/intel/sinkholes", + page=AsyncSinglePage[IntelSinkholeItem], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[SinkholeListResponse], ResultWrapper[SinkholeListResponse]), + model=IntelSinkholeItem, ) diff --git a/src/cloudflare/resources/keyless_certificates.py b/src/cloudflare/resources/keyless_certificates.py index 6fa50f619f8..8fc10fd3d1e 100644 --- a/src/cloudflare/resources/keyless_certificates.py +++ b/src/cloudflare/resources/keyless_certificates.py @@ -2,14 +2,13 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast from typing_extensions import Literal import httpx from ..types import ( KeylessCertificateHostname, - KeylessCertificateListResponse, KeylessCertificateDeleteResponse, keyless_certificate_edit_params, keyless_certificate_create_params, @@ -28,7 +27,9 @@ async_to_streamed_response_wrapper, ) from .._wrappers import ResultWrapper +from ..pagination import SyncSinglePage, AsyncSinglePage from .._base_client import ( + AsyncPaginator, make_request_options, ) @@ -126,7 +127,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeylessCertificateListResponse]: + ) -> SyncSinglePage[KeylessCertificateHostname]: """ List all Keyless SSL configurations for a given zone. @@ -143,16 +144,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/keyless_certificates", + page=SyncSinglePage[KeylessCertificateHostname], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[KeylessCertificateListResponse]], ResultWrapper[KeylessCertificateListResponse]), + model=KeylessCertificateHostname, ) def delete( @@ -403,7 +401,7 @@ async def create( cast_to=cast(Type[KeylessCertificateHostname], ResultWrapper[KeylessCertificateHostname]), ) - async def list( + def list( self, *, zone_id: str, @@ -413,7 +411,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[KeylessCertificateListResponse]: + ) -> AsyncPaginator[KeylessCertificateHostname, AsyncSinglePage[KeylessCertificateHostname]]: """ List all Keyless SSL configurations for a given zone. @@ -430,16 +428,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/keyless_certificates", + page=AsyncSinglePage[KeylessCertificateHostname], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[KeylessCertificateListResponse]], ResultWrapper[KeylessCertificateListResponse]), + model=KeylessCertificateHostname, ) async def delete( diff --git a/src/cloudflare/resources/load_balancers/load_balancers.py b/src/cloudflare/resources/load_balancers/load_balancers.py index 5dba4f5b38f..4216e4e2fe2 100644 --- a/src/cloudflare/resources/load_balancers/load_balancers.py +++ b/src/cloudflare/resources/load_balancers/load_balancers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Iterable, Optional, cast +from typing import List, Type, Iterable, cast from typing_extensions import Literal import httpx @@ -17,7 +17,6 @@ ) from ...types import ( LoadBalancer, - LoadBalancerListResponse, LoadBalancerDeleteResponse, load_balancer_edit_params, load_balancer_create_params, @@ -70,7 +69,9 @@ ) from ..._wrappers import ResultWrapper from .pools.pools import Pools, AsyncPools +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from .monitors.monitors import Monitors, AsyncMonitors @@ -520,7 +521,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[LoadBalancerListResponse]: + ) -> SyncSinglePage[LoadBalancer]: """ List configured load balancers. @@ -535,16 +536,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/load_balancers", + page=SyncSinglePage[LoadBalancer], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[LoadBalancerListResponse]], ResultWrapper[LoadBalancerListResponse]), + model=LoadBalancer, ) def delete( @@ -1265,7 +1263,7 @@ async def update( cast_to=cast(Type[LoadBalancer], ResultWrapper[LoadBalancer]), ) - async def list( + def list( self, *, zone_id: str, @@ -1275,7 +1273,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[LoadBalancerListResponse]: + ) -> AsyncPaginator[LoadBalancer, AsyncSinglePage[LoadBalancer]]: """ List configured load balancers. @@ -1290,16 +1288,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/load_balancers", + page=AsyncSinglePage[LoadBalancer], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[LoadBalancerListResponse]], ResultWrapper[LoadBalancerListResponse]), + model=LoadBalancer, ) async def delete( diff --git a/src/cloudflare/resources/load_balancers/monitors/monitors.py b/src/cloudflare/resources/load_balancers/monitors/monitors.py index 60212b302d3..53b9f963ff6 100644 --- a/src/cloudflare/resources/load_balancers/monitors/monitors.py +++ b/src/cloudflare/resources/load_balancers/monitors/monitors.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast from typing_extensions import Literal import httpx @@ -37,11 +37,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.load_balancers import ( - MonitorListResponse, MonitorDeleteResponse, monitor_edit_params, monitor_create_params, @@ -332,7 +333,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MonitorListResponse]: + ) -> SyncSinglePage[LoadBalancingMonitor]: """ List configured monitors for an account. @@ -349,16 +350,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/load_balancers/monitors", + page=SyncSinglePage[LoadBalancingMonitor], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[MonitorListResponse]], ResultWrapper[MonitorListResponse]), + model=LoadBalancingMonitor, ) def delete( @@ -844,7 +842,7 @@ async def update( cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), ) - async def list( + def list( self, *, account_id: str, @@ -854,7 +852,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MonitorListResponse]: + ) -> AsyncPaginator[LoadBalancingMonitor, AsyncSinglePage[LoadBalancingMonitor]]: """ List configured monitors for an account. @@ -871,16 +869,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/load_balancers/monitors", + page=AsyncSinglePage[LoadBalancingMonitor], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[MonitorListResponse]], ResultWrapper[MonitorListResponse]), + model=LoadBalancingMonitor, ) async def delete( diff --git a/src/cloudflare/resources/load_balancers/pools/pools.py b/src/cloudflare/resources/load_balancers/pools/pools.py index 5e115bdb6f8..d08af267c65 100644 --- a/src/cloudflare/resources/load_balancers/pools/pools.py +++ b/src/cloudflare/resources/load_balancers/pools/pools.py @@ -37,11 +37,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.load_balancers import ( - PoolListResponse, PoolDeleteResponse, pool_edit_params, pool_list_params, @@ -323,7 +324,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PoolListResponse]: + ) -> SyncSinglePage[LoadBalancingPool]: """ List configured pools. @@ -343,17 +344,17 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/load_balancers/pools", + page=SyncSinglePage[LoadBalancingPool], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[PoolListResponse]], ResultWrapper[PoolListResponse]), + model=LoadBalancingPool, ) def delete( @@ -835,7 +836,7 @@ async def update( cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), ) - async def list( + def list( self, *, account_id: str, @@ -846,7 +847,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PoolListResponse]: + ) -> AsyncPaginator[LoadBalancingPool, AsyncSinglePage[LoadBalancingPool]]: """ List configured pools. @@ -866,17 +867,17 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/load_balancers/pools", + page=AsyncSinglePage[LoadBalancingPool], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), - post_parser=ResultWrapper._unwrapper, + query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), ), - cast_to=cast(Type[Optional[PoolListResponse]], ResultWrapper[PoolListResponse]), + model=LoadBalancingPool, ) async def delete( diff --git a/src/cloudflare/resources/logpush/jobs.py b/src/cloudflare/resources/logpush/jobs.py index 56f3a10d613..f16d111e08b 100644 --- a/src/cloudflare/resources/logpush/jobs.py +++ b/src/cloudflare/resources/logpush/jobs.py @@ -21,10 +21,12 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.logpush import JobListResponse, JobDeleteResponse, job_create_params, job_update_params +from ...types.logpush import JobDeleteResponse, job_create_params, job_update_params from ...types.logpush.datasets import LogpushJob __all__ = ["Jobs", "AsyncJobs"] @@ -249,7 +251,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobListResponse: + ) -> SyncSinglePage[Optional[LogpushJob]]: """ Lists Logpush jobs for an account or zone. @@ -281,16 +283,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs", + page=SyncSinglePage[LogpushJob], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[JobListResponse], ResultWrapper[JobListResponse]), + model=LogpushJob, ) def delete( @@ -623,7 +622,7 @@ async def update( cast_to=cast(Type[Optional[LogpushJob]], ResultWrapper[LogpushJob]), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -634,7 +633,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> JobListResponse: + ) -> AsyncPaginator[Optional[LogpushJob], AsyncSinglePage[Optional[LogpushJob]]]: """ Lists Logpush jobs for an account or zone. @@ -666,16 +665,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/logpush/jobs", + page=AsyncSinglePage[LogpushJob], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[JobListResponse], ResultWrapper[JobListResponse]), + model=LogpushJob, ) async def delete( diff --git a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py index e1888cd6b18..fa4ae167353 100644 --- a/src/cloudflare/resources/magic_network_monitoring/rules/rules.py +++ b/src/cloudflare/resources/magic_network_monitoring/rules/rules.py @@ -16,6 +16,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from .advertisements import ( Advertisements, AsyncAdvertisements, @@ -25,9 +26,10 @@ AsyncAdvertisementsWithStreamingResponse, ) from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.magic_network_monitoring import RuleListResponse, MagicNetworkMonitoringRule +from ....types.magic_network_monitoring import MagicNetworkMonitoringRule __all__ = ["Rules", "AsyncRules"] @@ -131,7 +133,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleListResponse]: + ) -> SyncSinglePage[Optional[MagicNetworkMonitoringRule]]: """ Lists network monitoring rules for account. @@ -146,16 +148,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/mnm/rules", + page=SyncSinglePage[MagicNetworkMonitoringRule], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), + model=MagicNetworkMonitoringRule, ) def delete( @@ -368,7 +367,7 @@ async def update( cast_to=cast(Type[Optional[MagicNetworkMonitoringRule]], ResultWrapper[MagicNetworkMonitoringRule]), ) - async def list( + def list( self, *, account_id: str, @@ -378,7 +377,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleListResponse]: + ) -> AsyncPaginator[Optional[MagicNetworkMonitoringRule], AsyncSinglePage[Optional[MagicNetworkMonitoringRule]]]: """ Lists network monitoring rules for account. @@ -393,16 +392,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/mnm/rules", + page=AsyncSinglePage[MagicNetworkMonitoringRule], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), + model=MagicNetworkMonitoringRule, ) async def delete( diff --git a/src/cloudflare/resources/mtls_certificates/mtls_certificates.py b/src/cloudflare/resources/mtls_certificates/mtls_certificates.py index 0b04602dfd9..505f1a90c7d 100644 --- a/src/cloudflare/resources/mtls_certificates/mtls_certificates.py +++ b/src/cloudflare/resources/mtls_certificates/mtls_certificates.py @@ -2,16 +2,11 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx -from ...types import ( - MTLSCertificate, - MTLSCertificateUpdate, - MTLSCertificateListResponse, - mtls_certificate_create_params, -) +from ...types import MTLSCertificate, MTLSCertificateUpdate, mtls_certificate_create_params from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -26,6 +21,7 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from .associations import ( Associations, AsyncAssociations, @@ -35,6 +31,7 @@ AsyncAssociationsWithStreamingResponse, ) from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -124,7 +121,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MTLSCertificateListResponse]: + ) -> SyncSinglePage[MTLSCertificate]: """ Lists all mTLS certificates. @@ -141,16 +138,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/mtls_certificates", + page=SyncSinglePage[MTLSCertificate], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[MTLSCertificateListResponse]], ResultWrapper[MTLSCertificateListResponse]), + model=MTLSCertificate, ) def delete( @@ -320,7 +314,7 @@ async def create( cast_to=cast(Type[MTLSCertificateUpdate], ResultWrapper[MTLSCertificateUpdate]), ) - async def list( + def list( self, *, account_id: str, @@ -330,7 +324,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MTLSCertificateListResponse]: + ) -> AsyncPaginator[MTLSCertificate, AsyncSinglePage[MTLSCertificate]]: """ Lists all mTLS certificates. @@ -347,16 +341,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/mtls_certificates", + page=AsyncSinglePage[MTLSCertificate], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[MTLSCertificateListResponse]], ResultWrapper[MTLSCertificateListResponse]), + model=MTLSCertificate, ) async def delete( diff --git a/src/cloudflare/resources/origin_ca_certificates.py b/src/cloudflare/resources/origin_ca_certificates.py index 9451a6f5ae9..b9104ca3a01 100644 --- a/src/cloudflare/resources/origin_ca_certificates.py +++ b/src/cloudflare/resources/origin_ca_certificates.py @@ -2,14 +2,14 @@ from __future__ import annotations -from typing import Any, Type, Iterable, Optional, cast +from typing import Any, Type, Iterable, cast from typing_extensions import Literal import httpx from ..types import ( + OriginCACertificate, OriginCACertificateGetResponse, - OriginCACertificateListResponse, OriginCACertificateCreateResponse, OriginCACertificateDeleteResponse, origin_ca_certificate_create_params, @@ -28,7 +28,9 @@ async_to_streamed_response_wrapper, ) from .._wrappers import ResultWrapper +from ..pagination import SyncSinglePage, AsyncSinglePage from .._base_client import ( + AsyncPaginator, make_request_options, ) @@ -117,25 +119,20 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OriginCACertificateListResponse]: + ) -> SyncSinglePage[OriginCACertificate]: """List all existing Origin CA certificates for a given zone. Use your Origin CA Key as your User Service Key when calling this endpoint ([see above](#requests)). """ - return self._get( + return self._get_api_list( "/certificates", + page=SyncSinglePage[OriginCACertificate], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[OriginCACertificateListResponse]], ResultWrapper[OriginCACertificateListResponse] + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + model=OriginCACertificate, ) def delete( @@ -301,7 +298,7 @@ async def create( ), ) - async def list( + def list( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -310,25 +307,20 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OriginCACertificateListResponse]: + ) -> AsyncPaginator[OriginCACertificate, AsyncSinglePage[OriginCACertificate]]: """List all existing Origin CA certificates for a given zone. Use your Origin CA Key as your User Service Key when calling this endpoint ([see above](#requests)). """ - return await self._get( + return self._get_api_list( "/certificates", + page=AsyncSinglePage[OriginCACertificate], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[OriginCACertificateListResponse]], ResultWrapper[OriginCACertificateListResponse] + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + model=OriginCACertificate, ) async def delete( diff --git a/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py b/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py index 840dd2147a0..a20922942f9 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py +++ b/src/cloudflare/resources/origin_tls_client_auth/hostnames/certificates.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,14 +20,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.origin_tls_client_auth.hostnames import ( - CertificateListResponse, - OriginTLSClientCertificate, - certificate_create_params, -) +from ....types.origin_tls_client_auth import OriginTLSClientCertificateID +from ....types.origin_tls_client_auth.hostnames import OriginTLSClientCertificate, certificate_create_params __all__ = ["Certificates", "AsyncCertificates"] @@ -105,7 +104,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificateListResponse]: + ) -> SyncSinglePage[OriginTLSClientCertificateID]: """ List Certificates @@ -122,16 +121,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/origin_tls_client_auth/hostnames/certificates", + page=SyncSinglePage[OriginTLSClientCertificateID], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CertificateListResponse]], ResultWrapper[CertificateListResponse]), + model=OriginTLSClientCertificateID, ) def delete( @@ -286,7 +282,7 @@ async def create( cast_to=cast(Type[OriginTLSClientCertificate], ResultWrapper[OriginTLSClientCertificate]), ) - async def list( + def list( self, *, zone_id: str, @@ -296,7 +292,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificateListResponse]: + ) -> AsyncPaginator[OriginTLSClientCertificateID, AsyncSinglePage[OriginTLSClientCertificateID]]: """ List Certificates @@ -313,16 +309,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/origin_tls_client_auth/hostnames/certificates", + page=AsyncSinglePage[OriginTLSClientCertificateID], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CertificateListResponse]], ResultWrapper[CertificateListResponse]), + model=OriginTLSClientCertificateID, ) async def delete( diff --git a/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py b/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py index 8c9e842761c..bfed59276f2 100644 --- a/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py +++ b/src/cloudflare/resources/origin_tls_client_auth/origin_tls_client_auth.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, cast import httpx @@ -43,7 +43,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from .hostnames.hostnames import Hostnames, AsyncHostnames @@ -139,7 +141,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OriginTLSClientAuthListResponse]: + ) -> SyncSinglePage[OriginTLSClientAuthListResponse]: """ List Certificates @@ -156,18 +158,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/origin_tls_client_auth", + page=SyncSinglePage[OriginTLSClientAuthListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[OriginTLSClientAuthListResponse]], ResultWrapper[OriginTLSClientAuthListResponse] + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + model=OriginTLSClientAuthListResponse, ) def delete( @@ -347,7 +344,7 @@ async def create( ), ) - async def list( + def list( self, *, zone_id: str, @@ -357,7 +354,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[OriginTLSClientAuthListResponse]: + ) -> AsyncPaginator[OriginTLSClientAuthListResponse, AsyncSinglePage[OriginTLSClientAuthListResponse]]: """ List Certificates @@ -374,18 +371,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/origin_tls_client_auth", + page=AsyncSinglePage[OriginTLSClientAuthListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, - ), - cast_to=cast( - Type[Optional[OriginTLSClientAuthListResponse]], ResultWrapper[OriginTLSClientAuthListResponse] + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + model=OriginTLSClientAuthListResponse, ) async def delete( diff --git a/src/cloudflare/resources/page_shield/connections.py b/src/cloudflare/resources/page_shield/connections.py index 2bd9d184b44..64c146b362e 100644 --- a/src/cloudflare/resources/page_shield/connections.py +++ b/src/cloudflare/resources/page_shield/connections.py @@ -2,16 +2,12 @@ from __future__ import annotations -from typing import Type, Optional, cast from typing_extensions import Literal import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -20,11 +16,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.page_shield import PageShieldConnection, ConnectionListResponse, connection_list_params +from ...types.page_shield import PageShieldConnection, connection_list_params __all__ = ["Connections", "AsyncConnections"] @@ -60,7 +57,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConnectionListResponse]: + ) -> SyncSinglePage[PageShieldConnection]: """ Lists all connections detected by Page Shield. @@ -123,8 +120,9 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/page_shield/connections", + page=SyncSinglePage[PageShieldConnection], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -147,9 +145,8 @@ def list( }, connection_list_params.ConnectionListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[ConnectionListResponse]], ResultWrapper[ConnectionListResponse]), + model=PageShieldConnection, ) def get( @@ -202,7 +199,7 @@ def with_raw_response(self) -> AsyncConnectionsWithRawResponse: def with_streaming_response(self) -> AsyncConnectionsWithStreamingResponse: return AsyncConnectionsWithStreamingResponse(self) - async def list( + def list( self, *, zone_id: str, @@ -224,7 +221,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ConnectionListResponse]: + ) -> AsyncPaginator[PageShieldConnection, AsyncSinglePage[PageShieldConnection]]: """ Lists all connections detected by Page Shield. @@ -287,14 +284,15 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/page_shield/connections", + page=AsyncSinglePage[PageShieldConnection], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "direction": direction, "exclude_cdn_cgi": exclude_cdn_cgi, @@ -311,9 +309,8 @@ async def list( }, connection_list_params.ConnectionListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[ConnectionListResponse]], ResultWrapper[ConnectionListResponse]), + model=PageShieldConnection, ) async def get( diff --git a/src/cloudflare/resources/page_shield/policies.py b/src/cloudflare/resources/page_shield/policies.py index 626e619f8ac..5f55c1bc288 100644 --- a/src/cloudflare/resources/page_shield/policies.py +++ b/src/cloudflare/resources/page_shield/policies.py @@ -2,7 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -20,11 +19,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.page_shield import PageShieldPolicy, PolicyListResponse, policy_create_params, policy_update_params +from ...types.page_shield import PageShieldPolicy, policy_create_params, policy_update_params __all__ = ["Policies", "AsyncPolicies"] @@ -175,7 +175,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> SyncSinglePage[PageShieldPolicy]: """ Lists all Page Shield policies. @@ -192,16 +192,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/page_shield/policies", + page=SyncSinglePage[PageShieldPolicy], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=PageShieldPolicy, ) def delete( @@ -422,7 +419,7 @@ async def update( cast_to=PageShieldPolicy, ) - async def list( + def list( self, *, zone_id: str, @@ -432,7 +429,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> AsyncPaginator[PageShieldPolicy, AsyncSinglePage[PageShieldPolicy]]: """ Lists all Page Shield policies. @@ -449,16 +446,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/page_shield/policies", + page=AsyncSinglePage[PageShieldPolicy], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=PageShieldPolicy, ) async def delete( diff --git a/src/cloudflare/resources/page_shield/scripts.py b/src/cloudflare/resources/page_shield/scripts.py index 2b108402984..58d201d5e36 100644 --- a/src/cloudflare/resources/page_shield/scripts.py +++ b/src/cloudflare/resources/page_shield/scripts.py @@ -2,16 +2,12 @@ from __future__ import annotations -from typing import Type, Optional, cast from typing_extensions import Literal import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -20,11 +16,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.page_shield import ScriptGetResponse, ScriptListResponse, script_list_params +from ...types.page_shield import PageShieldScript, ScriptGetResponse, script_list_params __all__ = ["Scripts", "AsyncScripts"] @@ -61,7 +58,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ScriptListResponse]: + ) -> SyncSinglePage[PageShieldScript]: """ Lists all scripts detected by Page Shield. @@ -129,8 +126,9 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/page_shield/scripts", + page=SyncSinglePage[PageShieldScript], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -154,9 +152,8 @@ def list( }, script_list_params.ScriptListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[ScriptListResponse]], ResultWrapper[ScriptListResponse]), + model=PageShieldScript, ) def get( @@ -209,7 +206,7 @@ def with_raw_response(self) -> AsyncScriptsWithRawResponse: def with_streaming_response(self) -> AsyncScriptsWithStreamingResponse: return AsyncScriptsWithStreamingResponse(self) - async def list( + def list( self, *, zone_id: str, @@ -232,7 +229,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ScriptListResponse]: + ) -> AsyncPaginator[PageShieldScript, AsyncSinglePage[PageShieldScript]]: """ Lists all scripts detected by Page Shield. @@ -300,14 +297,15 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/page_shield/scripts", + page=AsyncSinglePage[PageShieldScript], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "direction": direction, "exclude_cdn_cgi": exclude_cdn_cgi, @@ -325,9 +323,8 @@ async def list( }, script_list_params.ScriptListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[ScriptListResponse]], ResultWrapper[ScriptListResponse]), + model=PageShieldScript, ) async def get( diff --git a/src/cloudflare/resources/pages/projects/deployments/deployments.py b/src/cloudflare/resources/pages/projects/deployments/deployments.py index 83cd0a1c3c4..114d015e84d 100644 --- a/src/cloudflare/resources/pages/projects/deployments/deployments.py +++ b/src/cloudflare/resources/pages/projects/deployments/deployments.py @@ -29,12 +29,14 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from .....types.pages import PagesDeployments from .history.history import History, AsyncHistory from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from .....types.pages.projects import DeploymentListResponse, deployment_list_params, deployment_create_params +from .....types.pages.projects import deployment_list_params, deployment_create_params __all__ = ["Deployments", "AsyncDeployments"] @@ -115,7 +117,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeploymentListResponse: + ) -> SyncSinglePage[PagesDeployments]: """ Fetch a list of project deployments. @@ -138,17 +140,17 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not project_name: raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/pages/projects/{project_name}/deployments", + page=SyncSinglePage[PagesDeployments], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({"env": env}, deployment_list_params.DeploymentListParams), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DeploymentListResponse], ResultWrapper[DeploymentListResponse]), + model=PagesDeployments, ) def delete( @@ -410,7 +412,7 @@ async def create( cast_to=cast(Type[PagesDeployments], ResultWrapper[PagesDeployments]), ) - async def list( + def list( self, project_name: str, *, @@ -422,7 +424,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DeploymentListResponse: + ) -> AsyncPaginator[PagesDeployments, AsyncSinglePage[PagesDeployments]]: """ Fetch a list of project deployments. @@ -445,17 +447,17 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not project_name: raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/pages/projects/{project_name}/deployments", + page=AsyncSinglePage[PagesDeployments], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform({"env": env}, deployment_list_params.DeploymentListParams), - post_parser=ResultWrapper._unwrapper, + query=maybe_transform({"env": env}, deployment_list_params.DeploymentListParams), ), - cast_to=cast(Type[DeploymentListResponse], ResultWrapper[DeploymentListResponse]), + model=PagesDeployments, ) async def delete( diff --git a/src/cloudflare/resources/pages/projects/domains.py b/src/cloudflare/resources/pages/projects/domains.py index 35b21afcafd..41fdc48d87f 100644 --- a/src/cloudflare/resources/pages/projects/domains.py +++ b/src/cloudflare/resources/pages/projects/domains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Optional, cast import httpx @@ -20,16 +20,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.pages.projects import ( - DomainGetResponse, - DomainEditResponse, - DomainListResponse, - DomainCreateResponse, - domain_create_params, -) +from ....types.pages.projects import DomainGetResponse, DomainEditResponse, DomainCreateResponse, domain_create_params __all__ = ["Domains", "AsyncDomains"] @@ -105,7 +101,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DomainListResponse: + ) -> SyncSinglePage[object]: """ Fetch a list of all domains associated with a Pages project. @@ -126,16 +122,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not project_name: raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/pages/projects/{project_name}/domains", + page=SyncSinglePage[object], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[DomainListResponse], ResultWrapper[DomainListResponse]), + model=object, ) def delete( @@ -352,7 +345,7 @@ async def create( ), ) - async def list( + def list( self, project_name: str, *, @@ -363,7 +356,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DomainListResponse: + ) -> AsyncPaginator[object, AsyncSinglePage[object]]: """ Fetch a list of all domains associated with a Pages project. @@ -384,16 +377,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not project_name: raise ValueError(f"Expected a non-empty value for `project_name` but received {project_name!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/pages/projects/{project_name}/domains", + page=AsyncSinglePage[object], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[DomainListResponse], ResultWrapper[DomainListResponse]), + model=object, ) async def delete( diff --git a/src/cloudflare/resources/pages/projects/projects.py b/src/cloudflare/resources/pages/projects/projects.py index a964fcb0a20..9aaba8bcf16 100644 --- a/src/cloudflare/resources/pages/projects/projects.py +++ b/src/cloudflare/resources/pages/projects/projects.py @@ -36,16 +36,18 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ....types.pages import ( PagesProjects, + PagesDeployments, ProjectEditResponse, - ProjectListResponse, PagesDeploymentsParam, ProjectCreateResponse, project_edit_params, project_create_params, ) from ...._base_client import ( + AsyncPaginator, make_request_options, ) from .deployments.deployments import Deployments, AsyncDeployments @@ -149,7 +151,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectListResponse: + ) -> SyncSinglePage[PagesDeployments]: """ Fetch a list of all user projects. @@ -166,16 +168,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/pages/projects", + page=SyncSinglePage[PagesDeployments], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ProjectListResponse], ResultWrapper[ProjectListResponse]), + model=PagesDeployments, ) def delete( @@ -442,7 +441,7 @@ async def create( ), ) - async def list( + def list( self, *, account_id: str, @@ -452,7 +451,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectListResponse: + ) -> AsyncPaginator[PagesDeployments, AsyncSinglePage[PagesDeployments]]: """ Fetch a list of all user projects. @@ -469,16 +468,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/pages/projects", + page=AsyncSinglePage[PagesDeployments], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ProjectListResponse], ResultWrapper[ProjectListResponse]), + model=PagesDeployments, ) async def delete( diff --git a/src/cloudflare/resources/pcaps/pcaps.py b/src/cloudflare/resources/pcaps/pcaps.py index 5bacf266dc8..2afd4a28fae 100644 --- a/src/cloudflare/resources/pcaps/pcaps.py +++ b/src/cloudflare/resources/pcaps/pcaps.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast, overload +from typing import Any, cast, overload from typing_extensions import Literal import httpx @@ -39,7 +39,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -228,7 +230,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PCAPListResponse]: + ) -> SyncSinglePage[PCAPListResponse]: """ Lists all packet capture requests for an account. @@ -245,16 +247,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/pcaps", + page=SyncSinglePage[PCAPListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PCAPListResponse]], ResultWrapper[PCAPListResponse]), + model=cast(Any, PCAPListResponse), # Union types cannot be passed in as arguments in the type system ) def get( @@ -479,7 +478,7 @@ async def create( ), ) - async def list( + def list( self, *, account_id: str, @@ -489,7 +488,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PCAPListResponse]: + ) -> AsyncPaginator[PCAPListResponse, AsyncSinglePage[PCAPListResponse]]: """ Lists all packet capture requests for an account. @@ -506,16 +505,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/pcaps", + page=AsyncSinglePage[PCAPListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PCAPListResponse]], ResultWrapper[PCAPListResponse]), + model=cast(Any, PCAPListResponse), # Union types cannot be passed in as arguments in the type system ) async def get( diff --git a/src/cloudflare/resources/plans.py b/src/cloudflare/resources/plans.py index f6ed7bc0e42..8b49136d3df 100644 --- a/src/cloudflare/resources/plans.py +++ b/src/cloudflare/resources/plans.py @@ -2,11 +2,11 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx -from ..types import PlanListResponse, AvailableRatePlan +from ..types import AvailableRatePlan from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -17,7 +17,9 @@ async_to_streamed_response_wrapper, ) from .._wrappers import ResultWrapper +from ..pagination import SyncSinglePage, AsyncSinglePage from .._base_client import ( + AsyncPaginator, make_request_options, ) @@ -43,7 +45,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PlanListResponse]: + ) -> SyncSinglePage[AvailableRatePlan]: """ Lists available plans the zone can subscribe to. @@ -60,16 +62,13 @@ def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_identifier}/available_plans", + page=SyncSinglePage[AvailableRatePlan], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PlanListResponse]], ResultWrapper[PlanListResponse]), + model=AvailableRatePlan, ) def get( @@ -126,7 +125,7 @@ def with_raw_response(self) -> AsyncPlansWithRawResponse: def with_streaming_response(self) -> AsyncPlansWithStreamingResponse: return AsyncPlansWithStreamingResponse(self) - async def list( + def list( self, zone_identifier: str, *, @@ -136,7 +135,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PlanListResponse]: + ) -> AsyncPaginator[AvailableRatePlan, AsyncSinglePage[AvailableRatePlan]]: """ Lists available plans the zone can subscribe to. @@ -153,16 +152,13 @@ async def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_identifier}/available_plans", + page=AsyncSinglePage[AvailableRatePlan], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PlanListResponse]], ResultWrapper[PlanListResponse]), + model=AvailableRatePlan, ) async def get( diff --git a/src/cloudflare/resources/queues/queues.py b/src/cloudflare/resources/queues/queues.py index 5f3220b8cbb..0f3f2a0c7fe 100644 --- a/src/cloudflare/resources/queues/queues.py +++ b/src/cloudflare/resources/queues/queues.py @@ -45,7 +45,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -166,7 +168,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueListResponse]: + ) -> SyncSinglePage[QueueListResponse]: """ Returns the queues owned by an account. @@ -183,16 +185,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/queues", + page=SyncSinglePage[QueueListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[QueueListResponse]], ResultWrapper[QueueListResponse]), + model=QueueListResponse, ) def delete( @@ -393,7 +392,7 @@ async def update( cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -403,7 +402,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[QueueListResponse]: + ) -> AsyncPaginator[QueueListResponse, AsyncSinglePage[QueueListResponse]]: """ Returns the queues owned by an account. @@ -420,16 +419,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/queues", + page=AsyncSinglePage[QueueListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[QueueListResponse]], ResultWrapper[QueueListResponse]), + model=QueueListResponse, ) async def delete( diff --git a/src/cloudflare/resources/registrar/domains.py b/src/cloudflare/resources/registrar/domains.py index cb889156b64..46e5881cae9 100644 --- a/src/cloudflare/resources/registrar/domains.py +++ b/src/cloudflare/resources/registrar/domains.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Optional, cast import httpx @@ -20,7 +20,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.registrar import DomainGetResponse, DomainListResponse, DomainUpdateResponse, domain_update_params @@ -114,7 +116,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DomainListResponse]: + ) -> SyncSinglePage[DomainListResponse]: """ List domains handled by Registrar. @@ -131,16 +133,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/registrar/domains", + page=SyncSinglePage[DomainListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DomainListResponse]], ResultWrapper[DomainListResponse]), + model=DomainListResponse, ) def get( @@ -269,7 +268,7 @@ async def update( ), ) - async def list( + def list( self, *, account_id: str, @@ -279,7 +278,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DomainListResponse]: + ) -> AsyncPaginator[DomainListResponse, AsyncSinglePage[DomainListResponse]]: """ List domains handled by Registrar. @@ -296,16 +295,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/registrar/domains", + page=AsyncSinglePage[DomainListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DomainListResponse]], ResultWrapper[DomainListResponse]), + model=DomainListResponse, ) async def get( diff --git a/src/cloudflare/resources/rules/lists/lists.py b/src/cloudflare/resources/rules/lists/lists.py index 45adeabd513..5cf9ef96496 100644 --- a/src/cloudflare/resources/rules/lists/lists.py +++ b/src/cloudflare/resources/rules/lists/lists.py @@ -29,8 +29,10 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.rules import ListsList, ListListResponse, ListDeleteResponse, list_create_params, list_update_params +from ....pagination import SyncSinglePage, AsyncSinglePage +from ....types.rules import ListsList, ListDeleteResponse, list_create_params, list_update_params from ...._base_client import ( + AsyncPaginator, make_request_options, ) from .bulk_operations import ( @@ -177,7 +179,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ListListResponse]: + ) -> SyncSinglePage[ListsList]: """ Fetches all lists in the account. @@ -194,16 +196,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/rules/lists", + page=SyncSinglePage[ListsList], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ListListResponse]], ResultWrapper[ListListResponse]), + model=ListsList, ) def delete( @@ -417,7 +416,7 @@ async def update( cast_to=cast(Type[Optional[ListsList]], ResultWrapper[ListsList]), ) - async def list( + def list( self, *, account_id: str, @@ -427,7 +426,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ListListResponse]: + ) -> AsyncPaginator[ListsList, AsyncSinglePage[ListsList]]: """ Fetches all lists in the account. @@ -444,16 +443,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/rules/lists", + page=AsyncSinglePage[ListsList], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ListListResponse]], ResultWrapper[ListListResponse]), + model=ListsList, ) async def delete( diff --git a/src/cloudflare/resources/rulesets/phases/versions.py b/src/cloudflare/resources/rulesets/phases/versions.py index 9ba3ae4e191..88d2733058d 100644 --- a/src/cloudflare/resources/rulesets/phases/versions.py +++ b/src/cloudflare/resources/rulesets/phases/versions.py @@ -7,7 +7,7 @@ import httpx -from ....types import RulesetsRulesetResponse, RulesetsRulesetsResponse +from ....types import RulesetsRulesetResponse from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -18,9 +18,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) +from ....types.rulesets.phases import VersionListResponse __all__ = ["Versions", "AsyncVersions"] @@ -70,7 +73,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RulesetsRulesetsResponse: + ) -> SyncSinglePage[VersionListResponse]: """ Fetches the versions of an account or zone entry point ruleset. @@ -106,16 +109,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions", + page=SyncSinglePage[VersionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RulesetsRulesetsResponse], ResultWrapper[RulesetsRulesetsResponse]), + model=VersionListResponse, ) def get( @@ -217,7 +217,7 @@ def with_raw_response(self) -> AsyncVersionsWithRawResponse: def with_streaming_response(self) -> AsyncVersionsWithStreamingResponse: return AsyncVersionsWithStreamingResponse(self) - async def list( + def list( self, ruleset_phase: Literal[ "ddos_l4", @@ -253,7 +253,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RulesetsRulesetsResponse: + ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: """ Fetches the versions of an account or zone entry point ruleset. @@ -289,16 +289,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions", + page=AsyncSinglePage[VersionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RulesetsRulesetsResponse], ResultWrapper[RulesetsRulesetsResponse]), + model=VersionListResponse, ) async def get( diff --git a/src/cloudflare/resources/rulesets/rulesets.py b/src/cloudflare/resources/rulesets/rulesets.py index 8a3262927f6..987edf37a38 100644 --- a/src/cloudflare/resources/rulesets/rulesets.py +++ b/src/cloudflare/resources/rulesets/rulesets.py @@ -24,8 +24,8 @@ AsyncPhasesWithStreamingResponse, ) from ...types import ( + RulesetListResponse, RulesetsRulesetResponse, - RulesetsRulesetsResponse, ruleset_create_params, ruleset_update_params, ) @@ -51,8 +51,10 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from .phases.phases import Phases, AsyncPhases from ..._base_client import ( + AsyncPaginator, make_request_options, ) from .versions.versions import Versions, AsyncVersions @@ -310,7 +312,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RulesetsRulesetsResponse: + ) -> SyncSinglePage[RulesetListResponse]: """ Fetches all rulesets. @@ -342,16 +344,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", + page=SyncSinglePage[RulesetListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RulesetsRulesetsResponse], ResultWrapper[RulesetsRulesetsResponse]), + model=RulesetListResponse, ) def delete( @@ -711,7 +710,7 @@ async def update( cast_to=cast(Type[RulesetsRulesetResponse], ResultWrapper[RulesetsRulesetResponse]), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -722,7 +721,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RulesetsRulesetsResponse: + ) -> AsyncPaginator[RulesetListResponse, AsyncSinglePage[RulesetListResponse]]: """ Fetches all rulesets. @@ -754,16 +753,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets", + page=AsyncSinglePage[RulesetListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RulesetsRulesetsResponse], ResultWrapper[RulesetsRulesetsResponse]), + model=RulesetListResponse, ) async def delete( diff --git a/src/cloudflare/resources/rulesets/versions/versions.py b/src/cloudflare/resources/rulesets/versions/versions.py index 170c31aff2e..6722ae11b41 100644 --- a/src/cloudflare/resources/rulesets/versions/versions.py +++ b/src/cloudflare/resources/rulesets/versions/versions.py @@ -14,7 +14,7 @@ ByTagWithStreamingResponse, AsyncByTagWithStreamingResponse, ) -from ....types import RulesetsRulesetResponse, RulesetsRulesetsResponse +from ....types import RulesetsRulesetResponse from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -25,9 +25,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) +from ....types.rulesets import VersionListResponse __all__ = ["Versions", "AsyncVersions"] @@ -57,7 +60,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RulesetsRulesetsResponse: + ) -> SyncSinglePage[VersionListResponse]: """ Fetches the versions of an account or zone ruleset. @@ -93,16 +96,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions", + page=SyncSinglePage[VersionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RulesetsRulesetsResponse], ResultWrapper[RulesetsRulesetsResponse]), + model=VersionListResponse, ) def delete( @@ -246,7 +246,7 @@ def with_raw_response(self) -> AsyncVersionsWithRawResponse: def with_streaming_response(self) -> AsyncVersionsWithStreamingResponse: return AsyncVersionsWithStreamingResponse(self) - async def list( + def list( self, ruleset_id: str, *, @@ -258,7 +258,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RulesetsRulesetsResponse: + ) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]: """ Fetches the versions of an account or zone ruleset. @@ -294,16 +294,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions", + page=AsyncSinglePage[VersionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RulesetsRulesetsResponse], ResultWrapper[RulesetsRulesetsResponse]), + model=VersionListResponse, ) async def delete( diff --git a/src/cloudflare/resources/secondary_dns/acls.py b/src/cloudflare/resources/secondary_dns/acls.py index e77f5a4ea81..66ece684370 100644 --- a/src/cloudflare/resources/secondary_dns/acls.py +++ b/src/cloudflare/resources/secondary_dns/acls.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,16 +20,12 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.secondary_dns import ( - ACLListResponse, - SecondaryDNSACL, - ACLDeleteResponse, - acl_create_params, - acl_update_params, -) +from ...types.secondary_dns import SecondaryDNSACL, ACLDeleteResponse, acl_create_params, acl_update_params __all__ = ["ACLs", "AsyncACLs"] @@ -149,7 +145,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ACLListResponse]: + ) -> SyncSinglePage[SecondaryDNSACL]: """ List ACLs. @@ -164,16 +160,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/secondary_dns/acls", + page=SyncSinglePage[SecondaryDNSACL], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ACLListResponse]], ResultWrapper[ACLListResponse]), + model=SecondaryDNSACL, ) def delete( @@ -362,7 +355,7 @@ async def update( cast_to=cast(Type[SecondaryDNSACL], ResultWrapper[SecondaryDNSACL]), ) - async def list( + def list( self, *, account_id: str, @@ -372,7 +365,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ACLListResponse]: + ) -> AsyncPaginator[SecondaryDNSACL, AsyncSinglePage[SecondaryDNSACL]]: """ List ACLs. @@ -387,16 +380,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/secondary_dns/acls", + page=AsyncSinglePage[SecondaryDNSACL], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ACLListResponse]], ResultWrapper[ACLListResponse]), + model=SecondaryDNSACL, ) async def delete( diff --git a/src/cloudflare/resources/secondary_dns/peers.py b/src/cloudflare/resources/secondary_dns/peers.py index 450572f1a7e..662e94d3bb6 100644 --- a/src/cloudflare/resources/secondary_dns/peers.py +++ b/src/cloudflare/resources/secondary_dns/peers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,16 +20,12 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.secondary_dns import ( - PeerListResponse, - SecondaryDNSPeer, - PeerDeleteResponse, - peer_create_params, - peer_update_params, -) +from ...types.secondary_dns import SecondaryDNSPeer, PeerDeleteResponse, peer_create_params, peer_update_params __all__ = ["Peers", "AsyncPeers"] @@ -163,7 +159,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PeerListResponse]: + ) -> SyncSinglePage[SecondaryDNSPeer]: """ List Peers. @@ -178,16 +174,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/secondary_dns/peers", + page=SyncSinglePage[SecondaryDNSPeer], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PeerListResponse]], ResultWrapper[PeerListResponse]), + model=SecondaryDNSPeer, ) def delete( @@ -390,7 +383,7 @@ async def update( cast_to=cast(Type[SecondaryDNSPeer], ResultWrapper[SecondaryDNSPeer]), ) - async def list( + def list( self, *, account_id: str, @@ -400,7 +393,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PeerListResponse]: + ) -> AsyncPaginator[SecondaryDNSPeer, AsyncSinglePage[SecondaryDNSPeer]]: """ List Peers. @@ -415,16 +408,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/secondary_dns/peers", + page=AsyncSinglePage[SecondaryDNSPeer], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PeerListResponse]], ResultWrapper[PeerListResponse]), + model=SecondaryDNSPeer, ) async def delete( diff --git a/src/cloudflare/resources/secondary_dns/tsigs.py b/src/cloudflare/resources/secondary_dns/tsigs.py index 20ba897b9a5..6031863ce6b 100644 --- a/src/cloudflare/resources/secondary_dns/tsigs.py +++ b/src/cloudflare/resources/secondary_dns/tsigs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,16 +20,12 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.secondary_dns import ( - SecondaryDNSTSIG, - TSIGListResponse, - TSIGDeleteResponse, - tsig_create_params, - tsig_update_params, -) +from ...types.secondary_dns import SecondaryDNSTSIG, TSIGDeleteResponse, tsig_create_params, tsig_update_params __all__ = ["TSIGs", "AsyncTSIGs"] @@ -164,7 +160,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TSIGListResponse]: + ) -> SyncSinglePage[SecondaryDNSTSIG]: """ List TSIGs. @@ -179,16 +175,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/secondary_dns/tsigs", + page=SyncSinglePage[SecondaryDNSTSIG], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[TSIGListResponse]], ResultWrapper[TSIGListResponse]), + model=SecondaryDNSTSIG, ) def delete( @@ -392,7 +385,7 @@ async def update( cast_to=cast(Type[SecondaryDNSTSIG], ResultWrapper[SecondaryDNSTSIG]), ) - async def list( + def list( self, *, account_id: str, @@ -402,7 +395,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TSIGListResponse]: + ) -> AsyncPaginator[SecondaryDNSTSIG, AsyncSinglePage[SecondaryDNSTSIG]]: """ List TSIGs. @@ -417,16 +410,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/secondary_dns/tsigs", + page=AsyncSinglePage[SecondaryDNSTSIG], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[TSIGListResponse]], ResultWrapper[TSIGListResponse]), + model=SecondaryDNSTSIG, ) async def delete( diff --git a/src/cloudflare/resources/snippets/rules.py b/src/cloudflare/resources/snippets/rules.py index ce543039f23..97ff1902080 100644 --- a/src/cloudflare/resources/snippets/rules.py +++ b/src/cloudflare/resources/snippets/rules.py @@ -20,7 +20,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.snippets import RuleListResponse, RuleUpdateResponse, rule_update_params @@ -90,7 +92,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleListResponse: + ) -> SyncSinglePage[RuleListResponse]: """ Rules @@ -107,16 +109,13 @@ def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_identifier}/snippets/snippet_rules", + page=SyncSinglePage[RuleListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RuleListResponse], ResultWrapper[RuleListResponse]), + model=RuleListResponse, ) @@ -172,7 +171,7 @@ async def update( cast_to=cast(Type[RuleUpdateResponse], ResultWrapper[RuleUpdateResponse]), ) - async def list( + def list( self, zone_identifier: str, *, @@ -182,7 +181,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RuleListResponse: + ) -> AsyncPaginator[RuleListResponse, AsyncSinglePage[RuleListResponse]]: """ Rules @@ -199,16 +198,13 @@ async def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_identifier}/snippets/snippet_rules", + page=AsyncSinglePage[RuleListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RuleListResponse], ResultWrapper[RuleListResponse]), + model=RuleListResponse, ) diff --git a/src/cloudflare/resources/snippets/snippets.py b/src/cloudflare/resources/snippets/snippets.py index 7340d291f64..b0427590db5 100644 --- a/src/cloudflare/resources/snippets/snippets.py +++ b/src/cloudflare/resources/snippets/snippets.py @@ -14,7 +14,7 @@ RulesWithStreamingResponse, AsyncRulesWithStreamingResponse, ) -from ...types import Snippet, SnippetListResponse, SnippetDeleteResponse, snippet_update_params +from ...types import Snippet, SnippetDeleteResponse, snippet_update_params from .content import ( Content, AsyncContent, @@ -37,7 +37,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -126,7 +128,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SnippetListResponse: + ) -> SyncSinglePage[Snippet]: """ All Snippets @@ -143,16 +145,13 @@ def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_identifier}/snippets", + page=SyncSinglePage[Snippet], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[SnippetListResponse], ResultWrapper[SnippetListResponse]), + model=Snippet, ) def delete( @@ -321,7 +320,7 @@ async def update( cast_to=cast(Type[Snippet], ResultWrapper[Snippet]), ) - async def list( + def list( self, zone_identifier: str, *, @@ -331,7 +330,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SnippetListResponse: + ) -> AsyncPaginator[Snippet, AsyncSinglePage[Snippet]]: """ All Snippets @@ -348,16 +347,13 @@ async def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_identifier}/snippets", + page=AsyncSinglePage[Snippet], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[SnippetListResponse], ResultWrapper[SnippetListResponse]), + model=Snippet, ) async def delete( diff --git a/src/cloudflare/resources/speed/pages.py b/src/cloudflare/resources/speed/pages.py index ce7be395119..97ec103cef3 100644 --- a/src/cloudflare/resources/speed/pages.py +++ b/src/cloudflare/resources/speed/pages.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast - import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,9 +13,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ...types.speed import PageListResponse from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -43,7 +42,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PageListResponse]: + ) -> SyncSinglePage[PageListResponse]: """ Lists all webpages which have been tested. @@ -60,16 +59,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/speed_api/pages", + page=SyncSinglePage[PageListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PageListResponse]], ResultWrapper[PageListResponse]), + model=PageListResponse, ) @@ -82,7 +78,7 @@ def with_raw_response(self) -> AsyncPagesWithRawResponse: def with_streaming_response(self) -> AsyncPagesWithStreamingResponse: return AsyncPagesWithStreamingResponse(self) - async def list( + def list( self, *, zone_id: str, @@ -92,7 +88,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PageListResponse]: + ) -> AsyncPaginator[PageListResponse, AsyncSinglePage[PageListResponse]]: """ Lists all webpages which have been tested. @@ -109,16 +105,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/speed_api/pages", + page=AsyncSinglePage[PageListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PageListResponse]], ResultWrapper[PageListResponse]), + model=PageListResponse, ) diff --git a/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py b/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py index fc408ca318a..f13bf748f95 100644 --- a/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py +++ b/src/cloudflare/resources/ssl/certificate_packs/certificate_packs.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Type, cast from typing_extensions import Literal import httpx @@ -24,10 +24,7 @@ AsyncQuotaWithStreamingResponse, ) from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -40,11 +37,12 @@ from ....types.ssl import ( CertificatePackGetResponse, CertificatePackEditResponse, - CertificatePackListResponse, CertificatePackDeleteResponse, certificate_pack_list_params, ) +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) @@ -79,7 +77,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificatePackListResponse]: + ) -> SyncSinglePage[object]: """ For a given zone, list all active certificate packs. @@ -98,17 +96,17 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/ssl/certificate_packs", + page=SyncSinglePage[object], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({"status": status}, certificate_pack_list_params.CertificatePackListParams), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[CertificatePackListResponse]], ResultWrapper[CertificatePackListResponse]), + model=object, ) def delete( @@ -275,7 +273,7 @@ def with_raw_response(self) -> AsyncCertificatePacksWithRawResponse: def with_streaming_response(self) -> AsyncCertificatePacksWithStreamingResponse: return AsyncCertificatePacksWithStreamingResponse(self) - async def list( + def list( self, *, zone_id: str, @@ -286,7 +284,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificatePackListResponse]: + ) -> AsyncPaginator[object, AsyncSinglePage[object]]: """ For a given zone, list all active certificate packs. @@ -305,19 +303,17 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/ssl/certificate_packs", + page=AsyncSinglePage[object], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( - {"status": status}, certificate_pack_list_params.CertificatePackListParams - ), - post_parser=ResultWrapper._unwrapper, + query=maybe_transform({"status": status}, certificate_pack_list_params.CertificatePackListParams), ), - cast_to=cast(Type[Optional[CertificatePackListResponse]], ResultWrapper[CertificatePackListResponse]), + model=object, ) async def delete( diff --git a/src/cloudflare/resources/stream/live_inputs/outputs.py b/src/cloudflare/resources/stream/live_inputs/outputs.py index 8e302d83a9a..4bed7a329b8 100644 --- a/src/cloudflare/resources/stream/live_inputs/outputs.py +++ b/src/cloudflare/resources/stream/live_inputs/outputs.py @@ -20,10 +20,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.stream.live_inputs import StreamOutput, OutputListResponse, output_create_params, output_update_params +from ....types.stream.live_inputs import StreamOutput, output_create_params, output_update_params __all__ = ["Outputs", "AsyncOutputs"] @@ -176,7 +178,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutputListResponse: + ) -> SyncSinglePage[StreamOutput]: """ Retrieves all outputs associated with a specified live input. @@ -199,16 +201,13 @@ def list( raise ValueError( f"Expected a non-empty value for `live_input_identifier` but received {live_input_identifier!r}" ) - return self._get( + return self._get_api_list( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs", + page=SyncSinglePage[StreamOutput], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[OutputListResponse], ResultWrapper[OutputListResponse]), + model=StreamOutput, ) def delete( @@ -397,7 +396,7 @@ async def update( cast_to=cast(Type[StreamOutput], ResultWrapper[StreamOutput]), ) - async def list( + def list( self, live_input_identifier: str, *, @@ -408,7 +407,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OutputListResponse: + ) -> AsyncPaginator[StreamOutput, AsyncSinglePage[StreamOutput]]: """ Retrieves all outputs associated with a specified live input. @@ -431,16 +430,13 @@ async def list( raise ValueError( f"Expected a non-empty value for `live_input_identifier` but received {live_input_identifier!r}" ) - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs", + page=AsyncSinglePage[StreamOutput], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[OutputListResponse], ResultWrapper[OutputListResponse]), + model=StreamOutput, ) async def delete( diff --git a/src/cloudflare/resources/stream/stream.py b/src/cloudflare/resources/stream/stream.py index a29b5cb7b15..1523b2cdec2 100644 --- a/src/cloudflare/resources/stream/stream.py +++ b/src/cloudflare/resources/stream/stream.py @@ -56,12 +56,9 @@ VideosWithStreamingResponse, AsyncVideosWithStreamingResponse, ) -from ...types import StreamVideos, StreamListResponse, stream_list_params +from ...types import StreamVideos, stream_list_params from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from .captions import ( Captions, AsyncCaptions, @@ -111,6 +108,7 @@ LiveInputsWithStreamingResponse, AsyncLiveInputsWithStreamingResponse, ) +from ...pagination import SyncSinglePage, AsyncSinglePage from .audio_tracks import ( AudioTracks, AsyncAudioTracks, @@ -128,6 +126,7 @@ AsyncDirectUploadWithStreamingResponse, ) from ..._base_client import ( + AsyncPaginator, make_request_options, ) from .live_inputs.live_inputs import LiveInputs, AsyncLiveInputs @@ -255,7 +254,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamListResponse: + ) -> SyncSinglePage[StreamVideos]: """Lists up to 1000 videos from a single request. For a specific range, refer to @@ -292,8 +291,9 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/stream", + page=SyncSinglePage[StreamVideos], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -312,9 +312,8 @@ def list( }, stream_list_params.StreamListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[StreamListResponse], ResultWrapper[StreamListResponse]), + model=StreamVideos, ) def delete( @@ -504,7 +503,7 @@ async def create( cast_to=NoneType, ) - async def list( + def list( self, *, account_id: str, @@ -523,7 +522,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> StreamListResponse: + ) -> AsyncPaginator[StreamVideos, AsyncSinglePage[StreamVideos]]: """Lists up to 1000 videos from a single request. For a specific range, refer to @@ -560,14 +559,15 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/stream", + page=AsyncSinglePage[StreamVideos], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "asc": asc, "creator": creator, @@ -580,9 +580,8 @@ async def list( }, stream_list_params.StreamListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[StreamListResponse], ResultWrapper[StreamListResponse]), + model=StreamVideos, ) async def delete( diff --git a/src/cloudflare/resources/stream/watermarks.py b/src/cloudflare/resources/stream/watermarks.py index 957e459c21d..d869bd90f78 100644 --- a/src/cloudflare/resources/stream/watermarks.py +++ b/src/cloudflare/resources/stream/watermarks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, cast +from typing import Any, cast import httpx @@ -20,12 +20,14 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.stream import ( + StreamWatermarks, WatermarkGetResponse, - WatermarkListResponse, WatermarkCreateResponse, WatermarkDeleteResponse, watermark_create_params, @@ -136,7 +138,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkListResponse: + ) -> SyncSinglePage[StreamWatermarks]: """ Lists all watermark profiles for an account. @@ -153,16 +155,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/stream/watermarks", + page=SyncSinglePage[StreamWatermarks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[WatermarkListResponse], ResultWrapper[WatermarkListResponse]), + model=StreamWatermarks, ) def delete( @@ -356,7 +355,7 @@ async def create( ), ) - async def list( + def list( self, *, account_id: str, @@ -366,7 +365,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> WatermarkListResponse: + ) -> AsyncPaginator[StreamWatermarks, AsyncSinglePage[StreamWatermarks]]: """ Lists all watermark profiles for an account. @@ -383,16 +382,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/stream/watermarks", + page=AsyncSinglePage[StreamWatermarks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[WatermarkListResponse], ResultWrapper[WatermarkListResponse]), + model=StreamWatermarks, ) async def delete( diff --git a/src/cloudflare/resources/subscriptions.py b/src/cloudflare/resources/subscriptions.py index ef45680e6dc..03ebe32ebe1 100644 --- a/src/cloudflare/resources/subscriptions.py +++ b/src/cloudflare/resources/subscriptions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Iterable, Optional, cast +from typing import Any, Type, Iterable, cast from typing_extensions import Literal import httpx @@ -30,7 +30,9 @@ async_to_streamed_response_wrapper, ) from .._wrappers import ResultWrapper +from ..pagination import SyncSinglePage, AsyncSinglePage from .._base_client import ( + AsyncPaginator, make_request_options, ) @@ -197,7 +199,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SubscriptionListResponse]: + ) -> SyncSinglePage[SubscriptionListResponse]: """ Lists all of an account's subscriptions. @@ -214,16 +216,13 @@ def list( """ if not account_identifier: raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", + page=SyncSinglePage[SubscriptionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[SubscriptionListResponse]], ResultWrapper[SubscriptionListResponse]), + model=SubscriptionListResponse, ) def delete( @@ -467,7 +466,7 @@ async def update( ), ) - async def list( + def list( self, account_identifier: str, *, @@ -477,7 +476,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SubscriptionListResponse]: + ) -> AsyncPaginator[SubscriptionListResponse, AsyncSinglePage[SubscriptionListResponse]]: """ Lists all of an account's subscriptions. @@ -494,16 +493,13 @@ async def list( """ if not account_identifier: raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", + page=AsyncSinglePage[SubscriptionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[SubscriptionListResponse]], ResultWrapper[SubscriptionListResponse]), + model=SubscriptionListResponse, ) async def delete( diff --git a/src/cloudflare/resources/user/invites.py b/src/cloudflare/resources/user/invites.py index fb776d08e2b..004b6fc05ea 100644 --- a/src/cloudflare/resources/user/invites.py +++ b/src/cloudflare/resources/user/invites.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, cast from typing_extensions import Literal import httpx @@ -21,8 +21,10 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ...types.user import InviteGetResponse, InviteEditResponse, InviteListResponse, invite_edit_params from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -47,18 +49,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[InviteListResponse]: + ) -> SyncSinglePage[InviteListResponse]: """Lists all invitations associated with my user.""" - return self._get( + return self._get_api_list( "/user/invites", + page=SyncSinglePage[InviteListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[InviteListResponse]], ResultWrapper[InviteListResponse]), + model=InviteListResponse, ) def edit( @@ -163,7 +162,7 @@ def with_raw_response(self) -> AsyncInvitesWithRawResponse: def with_streaming_response(self) -> AsyncInvitesWithStreamingResponse: return AsyncInvitesWithStreamingResponse(self) - async def list( + def list( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -172,18 +171,15 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[InviteListResponse]: + ) -> AsyncPaginator[InviteListResponse, AsyncSinglePage[InviteListResponse]]: """Lists all invitations associated with my user.""" - return await self._get( + return self._get_api_list( "/user/invites", + page=AsyncSinglePage[InviteListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[InviteListResponse]], ResultWrapper[InviteListResponse]), + model=InviteListResponse, ) async def edit( diff --git a/src/cloudflare/resources/user/load_balancers/analytics/events.py b/src/cloudflare/resources/user/load_balancers/analytics/events.py index 56dbd0fcca1..16d130bb45c 100644 --- a/src/cloudflare/resources/user/load_balancers/analytics/events.py +++ b/src/cloudflare/resources/user/load_balancers/analytics/events.py @@ -2,16 +2,13 @@ from __future__ import annotations -from typing import Type, Union, Optional, cast +from typing import Union from datetime import datetime import httpx from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ....._utils import ( - maybe_transform, - async_maybe_transform, -) +from ....._utils import maybe_transform from ....._compat import cached_property from ....._resource import SyncAPIResource, AsyncAPIResource from ....._response import ( @@ -20,11 +17,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from .....types.user.load_balancers.analytics import EventListResponse, event_list_params +from .....types.user.load_balancers.analytics import LoadBalancingAnalytics, event_list_params __all__ = ["Events", "AsyncEvents"] @@ -54,7 +52,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EventListResponse]: + ) -> SyncSinglePage[LoadBalancingAnalytics]: """ List origin health changes. @@ -81,8 +79,9 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/user/load_balancing_analytics/events", + page=SyncSinglePage[LoadBalancingAnalytics], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -100,9 +99,8 @@ def list( }, event_list_params.EventListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[EventListResponse]], ResultWrapper[EventListResponse]), + model=LoadBalancingAnalytics, ) @@ -115,7 +113,7 @@ def with_raw_response(self) -> AsyncEventsWithRawResponse: def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: return AsyncEventsWithStreamingResponse(self) - async def list( + def list( self, *, origin_healthy: bool | NotGiven = NOT_GIVEN, @@ -131,7 +129,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EventListResponse]: + ) -> AsyncPaginator[LoadBalancingAnalytics, AsyncSinglePage[LoadBalancingAnalytics]]: """ List origin health changes. @@ -158,14 +156,15 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/user/load_balancing_analytics/events", + page=AsyncSinglePage[LoadBalancingAnalytics], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "origin_healthy": origin_healthy, "origin_name": origin_name, @@ -177,9 +176,8 @@ async def list( }, event_list_params.EventListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[EventListResponse]], ResultWrapper[EventListResponse]), + model=LoadBalancingAnalytics, ) diff --git a/src/cloudflare/resources/user/load_balancers/monitors.py b/src/cloudflare/resources/user/load_balancers/monitors.py index 153221cfaf9..6fbbc6c5283 100644 --- a/src/cloudflare/resources/user/load_balancers/monitors.py +++ b/src/cloudflare/resources/user/load_balancers/monitors.py @@ -21,11 +21,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.user.load_balancers import ( - MonitorListResponse, LoadBalancingMonitor, MonitorDeleteResponse, MonitorPreviewResponse, @@ -300,18 +301,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MonitorListResponse]: + ) -> SyncSinglePage[LoadBalancingMonitor]: """List configured monitors for a user.""" - return self._get( + return self._get_api_list( "/user/load_balancers/monitors", + page=SyncSinglePage[LoadBalancingMonitor], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[MonitorListResponse]], ResultWrapper[MonitorListResponse]), + model=LoadBalancingMonitor, ) def delete( @@ -926,7 +924,7 @@ async def update( cast_to=cast(Type[LoadBalancingMonitor], ResultWrapper[LoadBalancingMonitor]), ) - async def list( + def list( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -935,18 +933,15 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[MonitorListResponse]: + ) -> AsyncPaginator[LoadBalancingMonitor, AsyncSinglePage[LoadBalancingMonitor]]: """List configured monitors for a user.""" - return await self._get( + return self._get_api_list( "/user/load_balancers/monitors", + page=AsyncSinglePage[LoadBalancingMonitor], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[MonitorListResponse]], ResultWrapper[MonitorListResponse]), + model=LoadBalancingMonitor, ) async def delete( diff --git a/src/cloudflare/resources/user/load_balancers/pools.py b/src/cloudflare/resources/user/load_balancers/pools.py index 4fd53ba8dd7..26b35dcb7d7 100644 --- a/src/cloudflare/resources/user/load_balancers/pools.py +++ b/src/cloudflare/resources/user/load_balancers/pools.py @@ -21,11 +21,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.user.load_balancers import ( - PoolListResponse, LoadBalancingPool, PoolDeleteResponse, PoolHealthResponse, @@ -319,7 +320,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PoolListResponse]: + ) -> SyncSinglePage[LoadBalancingPool]: """ List configured pools. @@ -335,17 +336,17 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get( + return self._get_api_list( "/user/load_balancers/pools", + page=SyncSinglePage[LoadBalancingPool], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[PoolListResponse]], ResultWrapper[PoolListResponse]), + model=LoadBalancingPool, ) def delete( @@ -1025,7 +1026,7 @@ async def update( cast_to=cast(Type[LoadBalancingPool], ResultWrapper[LoadBalancingPool]), ) - async def list( + def list( self, *, monitor: object | NotGiven = NOT_GIVEN, @@ -1035,7 +1036,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PoolListResponse]: + ) -> AsyncPaginator[LoadBalancingPool, AsyncSinglePage[LoadBalancingPool]]: """ List configured pools. @@ -1051,17 +1052,17 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - return await self._get( + return self._get_api_list( "/user/load_balancers/pools", + page=AsyncSinglePage[LoadBalancingPool], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), - post_parser=ResultWrapper._unwrapper, + query=maybe_transform({"monitor": monitor}, pool_list_params.PoolListParams), ), - cast_to=cast(Type[Optional[PoolListResponse]], ResultWrapper[PoolListResponse]), + model=LoadBalancingPool, ) async def delete( diff --git a/src/cloudflare/resources/user/tokens/permission_groups.py b/src/cloudflare/resources/user/tokens/permission_groups.py index b3b6b36a735..56114d8047d 100644 --- a/src/cloudflare/resources/user/tokens/permission_groups.py +++ b/src/cloudflare/resources/user/tokens/permission_groups.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast - import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,11 +13,11 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.user.tokens import PermissionGroupListResponse __all__ = ["PermissionGroups", "AsyncPermissionGroups"] @@ -42,18 +40,15 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PermissionGroupListResponse]: + ) -> SyncSinglePage[object]: """Find all available permission groups.""" - return self._get( + return self._get_api_list( "/user/tokens/permission_groups", + page=SyncSinglePage[object], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PermissionGroupListResponse]], ResultWrapper[PermissionGroupListResponse]), + model=object, ) @@ -66,7 +61,7 @@ def with_raw_response(self) -> AsyncPermissionGroupsWithRawResponse: def with_streaming_response(self) -> AsyncPermissionGroupsWithStreamingResponse: return AsyncPermissionGroupsWithStreamingResponse(self) - async def list( + def list( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -75,18 +70,15 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PermissionGroupListResponse]: + ) -> AsyncPaginator[object, AsyncSinglePage[object]]: """Find all available permission groups.""" - return await self._get( + return self._get_api_list( "/user/tokens/permission_groups", + page=AsyncSinglePage[object], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PermissionGroupListResponse]], ResultWrapper[PermissionGroupListResponse]), + model=object, ) diff --git a/src/cloudflare/resources/vectorize/indexes.py b/src/cloudflare/resources/vectorize/indexes.py index fc02930befd..345e6f36299 100644 --- a/src/cloudflare/resources/vectorize/indexes.py +++ b/src/cloudflare/resources/vectorize/indexes.py @@ -20,11 +20,12 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.vectorize import ( - IndexListResponse, IndexDeleteResponse, VectorizeIndexQuery, VectorizeCreateIndex, @@ -160,7 +161,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexListResponse: + ) -> SyncSinglePage[VectorizeCreateIndex]: """ Returns a list of Vectorize Indexes @@ -177,16 +178,13 @@ def list( """ if not account_identifier: raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_identifier}/vectorize/indexes", + page=SyncSinglePage[VectorizeCreateIndex], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[IndexListResponse], ResultWrapper[IndexListResponse]), + model=VectorizeCreateIndex, ) def delete( @@ -631,7 +629,7 @@ async def update( cast_to=cast(Type[Optional[VectorizeCreateIndex]], ResultWrapper[VectorizeCreateIndex]), ) - async def list( + def list( self, account_identifier: str, *, @@ -641,7 +639,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IndexListResponse: + ) -> AsyncPaginator[VectorizeCreateIndex, AsyncSinglePage[VectorizeCreateIndex]]: """ Returns a list of Vectorize Indexes @@ -658,16 +656,13 @@ async def list( """ if not account_identifier: raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_identifier}/vectorize/indexes", + page=AsyncSinglePage[VectorizeCreateIndex], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[IndexListResponse], ResultWrapper[IndexListResponse]), + model=VectorizeCreateIndex, ) async def delete( diff --git a/src/cloudflare/resources/waiting_rooms/events/events.py b/src/cloudflare/resources/waiting_rooms/events/events.py index 0f506aa3801..4f640e2a6c9 100644 --- a/src/cloudflare/resources/waiting_rooms/events/events.py +++ b/src/cloudflare/resources/waiting_rooms/events/events.py @@ -28,12 +28,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.waiting_rooms import ( WaitingroomEvent, - EventListResponse, EventDeleteResponse, event_edit_params, event_create_params, @@ -312,7 +313,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EventListResponse]: + ) -> SyncSinglePage[WaitingroomEvent]: """ Lists events for a waiting room. @@ -331,16 +332,13 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", + page=SyncSinglePage[WaitingroomEvent], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[EventListResponse]], ResultWrapper[EventListResponse]), + model=WaitingroomEvent, ) def delete( @@ -813,7 +811,7 @@ async def update( cast_to=cast(Type[WaitingroomEvent], ResultWrapper[WaitingroomEvent]), ) - async def list( + def list( self, waiting_room_id: str, *, @@ -824,7 +822,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[EventListResponse]: + ) -> AsyncPaginator[WaitingroomEvent, AsyncSinglePage[WaitingroomEvent]]: """ Lists events for a waiting room. @@ -843,16 +841,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/events", + page=AsyncSinglePage[WaitingroomEvent], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[EventListResponse]], ResultWrapper[EventListResponse]), + model=WaitingroomEvent, ) async def delete( diff --git a/src/cloudflare/resources/waiting_rooms/rules.py b/src/cloudflare/resources/waiting_rooms/rules.py index cce5332dfa7..78bd8d41228 100644 --- a/src/cloudflare/resources/waiting_rooms/rules.py +++ b/src/cloudflare/resources/waiting_rooms/rules.py @@ -21,12 +21,14 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.waiting_rooms import ( + WaitingroomRule, RuleEditResponse, - RuleListResponse, RuleCreateResponse, RuleDeleteResponse, RuleUpdateResponse, @@ -169,7 +171,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleListResponse]: + ) -> SyncSinglePage[WaitingroomRule]: """ Lists rules for a waiting room. @@ -188,16 +190,13 @@ def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", + page=SyncSinglePage[WaitingroomRule], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), + model=WaitingroomRule, ) def delete( @@ -440,7 +439,7 @@ async def update( cast_to=cast(Type[Optional[RuleUpdateResponse]], ResultWrapper[RuleUpdateResponse]), ) - async def list( + def list( self, waiting_room_id: str, *, @@ -451,7 +450,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleListResponse]: + ) -> AsyncPaginator[WaitingroomRule, AsyncSinglePage[WaitingroomRule]]: """ Lists rules for a waiting room. @@ -470,16 +469,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") if not waiting_room_id: raise ValueError(f"Expected a non-empty value for `waiting_room_id` but received {waiting_room_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_identifier}/waiting_rooms/{waiting_room_id}/rules", + page=AsyncSinglePage[WaitingroomRule], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), + model=WaitingroomRule, ) async def delete( diff --git a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py index ff2bb29295e..d7db5dfc32a 100644 --- a/src/cloudflare/resources/waiting_rooms/waiting_rooms.py +++ b/src/cloudflare/resources/waiting_rooms/waiting_rooms.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, Optional, cast +from typing import Type, Iterable, cast from typing_extensions import Literal import httpx @@ -33,7 +33,6 @@ ) from ...types import ( WaitingRoom, - WaitingRoomListResponse, WaitingRoomDeleteResponse, waiting_room_edit_params, waiting_room_create_params, @@ -69,8 +68,10 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from .events.events import Events, AsyncEvents from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -829,7 +830,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WaitingRoomListResponse]: + ) -> SyncSinglePage[WaitingRoom]: """ Lists waiting rooms. @@ -846,16 +847,13 @@ def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_identifier}/waiting_rooms", + page=SyncSinglePage[WaitingRoom], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[WaitingRoomListResponse]], ResultWrapper[WaitingRoomListResponse]), + model=WaitingRoom, ) def delete( @@ -2043,7 +2041,7 @@ async def update( cast_to=cast(Type[WaitingRoom], ResultWrapper[WaitingRoom]), ) - async def list( + def list( self, zone_identifier: str, *, @@ -2053,7 +2051,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[WaitingRoomListResponse]: + ) -> AsyncPaginator[WaitingRoom, AsyncSinglePage[WaitingRoom]]: """ Lists waiting rooms. @@ -2070,16 +2068,13 @@ async def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_identifier}/waiting_rooms", + page=AsyncSinglePage[WaitingRoom], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[WaitingRoomListResponse]], ResultWrapper[WaitingRoomListResponse]), + model=WaitingRoom, ) async def delete( diff --git a/src/cloudflare/resources/web3/hostnames/hostnames.py b/src/cloudflare/resources/web3/hostnames/hostnames.py index 9473bfe6c9d..368e8f12e60 100644 --- a/src/cloudflare/resources/web3/hostnames/hostnames.py +++ b/src/cloudflare/resources/web3/hostnames/hostnames.py @@ -21,14 +21,10 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....types.web3 import ( - HostnameListResponse, - DistributedWebHostname, - HostnameDeleteResponse, - hostname_edit_params, - hostname_create_params, -) +from ....pagination import SyncSinglePage, AsyncSinglePage +from ....types.web3 import DistributedWebHostname, HostnameDeleteResponse, hostname_edit_params, hostname_create_params from ...._base_client import ( + AsyncPaginator, make_request_options, ) from .ipfs_universal_paths import ( @@ -123,7 +119,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HostnameListResponse]: + ) -> SyncSinglePage[DistributedWebHostname]: """ List Web3 Hostnames @@ -140,16 +136,13 @@ def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_identifier}/web3/hostnames", + page=SyncSinglePage[DistributedWebHostname], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[HostnameListResponse]], ResultWrapper[HostnameListResponse]), + model=DistributedWebHostname, ) def delete( @@ -367,7 +360,7 @@ async def create( cast_to=cast(Type[DistributedWebHostname], ResultWrapper[DistributedWebHostname]), ) - async def list( + def list( self, zone_identifier: str, *, @@ -377,7 +370,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[HostnameListResponse]: + ) -> AsyncPaginator[DistributedWebHostname, AsyncSinglePage[DistributedWebHostname]]: """ List Web3 Hostnames @@ -394,16 +387,13 @@ async def list( """ if not zone_identifier: raise ValueError(f"Expected a non-empty value for `zone_identifier` but received {zone_identifier!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_identifier}/web3/hostnames", + page=AsyncSinglePage[DistributedWebHostname], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[HostnameListResponse]], ResultWrapper[HostnameListResponse]), + model=DistributedWebHostname, ) async def delete( diff --git a/src/cloudflare/resources/workers/domains.py b/src/cloudflare/resources/workers/domains.py index 53c62b76aa7..6fbc1af6e8c 100644 --- a/src/cloudflare/resources/workers/domains.py +++ b/src/cloudflare/resources/workers/domains.py @@ -20,10 +20,12 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) -from ...types.workers import WorkersDomain, DomainListResponse, domain_list_params, domain_update_params +from ...types.workers import WorkersDomain, domain_list_params, domain_update_params __all__ = ["Domains", "AsyncDomains"] @@ -110,7 +112,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DomainListResponse: + ) -> SyncSinglePage[WorkersDomain]: """ Lists all Worker Domains for an account. @@ -135,8 +137,9 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/domains", + page=SyncSinglePage[WorkersDomain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -152,9 +155,8 @@ def list( }, domain_list_params.DomainListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DomainListResponse], ResultWrapper[DomainListResponse]), + model=WorkersDomain, ) def delete( @@ -306,7 +308,7 @@ async def update( cast_to=cast(Type[WorkersDomain], ResultWrapper[WorkersDomain]), ) - async def list( + def list( self, *, account_id: str, @@ -321,7 +323,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DomainListResponse: + ) -> AsyncPaginator[WorkersDomain, AsyncSinglePage[WorkersDomain]]: """ Lists all Worker Domains for an account. @@ -346,14 +348,15 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/domains", + page=AsyncSinglePage[WorkersDomain], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "environment": environment, "hostname": hostname, @@ -363,9 +366,8 @@ async def list( }, domain_list_params.DomainListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[DomainListResponse], ResultWrapper[DomainListResponse]), + model=WorkersDomain, ) async def delete( diff --git a/src/cloudflare/resources/workers/filters.py b/src/cloudflare/resources/workers/filters.py index ab63f0f0627..f9b067df2f0 100644 --- a/src/cloudflare/resources/workers/filters.py +++ b/src/cloudflare/resources/workers/filters.py @@ -20,12 +20,13 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.workers import ( WorkersFilter, - FilterListResponse, FilterCreateResponse, FilterDeleteResponse, filter_create_params, @@ -155,7 +156,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FilterListResponse: + ) -> SyncSinglePage[WorkersFilter]: """ List Filters @@ -172,16 +173,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/workers/filters", + page=SyncSinglePage[WorkersFilter], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[FilterListResponse], ResultWrapper[FilterListResponse]), + model=WorkersFilter, ) def delete( @@ -339,7 +337,7 @@ async def update( cast_to=cast(Type[WorkersFilter], ResultWrapper[WorkersFilter]), ) - async def list( + def list( self, *, zone_id: str, @@ -349,7 +347,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> FilterListResponse: + ) -> AsyncPaginator[WorkersFilter, AsyncSinglePage[WorkersFilter]]: """ List Filters @@ -366,16 +364,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/workers/filters", + page=AsyncSinglePage[WorkersFilter], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[FilterListResponse], ResultWrapper[FilterListResponse]), + model=WorkersFilter, ) async def delete( diff --git a/src/cloudflare/resources/workers/routes.py b/src/cloudflare/resources/workers/routes.py index 3231926ebed..4b5b565e3f7 100644 --- a/src/cloudflare/resources/workers/routes.py +++ b/src/cloudflare/resources/workers/routes.py @@ -20,12 +20,13 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.workers import ( WorkersRoute, - RouteListResponse, RouteCreateResponse, RouteDeleteResponse, route_create_params, @@ -164,7 +165,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteListResponse: + ) -> SyncSinglePage[WorkersRoute]: """ Returns routes for a zone. @@ -181,16 +182,13 @@ def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._get( + return self._get_api_list( f"/zones/{zone_id}/workers/routes", + page=SyncSinglePage[WorkersRoute], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RouteListResponse], ResultWrapper[RouteListResponse]), + model=WorkersRoute, ) def delete( @@ -406,7 +404,7 @@ async def update( cast_to=cast(Type[WorkersRoute], ResultWrapper[WorkersRoute]), ) - async def list( + def list( self, *, zone_id: str, @@ -416,7 +414,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RouteListResponse: + ) -> AsyncPaginator[WorkersRoute, AsyncSinglePage[WorkersRoute]]: """ Returns routes for a zone. @@ -433,16 +431,13 @@ async def list( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._get( + return self._get_api_list( f"/zones/{zone_id}/workers/routes", + page=AsyncSinglePage[WorkersRoute], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[RouteListResponse], ResultWrapper[RouteListResponse]), + model=WorkersRoute, ) async def delete( diff --git a/src/cloudflare/resources/workers/scripts/scripts.py b/src/cloudflare/resources/workers/scripts/scripts.py index 7288195cf54..80ae6ca12c3 100644 --- a/src/cloudflare/resources/workers/scripts/scripts.py +++ b/src/cloudflare/resources/workers/scripts/scripts.py @@ -85,10 +85,12 @@ async_to_custom_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.workers import WorkersScript, ScriptListResponse, script_delete_params, script_update_params +from ....types.workers import WorkersScript, script_delete_params, script_update_params __all__ = ["Scripts", "AsyncScripts"] @@ -266,7 +268,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScriptListResponse: + ) -> SyncSinglePage[WorkersScript]: """ Fetch a list of uploaded workers. @@ -283,16 +285,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/scripts", + page=SyncSinglePage[WorkersScript], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ScriptListResponse], ResultWrapper[ScriptListResponse]), + model=WorkersScript, ) def delete( @@ -555,7 +554,7 @@ async def update( cast_to=cast(Type[WorkersScript], ResultWrapper[WorkersScript]), ) - async def list( + def list( self, *, account_id: str, @@ -565,7 +564,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ScriptListResponse: + ) -> AsyncPaginator[WorkersScript, AsyncSinglePage[WorkersScript]]: """ Fetch a list of uploaded workers. @@ -582,16 +581,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/scripts", + page=AsyncSinglePage[WorkersScript], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[ScriptListResponse], ResultWrapper[ScriptListResponse]), + model=WorkersScript, ) async def delete( diff --git a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py index 1830339efd6..0f025e9189a 100644 --- a/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py +++ b/src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/namespaces.py @@ -28,8 +28,10 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from .scripts.scripts import Scripts, AsyncScripts from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.workers_for_platforms.dispatch import ( @@ -108,7 +110,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceListResponse: + ) -> SyncSinglePage[NamespaceListResponse]: """ Fetch a list of Workers for Platforms namespaces. @@ -125,16 +127,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/dispatch/namespaces", + page=SyncSinglePage[NamespaceListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[NamespaceListResponse], ResultWrapper[NamespaceListResponse]), + model=NamespaceListResponse, ) def delete( @@ -282,7 +281,7 @@ async def create( cast_to=cast(Type[NamespaceCreateResponse], ResultWrapper[NamespaceCreateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -292,7 +291,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> NamespaceListResponse: + ) -> AsyncPaginator[NamespaceListResponse, AsyncSinglePage[NamespaceListResponse]]: """ Fetch a list of Workers for Platforms namespaces. @@ -309,16 +308,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/workers/dispatch/namespaces", + page=AsyncSinglePage[NamespaceListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[NamespaceListResponse], ResultWrapper[NamespaceListResponse]), + model=NamespaceListResponse, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/applications/applications.py b/src/cloudflare/resources/zero_trust/access/applications/applications.py index e2069c027d2..79e1cc21d43 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/applications.py +++ b/src/cloudflare/resources/zero_trust/access/applications/applications.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Union, Optional, cast, overload +from typing import Any, List, Type, Union, cast, overload from typing_extensions import Literal import httpx @@ -37,7 +37,9 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .user_policy_checks import ( @@ -50,7 +52,6 @@ ) from .....types.zero_trust.access import ( ZeroTrustApps, - ApplicationListResponse, ApplicationDeleteResponse, application_create_params, application_update_params, @@ -1472,7 +1473,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ApplicationListResponse]: + ) -> SyncSinglePage[ZeroTrustApps]: """ Lists all Access applications in an account or zone. @@ -1504,16 +1505,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps", + page=SyncSinglePage[ZeroTrustApps], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ApplicationListResponse]], ResultWrapper[ApplicationListResponse]), + model=cast(Any, ZeroTrustApps), # Union types cannot be passed in as arguments in the type system ) def delete( @@ -3098,7 +3096,7 @@ async def update( ), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -3109,7 +3107,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ApplicationListResponse]: + ) -> AsyncPaginator[ZeroTrustApps, AsyncSinglePage[ZeroTrustApps]]: """ Lists all Access applications in an account or zone. @@ -3141,16 +3139,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps", + page=AsyncSinglePage[ZeroTrustApps], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ApplicationListResponse]], ResultWrapper[ApplicationListResponse]), + model=cast(Any, ZeroTrustApps), # Union types cannot be passed in as arguments in the type system ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/applications/cas.py b/src/cloudflare/resources/zero_trust/access/applications/cas.py index 15d65bc4bf2..34262b5b4fd 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/cas.py +++ b/src/cloudflare/resources/zero_trust/access/applications/cas.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Type, cast import httpx @@ -16,10 +16,12 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from .....types.zero_trust.access.applications import CAGetResponse, CAListResponse, CACreateResponse, CADeleteResponse +from .....types.zero_trust.access.applications import ZeroTrustCA, CAGetResponse, CACreateResponse, CADeleteResponse __all__ = ["CAs", "AsyncCAs"] @@ -109,7 +111,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CAListResponse]: + ) -> SyncSinglePage[ZeroTrustCA]: """ Lists short-lived certificate CAs and their public keys. @@ -141,16 +143,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/ca", + page=SyncSinglePage[ZeroTrustCA], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CAListResponse]], ResultWrapper[CAListResponse]), + model=ZeroTrustCA, ) def delete( @@ -353,7 +352,7 @@ async def create( ), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -364,7 +363,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CAListResponse]: + ) -> AsyncPaginator[ZeroTrustCA, AsyncSinglePage[ZeroTrustCA]]: """ Lists short-lived certificate CAs and their public keys. @@ -396,16 +395,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/ca", + page=AsyncSinglePage[ZeroTrustCA], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CAListResponse]], ResultWrapper[CAListResponse]), + model=ZeroTrustCA, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/applications/policies.py b/src/cloudflare/resources/zero_trust/access/applications/policies.py index 1b96d6d8493..cab5e55073f 100644 --- a/src/cloudflare/resources/zero_trust/access/applications/policies.py +++ b/src/cloudflare/resources/zero_trust/access/applications/policies.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, Optional, cast +from typing import Type, Iterable, cast from typing_extensions import Literal import httpx @@ -21,12 +21,13 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.access.applications import ( ZeroTrustPolicies, - PolicyListResponse, PolicyDeleteResponse, policy_create_params, policy_update_params, @@ -303,7 +304,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> SyncSinglePage[ZeroTrustPolicies]: """ Lists Access policies configured for an application. @@ -339,16 +340,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", + page=SyncSinglePage[ZeroTrustPolicies], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=ZeroTrustPolicies, ) def delete( @@ -738,7 +736,7 @@ async def update( cast_to=cast(Type[ZeroTrustPolicies], ResultWrapper[ZeroTrustPolicies]), ) - async def list( + def list( self, uuid: str, *, @@ -750,7 +748,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> AsyncPaginator[ZeroTrustPolicies, AsyncSinglePage[ZeroTrustPolicies]]: """ Lists Access policies configured for an application. @@ -786,16 +784,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/apps/{uuid}/policies", + page=AsyncSinglePage[ZeroTrustPolicies], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=ZeroTrustPolicies, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/bookmarks.py b/src/cloudflare/resources/zero_trust/access/bookmarks.py index 488fc78f779..283c3ef36b0 100644 --- a/src/cloudflare/resources/zero_trust/access/bookmarks.py +++ b/src/cloudflare/resources/zero_trust/access/bookmarks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -16,10 +16,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ZeroTrustBookmarks, BookmarkListResponse, BookmarkDeleteResponse +from ....types.zero_trust.access import ZeroTrustBookmarks, BookmarkDeleteResponse __all__ = ["Bookmarks", "AsyncBookmarks"] @@ -127,7 +129,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BookmarkListResponse]: + ) -> SyncSinglePage[ZeroTrustBookmarks]: """ Lists Bookmark applications. @@ -142,16 +144,13 @@ def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( + return self._get_api_list( f"/accounts/{identifier}/access/bookmarks", + page=SyncSinglePage[ZeroTrustBookmarks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[BookmarkListResponse]], ResultWrapper[BookmarkListResponse]), + model=ZeroTrustBookmarks, ) def delete( @@ -332,7 +331,7 @@ async def update( cast_to=cast(Type[ZeroTrustBookmarks], ResultWrapper[ZeroTrustBookmarks]), ) - async def list( + def list( self, identifier: str, *, @@ -342,7 +341,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[BookmarkListResponse]: + ) -> AsyncPaginator[ZeroTrustBookmarks, AsyncSinglePage[ZeroTrustBookmarks]]: """ Lists Bookmark applications. @@ -357,16 +356,13 @@ async def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( + return self._get_api_list( f"/accounts/{identifier}/access/bookmarks", + page=AsyncSinglePage[ZeroTrustBookmarks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[BookmarkListResponse]], ResultWrapper[BookmarkListResponse]), + model=ZeroTrustBookmarks, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py index c356a526d8f..72886a437a4 100644 --- a/src/cloudflare/resources/zero_trust/access/certificates/certificates.py +++ b/src/cloudflare/resources/zero_trust/access/certificates/certificates.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import List, Type, Optional, cast +from typing import List, Type, cast import httpx @@ -28,12 +28,13 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.access import ( ZeroTrustCertificates, - CertificateListResponse, CertificateDeleteResponse, certificate_create_params, certificate_update_params, @@ -211,7 +212,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificateListResponse]: + ) -> SyncSinglePage[ZeroTrustCertificates]: """ Lists all mTLS root certificates. @@ -243,16 +244,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/certificates", + page=SyncSinglePage[ZeroTrustCertificates], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CertificateListResponse]], ResultWrapper[CertificateListResponse]), + model=ZeroTrustCertificates, ) def delete( @@ -534,7 +532,7 @@ async def update( cast_to=cast(Type[ZeroTrustCertificates], ResultWrapper[ZeroTrustCertificates]), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -545,7 +543,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CertificateListResponse]: + ) -> AsyncPaginator[ZeroTrustCertificates, AsyncSinglePage[ZeroTrustCertificates]]: """ Lists all mTLS root certificates. @@ -577,16 +575,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/certificates", + page=AsyncSinglePage[ZeroTrustCertificates], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CertificateListResponse]], ResultWrapper[CertificateListResponse]), + model=ZeroTrustCertificates, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/custom_pages.py b/src/cloudflare/resources/zero_trust/access/custom_pages.py index e5d50209dac..1e65a80ae45 100644 --- a/src/cloudflare/resources/zero_trust/access/custom_pages.py +++ b/src/cloudflare/resources/zero_trust/access/custom_pages.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast from typing_extensions import Literal import httpx @@ -21,12 +21,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.access import ( ZeroTrustCustomPage, - CustomPageListResponse, CustomPageDeleteResponse, ZeroTrustCustomPageWithoutHTML, custom_page_create_params, @@ -180,7 +181,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageListResponse]: + ) -> SyncSinglePage[ZeroTrustCustomPageWithoutHTML]: """ List custom pages @@ -197,16 +198,13 @@ def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( + return self._get_api_list( f"/accounts/{identifier}/access/custom_pages", + page=SyncSinglePage[ZeroTrustCustomPageWithoutHTML], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CustomPageListResponse]], ResultWrapper[CustomPageListResponse]), + model=ZeroTrustCustomPageWithoutHTML, ) def delete( @@ -432,7 +430,7 @@ async def update( cast_to=cast(Type[ZeroTrustCustomPageWithoutHTML], ResultWrapper[ZeroTrustCustomPageWithoutHTML]), ) - async def list( + def list( self, identifier: str, *, @@ -442,7 +440,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CustomPageListResponse]: + ) -> AsyncPaginator[ZeroTrustCustomPageWithoutHTML, AsyncSinglePage[ZeroTrustCustomPageWithoutHTML]]: """ List custom pages @@ -459,16 +457,13 @@ async def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( + return self._get_api_list( f"/accounts/{identifier}/access/custom_pages", + page=AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CustomPageListResponse]], ResultWrapper[CustomPageListResponse]), + model=ZeroTrustCustomPageWithoutHTML, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/groups.py b/src/cloudflare/resources/zero_trust/access/groups.py index 250aa7914f5..5920fb6f57b 100644 --- a/src/cloudflare/resources/zero_trust/access/groups.py +++ b/src/cloudflare/resources/zero_trust/access/groups.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Iterable, Optional, cast +from typing import Type, Iterable, cast import httpx @@ -20,16 +20,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ( - ZeroTrustGroups, - GroupListResponse, - GroupDeleteResponse, - group_create_params, - group_update_params, -) +from ....types.zero_trust.access import ZeroTrustGroups, GroupDeleteResponse, group_create_params, group_update_params __all__ = ["Groups", "AsyncGroups"] @@ -225,7 +221,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[GroupListResponse]: + ) -> SyncSinglePage[ZeroTrustGroups]: """ Lists all Access groups. @@ -257,16 +253,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/groups", + page=SyncSinglePage[ZeroTrustGroups], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[GroupListResponse]], ResultWrapper[GroupListResponse]), + model=ZeroTrustGroups, ) def delete( @@ -570,7 +563,7 @@ async def update( cast_to=cast(Type[ZeroTrustGroups], ResultWrapper[ZeroTrustGroups]), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -581,7 +574,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[GroupListResponse]: + ) -> AsyncPaginator[ZeroTrustGroups, AsyncSinglePage[ZeroTrustGroups]]: """ Lists all Access groups. @@ -613,16 +606,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/groups", + page=AsyncSinglePage[ZeroTrustGroups], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[GroupListResponse]], ResultWrapper[GroupListResponse]), + model=ZeroTrustGroups, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/service_tokens.py b/src/cloudflare/resources/zero_trust/access/service_tokens.py index f318849caa8..953e58131ec 100644 --- a/src/cloudflare/resources/zero_trust/access/service_tokens.py +++ b/src/cloudflare/resources/zero_trust/access/service_tokens.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,12 +20,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.access import ( ZeroTrustServiceTokens, - ServiceTokenListResponse, ServiceTokenCreateResponse, ServiceTokenRotateResponse, service_token_create_params, @@ -203,7 +204,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceTokenListResponse]: + ) -> SyncSinglePage[ZeroTrustServiceTokens]: """ Lists all service tokens. @@ -235,16 +236,13 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens", + page=SyncSinglePage[ZeroTrustServiceTokens], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ServiceTokenListResponse]], ResultWrapper[ServiceTokenListResponse]), + model=ZeroTrustServiceTokens, ) def delete( @@ -553,7 +551,7 @@ async def update( cast_to=cast(Type[ZeroTrustServiceTokens], ResultWrapper[ZeroTrustServiceTokens]), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -564,7 +562,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ServiceTokenListResponse]: + ) -> AsyncPaginator[ZeroTrustServiceTokens, AsyncSinglePage[ZeroTrustServiceTokens]]: """ Lists all service tokens. @@ -596,16 +594,13 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/service_tokens", + page=AsyncSinglePage[ZeroTrustServiceTokens], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ServiceTokenListResponse]], ResultWrapper[ServiceTokenListResponse]), + model=ZeroTrustServiceTokens, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/tags.py b/src/cloudflare/resources/zero_trust/access/tags.py index 57cd3bb4b25..0bfece83082 100644 --- a/src/cloudflare/resources/zero_trust/access/tags.py +++ b/src/cloudflare/resources/zero_trust/access/tags.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -20,16 +20,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.zero_trust.access import ( - ZeroTrustTag, - TagListResponse, - TagDeleteResponse, - tag_create_params, - tag_update_params, -) +from ....types.zero_trust.access import ZeroTrustTag, TagDeleteResponse, tag_create_params, tag_update_params __all__ = ["Tags", "AsyncTags"] @@ -144,7 +140,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TagListResponse]: + ) -> SyncSinglePage[ZeroTrustTag]: """ List tags @@ -161,16 +157,13 @@ def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( + return self._get_api_list( f"/accounts/{identifier}/access/tags", + page=SyncSinglePage[ZeroTrustTag], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[TagListResponse]], ResultWrapper[TagListResponse]), + model=ZeroTrustTag, ) def delete( @@ -362,7 +355,7 @@ async def update( cast_to=cast(Type[ZeroTrustTag], ResultWrapper[ZeroTrustTag]), ) - async def list( + def list( self, identifier: str, *, @@ -372,7 +365,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[TagListResponse]: + ) -> AsyncPaginator[ZeroTrustTag, AsyncSinglePage[ZeroTrustTag]]: """ List tags @@ -389,16 +382,13 @@ async def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( + return self._get_api_list( f"/accounts/{identifier}/access/tags", + page=AsyncSinglePage[ZeroTrustTag], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[TagListResponse]], ResultWrapper[TagListResponse]), + model=ZeroTrustTag, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/access/users/active_sessions.py b/src/cloudflare/resources/zero_trust/access/users/active_sessions.py index 87c9717dad3..92e9fc65093 100644 --- a/src/cloudflare/resources/zero_trust/access/users/active_sessions.py +++ b/src/cloudflare/resources/zero_trust/access/users/active_sessions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Type, cast import httpx @@ -16,7 +16,9 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.access.users import ActiveSessionGetResponse, ActiveSessionListResponse @@ -44,7 +46,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ActiveSessionListResponse]: + ) -> SyncSinglePage[ActiveSessionListResponse]: """ Get active sessions for a single user. @@ -65,16 +67,13 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get( + return self._get_api_list( f"/accounts/{identifier}/access/users/{id}/active_sessions", + page=SyncSinglePage[ActiveSessionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ActiveSessionListResponse]], ResultWrapper[ActiveSessionListResponse]), + model=ActiveSessionListResponse, ) def get( @@ -134,7 +133,7 @@ def with_raw_response(self) -> AsyncActiveSessionsWithRawResponse: def with_streaming_response(self) -> AsyncActiveSessionsWithStreamingResponse: return AsyncActiveSessionsWithStreamingResponse(self) - async def list( + def list( self, id: str, *, @@ -145,7 +144,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ActiveSessionListResponse]: + ) -> AsyncPaginator[ActiveSessionListResponse, AsyncSinglePage[ActiveSessionListResponse]]: """ Get active sessions for a single user. @@ -166,16 +165,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{identifier}/access/users/{id}/active_sessions", + page=AsyncSinglePage[ActiveSessionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ActiveSessionListResponse]], ResultWrapper[ActiveSessionListResponse]), + model=ActiveSessionListResponse, ) async def get( diff --git a/src/cloudflare/resources/zero_trust/access/users/failed_logins.py b/src/cloudflare/resources/zero_trust/access/users/failed_logins.py index bc10927f50f..7f37f31f146 100644 --- a/src/cloudflare/resources/zero_trust/access/users/failed_logins.py +++ b/src/cloudflare/resources/zero_trust/access/users/failed_logins.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast - import httpx from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,8 +13,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.access.users import FailedLoginListResponse @@ -44,7 +43,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FailedLoginListResponse]: + ) -> SyncSinglePage[FailedLoginListResponse]: """ Get all failed login attempts for a single user. @@ -65,16 +64,13 @@ def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return self._get( + return self._get_api_list( f"/accounts/{identifier}/access/users/{id}/failed_logins", + page=SyncSinglePage[FailedLoginListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[FailedLoginListResponse]], ResultWrapper[FailedLoginListResponse]), + model=FailedLoginListResponse, ) @@ -87,7 +83,7 @@ def with_raw_response(self) -> AsyncFailedLoginsWithRawResponse: def with_streaming_response(self) -> AsyncFailedLoginsWithStreamingResponse: return AsyncFailedLoginsWithStreamingResponse(self) - async def list( + def list( self, id: str, *, @@ -98,7 +94,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FailedLoginListResponse]: + ) -> AsyncPaginator[FailedLoginListResponse, AsyncSinglePage[FailedLoginListResponse]]: """ Get all failed login attempts for a single user. @@ -119,16 +115,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") if not id: raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{identifier}/access/users/{id}/failed_logins", + page=AsyncSinglePage[FailedLoginListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[FailedLoginListResponse]], ResultWrapper[FailedLoginListResponse]), + model=FailedLoginListResponse, ) diff --git a/src/cloudflare/resources/zero_trust/access/users/users.py b/src/cloudflare/resources/zero_trust/access/users/users.py index fe06ee20999..0d656b5f90b 100644 --- a/src/cloudflare/resources/zero_trust/access/users/users.py +++ b/src/cloudflare/resources/zero_trust/access/users/users.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast - import httpx from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,7 +13,6 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper from .failed_logins import ( FailedLogins, AsyncFailedLogins, @@ -24,6 +21,7 @@ FailedLoginsWithStreamingResponse, AsyncFailedLoginsWithStreamingResponse, ) +from .....pagination import SyncSinglePage, AsyncSinglePage from .active_sessions import ( ActiveSessions, AsyncActiveSessions, @@ -33,6 +31,7 @@ AsyncActiveSessionsWithStreamingResponse, ) from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .last_seen_identity import ( @@ -43,7 +42,7 @@ LastSeenIdentityWithStreamingResponse, AsyncLastSeenIdentityWithStreamingResponse, ) -from .....types.zero_trust.access import UserListResponse +from .....types.zero_trust.access import ZeroTrustUsers __all__ = ["Users", "AsyncUsers"] @@ -79,7 +78,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UserListResponse]: + ) -> SyncSinglePage[ZeroTrustUsers]: """ Gets a list of users for an account. @@ -96,16 +95,13 @@ def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return self._get( + return self._get_api_list( f"/accounts/{identifier}/access/users", + page=SyncSinglePage[ZeroTrustUsers], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[UserListResponse]], ResultWrapper[UserListResponse]), + model=ZeroTrustUsers, ) @@ -130,7 +126,7 @@ def with_raw_response(self) -> AsyncUsersWithRawResponse: def with_streaming_response(self) -> AsyncUsersWithStreamingResponse: return AsyncUsersWithStreamingResponse(self) - async def list( + def list( self, identifier: str, *, @@ -140,7 +136,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[UserListResponse]: + ) -> AsyncPaginator[ZeroTrustUsers, AsyncSinglePage[ZeroTrustUsers]]: """ Gets a list of users for an account. @@ -157,16 +153,13 @@ async def list( """ if not identifier: raise ValueError(f"Expected a non-empty value for `identifier` but received {identifier!r}") - return await self._get( + return self._get_api_list( f"/accounts/{identifier}/access/users", + page=AsyncSinglePage[ZeroTrustUsers], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[UserListResponse]], ResultWrapper[UserListResponse]), + model=ZeroTrustUsers, ) diff --git a/src/cloudflare/resources/zero_trust/devices/devices.py b/src/cloudflare/resources/zero_trust/devices/devices.py index 08e70ae1bf7..c8462bafd41 100644 --- a/src/cloudflare/resources/zero_trust/devices/devices.py +++ b/src/cloudflare/resources/zero_trust/devices/devices.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Optional, cast import httpx @@ -72,6 +72,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from .override_codes import ( OverrideCodes, AsyncOverrideCodes, @@ -81,11 +82,12 @@ AsyncOverrideCodesWithStreamingResponse, ) from ...._base_client import ( + AsyncPaginator, make_request_options, ) from .posture.posture import Posture, AsyncPosture from .policies.policies import Policies, AsyncPolicies -from ....types.zero_trust import DeviceGetResponse, DeviceListResponse +from ....types.zero_trust import ZeroTrustDevices, DeviceGetResponse __all__ = ["Devices", "AsyncDevices"] @@ -141,7 +143,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceListResponse]: + ) -> SyncSinglePage[ZeroTrustDevices]: """ Fetches a list of enrolled devices. @@ -156,16 +158,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices", + page=SyncSinglePage[ZeroTrustDevices], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DeviceListResponse]], ResultWrapper[DeviceListResponse]), + model=ZeroTrustDevices, ) def get( @@ -257,7 +256,7 @@ def with_raw_response(self) -> AsyncDevicesWithRawResponse: def with_streaming_response(self) -> AsyncDevicesWithStreamingResponse: return AsyncDevicesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -267,7 +266,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DeviceListResponse]: + ) -> AsyncPaginator[ZeroTrustDevices, AsyncSinglePage[ZeroTrustDevices]]: """ Fetches a list of enrolled devices. @@ -282,16 +281,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices", + page=AsyncSinglePage[ZeroTrustDevices], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DeviceListResponse]], ResultWrapper[DeviceListResponse]), + model=ZeroTrustDevices, ) async def get( diff --git a/src/cloudflare/resources/zero_trust/devices/dex_tests.py b/src/cloudflare/resources/zero_trust/devices/dex_tests.py index 50735d5de84..65ad0e65432 100644 --- a/src/cloudflare/resources/zero_trust/devices/dex_tests.py +++ b/src/cloudflare/resources/zero_trust/devices/dex_tests.py @@ -20,12 +20,13 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.devices import ( DEXTestSchemasHTTP, - DEXTestListResponse, DEXTestDeleteResponse, dex_test_create_params, dex_test_update_params, @@ -184,7 +185,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DEXTestListResponse]: + ) -> SyncSinglePage[DEXTestSchemasHTTP]: """ Fetch all DEX tests. @@ -199,16 +200,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/dex_tests", + page=SyncSinglePage[DEXTestSchemasHTTP], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DEXTestListResponse]], ResultWrapper[DEXTestListResponse]), + model=DEXTestSchemasHTTP, ) def delete( @@ -438,7 +436,7 @@ async def update( cast_to=cast(Type[Optional[DEXTestSchemasHTTP]], ResultWrapper[DEXTestSchemasHTTP]), ) - async def list( + def list( self, *, account_id: str, @@ -448,7 +446,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DEXTestListResponse]: + ) -> AsyncPaginator[DEXTestSchemasHTTP, AsyncSinglePage[DEXTestSchemasHTTP]]: """ Fetch all DEX tests. @@ -463,16 +461,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/dex_tests", + page=AsyncSinglePage[DEXTestSchemasHTTP], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DEXTestListResponse]], ResultWrapper[DEXTestListResponse]), + model=DEXTestSchemasHTTP, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/devices/networks.py b/src/cloudflare/resources/zero_trust/devices/networks.py index 4666e1cd3ba..0e1f3328fea 100644 --- a/src/cloudflare/resources/zero_trust/devices/networks.py +++ b/src/cloudflare/resources/zero_trust/devices/networks.py @@ -21,11 +21,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.devices import ( - NetworkListResponse, DeviceManagedNetworks, NetworkDeleteResponse, network_create_params, @@ -169,7 +170,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NetworkListResponse]: + ) -> SyncSinglePage[DeviceManagedNetworks]: """ Fetches a list of managed networks for an account. @@ -184,16 +185,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/networks", + page=SyncSinglePage[DeviceManagedNetworks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[NetworkListResponse]], ResultWrapper[NetworkListResponse]), + model=DeviceManagedNetworks, ) def delete( @@ -406,7 +404,7 @@ async def update( cast_to=cast(Type[Optional[DeviceManagedNetworks]], ResultWrapper[DeviceManagedNetworks]), ) - async def list( + def list( self, *, account_id: str, @@ -416,7 +414,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[NetworkListResponse]: + ) -> AsyncPaginator[DeviceManagedNetworks, AsyncSinglePage[DeviceManagedNetworks]]: """ Fetches a list of managed networks for an account. @@ -431,16 +429,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/networks", + page=AsyncSinglePage[DeviceManagedNetworks], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[NetworkListResponse]], ResultWrapper[NetworkListResponse]), + model=DeviceManagedNetworks, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/excludes.py b/src/cloudflare/resources/zero_trust/devices/policies/excludes.py index cc9d47f8db6..9ee1ea2922b 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/excludes.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/excludes.py @@ -20,12 +20,14 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.devices.policies import ( + DevicesSplitTunnel, ExcludeGetResponse, - ExcludeListResponse, ExcludeUpdateResponse, DevicesSplitTunnelParam, exclude_update_params, @@ -92,7 +94,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ExcludeListResponse]: + ) -> SyncSinglePage[DevicesSplitTunnel]: """ Fetches the list of routes excluded from the WARP client's tunnel. @@ -107,16 +109,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policy/exclude", + page=SyncSinglePage[DevicesSplitTunnel], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ExcludeListResponse]], ResultWrapper[ExcludeListResponse]), + model=DevicesSplitTunnel, ) def get( @@ -211,7 +210,7 @@ async def update( cast_to=cast(Type[Optional[ExcludeUpdateResponse]], ResultWrapper[ExcludeUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -221,7 +220,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ExcludeListResponse]: + ) -> AsyncPaginator[DevicesSplitTunnel, AsyncSinglePage[DevicesSplitTunnel]]: """ Fetches the list of routes excluded from the WARP client's tunnel. @@ -236,16 +235,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policy/exclude", + page=AsyncSinglePage[DevicesSplitTunnel], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ExcludeListResponse]], ResultWrapper[ExcludeListResponse]), + model=DevicesSplitTunnel, ) async def get( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py b/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py index 3984767e2d7..4c968946186 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/fallback_domains.py @@ -20,13 +20,15 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.devices.policies import ( + DevicesFallbackDomain, FallbackDomainGetResponse, DevicesFallbackDomainParam, - FallbackDomainListResponse, FallbackDomainUpdateResponse, fallback_domain_update_params, ) @@ -100,7 +102,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FallbackDomainListResponse]: + ) -> SyncSinglePage[DevicesFallbackDomain]: """Fetches a list of domains to bypass Gateway DNS resolution. These domains will @@ -117,16 +119,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policy/fallback_domains", + page=SyncSinglePage[DevicesFallbackDomain], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[FallbackDomainListResponse]], ResultWrapper[FallbackDomainListResponse]), + model=DevicesFallbackDomain, ) def get( @@ -230,7 +229,7 @@ async def update( cast_to=cast(Type[Optional[FallbackDomainUpdateResponse]], ResultWrapper[FallbackDomainUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -240,7 +239,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[FallbackDomainListResponse]: + ) -> AsyncPaginator[DevicesFallbackDomain, AsyncSinglePage[DevicesFallbackDomain]]: """Fetches a list of domains to bypass Gateway DNS resolution. These domains will @@ -257,16 +256,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policy/fallback_domains", + page=AsyncSinglePage[DevicesFallbackDomain], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[FallbackDomainListResponse]], ResultWrapper[FallbackDomainListResponse]), + model=DevicesFallbackDomain, ) async def get( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/includes.py b/src/cloudflare/resources/zero_trust/devices/policies/includes.py index d04eaa8f338..7a6d7b9880b 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/includes.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/includes.py @@ -20,13 +20,15 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.devices.policies import ( IncludeGetResponse, - IncludeListResponse, IncludeUpdateResponse, + DevicesSplitTunnelInclude, DevicesSplitTunnelIncludeParam, include_update_params, ) @@ -92,7 +94,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IncludeListResponse]: + ) -> SyncSinglePage[DevicesSplitTunnelInclude]: """ Fetches the list of routes included in the WARP client's tunnel. @@ -107,16 +109,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policy/include", + page=SyncSinglePage[DevicesSplitTunnelInclude], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[IncludeListResponse]], ResultWrapper[IncludeListResponse]), + model=DevicesSplitTunnelInclude, ) def get( @@ -211,7 +210,7 @@ async def update( cast_to=cast(Type[Optional[IncludeUpdateResponse]], ResultWrapper[IncludeUpdateResponse]), ) - async def list( + def list( self, *, account_id: str, @@ -221,7 +220,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IncludeListResponse]: + ) -> AsyncPaginator[DevicesSplitTunnelInclude, AsyncSinglePage[DevicesSplitTunnelInclude]]: """ Fetches the list of routes included in the WARP client's tunnel. @@ -236,16 +235,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policy/include", + page=AsyncSinglePage[DevicesSplitTunnelInclude], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[IncludeListResponse]], ResultWrapper[IncludeListResponse]), + model=DevicesSplitTunnelInclude, ) async def get( diff --git a/src/cloudflare/resources/zero_trust/devices/policies/policies.py b/src/cloudflare/resources/zero_trust/devices/policies/policies.py index 7a2ad9f251f..9a84c73442b 100644 --- a/src/cloudflare/resources/zero_trust/devices/policies/policies.py +++ b/src/cloudflare/resources/zero_trust/devices/policies/policies.py @@ -36,6 +36,7 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from .default_policy import ( DefaultPolicy, AsyncDefaultPolicy, @@ -45,6 +46,7 @@ AsyncDefaultPolicyWithStreamingResponse, ) from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .fallback_domains import ( @@ -56,7 +58,6 @@ AsyncFallbackDomainsWithStreamingResponse, ) from .....types.zero_trust.devices import ( - PolicyListResponse, PolicyDeleteResponse, DevicesDeviceSettingsPolicy, policy_edit_params, @@ -218,7 +219,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> SyncSinglePage[DevicesDeviceSettingsPolicy]: """ Fetches a list of the device settings profiles for an account. @@ -233,16 +234,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policies", + page=SyncSinglePage[DevicesDeviceSettingsPolicy], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=DevicesDeviceSettingsPolicy, ) def delete( @@ -582,7 +580,7 @@ async def create( cast_to=cast(Type[Optional[DevicesDeviceSettingsPolicy]], ResultWrapper[DevicesDeviceSettingsPolicy]), ) - async def list( + def list( self, *, account_id: str, @@ -592,7 +590,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PolicyListResponse]: + ) -> AsyncPaginator[DevicesDeviceSettingsPolicy, AsyncSinglePage[DevicesDeviceSettingsPolicy]]: """ Fetches a list of the device settings profiles for an account. @@ -607,16 +605,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/policies", + page=AsyncSinglePage[DevicesDeviceSettingsPolicy], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PolicyListResponse]], ResultWrapper[PolicyListResponse]), + model=DevicesDeviceSettingsPolicy, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py index 829193dfa63..9bc0de48001 100644 --- a/src/cloudflare/resources/zero_trust/devices/posture/integrations.py +++ b/src/cloudflare/resources/zero_trust/devices/posture/integrations.py @@ -21,11 +21,12 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.devices.posture import ( - IntegrationListResponse, DevicePostureIntegrations, IntegrationDeleteResponse, integration_edit_params, @@ -113,7 +114,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IntegrationListResponse]: + ) -> SyncSinglePage[DevicePostureIntegrations]: """ Fetches the list of device posture integrations for an account. @@ -128,16 +129,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/posture/integration", + page=SyncSinglePage[DevicePostureIntegrations], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[IntegrationListResponse]], ResultWrapper[IntegrationListResponse]), + model=DevicePostureIntegrations, ) def delete( @@ -363,7 +361,7 @@ async def create( cast_to=cast(Type[Optional[DevicePostureIntegrations]], ResultWrapper[DevicePostureIntegrations]), ) - async def list( + def list( self, *, account_id: str, @@ -373,7 +371,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IntegrationListResponse]: + ) -> AsyncPaginator[DevicePostureIntegrations, AsyncSinglePage[DevicePostureIntegrations]]: """ Fetches the list of device posture integrations for an account. @@ -388,16 +386,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/posture/integration", + page=AsyncSinglePage[DevicePostureIntegrations], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[IntegrationListResponse]], ResultWrapper[IntegrationListResponse]), + model=DevicePostureIntegrations, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/devices/posture/posture.py b/src/cloudflare/resources/zero_trust/devices/posture/posture.py index 07d0f53e101..93c970a7bbc 100644 --- a/src/cloudflare/resources/zero_trust/devices/posture/posture.py +++ b/src/cloudflare/resources/zero_trust/devices/posture/posture.py @@ -29,12 +29,13 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.devices import ( DevicePostureRules, - PostureListResponse, PostureDeleteResponse, posture_create_params, posture_update_params, @@ -255,7 +256,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PostureListResponse]: + ) -> SyncSinglePage[DevicePostureRules]: """ Fetches device posture rules for a Zero Trust account. @@ -270,16 +271,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/posture", + page=SyncSinglePage[DevicePostureRules], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PostureListResponse]], ResultWrapper[PostureListResponse]), + model=DevicePostureRules, ) def delete( @@ -569,7 +567,7 @@ async def update( cast_to=cast(Type[Optional[DevicePostureRules]], ResultWrapper[DevicePostureRules]), ) - async def list( + def list( self, *, account_id: str, @@ -579,7 +577,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PostureListResponse]: + ) -> AsyncPaginator[DevicePostureRules, AsyncSinglePage[DevicePostureRules]]: """ Fetches device posture rules for a Zero Trust account. @@ -594,16 +592,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/devices/posture", + page=AsyncSinglePage[DevicePostureRules], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PostureListResponse]], ResultWrapper[PostureListResponse]), + model=DevicePostureRules, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/dex/colos.py b/src/cloudflare/resources/zero_trust/dex/colos.py index 22b91354d01..8d49fdc332a 100644 --- a/src/cloudflare/resources/zero_trust/dex/colos.py +++ b/src/cloudflare/resources/zero_trust/dex/colos.py @@ -2,16 +2,12 @@ from __future__ import annotations -from typing import Type, Optional, cast from typing_extensions import Literal import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ...._utils import ( - maybe_transform, - async_maybe_transform, -) +from ...._utils import maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource from ...._response import ( @@ -20,11 +16,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.zero_trust.dex import ColoListResponse, colo_list_params +from ....types.zero_trust.dex import colo_list_params __all__ = ["Colos", "AsyncColos"] @@ -51,7 +48,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ColoListResponse]: + ) -> SyncSinglePage[object]: """ List Cloudflare colos that account's devices were connected to during a time period, sorted by usage starting from the most used colo. Colos without traffic @@ -75,8 +72,9 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/dex/colos", + page=SyncSinglePage[object], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -90,9 +88,8 @@ def list( }, colo_list_params.ColoListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[ColoListResponse]], ResultWrapper[ColoListResponse]), + model=object, ) @@ -105,7 +102,7 @@ def with_raw_response(self) -> AsyncColosWithRawResponse: def with_streaming_response(self) -> AsyncColosWithStreamingResponse: return AsyncColosWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -118,7 +115,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ColoListResponse]: + ) -> AsyncPaginator[object, AsyncSinglePage[object]]: """ List Cloudflare colos that account's devices were connected to during a time period, sorted by usage starting from the most used colo. Colos without traffic @@ -142,14 +139,15 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/dex/colos", + page=AsyncSinglePage[object], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "time_end": time_end, "time_start": time_start, @@ -157,9 +155,8 @@ async def list( }, colo_list_params.ColoListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[ColoListResponse]], ResultWrapper[ColoListResponse]), + model=object, ) diff --git a/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py b/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py index ba359dd804d..edb57507ffe 100644 --- a/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py +++ b/src/cloudflare/resources/zero_trust/dlp/datasets/datasets.py @@ -28,16 +28,12 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from .....types.zero_trust.dlp import ( - DLPDataset, - DLPDatasetArray, - DLPDatasetCreation, - dataset_create_params, - dataset_update_params, -) +from .....types.zero_trust.dlp import DLPDataset, DLPDatasetCreation, dataset_create_params, dataset_update_params __all__ = ["Datasets", "AsyncDatasets"] @@ -167,7 +163,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDatasetArray]: + ) -> SyncSinglePage[DLPDataset]: """ Fetch all datasets with information about available versions. @@ -182,16 +178,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/dlp/datasets", + page=SyncSinglePage[DLPDataset], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DLPDatasetArray]], ResultWrapper[DLPDatasetArray]), + model=DLPDataset, ) def delete( @@ -389,7 +382,7 @@ async def update( cast_to=cast(Type[Optional[DLPDataset]], ResultWrapper[DLPDataset]), ) - async def list( + def list( self, *, account_id: str, @@ -399,7 +392,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[DLPDatasetArray]: + ) -> AsyncPaginator[DLPDataset, AsyncSinglePage[DLPDataset]]: """ Fetch all datasets with information about available versions. @@ -414,16 +407,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/dlp/datasets", + page=AsyncSinglePage[DLPDataset], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[DLPDatasetArray]], ResultWrapper[DLPDatasetArray]), + model=DLPDataset, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py b/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py index ff46cbf04ee..04d6aa9cb2c 100644 --- a/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py +++ b/src/cloudflare/resources/zero_trust/dlp/profiles/profiles.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, cast import httpx @@ -32,10 +32,12 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) -from .....types.zero_trust.dlp import ProfileGetResponse, ProfileListResponse +from .....types.zero_trust.dlp import DLPProfiles, ProfileGetResponse __all__ = ["Profiles", "AsyncProfiles"] @@ -67,7 +69,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProfileListResponse]: + ) -> SyncSinglePage[DLPProfiles]: """ Lists all DLP profiles in an account. @@ -84,16 +86,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/dlp/profiles", + page=SyncSinglePage[DLPProfiles], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ProfileListResponse]], ResultWrapper[ProfileListResponse]), + model=cast(Any, DLPProfiles), # Union types cannot be passed in as arguments in the type system ) def get( @@ -164,7 +163,7 @@ def with_raw_response(self) -> AsyncProfilesWithRawResponse: def with_streaming_response(self) -> AsyncProfilesWithStreamingResponse: return AsyncProfilesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -174,7 +173,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProfileListResponse]: + ) -> AsyncPaginator[DLPProfiles, AsyncSinglePage[DLPProfiles]]: """ Lists all DLP profiles in an account. @@ -191,16 +190,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/dlp/profiles", + page=AsyncSinglePage[DLPProfiles], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ProfileListResponse]], ResultWrapper[ProfileListResponse]), + model=cast(Any, DLPProfiles), # Union types cannot be passed in as arguments in the type system ) async def get( diff --git a/src/cloudflare/resources/zero_trust/gateway/app_types.py b/src/cloudflare/resources/zero_trust/gateway/app_types.py index 6f78b840fe0..c7b75140620 100644 --- a/src/cloudflare/resources/zero_trust/gateway/app_types.py +++ b/src/cloudflare/resources/zero_trust/gateway/app_types.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, Optional, cast +from typing import Any, cast import httpx @@ -15,11 +15,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.zero_trust.gateway import AppTypeListResponse +from ....types.zero_trust.gateway import ZeroTrustGatewayAppTypes __all__ = ["AppTypes", "AsyncAppTypes"] @@ -43,7 +44,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AppTypeListResponse]: + ) -> SyncSinglePage[ZeroTrustGatewayAppTypes]: """ Fetches all application and application type mappings. @@ -60,16 +61,15 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/app_types", + page=SyncSinglePage[ZeroTrustGatewayAppTypes], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[AppTypeListResponse]], ResultWrapper[AppTypeListResponse]), + model=cast( + Any, ZeroTrustGatewayAppTypes + ), # Union types cannot be passed in as arguments in the type system ) @@ -82,7 +82,7 @@ def with_raw_response(self) -> AsyncAppTypesWithRawResponse: def with_streaming_response(self) -> AsyncAppTypesWithStreamingResponse: return AsyncAppTypesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -92,7 +92,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[AppTypeListResponse]: + ) -> AsyncPaginator[ZeroTrustGatewayAppTypes, AsyncSinglePage[ZeroTrustGatewayAppTypes]]: """ Fetches all application and application type mappings. @@ -109,16 +109,15 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/app_types", + page=AsyncSinglePage[ZeroTrustGatewayAppTypes], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[AppTypeListResponse]], ResultWrapper[AppTypeListResponse]), + model=cast( + Any, ZeroTrustGatewayAppTypes + ), # Union types cannot be passed in as arguments in the type system ) diff --git a/src/cloudflare/resources/zero_trust/gateway/categories.py b/src/cloudflare/resources/zero_trust/gateway/categories.py index 5eb0fe36103..430e44ef82f 100644 --- a/src/cloudflare/resources/zero_trust/gateway/categories.py +++ b/src/cloudflare/resources/zero_trust/gateway/categories.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast - import httpx from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,11 +13,12 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) -from ....types.zero_trust.gateway import CategoryListResponse +from ....types.zero_trust.gateway import ZeroTrustGatewayCategories __all__ = ["Categories", "AsyncCategories"] @@ -43,7 +42,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CategoryListResponse]: + ) -> SyncSinglePage[ZeroTrustGatewayCategories]: """ Fetches a list of all categories. @@ -60,16 +59,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/categories", + page=SyncSinglePage[ZeroTrustGatewayCategories], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CategoryListResponse]], ResultWrapper[CategoryListResponse]), + model=ZeroTrustGatewayCategories, ) @@ -82,7 +78,7 @@ def with_raw_response(self) -> AsyncCategoriesWithRawResponse: def with_streaming_response(self) -> AsyncCategoriesWithStreamingResponse: return AsyncCategoriesWithStreamingResponse(self) - async def list( + def list( self, *, account_id: str, @@ -92,7 +88,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[CategoryListResponse]: + ) -> AsyncPaginator[ZeroTrustGatewayCategories, AsyncSinglePage[ZeroTrustGatewayCategories]]: """ Fetches a list of all categories. @@ -109,16 +105,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/categories", + page=AsyncSinglePage[ZeroTrustGatewayCategories], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[CategoryListResponse]], ResultWrapper[CategoryListResponse]), + model=ZeroTrustGatewayCategories, ) diff --git a/src/cloudflare/resources/zero_trust/gateway/lists/items.py b/src/cloudflare/resources/zero_trust/gateway/lists/items.py index a2b29256b0d..ef83861be8d 100644 --- a/src/cloudflare/resources/zero_trust/gateway/lists/items.py +++ b/src/cloudflare/resources/zero_trust/gateway/lists/items.py @@ -2,8 +2,6 @@ from __future__ import annotations -from typing import Type, Optional, cast - import httpx from ....._types import NOT_GIVEN, Body, Query, Headers, NotGiven @@ -15,8 +13,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.gateway.lists import ItemListResponse @@ -44,7 +43,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ItemListResponse]: + ) -> SyncSinglePage[ItemListResponse]: """ Fetches all items in a single Zero Trust list. @@ -63,16 +62,13 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not list_id: raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/lists/{list_id}/items", + page=SyncSinglePage[ItemListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ItemListResponse]], ResultWrapper[ItemListResponse]), + model=ItemListResponse, ) @@ -85,7 +81,7 @@ def with_raw_response(self) -> AsyncItemsWithRawResponse: def with_streaming_response(self) -> AsyncItemsWithStreamingResponse: return AsyncItemsWithStreamingResponse(self) - async def list( + def list( self, list_id: str, *, @@ -96,7 +92,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ItemListResponse]: + ) -> AsyncPaginator[ItemListResponse, AsyncSinglePage[ItemListResponse]]: """ Fetches all items in a single Zero Trust list. @@ -115,16 +111,13 @@ async def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") if not list_id: raise ValueError(f"Expected a non-empty value for `list_id` but received {list_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/lists/{list_id}/items", + page=AsyncSinglePage[ItemListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ItemListResponse]], ResultWrapper[ItemListResponse]), + model=ItemListResponse, ) diff --git a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py index a3eb02e0167..3c8587631cc 100644 --- a/src/cloudflare/resources/zero_trust/gateway/lists/lists.py +++ b/src/cloudflare/resources/zero_trust/gateway/lists/lists.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Iterable, Optional, cast +from typing import Any, List, Type, Iterable, cast from typing_extensions import Literal import httpx @@ -29,11 +29,12 @@ async_to_streamed_response_wrapper, ) from ....._wrappers import ResultWrapper +from .....pagination import SyncSinglePage, AsyncSinglePage from ....._base_client import ( + AsyncPaginator, make_request_options, ) from .....types.zero_trust.gateway import ( - ListListResponse, ListCreateResponse, ListDeleteResponse, ZeroTrustGatewayLists, @@ -181,7 +182,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ListListResponse]: + ) -> SyncSinglePage[ZeroTrustGatewayLists]: """ Fetches all Zero Trust lists for an account. @@ -196,16 +197,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/lists", + page=SyncSinglePage[ZeroTrustGatewayLists], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ListListResponse]], ResultWrapper[ListListResponse]), + model=ZeroTrustGatewayLists, ) def delete( @@ -479,7 +477,7 @@ async def update( cast_to=cast(Type[ZeroTrustGatewayLists], ResultWrapper[ZeroTrustGatewayLists]), ) - async def list( + def list( self, *, account_id: str, @@ -489,7 +487,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ListListResponse]: + ) -> AsyncPaginator[ZeroTrustGatewayLists, AsyncSinglePage[ZeroTrustGatewayLists]]: """ Fetches all Zero Trust lists for an account. @@ -504,16 +502,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/lists", + page=AsyncSinglePage[ZeroTrustGatewayLists], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ListListResponse]], ResultWrapper[ListListResponse]), + model=ZeroTrustGatewayLists, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/gateway/locations.py b/src/cloudflare/resources/zero_trust/gateway/locations.py index d39d1382e09..f0795637204 100644 --- a/src/cloudflare/resources/zero_trust/gateway/locations.py +++ b/src/cloudflare/resources/zero_trust/gateway/locations.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Iterable, Optional, cast +from typing import Any, Type, Iterable, cast import httpx @@ -20,11 +20,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.gateway import ( - LocationListResponse, LocationDeleteResponse, ZeroTrustGatewayLocations, location_create_params, @@ -172,7 +173,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[LocationListResponse]: + ) -> SyncSinglePage[ZeroTrustGatewayLocations]: """ Fetches Zero Trust Gateway locations for an account. @@ -187,16 +188,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/locations", + page=SyncSinglePage[ZeroTrustGatewayLocations], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[LocationListResponse]], ResultWrapper[LocationListResponse]), + model=ZeroTrustGatewayLocations, ) def delete( @@ -413,7 +411,7 @@ async def update( cast_to=cast(Type[ZeroTrustGatewayLocations], ResultWrapper[ZeroTrustGatewayLocations]), ) - async def list( + def list( self, *, account_id: str, @@ -423,7 +421,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[LocationListResponse]: + ) -> AsyncPaginator[ZeroTrustGatewayLocations, AsyncSinglePage[ZeroTrustGatewayLocations]]: """ Fetches Zero Trust Gateway locations for an account. @@ -438,16 +436,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/locations", + page=AsyncSinglePage[ZeroTrustGatewayLocations], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[LocationListResponse]], ResultWrapper[LocationListResponse]), + model=ZeroTrustGatewayLocations, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py index 991533ef25e..f9d72d45d45 100644 --- a/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py +++ b/src/cloudflare/resources/zero_trust/gateway/proxy_endpoints.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Optional, cast +from typing import Any, List, Type, cast import httpx @@ -20,11 +20,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.gateway import ( - ProxyEndpointListResponse, ProxyEndpointDeleteResponse, ZeroTrustGatewayProxyEndpoints, proxy_endpoint_edit_params, @@ -107,7 +108,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyEndpointListResponse]: + ) -> SyncSinglePage[ZeroTrustGatewayProxyEndpoints]: """ Fetches a single Zero Trust Gateway proxy endpoint. @@ -122,16 +123,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/proxy_endpoints", + page=SyncSinglePage[ZeroTrustGatewayProxyEndpoints], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ProxyEndpointListResponse]], ResultWrapper[ProxyEndpointListResponse]), + model=ZeroTrustGatewayProxyEndpoints, ) def delete( @@ -340,7 +338,7 @@ async def create( cast_to=cast(Type[ZeroTrustGatewayProxyEndpoints], ResultWrapper[ZeroTrustGatewayProxyEndpoints]), ) - async def list( + def list( self, *, account_id: str, @@ -350,7 +348,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[ProxyEndpointListResponse]: + ) -> AsyncPaginator[ZeroTrustGatewayProxyEndpoints, AsyncSinglePage[ZeroTrustGatewayProxyEndpoints]]: """ Fetches a single Zero Trust Gateway proxy endpoint. @@ -365,16 +363,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/proxy_endpoints", + page=AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[ProxyEndpointListResponse]], ResultWrapper[ProxyEndpointListResponse]), + model=ZeroTrustGatewayProxyEndpoints, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/gateway/rules.py b/src/cloudflare/resources/zero_trust/gateway/rules.py index 420cc8f9db5..9330728e9ac 100644 --- a/src/cloudflare/resources/zero_trust/gateway/rules.py +++ b/src/cloudflare/resources/zero_trust/gateway/rules.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Type, Optional, cast +from typing import Any, List, Type, cast from typing_extensions import Literal import httpx @@ -21,11 +21,12 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.gateway import ( - RuleListResponse, RuleDeleteResponse, ZeroTrustGatewayRules, rule_create_params, @@ -271,7 +272,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleListResponse]: + ) -> SyncSinglePage[ZeroTrustGatewayRules]: """ Fetches the Zero Trust Gateway rules for an account. @@ -286,16 +287,13 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/rules", + page=SyncSinglePage[ZeroTrustGatewayRules], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), + model=ZeroTrustGatewayRules, ) def delete( @@ -614,7 +612,7 @@ async def update( cast_to=cast(Type[ZeroTrustGatewayRules], ResultWrapper[ZeroTrustGatewayRules]), ) - async def list( + def list( self, *, account_id: str, @@ -624,7 +622,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[RuleListResponse]: + ) -> AsyncPaginator[ZeroTrustGatewayRules, AsyncSinglePage[ZeroTrustGatewayRules]]: """ Fetches the Zero Trust Gateway rules for an account. @@ -639,16 +637,13 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/gateway/rules", + page=AsyncSinglePage[ZeroTrustGatewayRules], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[RuleListResponse]], ResultWrapper[RuleListResponse]), + model=ZeroTrustGatewayRules, ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/identity_providers.py b/src/cloudflare/resources/zero_trust/identity_providers.py index f24db0e102f..c265b813a21 100644 --- a/src/cloudflare/resources/zero_trust/identity_providers.py +++ b/src/cloudflare/resources/zero_trust/identity_providers.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast, overload +from typing import Any, Type, cast, overload from typing_extensions import Literal import httpx @@ -22,7 +22,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ..._base_client import ( + AsyncPaginator, make_request_options, ) from ...types.zero_trust import ( @@ -2061,7 +2063,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProviderListResponse]: + ) -> SyncSinglePage[IdentityProviderListResponse]: """ Lists all configured identity providers. @@ -2093,16 +2095,15 @@ def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", + page=SyncSinglePage[IdentityProviderListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[IdentityProviderListResponse]], ResultWrapper[IdentityProviderListResponse]), + model=cast( + Any, IdentityProviderListResponse + ), # Union types cannot be passed in as arguments in the type system ) def delete( @@ -4245,7 +4246,7 @@ async def update( ), ) - async def list( + def list( self, *, account_id: str | NotGiven = NOT_GIVEN, @@ -4256,7 +4257,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[IdentityProviderListResponse]: + ) -> AsyncPaginator[IdentityProviderListResponse, AsyncSinglePage[IdentityProviderListResponse]]: """ Lists all configured identity providers. @@ -4288,16 +4289,15 @@ async def list( else: account_or_zone = "zones" account_or_zone_id = zone_id - return await self._get( + return self._get_api_list( f"/{account_or_zone}/{account_or_zone_id}/access/identity_providers", + page=AsyncSinglePage[IdentityProviderListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[IdentityProviderListResponse]], ResultWrapper[IdentityProviderListResponse]), + model=cast( + Any, IdentityProviderListResponse + ), # Union types cannot be passed in as arguments in the type system ) async def delete( diff --git a/src/cloudflare/resources/zero_trust/networks/virtual_networks.py b/src/cloudflare/resources/zero_trust/networks/virtual_networks.py index cadeec684ae..0144eed7a10 100644 --- a/src/cloudflare/resources/zero_trust/networks/virtual_networks.py +++ b/src/cloudflare/resources/zero_trust/networks/virtual_networks.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, cast import httpx @@ -20,12 +20,14 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper +from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import ( + AsyncPaginator, make_request_options, ) from ....types.zero_trust.networks import ( + TunnelVirtualNetwork, VirtualNetworkEditResponse, - VirtualNetworkListResponse, VirtualNetworkCreateResponse, VirtualNetworkDeleteResponse, virtual_network_edit_params, @@ -120,7 +122,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VirtualNetworkListResponse]: + ) -> SyncSinglePage[TunnelVirtualNetwork]: """ Lists and filters virtual networks in an account. @@ -147,8 +149,9 @@ def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/teamnet/virtual_networks", + page=SyncSinglePage[TunnelVirtualNetwork], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -163,9 +166,8 @@ def list( }, virtual_network_list_params.VirtualNetworkListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[VirtualNetworkListResponse]], ResultWrapper[VirtualNetworkListResponse]), + model=TunnelVirtualNetwork, ) def delete( @@ -354,7 +356,7 @@ async def create( ), ) - async def list( + def list( self, *, account_id: str, @@ -368,7 +370,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[VirtualNetworkListResponse]: + ) -> AsyncPaginator[TunnelVirtualNetwork, AsyncSinglePage[TunnelVirtualNetwork]]: """ Lists and filters virtual networks in an account. @@ -395,14 +397,15 @@ async def list( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/teamnet/virtual_networks", + page=AsyncSinglePage[TunnelVirtualNetwork], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "is_default": is_default, "is_deleted": is_deleted, @@ -411,9 +414,8 @@ async def list( }, virtual_network_list_params.VirtualNetworkListParams, ), - post_parser=ResultWrapper._unwrapper, ), - cast_to=cast(Type[Optional[VirtualNetworkListResponse]], ResultWrapper[VirtualNetworkListResponse]), + model=TunnelVirtualNetwork, ) async def delete( diff --git a/src/cloudflare/resources/zones/subscriptions.py b/src/cloudflare/resources/zones/subscriptions.py index d667294237e..8eb96a52ed6 100644 --- a/src/cloudflare/resources/zones/subscriptions.py +++ b/src/cloudflare/resources/zones/subscriptions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Iterable, Optional, cast +from typing import Any, Iterable, cast from typing_extensions import Literal import httpx @@ -21,6 +21,7 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper +from ...pagination import SyncSinglePage, AsyncSinglePage from ...types.zones import ( SubscriptionGetResponse, SubscriptionListResponse, @@ -28,6 +29,7 @@ subscription_create_params, ) from ..._base_client import ( + AsyncPaginator, make_request_options, ) @@ -120,7 +122,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SubscriptionListResponse]: + ) -> SyncSinglePage[SubscriptionListResponse]: """ Lists all of an account's subscriptions. @@ -137,16 +139,13 @@ def list( """ if not account_identifier: raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", + page=SyncSinglePage[SubscriptionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[SubscriptionListResponse]], ResultWrapper[SubscriptionListResponse]), + model=SubscriptionListResponse, ) def get( @@ -270,7 +269,7 @@ async def create( ), ) - async def list( + def list( self, account_identifier: str, *, @@ -280,7 +279,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SubscriptionListResponse]: + ) -> AsyncPaginator[SubscriptionListResponse, AsyncSinglePage[SubscriptionListResponse]]: """ Lists all of an account's subscriptions. @@ -297,16 +296,13 @@ async def list( """ if not account_identifier: raise ValueError(f"Expected a non-empty value for `account_identifier` but received {account_identifier!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_identifier}/subscriptions", + page=AsyncSinglePage[SubscriptionListResponse], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[SubscriptionListResponse]], ResultWrapper[SubscriptionListResponse]), + model=SubscriptionListResponse, ) async def get( diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py index 743bd7b3600..2a1eba444ba 100644 --- a/src/cloudflare/types/__init__.py +++ b/src/cloudflare/types/__init__.py @@ -29,7 +29,6 @@ from .user_get_response import UserGetResponse as UserGetResponse from .cache_purge_params import CachePurgeParams as CachePurgeParams from .call_create_params import CallCreateParams as CallCreateParams -from .call_list_response import CallListResponse as CallListResponse from .call_update_params import CallUpdateParams as CallUpdateParams from .client_certificate import ClientCertificate as ClientCertificate from .custom_certificate import CustomCertificate as CustomCertificate @@ -37,7 +36,6 @@ from .filter_list_params import FilterListParams as FilterListParams from .pcap_create_params import PCAPCreateParams as PCAPCreateParams from .pcap_list_response import PCAPListResponse as PCAPListResponse -from .plan_list_response import PlanListResponse as PlanListResponse from .queue_get_response import QueueGetResponse as QueueGetResponse from .stream_list_params import StreamListParams as StreamListParams from .user_edit_response import UserEditResponse as UserEditResponse @@ -57,7 +55,6 @@ from .pagerule_edit_params import PageruleEditParams as PageruleEditParams from .pagerule_list_params import PageruleListParams as PageruleListParams from .pcap_create_response import PCAPCreateResponse as PCAPCreateResponse -from .stream_list_response import StreamListResponse as StreamListResponse from .zone_delete_response import ZoneDeleteResponse as ZoneDeleteResponse from .account_update_params import AccountUpdateParams as AccountUpdateParams from .audit_log_list_params import AuditLogListParams as AuditLogListParams @@ -68,8 +65,8 @@ from .queue_delete_response import QueueDeleteResponse as QueueDeleteResponse from .queue_update_response import QueueUpdateResponse as QueueUpdateResponse from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams +from .ruleset_list_response import RulesetListResponse as RulesetListResponse from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams -from .snippet_list_response import SnippetListResponse as SnippetListResponse from .snippet_update_params import SnippetUpdateParams as SnippetUpdateParams from .speed_delete_response import SpeedDeleteResponse as SpeedDeleteResponse from .dnssec_delete_response import DNSSECDeleteResponse as DNSSECDeleteResponse @@ -101,7 +98,6 @@ from .speed_trends_list_params import SpeedTrendsListParams as SpeedTrendsListParams from .waiting_room_edit_params import WaitingRoomEditParams as WaitingRoomEditParams from .healthcheck_create_params import HealthcheckCreateParams as HealthcheckCreateParams -from .healthcheck_list_response import HealthcheckListResponse as HealthcheckListResponse from .healthcheck_update_params import HealthcheckUpdateParams as HealthcheckUpdateParams from .intel_phishing_url_submit import IntelPhishingURLSubmit as IntelPhishingURLSubmit from .load_balancer_edit_params import LoadBalancerEditParams as LoadBalancerEditParams @@ -121,7 +117,6 @@ from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams from .waiting_room_create_params import WaitingRoomCreateParams as WaitingRoomCreateParams -from .waiting_room_list_response import WaitingRoomListResponse as WaitingRoomListResponse from .waiting_room_update_params import WaitingRoomUpdateParams as WaitingRoomUpdateParams from .warp_connector_edit_params import WARPConnectorEditParams as WARPConnectorEditParams from .warp_connector_list_params import WARPConnectorListParams as WARPConnectorListParams @@ -130,7 +125,6 @@ from .custom_hostname_list_params import CustomHostnameListParams as CustomHostnameListParams from .healthcheck_delete_response import HealthcheckDeleteResponse as HealthcheckDeleteResponse from .load_balancer_create_params import LoadBalancerCreateParams as LoadBalancerCreateParams -from .load_balancer_list_response import LoadBalancerListResponse as LoadBalancerListResponse from .load_balancer_update_params import LoadBalancerUpdateParams as LoadBalancerUpdateParams from .page_shield_update_response import PageShieldUpdateResponse as PageShieldUpdateResponse from .warp_connector_get_response import WARPConnectorGetResponse as WARPConnectorGetResponse @@ -161,7 +155,6 @@ from .custom_nameserver_get_response import CustomNameserverGetResponse as CustomNameserverGetResponse from .email_routing_disable_response import EmailRoutingDisableResponse as EmailRoutingDisableResponse from .mtls_certificate_create_params import MTLSCertificateCreateParams as MTLSCertificateCreateParams -from .mtls_certificate_list_response import MTLSCertificateListResponse as MTLSCertificateListResponse from .url_normalization_get_response import URLNormalizationGetResponse as URLNormalizationGetResponse from .warp_connector_create_response import WARPConnectorCreateResponse as WARPConnectorCreateResponse from .warp_connector_delete_response import WARPConnectorDeleteResponse as WARPConnectorDeleteResponse @@ -178,14 +171,12 @@ from .custom_nameserver_delete_response import CustomNameserverDeleteResponse as CustomNameserverDeleteResponse from .custom_nameserver_verify_response import CustomNameserverVerifyResponse as CustomNameserverVerifyResponse from .keyless_certificate_create_params import KeylessCertificateCreateParams as KeylessCertificateCreateParams -from .keyless_certificate_list_response import KeylessCertificateListResponse as KeylessCertificateListResponse from .url_normalization_update_response import URLNormalizationUpdateResponse as URLNormalizationUpdateResponse from .custom_certificate_create_response import CustomCertificateCreateResponse as CustomCertificateCreateResponse from .custom_certificate_delete_response import CustomCertificateDeleteResponse as CustomCertificateDeleteResponse from .origin_ca_certificate_get_response import OriginCACertificateGetResponse as OriginCACertificateGetResponse from .keyless_certificate_delete_response import KeylessCertificateDeleteResponse as KeylessCertificateDeleteResponse from .origin_ca_certificate_create_params import OriginCACertificateCreateParams as OriginCACertificateCreateParams -from .origin_ca_certificate_list_response import OriginCACertificateListResponse as OriginCACertificateListResponse from .origin_tls_client_auth_get_response import OriginTLSClientAuthGetResponse as OriginTLSClientAuthGetResponse from .origin_tls_client_auth_create_params import OriginTLSClientAuthCreateParams as OriginTLSClientAuthCreateParams from .origin_tls_client_auth_list_response import OriginTLSClientAuthListResponse as OriginTLSClientAuthListResponse diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py index f642f617512..c004560aa23 100644 --- a/src/cloudflare/types/accounts/__init__.py +++ b/src/cloudflare/types/accounts/__init__.py @@ -6,7 +6,6 @@ from .account_member import AccountMember as AccountMember from .role_get_response import RoleGetResponse as RoleGetResponse from .member_list_params import MemberListParams as MemberListParams -from .role_list_response import RoleListResponse as RoleListResponse from .member_create_params import MemberCreateParams as MemberCreateParams from .member_list_response import MemberListResponse as MemberListResponse from .member_update_params import MemberUpdateParams as MemberUpdateParams diff --git a/src/cloudflare/types/accounts/role_list_response.py b/src/cloudflare/types/accounts/role_list_response.py deleted file mode 100644 index d68445c0957..00000000000 --- a/src/cloudflare/types/accounts/role_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .role import Role - -__all__ = ["RoleListResponse"] - -RoleListResponse = List[Role] diff --git a/src/cloudflare/types/addressing/__init__.py b/src/cloudflare/types/addressing/__init__.py index 18f47438c47..ede0ad000f2 100644 --- a/src/cloudflare/types/addressing/__init__.py +++ b/src/cloudflare/types/addressing/__init__.py @@ -4,7 +4,6 @@ from .prefix_edit_params import PrefixEditParams as PrefixEditParams from .prefix_create_params import PrefixCreateParams as PrefixCreateParams -from .prefix_list_response import PrefixListResponse as PrefixListResponse from .service_list_response import ServiceListResponse as ServiceListResponse from .prefix_delete_response import PrefixDeleteResponse as PrefixDeleteResponse from .address_map_edit_params import AddressMapEditParams as AddressMapEditParams @@ -12,7 +11,6 @@ from .address_map_get_response import AddressMapGetResponse as AddressMapGetResponse from .addressing_ipam_prefixes import AddressingIpamPrefixes as AddressingIpamPrefixes from .address_map_create_params import AddressMapCreateParams as AddressMapCreateParams -from .address_map_list_response import AddressMapListResponse as AddressMapListResponse from .loa_document_create_params import LOADocumentCreateParams as LOADocumentCreateParams from .address_map_create_response import AddressMapCreateResponse as AddressMapCreateResponse from .address_map_delete_response import AddressMapDeleteResponse as AddressMapDeleteResponse diff --git a/src/cloudflare/types/addressing/address_map_list_response.py b/src/cloudflare/types/addressing/address_map_list_response.py deleted file mode 100644 index e2bd1bd0a11..00000000000 --- a/src/cloudflare/types/addressing/address_map_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .addressing_address_maps import AddressingAddressMaps - -__all__ = ["AddressMapListResponse"] - -AddressMapListResponse = List[AddressingAddressMaps] diff --git a/src/cloudflare/types/addressing/prefix_list_response.py b/src/cloudflare/types/addressing/prefix_list_response.py deleted file mode 100644 index 7c96f914616..00000000000 --- a/src/cloudflare/types/addressing/prefix_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .addressing_ipam_prefixes import AddressingIpamPrefixes - -__all__ = ["PrefixListResponse"] - -PrefixListResponse = List[AddressingIpamPrefixes] diff --git a/src/cloudflare/types/addressing/prefixes/__init__.py b/src/cloudflare/types/addressing/prefixes/__init__.py index a8c7c5a3450..9239415391d 100644 --- a/src/cloudflare/types/addressing/prefixes/__init__.py +++ b/src/cloudflare/types/addressing/prefixes/__init__.py @@ -3,6 +3,5 @@ from __future__ import annotations from .delegation_create_params import DelegationCreateParams as DelegationCreateParams -from .delegation_list_response import DelegationListResponse as DelegationListResponse from .delegation_delete_response import DelegationDeleteResponse as DelegationDeleteResponse from .addressing_ipam_delegations import AddressingIpamDelegations as AddressingIpamDelegations diff --git a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py b/src/cloudflare/types/addressing/prefixes/bgp/__init__.py index 11200d454d1..6e1aa204e26 100644 --- a/src/cloudflare/types/addressing/prefixes/bgp/__init__.py +++ b/src/cloudflare/types/addressing/prefixes/bgp/__init__.py @@ -5,10 +5,8 @@ from .prefix_edit_params import PrefixEditParams as PrefixEditParams from .status_edit_params import StatusEditParams as StatusEditParams from .status_get_response import StatusGetResponse as StatusGetResponse -from .prefix_list_response import PrefixListResponse as PrefixListResponse from .status_edit_response import StatusEditResponse as StatusEditResponse from .binding_create_params import BindingCreateParams as BindingCreateParams -from .binding_list_response import BindingListResponse as BindingListResponse from .binding_delete_response import BindingDeleteResponse as BindingDeleteResponse from .addressing_service_binding import AddressingServiceBinding as AddressingServiceBinding from .addressing_ipam_bgp_prefixes import AddressingIpamBGPPrefixes as AddressingIpamBGPPrefixes diff --git a/src/cloudflare/types/addressing/prefixes/bgp/binding_list_response.py b/src/cloudflare/types/addressing/prefixes/bgp/binding_list_response.py deleted file mode 100644 index ce8490ed2e7..00000000000 --- a/src/cloudflare/types/addressing/prefixes/bgp/binding_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .addressing_service_binding import AddressingServiceBinding - -__all__ = ["BindingListResponse"] - -BindingListResponse = List[AddressingServiceBinding] diff --git a/src/cloudflare/types/addressing/prefixes/bgp/prefix_list_response.py b/src/cloudflare/types/addressing/prefixes/bgp/prefix_list_response.py deleted file mode 100644 index b5a6d8d1dac..00000000000 --- a/src/cloudflare/types/addressing/prefixes/bgp/prefix_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .addressing_ipam_bgp_prefixes import AddressingIpamBGPPrefixes - -__all__ = ["PrefixListResponse"] - -PrefixListResponse = List[AddressingIpamBGPPrefixes] diff --git a/src/cloudflare/types/addressing/prefixes/delegation_list_response.py b/src/cloudflare/types/addressing/prefixes/delegation_list_response.py deleted file mode 100644 index 06c8b22efa7..00000000000 --- a/src/cloudflare/types/addressing/prefixes/delegation_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .addressing_ipam_delegations import AddressingIpamDelegations - -__all__ = ["DelegationListResponse"] - -DelegationListResponse = List[AddressingIpamDelegations] diff --git a/src/cloudflare/types/addressing/service_list_response.py b/src/cloudflare/types/addressing/service_list_response.py index 46524e059af..e4e66040091 100644 --- a/src/cloudflare/types/addressing/service_list_response.py +++ b/src/cloudflare/types/addressing/service_list_response.py @@ -1,18 +1,15 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from ..._models import BaseModel -__all__ = ["ServiceListResponse", "ServiceListResponseItem"] +__all__ = ["ServiceListResponse"] -class ServiceListResponseItem(BaseModel): +class ServiceListResponse(BaseModel): id: Optional[str] = None """Identifier""" name: Optional[str] = None """Name of a service running on the Cloudflare network""" - - -ServiceListResponse = List[ServiceListResponseItem] diff --git a/src/cloudflare/types/alerting/__init__.py b/src/cloudflare/types/alerting/__init__.py index 130bbca1356..50de6d3c5e7 100644 --- a/src/cloudflare/types/alerting/__init__.py +++ b/src/cloudflare/types/alerting/__init__.py @@ -6,7 +6,6 @@ from .alerting_policies import AlertingPolicies as AlertingPolicies from .history_list_params import HistoryListParams as HistoryListParams from .policy_create_params import PolicyCreateParams as PolicyCreateParams -from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .policy_create_response import PolicyCreateResponse as PolicyCreateResponse from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse diff --git a/src/cloudflare/types/alerting/destinations/__init__.py b/src/cloudflare/types/alerting/destinations/__init__.py index ec704abb4c0..720b22c588e 100644 --- a/src/cloudflare/types/alerting/destinations/__init__.py +++ b/src/cloudflare/types/alerting/destinations/__init__.py @@ -6,7 +6,6 @@ from .alerting_pagerduty import AlertingPagerduty as AlertingPagerduty from .eligible_get_response import EligibleGetResponse as EligibleGetResponse from .webhook_create_params import WebhookCreateParams as WebhookCreateParams -from .webhook_list_response import WebhookListResponse as WebhookListResponse from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams from .pagerduty_get_response import PagerdutyGetResponse as PagerdutyGetResponse from .pagerduty_link_response import PagerdutyLinkResponse as PagerdutyLinkResponse diff --git a/src/cloudflare/types/alerting/destinations/webhook_list_response.py b/src/cloudflare/types/alerting/destinations/webhook_list_response.py deleted file mode 100644 index fbab0b11b17..00000000000 --- a/src/cloudflare/types/alerting/destinations/webhook_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .alerting_webhooks import AlertingWebhooks - -__all__ = ["WebhookListResponse"] - -WebhookListResponse = List[AlertingWebhooks] diff --git a/src/cloudflare/types/alerting/policy_list_response.py b/src/cloudflare/types/alerting/policy_list_response.py deleted file mode 100644 index ed8d3284838..00000000000 --- a/src/cloudflare/types/alerting/policy_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .alerting_policies import AlertingPolicies - -__all__ = ["PolicyListResponse"] - -PolicyListResponse = List[AlertingPolicies] diff --git a/src/cloudflare/types/call_list_response.py b/src/cloudflare/types/call_list_response.py deleted file mode 100644 index e90f4feda80..00000000000 --- a/src/cloudflare/types/call_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .calls_app import CallsApp - -__all__ = ["CallListResponse"] - -CallListResponse = List[CallsApp] diff --git a/src/cloudflare/types/durable_objects/__init__.py b/src/cloudflare/types/durable_objects/__init__.py index c300a66b56d..6688d0304a5 100644 --- a/src/cloudflare/types/durable_objects/__init__.py +++ b/src/cloudflare/types/durable_objects/__init__.py @@ -2,5 +2,4 @@ from __future__ import annotations -from .namespace_list_response import NamespaceListResponse as NamespaceListResponse from .durable_object_namespace import DurableObjectNamespace as DurableObjectNamespace diff --git a/src/cloudflare/types/durable_objects/namespace_list_response.py b/src/cloudflare/types/durable_objects/namespace_list_response.py deleted file mode 100644 index 970cab661cd..00000000000 --- a/src/cloudflare/types/durable_objects/namespace_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .durable_object_namespace import DurableObjectNamespace - -__all__ = ["NamespaceListResponse"] - -NamespaceListResponse = List[DurableObjectNamespace] diff --git a/src/cloudflare/types/healthcheck_list_response.py b/src/cloudflare/types/healthcheck_list_response.py deleted file mode 100644 index 1c5907a04b9..00000000000 --- a/src/cloudflare/types/healthcheck_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .healthcheck import Healthcheck - -__all__ = ["HealthcheckListResponse"] - -HealthcheckListResponse = List[Healthcheck] diff --git a/src/cloudflare/types/hyperdrive/config_list_response.py b/src/cloudflare/types/hyperdrive/config_list_response.py index 8737707a80b..7721424cc22 100644 --- a/src/cloudflare/types/hyperdrive/config_list_response.py +++ b/src/cloudflare/types/hyperdrive/config_list_response.py @@ -1,15 +1,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from ..._models import BaseModel -__all__ = ["ConfigListResponse", "ConfigListResponseItem"] +__all__ = ["ConfigListResponse"] -class ConfigListResponseItem(BaseModel): +class ConfigListResponse(BaseModel): id: Optional[str] = None """Identifier""" - - -ConfigListResponse = List[ConfigListResponseItem] diff --git a/src/cloudflare/types/intel/__init__.py b/src/cloudflare/types/intel/__init__.py index 3749dbb5139..4797f1df51d 100644 --- a/src/cloudflare/types/intel/__init__.py +++ b/src/cloudflare/types/intel/__init__.py @@ -15,7 +15,6 @@ from .intel_sinkhole_item import IntelSinkholeItem as IntelSinkholeItem from .intel_domain_history import IntelDomainHistory as IntelDomainHistory from .ip_list_get_response import IPListGetResponse as IPListGetResponse -from .sinkhole_list_response import SinkholeListResponse as SinkholeListResponse from .intel_passive_dns_by_ip import IntelPassiveDNSByIP as IntelPassiveDNSByIP from .domain_history_get_params import DomainHistoryGetParams as DomainHistoryGetParams from .domain_history_get_response import DomainHistoryGetResponse as DomainHistoryGetResponse diff --git a/src/cloudflare/types/intel/indicator_feed_list_response.py b/src/cloudflare/types/intel/indicator_feed_list_response.py index 419628c0893..5f965155c38 100644 --- a/src/cloudflare/types/intel/indicator_feed_list_response.py +++ b/src/cloudflare/types/intel/indicator_feed_list_response.py @@ -1,14 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from ..._models import BaseModel -__all__ = ["IndicatorFeedListResponse", "IndicatorFeedListResponseItem"] +__all__ = ["IndicatorFeedListResponse"] -class IndicatorFeedListResponseItem(BaseModel): +class IndicatorFeedListResponse(BaseModel): id: Optional[int] = None """The unique identifier for the indicator feed""" @@ -23,6 +23,3 @@ class IndicatorFeedListResponseItem(BaseModel): name: Optional[str] = None """The name of the indicator feed""" - - -IndicatorFeedListResponse = List[IndicatorFeedListResponseItem] diff --git a/src/cloudflare/types/intel/sinkhole_list_response.py b/src/cloudflare/types/intel/sinkhole_list_response.py deleted file mode 100644 index f6032dcc8a5..00000000000 --- a/src/cloudflare/types/intel/sinkhole_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .intel_sinkhole_item import IntelSinkholeItem - -__all__ = ["SinkholeListResponse"] - -SinkholeListResponse = List[IntelSinkholeItem] diff --git a/src/cloudflare/types/keyless_certificate_list_response.py b/src/cloudflare/types/keyless_certificate_list_response.py deleted file mode 100644 index d2830796083..00000000000 --- a/src/cloudflare/types/keyless_certificate_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .keyless_certificate_hostname import KeylessCertificateHostname - -__all__ = ["KeylessCertificateListResponse"] - -KeylessCertificateListResponse = List[KeylessCertificateHostname] diff --git a/src/cloudflare/types/load_balancer_list_response.py b/src/cloudflare/types/load_balancer_list_response.py deleted file mode 100644 index b9fcda285c2..00000000000 --- a/src/cloudflare/types/load_balancer_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .load_balancer import LoadBalancer - -__all__ = ["LoadBalancerListResponse"] - -LoadBalancerListResponse = List[LoadBalancer] diff --git a/src/cloudflare/types/load_balancers/__init__.py b/src/cloudflare/types/load_balancers/__init__.py index 73537bf6dd5..ec053f79213 100644 --- a/src/cloudflare/types/load_balancers/__init__.py +++ b/src/cloudflare/types/load_balancers/__init__.py @@ -6,7 +6,6 @@ from .pool_list_params import PoolListParams as PoolListParams from .search_get_params import SearchGetParams as SearchGetParams from .pool_create_params import PoolCreateParams as PoolCreateParams -from .pool_list_response import PoolListResponse as PoolListResponse from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .region_list_params import RegionListParams as RegionListParams from .monitor_edit_params import MonitorEditParams as MonitorEditParams @@ -15,6 +14,5 @@ from .pool_delete_response import PoolDeleteResponse as PoolDeleteResponse from .region_list_response import RegionListResponse as RegionListResponse from .monitor_create_params import MonitorCreateParams as MonitorCreateParams -from .monitor_list_response import MonitorListResponse as MonitorListResponse from .monitor_update_params import MonitorUpdateParams as MonitorUpdateParams from .monitor_delete_response import MonitorDeleteResponse as MonitorDeleteResponse diff --git a/src/cloudflare/types/load_balancers/monitor_list_response.py b/src/cloudflare/types/load_balancers/monitor_list_response.py deleted file mode 100644 index f53dc19f332..00000000000 --- a/src/cloudflare/types/load_balancers/monitor_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..user.load_balancers import LoadBalancingMonitor - -__all__ = ["MonitorListResponse"] - -MonitorListResponse = List[LoadBalancingMonitor] diff --git a/src/cloudflare/types/load_balancers/pool_list_response.py b/src/cloudflare/types/load_balancers/pool_list_response.py deleted file mode 100644 index 377c57b9f70..00000000000 --- a/src/cloudflare/types/load_balancers/pool_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..user.load_balancers import LoadBalancingPool - -__all__ = ["PoolListResponse"] - -PoolListResponse = List[LoadBalancingPool] diff --git a/src/cloudflare/types/logpush/__init__.py b/src/cloudflare/types/logpush/__init__.py index 9e659c00d63..37d5d84f48c 100644 --- a/src/cloudflare/types/logpush/__init__.py +++ b/src/cloudflare/types/logpush/__init__.py @@ -4,7 +4,6 @@ from .edge_get_response import EdgeGetResponse as EdgeGetResponse from .job_create_params import JobCreateParams as JobCreateParams -from .job_list_response import JobListResponse as JobListResponse from .job_update_params import JobUpdateParams as JobUpdateParams from .edge_create_params import EdgeCreateParams as EdgeCreateParams from .instant_logpush_job import InstantLogpushJob as InstantLogpushJob diff --git a/src/cloudflare/types/logpush/job_list_response.py b/src/cloudflare/types/logpush/job_list_response.py deleted file mode 100644 index e30f65b2620..00000000000 --- a/src/cloudflare/types/logpush/job_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .datasets import LogpushJob - -__all__ = ["JobListResponse"] - -JobListResponse = List[Optional[LogpushJob]] diff --git a/src/cloudflare/types/magic_network_monitoring/__init__.py b/src/cloudflare/types/magic_network_monitoring/__init__.py index 1cef197ce1b..5bfc950aadb 100644 --- a/src/cloudflare/types/magic_network_monitoring/__init__.py +++ b/src/cloudflare/types/magic_network_monitoring/__init__.py @@ -2,6 +2,5 @@ from __future__ import annotations -from .rule_list_response import RuleListResponse as RuleListResponse from .magic_network_monitoring_rule import MagicNetworkMonitoringRule as MagicNetworkMonitoringRule from .magic_network_monitoring_config import MagicNetworkMonitoringConfig as MagicNetworkMonitoringConfig diff --git a/src/cloudflare/types/magic_network_monitoring/rule_list_response.py b/src/cloudflare/types/magic_network_monitoring/rule_list_response.py deleted file mode 100644 index 29929a92adc..00000000000 --- a/src/cloudflare/types/magic_network_monitoring/rule_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional - -from .magic_network_monitoring_rule import MagicNetworkMonitoringRule - -__all__ = ["RuleListResponse"] - -RuleListResponse = List[Optional[MagicNetworkMonitoringRule]] diff --git a/src/cloudflare/types/mtls_certificate_list_response.py b/src/cloudflare/types/mtls_certificate_list_response.py deleted file mode 100644 index a4dc4610fd2..00000000000 --- a/src/cloudflare/types/mtls_certificate_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .mtls_certificate import MTLSCertificate - -__all__ = ["MTLSCertificateListResponse"] - -MTLSCertificateListResponse = List[MTLSCertificate] diff --git a/src/cloudflare/types/origin_ca_certificate_list_response.py b/src/cloudflare/types/origin_ca_certificate_list_response.py deleted file mode 100644 index 404f4af7631..00000000000 --- a/src/cloudflare/types/origin_ca_certificate_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .origin_ca_certificate import OriginCACertificate - -__all__ = ["OriginCACertificateListResponse"] - -OriginCACertificateListResponse = List[OriginCACertificate] diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py index 11cf99a6c82..4db93e9c1fe 100644 --- a/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py +++ b/src/cloudflare/types/origin_tls_client_auth/hostnames/__init__.py @@ -3,5 +3,4 @@ from __future__ import annotations from .certificate_create_params import CertificateCreateParams as CertificateCreateParams -from .certificate_list_response import CertificateListResponse as CertificateListResponse from .origin_tls_client_certificate import OriginTLSClientCertificate as OriginTLSClientCertificate diff --git a/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_list_response.py b/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_list_response.py deleted file mode 100644 index 5dcb437b4d6..00000000000 --- a/src/cloudflare/types/origin_tls_client_auth/hostnames/certificate_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..origin_tls_client_certificate_id import OriginTLSClientCertificateID - -__all__ = ["CertificateListResponse"] - -CertificateListResponse = List[OriginTLSClientCertificateID] diff --git a/src/cloudflare/types/origin_tls_client_auth_list_response.py b/src/cloudflare/types/origin_tls_client_auth_list_response.py index 97559730db1..c29eb8c17d1 100644 --- a/src/cloudflare/types/origin_tls_client_auth_list_response.py +++ b/src/cloudflare/types/origin_tls_client_auth_list_response.py @@ -1,13 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from .._models import BaseModel -__all__ = ["OriginTLSClientAuthListResponse", "OriginTLSClientAuthListResponseItem"] +__all__ = ["OriginTLSClientAuthListResponse"] -class OriginTLSClientAuthListResponseItem(BaseModel): +class OriginTLSClientAuthListResponse(BaseModel): id: Optional[str] = None """Identifier""" @@ -19,6 +19,3 @@ class OriginTLSClientAuthListResponseItem(BaseModel): private_key: Optional[str] = None """The zone's private key.""" - - -OriginTLSClientAuthListResponse = List[OriginTLSClientAuthListResponseItem] diff --git a/src/cloudflare/types/page_shield/__init__.py b/src/cloudflare/types/page_shield/__init__.py index ecd67c57457..f9203122f82 100644 --- a/src/cloudflare/types/page_shield/__init__.py +++ b/src/cloudflare/types/page_shield/__init__.py @@ -7,9 +7,6 @@ from .script_list_params import ScriptListParams as ScriptListParams from .script_get_response import ScriptGetResponse as ScriptGetResponse from .policy_create_params import PolicyCreateParams as PolicyCreateParams -from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams -from .script_list_response import ScriptListResponse as ScriptListResponse from .connection_list_params import ConnectionListParams as ConnectionListParams from .page_shield_connection import PageShieldConnection as PageShieldConnection -from .connection_list_response import ConnectionListResponse as ConnectionListResponse diff --git a/src/cloudflare/types/page_shield/connection_list_response.py b/src/cloudflare/types/page_shield/connection_list_response.py deleted file mode 100644 index e840921597f..00000000000 --- a/src/cloudflare/types/page_shield/connection_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .page_shield_connection import PageShieldConnection - -__all__ = ["ConnectionListResponse"] - -ConnectionListResponse = List[PageShieldConnection] diff --git a/src/cloudflare/types/page_shield/policy_list_response.py b/src/cloudflare/types/page_shield/policy_list_response.py deleted file mode 100644 index ba303df61e0..00000000000 --- a/src/cloudflare/types/page_shield/policy_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .page_shield_policy import PageShieldPolicy - -__all__ = ["PolicyListResponse"] - -PolicyListResponse = List[PageShieldPolicy] diff --git a/src/cloudflare/types/page_shield/script_list_response.py b/src/cloudflare/types/page_shield/script_list_response.py deleted file mode 100644 index cb784d2b50b..00000000000 --- a/src/cloudflare/types/page_shield/script_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .page_shield_script import PageShieldScript - -__all__ = ["ScriptListResponse"] - -ScriptListResponse = List[PageShieldScript] diff --git a/src/cloudflare/types/pages/__init__.py b/src/cloudflare/types/pages/__init__.py index a2af4a66bff..7619885558e 100644 --- a/src/cloudflare/types/pages/__init__.py +++ b/src/cloudflare/types/pages/__init__.py @@ -7,6 +7,5 @@ from .project_edit_params import ProjectEditParams as ProjectEditParams from .project_create_params import ProjectCreateParams as ProjectCreateParams from .project_edit_response import ProjectEditResponse as ProjectEditResponse -from .project_list_response import ProjectListResponse as ProjectListResponse from .pages_deployments_param import PagesDeploymentsParam as PagesDeploymentsParam from .project_create_response import ProjectCreateResponse as ProjectCreateResponse diff --git a/src/cloudflare/types/pages/project_list_response.py b/src/cloudflare/types/pages/project_list_response.py deleted file mode 100644 index 78292e7956f..00000000000 --- a/src/cloudflare/types/pages/project_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .pages_deployments import PagesDeployments - -__all__ = ["ProjectListResponse"] - -ProjectListResponse = List[PagesDeployments] diff --git a/src/cloudflare/types/pages/projects/__init__.py b/src/cloudflare/types/pages/projects/__init__.py index 92edb94f56f..5a41f0031a9 100644 --- a/src/cloudflare/types/pages/projects/__init__.py +++ b/src/cloudflare/types/pages/projects/__init__.py @@ -5,8 +5,6 @@ from .domain_get_response import DomainGetResponse as DomainGetResponse from .domain_create_params import DomainCreateParams as DomainCreateParams from .domain_edit_response import DomainEditResponse as DomainEditResponse -from .domain_list_response import DomainListResponse as DomainListResponse from .deployment_list_params import DeploymentListParams as DeploymentListParams from .domain_create_response import DomainCreateResponse as DomainCreateResponse from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams -from .deployment_list_response import DeploymentListResponse as DeploymentListResponse diff --git a/src/cloudflare/types/pages/projects/deployment_list_response.py b/src/cloudflare/types/pages/projects/deployment_list_response.py deleted file mode 100644 index cc21070b73e..00000000000 --- a/src/cloudflare/types/pages/projects/deployment_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from ..pages_deployments import PagesDeployments - -__all__ = ["DeploymentListResponse"] - -DeploymentListResponse = List[PagesDeployments] diff --git a/src/cloudflare/types/pages/projects/domain_list_response.py b/src/cloudflare/types/pages/projects/domain_list_response.py deleted file mode 100644 index 0389742f089..00000000000 --- a/src/cloudflare/types/pages/projects/domain_list_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -__all__ = ["DomainListResponse"] - -DomainListResponse = List[object] diff --git a/src/cloudflare/types/pcap_list_response.py b/src/cloudflare/types/pcap_list_response.py index fa55cd1e0a4..ef6ac672c55 100644 --- a/src/cloudflare/types/pcap_list_response.py +++ b/src/cloudflare/types/pcap_list_response.py @@ -1,21 +1,20 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union, Optional +from typing import Union, Optional from typing_extensions import Literal from .._models import BaseModel __all__ = [ "PCAPListResponse", - "PCAPListResponseItem", - "PCAPListResponseItemMagicVisibilityPCAPsResponseSimple", - "PCAPListResponseItemMagicVisibilityPCAPsResponseSimpleFilterV1", - "PCAPListResponseItemMagicVisibilityPCAPsResponseFull", - "PCAPListResponseItemMagicVisibilityPCAPsResponseFullFilterV1", + "MagicVisibilityPCAPsResponseSimple", + "MagicVisibilityPCAPsResponseSimpleFilterV1", + "MagicVisibilityPCAPsResponseFull", + "MagicVisibilityPCAPsResponseFullFilterV1", ] -class PCAPListResponseItemMagicVisibilityPCAPsResponseSimpleFilterV1(BaseModel): +class MagicVisibilityPCAPsResponseSimpleFilterV1(BaseModel): destination_address: Optional[str] = None """The destination IP address of the packet.""" @@ -32,11 +31,11 @@ class PCAPListResponseItemMagicVisibilityPCAPsResponseSimpleFilterV1(BaseModel): """The source port of the packet.""" -class PCAPListResponseItemMagicVisibilityPCAPsResponseSimple(BaseModel): +class MagicVisibilityPCAPsResponseSimple(BaseModel): id: Optional[str] = None """The ID for the packet capture.""" - filter_v1: Optional[PCAPListResponseItemMagicVisibilityPCAPsResponseSimpleFilterV1] = None + filter_v1: Optional[MagicVisibilityPCAPsResponseSimpleFilterV1] = None """The packet capture filter. When this field is empty, all packets are captured.""" status: Optional[ @@ -63,7 +62,7 @@ class PCAPListResponseItemMagicVisibilityPCAPsResponseSimple(BaseModel): """ -class PCAPListResponseItemMagicVisibilityPCAPsResponseFullFilterV1(BaseModel): +class MagicVisibilityPCAPsResponseFullFilterV1(BaseModel): destination_address: Optional[str] = None """The destination IP address of the packet.""" @@ -80,7 +79,7 @@ class PCAPListResponseItemMagicVisibilityPCAPsResponseFullFilterV1(BaseModel): """The source port of the packet.""" -class PCAPListResponseItemMagicVisibilityPCAPsResponseFull(BaseModel): +class MagicVisibilityPCAPsResponseFull(BaseModel): id: Optional[str] = None """The ID for the packet capture.""" @@ -106,7 +105,7 @@ class PCAPListResponseItemMagicVisibilityPCAPsResponseFull(BaseModel): This field only applies to `full` packet captures. """ - filter_v1: Optional[PCAPListResponseItemMagicVisibilityPCAPsResponseFullFilterV1] = None + filter_v1: Optional[MagicVisibilityPCAPsResponseFullFilterV1] = None """The packet capture filter. When this field is empty, all packets are captured.""" status: Optional[ @@ -133,8 +132,4 @@ class PCAPListResponseItemMagicVisibilityPCAPsResponseFull(BaseModel): """ -PCAPListResponseItem = Union[ - PCAPListResponseItemMagicVisibilityPCAPsResponseSimple, PCAPListResponseItemMagicVisibilityPCAPsResponseFull -] - -PCAPListResponse = List[PCAPListResponseItem] +PCAPListResponse = Union[MagicVisibilityPCAPsResponseSimple, MagicVisibilityPCAPsResponseFull] diff --git a/src/cloudflare/types/plan_list_response.py b/src/cloudflare/types/plan_list_response.py deleted file mode 100644 index 0b3bfce127b..00000000000 --- a/src/cloudflare/types/plan_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .available_rate_plan import AvailableRatePlan - -__all__ = ["PlanListResponse"] - -PlanListResponse = List[AvailableRatePlan] diff --git a/src/cloudflare/types/queue_list_response.py b/src/cloudflare/types/queue_list_response.py index 9b0038b8c4d..1ccfe1e6e71 100644 --- a/src/cloudflare/types/queue_list_response.py +++ b/src/cloudflare/types/queue_list_response.py @@ -1,13 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from .._models import BaseModel -__all__ = ["QueueListResponse", "QueueListResponseItem"] +__all__ = ["QueueListResponse"] -class QueueListResponseItem(BaseModel): +class QueueListResponse(BaseModel): consumers: Optional[object] = None consumers_total_count: Optional[object] = None @@ -23,6 +23,3 @@ class QueueListResponseItem(BaseModel): queue_id: Optional[str] = None queue_name: Optional[str] = None - - -QueueListResponse = List[QueueListResponseItem] diff --git a/src/cloudflare/types/registrar/domain_list_response.py b/src/cloudflare/types/registrar/domain_list_response.py index bb2c9ac02f0..7dbde7dd61a 100644 --- a/src/cloudflare/types/registrar/domain_list_response.py +++ b/src/cloudflare/types/registrar/domain_list_response.py @@ -1,19 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from ..._models import BaseModel -__all__ = [ - "DomainListResponse", - "DomainListResponseItem", - "DomainListResponseItemRegistrantContact", - "DomainListResponseItemTransferIn", -] +__all__ = ["DomainListResponse", "RegistrantContact", "TransferIn"] -class DomainListResponseItemRegistrantContact(BaseModel): +class RegistrantContact(BaseModel): address: str """Address.""" @@ -54,7 +49,7 @@ class DomainListResponseItemRegistrantContact(BaseModel): """Contact fax number.""" -class DomainListResponseItemTransferIn(BaseModel): +class TransferIn(BaseModel): accept_foa: Optional[str] = None """Form of authorization has been accepted by the registrant.""" @@ -74,7 +69,7 @@ class DomainListResponseItemTransferIn(BaseModel): """Domain is unlocked at the foreign registrar.""" -class DomainListResponseItem(BaseModel): +class DomainListResponse(BaseModel): id: Optional[str] = None """Domain identifier.""" @@ -96,7 +91,7 @@ class DomainListResponseItem(BaseModel): locked: Optional[bool] = None """Shows whether a registrar lock is in place for a domain.""" - registrant_contact: Optional[DomainListResponseItemRegistrantContact] = None + registrant_contact: Optional[RegistrantContact] = None """Shows contact information for domain registrant.""" registry_statuses: Optional[str] = None @@ -113,11 +108,8 @@ class DomainListResponseItem(BaseModel): supported TLDs. """ - transfer_in: Optional[DomainListResponseItemTransferIn] = None + transfer_in: Optional[TransferIn] = None """Statuses for domain transfers into Cloudflare Registrar.""" updated_at: Optional[datetime] = None """Last updated.""" - - -DomainListResponse = List[DomainListResponseItem] diff --git a/src/cloudflare/types/rules/__init__.py b/src/cloudflare/types/rules/__init__.py index da78e03456e..eac7c5e729f 100644 --- a/src/cloudflare/types/rules/__init__.py +++ b/src/cloudflare/types/rules/__init__.py @@ -4,6 +4,5 @@ from .lists_list import ListsList as ListsList from .list_create_params import ListCreateParams as ListCreateParams -from .list_list_response import ListListResponse as ListListResponse from .list_update_params import ListUpdateParams as ListUpdateParams from .list_delete_response import ListDeleteResponse as ListDeleteResponse diff --git a/src/cloudflare/types/rules/list_list_response.py b/src/cloudflare/types/rules/list_list_response.py deleted file mode 100644 index 0960fc6af0f..00000000000 --- a/src/cloudflare/types/rules/list_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .lists_list import ListsList - -__all__ = ["ListListResponse"] - -ListListResponse = List[ListsList] diff --git a/src/cloudflare/types/ruleset_list_response.py b/src/cloudflare/types/ruleset_list_response.py new file mode 100644 index 00000000000..ef7fb89731e --- /dev/null +++ b/src/cloudflare/types/ruleset_list_response.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["RulesetListResponse"] + + +class RulesetListResponse(BaseModel): + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + id: Optional[str] = None + """The unique ID of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" + + last_updated: Optional[datetime] = None + """The timestamp of when the ruleset was last modified.""" + + version: Optional[str] = None + """The version of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/__init__.py b/src/cloudflare/types/rulesets/__init__.py index a7defbada7b..f493d78c72b 100644 --- a/src/cloudflare/types/rulesets/__init__.py +++ b/src/cloudflare/types/rulesets/__init__.py @@ -5,3 +5,4 @@ from .rule_edit_params import RuleEditParams as RuleEditParams from .rule_create_params import RuleCreateParams as RuleCreateParams from .phase_update_params import PhaseUpdateParams as PhaseUpdateParams +from .version_list_response import VersionListResponse as VersionListResponse diff --git a/src/cloudflare/types/rulesets/phases/__init__.py b/src/cloudflare/types/rulesets/phases/__init__.py index f8ee8b14b1c..6164c34d4c8 100644 --- a/src/cloudflare/types/rulesets/phases/__init__.py +++ b/src/cloudflare/types/rulesets/phases/__init__.py @@ -1,3 +1,5 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from __future__ import annotations + +from .version_list_response import VersionListResponse as VersionListResponse diff --git a/src/cloudflare/types/rulesets/phases/version_list_response.py b/src/cloudflare/types/rulesets/phases/version_list_response.py new file mode 100644 index 00000000000..f91c007c1f9 --- /dev/null +++ b/src/cloudflare/types/rulesets/phases/version_list_response.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ...._models import BaseModel + +__all__ = ["VersionListResponse"] + + +class VersionListResponse(BaseModel): + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + id: Optional[str] = None + """The unique ID of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" + + last_updated: Optional[datetime] = None + """The timestamp of when the ruleset was last modified.""" + + version: Optional[str] = None + """The version of the ruleset.""" diff --git a/src/cloudflare/types/rulesets/version_list_response.py b/src/cloudflare/types/rulesets/version_list_response.py new file mode 100644 index 00000000000..dd14aeee32a --- /dev/null +++ b/src/cloudflare/types/rulesets/version_list_response.py @@ -0,0 +1,56 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["VersionListResponse"] + + +class VersionListResponse(BaseModel): + kind: Literal["managed", "custom", "root", "zone"] + """The kind of the ruleset.""" + + name: str + """The human-readable name of the ruleset.""" + + phase: Literal[ + "ddos_l4", + "ddos_l7", + "http_config_settings", + "http_custom_errors", + "http_log_custom_fields", + "http_ratelimit", + "http_request_cache_settings", + "http_request_dynamic_redirect", + "http_request_firewall_custom", + "http_request_firewall_managed", + "http_request_late_transform", + "http_request_origin", + "http_request_redirect", + "http_request_sanitize", + "http_request_sbfm", + "http_request_select_configuration", + "http_request_transform", + "http_response_compression", + "http_response_firewall_managed", + "http_response_headers_transform", + "magic_transit", + "magic_transit_ids_managed", + "magic_transit_managed", + ] + """The phase of the ruleset.""" + + id: Optional[str] = None + """The unique ID of the ruleset.""" + + description: Optional[str] = None + """An informative description of the ruleset.""" + + last_updated: Optional[datetime] = None + """The timestamp of when the ruleset was last modified.""" + + version: Optional[str] = None + """The version of the ruleset.""" diff --git a/src/cloudflare/types/secondary_dns/__init__.py b/src/cloudflare/types/secondary_dns/__init__.py index 06ee64c3d7a..cae90a7d2c4 100644 --- a/src/cloudflare/types/secondary_dns/__init__.py +++ b/src/cloudflare/types/secondary_dns/__init__.py @@ -3,16 +3,13 @@ from __future__ import annotations from .acl_create_params import ACLCreateParams as ACLCreateParams -from .acl_list_response import ACLListResponse as ACLListResponse from .acl_update_params import ACLUpdateParams as ACLUpdateParams from .secondary_dns_acl import SecondaryDNSACL as SecondaryDNSACL from .peer_create_params import PeerCreateParams as PeerCreateParams -from .peer_list_response import PeerListResponse as PeerListResponse from .peer_update_params import PeerUpdateParams as PeerUpdateParams from .secondary_dns_peer import SecondaryDNSPeer as SecondaryDNSPeer from .secondary_dns_tsig import SecondaryDNSTSIG as SecondaryDNSTSIG from .tsig_create_params import TSIGCreateParams as TSIGCreateParams -from .tsig_list_response import TSIGListResponse as TSIGListResponse from .tsig_update_params import TSIGUpdateParams as TSIGUpdateParams from .acl_delete_response import ACLDeleteResponse as ACLDeleteResponse from .secondary_dns_force import SecondaryDNSForce as SecondaryDNSForce diff --git a/src/cloudflare/types/secondary_dns/acl_list_response.py b/src/cloudflare/types/secondary_dns/acl_list_response.py deleted file mode 100644 index a59ec9be8c9..00000000000 --- a/src/cloudflare/types/secondary_dns/acl_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .secondary_dns_acl import SecondaryDNSACL - -__all__ = ["ACLListResponse"] - -ACLListResponse = List[SecondaryDNSACL] diff --git a/src/cloudflare/types/secondary_dns/peer_list_response.py b/src/cloudflare/types/secondary_dns/peer_list_response.py deleted file mode 100644 index d6288041048..00000000000 --- a/src/cloudflare/types/secondary_dns/peer_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .secondary_dns_peer import SecondaryDNSPeer - -__all__ = ["PeerListResponse"] - -PeerListResponse = List[SecondaryDNSPeer] diff --git a/src/cloudflare/types/secondary_dns/tsig_list_response.py b/src/cloudflare/types/secondary_dns/tsig_list_response.py deleted file mode 100644 index 02c7e684662..00000000000 --- a/src/cloudflare/types/secondary_dns/tsig_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .secondary_dns_tsig import SecondaryDNSTSIG - -__all__ = ["TSIGListResponse"] - -TSIGListResponse = List[SecondaryDNSTSIG] diff --git a/src/cloudflare/types/snippet_list_response.py b/src/cloudflare/types/snippet_list_response.py deleted file mode 100644 index 1713f9f089c..00000000000 --- a/src/cloudflare/types/snippet_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .snippet import Snippet - -__all__ = ["SnippetListResponse"] - -SnippetListResponse = List[Snippet] diff --git a/src/cloudflare/types/snippets/rule_list_response.py b/src/cloudflare/types/snippets/rule_list_response.py index eff01c9b2b0..63c540e55c7 100644 --- a/src/cloudflare/types/snippets/rule_list_response.py +++ b/src/cloudflare/types/snippets/rule_list_response.py @@ -1,13 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from ..._models import BaseModel -__all__ = ["RuleListResponse", "RuleListResponseItem"] +__all__ = ["RuleListResponse"] -class RuleListResponseItem(BaseModel): +class RuleListResponse(BaseModel): description: Optional[str] = None enabled: Optional[bool] = None @@ -16,6 +16,3 @@ class RuleListResponseItem(BaseModel): snippet_name: Optional[str] = None """Snippet identifying name""" - - -RuleListResponse = List[RuleListResponseItem] diff --git a/src/cloudflare/types/speed/page_list_response.py b/src/cloudflare/types/speed/page_list_response.py index d1f9bf88a7e..a8d40729f35 100644 --- a/src/cloudflare/types/speed/page_list_response.py +++ b/src/cloudflare/types/speed/page_list_response.py @@ -8,10 +8,10 @@ from ..._models import BaseModel from .observatory_page_test import ObservatoryPageTest -__all__ = ["PageListResponse", "PageListResponseItem", "PageListResponseItemRegion"] +__all__ = ["PageListResponse", "Region"] -class PageListResponseItemRegion(BaseModel): +class Region(BaseModel): label: Optional[str] = None value: Optional[ @@ -42,8 +42,8 @@ class PageListResponseItemRegion(BaseModel): """A test region.""" -class PageListResponseItem(BaseModel): - region: Optional[PageListResponseItemRegion] = None +class PageListResponse(BaseModel): + region: Optional[Region] = None """A test region with a label.""" schedule_frequency: Optional[Literal["DAILY", "WEEKLY"]] = FieldInfo(alias="scheduleFrequency", default=None) @@ -53,6 +53,3 @@ class PageListResponseItem(BaseModel): url: Optional[str] = None """A URL.""" - - -PageListResponse = List[PageListResponseItem] diff --git a/src/cloudflare/types/ssl/__init__.py b/src/cloudflare/types/ssl/__init__.py index 1d4a5253625..ce56689f3f6 100644 --- a/src/cloudflare/types/ssl/__init__.py +++ b/src/cloudflare/types/ssl/__init__.py @@ -13,5 +13,4 @@ from .certificate_pack_list_params import CertificatePackListParams as CertificatePackListParams from .certificate_pack_get_response import CertificatePackGetResponse as CertificatePackGetResponse from .certificate_pack_edit_response import CertificatePackEditResponse as CertificatePackEditResponse -from .certificate_pack_list_response import CertificatePackListResponse as CertificatePackListResponse from .certificate_pack_delete_response import CertificatePackDeleteResponse as CertificatePackDeleteResponse diff --git a/src/cloudflare/types/ssl/certificate_pack_list_response.py b/src/cloudflare/types/ssl/certificate_pack_list_response.py deleted file mode 100644 index f0f8da5a679..00000000000 --- a/src/cloudflare/types/ssl/certificate_pack_list_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -__all__ = ["CertificatePackListResponse"] - -CertificatePackListResponse = List[object] diff --git a/src/cloudflare/types/stream/__init__.py b/src/cloudflare/types/stream/__init__.py index 532bacd0826..c80b853fe3f 100644 --- a/src/cloudflare/types/stream/__init__.py +++ b/src/cloudflare/types/stream/__init__.py @@ -27,7 +27,6 @@ from .caption_delete_response import CaptionDeleteResponse as CaptionDeleteResponse from .caption_update_response import CaptionUpdateResponse as CaptionUpdateResponse from .watermark_create_params import WatermarkCreateParams as WatermarkCreateParams -from .watermark_list_response import WatermarkListResponse as WatermarkListResponse from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse from .webhook_update_response import WebhookUpdateResponse as WebhookUpdateResponse from .audio_track_get_response import AudioTrackGetResponse as AudioTrackGetResponse diff --git a/src/cloudflare/types/stream/live_inputs/__init__.py b/src/cloudflare/types/stream/live_inputs/__init__.py index 58b3f4b5355..be1652c3338 100644 --- a/src/cloudflare/types/stream/live_inputs/__init__.py +++ b/src/cloudflare/types/stream/live_inputs/__init__.py @@ -4,5 +4,4 @@ from .stream_output import StreamOutput as StreamOutput from .output_create_params import OutputCreateParams as OutputCreateParams -from .output_list_response import OutputListResponse as OutputListResponse from .output_update_params import OutputUpdateParams as OutputUpdateParams diff --git a/src/cloudflare/types/stream/live_inputs/output_list_response.py b/src/cloudflare/types/stream/live_inputs/output_list_response.py deleted file mode 100644 index 5bdf153d982..00000000000 --- a/src/cloudflare/types/stream/live_inputs/output_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .stream_output import StreamOutput - -__all__ = ["OutputListResponse"] - -OutputListResponse = List[StreamOutput] diff --git a/src/cloudflare/types/stream/watermark_list_response.py b/src/cloudflare/types/stream/watermark_list_response.py deleted file mode 100644 index 1bad6e2f713..00000000000 --- a/src/cloudflare/types/stream/watermark_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .stream_watermarks import StreamWatermarks - -__all__ = ["WatermarkListResponse"] - -WatermarkListResponse = List[StreamWatermarks] diff --git a/src/cloudflare/types/stream_list_response.py b/src/cloudflare/types/stream_list_response.py deleted file mode 100644 index c0ff17fb611..00000000000 --- a/src/cloudflare/types/stream_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .stream_videos import StreamVideos - -__all__ = ["StreamListResponse"] - -StreamListResponse = List[StreamVideos] diff --git a/src/cloudflare/types/subscription_list_response.py b/src/cloudflare/types/subscription_list_response.py index 82a91bcdabf..88d6c34f983 100644 --- a/src/cloudflare/types/subscription_list_response.py +++ b/src/cloudflare/types/subscription_list_response.py @@ -6,22 +6,15 @@ from .._models import BaseModel -__all__ = [ - "SubscriptionListResponse", - "SubscriptionListResponseItem", - "SubscriptionListResponseItemApp", - "SubscriptionListResponseItemComponentValue", - "SubscriptionListResponseItemRatePlan", - "SubscriptionListResponseItemZone", -] +__all__ = ["SubscriptionListResponse", "App", "ComponentValue", "RatePlan", "Zone"] -class SubscriptionListResponseItemApp(BaseModel): +class App(BaseModel): install_id: Optional[str] = None """app install id.""" -class SubscriptionListResponseItemComponentValue(BaseModel): +class ComponentValue(BaseModel): default: Optional[float] = None """The default amount assigned.""" @@ -35,7 +28,7 @@ class SubscriptionListResponseItemComponentValue(BaseModel): """The amount of the component value assigned.""" -class SubscriptionListResponseItemRatePlan(BaseModel): +class RatePlan(BaseModel): id: Optional[str] = None """The ID of the rate plan.""" @@ -58,7 +51,7 @@ class SubscriptionListResponseItemRatePlan(BaseModel): """The list of sets this rate plan applies to.""" -class SubscriptionListResponseItemZone(BaseModel): +class Zone(BaseModel): id: Optional[str] = None """Identifier""" @@ -66,13 +59,13 @@ class SubscriptionListResponseItemZone(BaseModel): """The domain name""" -class SubscriptionListResponseItem(BaseModel): +class SubscriptionListResponse(BaseModel): id: Optional[str] = None """Subscription identifier tag.""" - app: Optional[SubscriptionListResponseItemApp] = None + app: Optional[App] = None - component_values: Optional[List[SubscriptionListResponseItemComponentValue]] = None + component_values: Optional[List[ComponentValue]] = None """The list of add-ons subscribed to.""" currency: Optional[str] = None @@ -93,14 +86,11 @@ class SubscriptionListResponseItem(BaseModel): price: Optional[float] = None """The price of the subscription that will be billed, in US dollars.""" - rate_plan: Optional[SubscriptionListResponseItemRatePlan] = None + rate_plan: Optional[RatePlan] = None """The rate plan applied to the subscription.""" state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None """The state that the subscription is in.""" - zone: Optional[SubscriptionListResponseItemZone] = None + zone: Optional[Zone] = None """A simple zone object. May have null properties if not a zone subscription.""" - - -SubscriptionListResponse = List[SubscriptionListResponseItem] diff --git a/src/cloudflare/types/user/invite_list_response.py b/src/cloudflare/types/user/invite_list_response.py index 338d0f09636..4552dab6bdb 100644 --- a/src/cloudflare/types/user/invite_list_response.py +++ b/src/cloudflare/types/user/invite_list_response.py @@ -7,10 +7,10 @@ from ..._models import BaseModel from ..accounts import Role -__all__ = ["InviteListResponse", "InviteListResponseItem"] +__all__ = ["InviteListResponse"] -class InviteListResponseItem(BaseModel): +class InviteListResponse(BaseModel): invited_member_id: Optional[str] = None """ID of the user to add to the organization.""" @@ -40,6 +40,3 @@ class InviteListResponseItem(BaseModel): status: Optional[Literal["pending", "accepted", "rejected", "expired"]] = None """Current status of the invitation.""" - - -InviteListResponse = List[InviteListResponseItem] diff --git a/src/cloudflare/types/user/load_balancers/__init__.py b/src/cloudflare/types/user/load_balancers/__init__.py index 650c5b7f348..acb23dfd758 100644 --- a/src/cloudflare/types/user/load_balancers/__init__.py +++ b/src/cloudflare/types/user/load_balancers/__init__.py @@ -5,7 +5,6 @@ from .pool_edit_params import PoolEditParams as PoolEditParams from .pool_list_params import PoolListParams as PoolListParams from .pool_create_params import PoolCreateParams as PoolCreateParams -from .pool_list_response import PoolListResponse as PoolListResponse from .pool_update_params import PoolUpdateParams as PoolUpdateParams from .load_balancing_pool import LoadBalancingPool as LoadBalancingPool from .monitor_edit_params import MonitorEditParams as MonitorEditParams @@ -13,7 +12,6 @@ from .pool_delete_response import PoolDeleteResponse as PoolDeleteResponse from .pool_health_response import PoolHealthResponse as PoolHealthResponse from .monitor_create_params import MonitorCreateParams as MonitorCreateParams -from .monitor_list_response import MonitorListResponse as MonitorListResponse from .monitor_update_params import MonitorUpdateParams as MonitorUpdateParams from .pool_preview_response import PoolPreviewResponse as PoolPreviewResponse from .load_balancing_monitor import LoadBalancingMonitor as LoadBalancingMonitor diff --git a/src/cloudflare/types/user/load_balancers/analytics/__init__.py b/src/cloudflare/types/user/load_balancers/analytics/__init__.py index 03445926bb1..6e17e38c1cd 100644 --- a/src/cloudflare/types/user/load_balancers/analytics/__init__.py +++ b/src/cloudflare/types/user/load_balancers/analytics/__init__.py @@ -3,5 +3,4 @@ from __future__ import annotations from .event_list_params import EventListParams as EventListParams -from .event_list_response import EventListResponse as EventListResponse from .load_balancing_analytics import LoadBalancingAnalytics as LoadBalancingAnalytics diff --git a/src/cloudflare/types/user/load_balancers/analytics/event_list_response.py b/src/cloudflare/types/user/load_balancers/analytics/event_list_response.py deleted file mode 100644 index a667cbd1d3e..00000000000 --- a/src/cloudflare/types/user/load_balancers/analytics/event_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .load_balancing_analytics import LoadBalancingAnalytics - -__all__ = ["EventListResponse"] - -EventListResponse = List[LoadBalancingAnalytics] diff --git a/src/cloudflare/types/user/load_balancers/monitor_list_response.py b/src/cloudflare/types/user/load_balancers/monitor_list_response.py deleted file mode 100644 index a044deba898..00000000000 --- a/src/cloudflare/types/user/load_balancers/monitor_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .load_balancing_monitor import LoadBalancingMonitor - -__all__ = ["MonitorListResponse"] - -MonitorListResponse = List[LoadBalancingMonitor] diff --git a/src/cloudflare/types/user/load_balancers/pool_list_response.py b/src/cloudflare/types/user/load_balancers/pool_list_response.py deleted file mode 100644 index 90fa664c357..00000000000 --- a/src/cloudflare/types/user/load_balancers/pool_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .load_balancing_pool import LoadBalancingPool - -__all__ = ["PoolListResponse"] - -PoolListResponse = List[LoadBalancingPool] diff --git a/src/cloudflare/types/user/tokens/__init__.py b/src/cloudflare/types/user/tokens/__init__.py index e8c83a2d8f5..11148d0023c 100644 --- a/src/cloudflare/types/user/tokens/__init__.py +++ b/src/cloudflare/types/user/tokens/__init__.py @@ -4,4 +4,3 @@ from .token_value import TokenValue as TokenValue from .value_update_params import ValueUpdateParams as ValueUpdateParams -from .permission_group_list_response import PermissionGroupListResponse as PermissionGroupListResponse diff --git a/src/cloudflare/types/user/tokens/permission_group_list_response.py b/src/cloudflare/types/user/tokens/permission_group_list_response.py deleted file mode 100644 index ee266930c69..00000000000 --- a/src/cloudflare/types/user/tokens/permission_group_list_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -__all__ = ["PermissionGroupListResponse"] - -PermissionGroupListResponse = List[object] diff --git a/src/cloudflare/types/vectorize/__init__.py b/src/cloudflare/types/vectorize/__init__.py index a595b894226..2abd20d71b2 100644 --- a/src/cloudflare/types/vectorize/__init__.py +++ b/src/cloudflare/types/vectorize/__init__.py @@ -4,7 +4,6 @@ from .index_query_params import IndexQueryParams as IndexQueryParams from .index_create_params import IndexCreateParams as IndexCreateParams -from .index_list_response import IndexListResponse as IndexListResponse from .index_update_params import IndexUpdateParams as IndexUpdateParams from .index_delete_response import IndexDeleteResponse as IndexDeleteResponse from .vectorize_index_query import VectorizeIndexQuery as VectorizeIndexQuery diff --git a/src/cloudflare/types/vectorize/index_list_response.py b/src/cloudflare/types/vectorize/index_list_response.py deleted file mode 100644 index 89b1a3fefb5..00000000000 --- a/src/cloudflare/types/vectorize/index_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .vectorize_create_index import VectorizeCreateIndex - -__all__ = ["IndexListResponse"] - -IndexListResponse = List[VectorizeCreateIndex] diff --git a/src/cloudflare/types/waiting_room_list_response.py b/src/cloudflare/types/waiting_room_list_response.py deleted file mode 100644 index 45a85780e8a..00000000000 --- a/src/cloudflare/types/waiting_room_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .waiting_room import WaitingRoom - -__all__ = ["WaitingRoomListResponse"] - -WaitingRoomListResponse = List[WaitingRoom] diff --git a/src/cloudflare/types/waiting_rooms/__init__.py b/src/cloudflare/types/waiting_rooms/__init__.py index 0175c121a21..0ca5f4aadf1 100644 --- a/src/cloudflare/types/waiting_rooms/__init__.py +++ b/src/cloudflare/types/waiting_rooms/__init__.py @@ -8,10 +8,8 @@ from .waitingroom_event import WaitingroomEvent as WaitingroomEvent from .rule_create_params import RuleCreateParams as RuleCreateParams from .rule_edit_response import RuleEditResponse as RuleEditResponse -from .rule_list_response import RuleListResponse as RuleListResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams from .event_create_params import EventCreateParams as EventCreateParams -from .event_list_response import EventListResponse as EventListResponse from .event_update_params import EventUpdateParams as EventUpdateParams from .page_preview_params import PagePreviewParams as PagePreviewParams from .setting_edit_params import SettingEditParams as SettingEditParams diff --git a/src/cloudflare/types/waiting_rooms/event_list_response.py b/src/cloudflare/types/waiting_rooms/event_list_response.py deleted file mode 100644 index 1aae0ee87eb..00000000000 --- a/src/cloudflare/types/waiting_rooms/event_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .waitingroom_event import WaitingroomEvent - -__all__ = ["EventListResponse"] - -EventListResponse = List[WaitingroomEvent] diff --git a/src/cloudflare/types/waiting_rooms/rule_list_response.py b/src/cloudflare/types/waiting_rooms/rule_list_response.py deleted file mode 100644 index 7b1cf806b3b..00000000000 --- a/src/cloudflare/types/waiting_rooms/rule_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .waitingroom_rule import WaitingroomRule - -__all__ = ["RuleListResponse"] - -RuleListResponse = List[WaitingroomRule] diff --git a/src/cloudflare/types/web3/__init__.py b/src/cloudflare/types/web3/__init__.py index 4e579bfc0e9..f4b73f59178 100644 --- a/src/cloudflare/types/web3/__init__.py +++ b/src/cloudflare/types/web3/__init__.py @@ -4,6 +4,5 @@ from .hostname_edit_params import HostnameEditParams as HostnameEditParams from .hostname_create_params import HostnameCreateParams as HostnameCreateParams -from .hostname_list_response import HostnameListResponse as HostnameListResponse from .distributed_web_hostname import DistributedWebHostname as DistributedWebHostname from .hostname_delete_response import HostnameDeleteResponse as HostnameDeleteResponse diff --git a/src/cloudflare/types/web3/hostname_list_response.py b/src/cloudflare/types/web3/hostname_list_response.py deleted file mode 100644 index 37188d53ac7..00000000000 --- a/src/cloudflare/types/web3/hostname_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .distributed_web_hostname import DistributedWebHostname - -__all__ = ["HostnameListResponse"] - -HostnameListResponse = List[DistributedWebHostname] diff --git a/src/cloudflare/types/workers/__init__.py b/src/cloudflare/types/workers/__init__.py index 48267c12bb4..64fead694f0 100644 --- a/src/cloudflare/types/workers/__init__.py +++ b/src/cloudflare/types/workers/__init__.py @@ -10,15 +10,11 @@ from .ai_run_response import AIRunResponse as AIRunResponse from .domain_list_params import DomainListParams as DomainListParams from .route_create_params import RouteCreateParams as RouteCreateParams -from .route_list_response import RouteListResponse as RouteListResponse from .route_update_params import RouteUpdateParams as RouteUpdateParams -from .domain_list_response import DomainListResponse as DomainListResponse from .domain_update_params import DomainUpdateParams as DomainUpdateParams from .filter_create_params import FilterCreateParams as FilterCreateParams -from .filter_list_response import FilterListResponse as FilterListResponse from .filter_update_params import FilterUpdateParams as FilterUpdateParams from .script_delete_params import ScriptDeleteParams as ScriptDeleteParams -from .script_list_response import ScriptListResponse as ScriptListResponse from .script_update_params import ScriptUpdateParams as ScriptUpdateParams from .route_create_response import RouteCreateResponse as RouteCreateResponse from .route_delete_response import RouteDeleteResponse as RouteDeleteResponse diff --git a/src/cloudflare/types/workers/domain_list_response.py b/src/cloudflare/types/workers/domain_list_response.py deleted file mode 100644 index 3e9ce9a4d6c..00000000000 --- a/src/cloudflare/types/workers/domain_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .workers_domain import WorkersDomain - -__all__ = ["DomainListResponse"] - -DomainListResponse = List[WorkersDomain] diff --git a/src/cloudflare/types/workers/filter_list_response.py b/src/cloudflare/types/workers/filter_list_response.py deleted file mode 100644 index e01ef8e5a05..00000000000 --- a/src/cloudflare/types/workers/filter_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .workers_filter import WorkersFilter - -__all__ = ["FilterListResponse"] - -FilterListResponse = List[WorkersFilter] diff --git a/src/cloudflare/types/workers/route_list_response.py b/src/cloudflare/types/workers/route_list_response.py deleted file mode 100644 index 0c238e3bfff..00000000000 --- a/src/cloudflare/types/workers/route_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .workers_route import WorkersRoute - -__all__ = ["RouteListResponse"] - -RouteListResponse = List[WorkersRoute] diff --git a/src/cloudflare/types/workers/script_list_response.py b/src/cloudflare/types/workers/script_list_response.py deleted file mode 100644 index 12cccbaa599..00000000000 --- a/src/cloudflare/types/workers/script_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .workers_script import WorkersScript - -__all__ = ["ScriptListResponse"] - -ScriptListResponse = List[WorkersScript] diff --git a/src/cloudflare/types/workers_for_platforms/dispatch/namespace_list_response.py b/src/cloudflare/types/workers_for_platforms/dispatch/namespace_list_response.py index 18986d0c333..afd2b614ddc 100644 --- a/src/cloudflare/types/workers_for_platforms/dispatch/namespace_list_response.py +++ b/src/cloudflare/types/workers_for_platforms/dispatch/namespace_list_response.py @@ -1,14 +1,14 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from datetime import datetime from ...._models import BaseModel -__all__ = ["NamespaceListResponse", "NamespaceListResponseItem"] +__all__ = ["NamespaceListResponse"] -class NamespaceListResponseItem(BaseModel): +class NamespaceListResponse(BaseModel): created_by: Optional[str] = None """Identifier""" @@ -29,6 +29,3 @@ class NamespaceListResponseItem(BaseModel): script_count: Optional[int] = None """The current number of scripts in this Dispatch Namespace""" - - -NamespaceListResponse = List[NamespaceListResponseItem] diff --git a/src/cloudflare/types/zero_trust/__init__.py b/src/cloudflare/types/zero_trust/__init__.py index ee029326e27..63750a56b20 100644 --- a/src/cloudflare/types/zero_trust/__init__.py +++ b/src/cloudflare/types/zero_trust/__init__.py @@ -10,7 +10,6 @@ from .tunnel_list_params import TunnelListParams as TunnelListParams from .zero_trust_devices import ZeroTrustDevices as ZeroTrustDevices from .device_get_response import DeviceGetResponse as DeviceGetResponse -from .device_list_response import DeviceListResponse as DeviceListResponse from .tunnel_create_params import TunnelCreateParams as TunnelCreateParams from .tunnel_delete_params import TunnelDeleteParams as TunnelDeleteParams from .tunnel_edit_response import TunnelEditResponse as TunnelEditResponse diff --git a/src/cloudflare/types/zero_trust/access/__init__.py b/src/cloudflare/types/zero_trust/access/__init__.py index 7f01f1a80df..8406db99375 100644 --- a/src/cloudflare/types/zero_trust/access/__init__.py +++ b/src/cloudflare/types/zero_trust/access/__init__.py @@ -8,37 +8,29 @@ from .zero_trust_users import ZeroTrustUsers as ZeroTrustUsers from .key_update_params import KeyUpdateParams as KeyUpdateParams from .tag_create_params import TagCreateParams as TagCreateParams -from .tag_list_response import TagListResponse as TagListResponse from .tag_update_params import TagUpdateParams as TagUpdateParams from .zero_trust_groups import ZeroTrustGroups as ZeroTrustGroups -from .user_list_response import UserListResponse as UserListResponse from .group_create_params import GroupCreateParams as GroupCreateParams -from .group_list_response import GroupListResponse as GroupListResponse from .group_update_params import GroupUpdateParams as GroupUpdateParams from .key_rotate_response import KeyRotateResponse as KeyRotateResponse from .key_update_response import KeyUpdateResponse as KeyUpdateResponse from .tag_delete_response import TagDeleteResponse as TagDeleteResponse from .zero_trust_bookmarks import ZeroTrustBookmarks as ZeroTrustBookmarks from .group_delete_response import GroupDeleteResponse as GroupDeleteResponse -from .bookmark_list_response import BookmarkListResponse as BookmarkListResponse from .zero_trust_custom_page import ZeroTrustCustomPage as ZeroTrustCustomPage from .zero_trust_certificates import ZeroTrustCertificates as ZeroTrustCertificates from .bookmark_delete_response import BookmarkDeleteResponse as BookmarkDeleteResponse from .application_create_params import ApplicationCreateParams as ApplicationCreateParams -from .application_list_response import ApplicationListResponse as ApplicationListResponse from .application_update_params import ApplicationUpdateParams as ApplicationUpdateParams from .certificate_create_params import CertificateCreateParams as CertificateCreateParams -from .certificate_list_response import CertificateListResponse as CertificateListResponse from .certificate_update_params import CertificateUpdateParams as CertificateUpdateParams from .custom_page_create_params import CustomPageCreateParams as CustomPageCreateParams -from .custom_page_list_response import CustomPageListResponse as CustomPageListResponse from .custom_page_update_params import CustomPageUpdateParams as CustomPageUpdateParams from .zero_trust_service_tokens import ZeroTrustServiceTokens as ZeroTrustServiceTokens from .application_delete_response import ApplicationDeleteResponse as ApplicationDeleteResponse from .certificate_delete_response import CertificateDeleteResponse as CertificateDeleteResponse from .custom_page_delete_response import CustomPageDeleteResponse as CustomPageDeleteResponse from .service_token_create_params import ServiceTokenCreateParams as ServiceTokenCreateParams -from .service_token_list_response import ServiceTokenListResponse as ServiceTokenListResponse from .service_token_update_params import ServiceTokenUpdateParams as ServiceTokenUpdateParams from .service_token_create_response import ServiceTokenCreateResponse as ServiceTokenCreateResponse from .service_token_rotate_response import ServiceTokenRotateResponse as ServiceTokenRotateResponse diff --git a/src/cloudflare/types/zero_trust/access/application_list_response.py b/src/cloudflare/types/zero_trust/access/application_list_response.py deleted file mode 100644 index 910868ea87c..00000000000 --- a/src/cloudflare/types/zero_trust/access/application_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_apps import ZeroTrustApps - -__all__ = ["ApplicationListResponse"] - -ApplicationListResponse = List[ZeroTrustApps] diff --git a/src/cloudflare/types/zero_trust/access/applications/__init__.py b/src/cloudflare/types/zero_trust/access/applications/__init__.py index a4ca1c2cdb4..4c51f6afacf 100644 --- a/src/cloudflare/types/zero_trust/access/applications/__init__.py +++ b/src/cloudflare/types/zero_trust/access/applications/__init__.py @@ -4,12 +4,10 @@ from .zero_trust_ca import ZeroTrustCA as ZeroTrustCA from .ca_get_response import CAGetResponse as CAGetResponse -from .ca_list_response import CAListResponse as CAListResponse from .ca_create_response import CACreateResponse as CACreateResponse from .ca_delete_response import CADeleteResponse as CADeleteResponse from .zero_trust_policies import ZeroTrustPolicies as ZeroTrustPolicies from .policy_create_params import PolicyCreateParams as PolicyCreateParams -from .policy_list_response import PolicyListResponse as PolicyListResponse from .policy_update_params import PolicyUpdateParams as PolicyUpdateParams from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse from .user_policy_check_list_response import UserPolicyCheckListResponse as UserPolicyCheckListResponse diff --git a/src/cloudflare/types/zero_trust/access/applications/ca_list_response.py b/src/cloudflare/types/zero_trust/access/applications/ca_list_response.py deleted file mode 100644 index 9c1eb6e62bc..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/ca_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_ca import ZeroTrustCA - -__all__ = ["CAListResponse"] - -CAListResponse = List[ZeroTrustCA] diff --git a/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py b/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py deleted file mode 100644 index 8413c1af279..00000000000 --- a/src/cloudflare/types/zero_trust/access/applications/policy_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_policies import ZeroTrustPolicies - -__all__ = ["PolicyListResponse"] - -PolicyListResponse = List[ZeroTrustPolicies] diff --git a/src/cloudflare/types/zero_trust/access/bookmark_list_response.py b/src/cloudflare/types/zero_trust/access/bookmark_list_response.py deleted file mode 100644 index 50bdaeafc83..00000000000 --- a/src/cloudflare/types/zero_trust/access/bookmark_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_bookmarks import ZeroTrustBookmarks - -__all__ = ["BookmarkListResponse"] - -BookmarkListResponse = List[ZeroTrustBookmarks] diff --git a/src/cloudflare/types/zero_trust/access/certificate_list_response.py b/src/cloudflare/types/zero_trust/access/certificate_list_response.py deleted file mode 100644 index 4366d11dd0b..00000000000 --- a/src/cloudflare/types/zero_trust/access/certificate_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_certificates import ZeroTrustCertificates - -__all__ = ["CertificateListResponse"] - -CertificateListResponse = List[ZeroTrustCertificates] diff --git a/src/cloudflare/types/zero_trust/access/custom_page_list_response.py b/src/cloudflare/types/zero_trust/access/custom_page_list_response.py deleted file mode 100644 index 2f7128ef608..00000000000 --- a/src/cloudflare/types/zero_trust/access/custom_page_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_custom_page_without_html import ZeroTrustCustomPageWithoutHTML - -__all__ = ["CustomPageListResponse"] - -CustomPageListResponse = List[ZeroTrustCustomPageWithoutHTML] diff --git a/src/cloudflare/types/zero_trust/access/group_list_response.py b/src/cloudflare/types/zero_trust/access/group_list_response.py deleted file mode 100644 index 75d9ddeea05..00000000000 --- a/src/cloudflare/types/zero_trust/access/group_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_groups import ZeroTrustGroups - -__all__ = ["GroupListResponse"] - -GroupListResponse = List[ZeroTrustGroups] diff --git a/src/cloudflare/types/zero_trust/access/service_token_list_response.py b/src/cloudflare/types/zero_trust/access/service_token_list_response.py deleted file mode 100644 index ec616ff266b..00000000000 --- a/src/cloudflare/types/zero_trust/access/service_token_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_service_tokens import ZeroTrustServiceTokens - -__all__ = ["ServiceTokenListResponse"] - -ServiceTokenListResponse = List[ZeroTrustServiceTokens] diff --git a/src/cloudflare/types/zero_trust/access/tag_list_response.py b/src/cloudflare/types/zero_trust/access/tag_list_response.py deleted file mode 100644 index 727b975fce5..00000000000 --- a/src/cloudflare/types/zero_trust/access/tag_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_tag import ZeroTrustTag - -__all__ = ["TagListResponse"] - -TagListResponse = List[ZeroTrustTag] diff --git a/src/cloudflare/types/zero_trust/access/user_list_response.py b/src/cloudflare/types/zero_trust/access/user_list_response.py deleted file mode 100644 index 255083b287b..00000000000 --- a/src/cloudflare/types/zero_trust/access/user_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_users import ZeroTrustUsers - -__all__ = ["UserListResponse"] - -UserListResponse = List[ZeroTrustUsers] diff --git a/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py b/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py index e27ef03ac17..ac0f4059a81 100644 --- a/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py +++ b/src/cloudflare/types/zero_trust/access/users/active_session_list_response.py @@ -1,18 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Optional +from typing import Dict, Optional from ....._models import BaseModel -__all__ = [ - "ActiveSessionListResponse", - "ActiveSessionListResponseItem", - "ActiveSessionListResponseItemMetadata", - "ActiveSessionListResponseItemMetadataApps", -] +__all__ = ["ActiveSessionListResponse", "Metadata", "MetadataApps"] -class ActiveSessionListResponseItemMetadataApps(BaseModel): +class MetadataApps(BaseModel): hostname: Optional[str] = None name: Optional[str] = None @@ -22,8 +17,8 @@ class ActiveSessionListResponseItemMetadataApps(BaseModel): uid: Optional[str] = None -class ActiveSessionListResponseItemMetadata(BaseModel): - apps: Optional[Dict[str, ActiveSessionListResponseItemMetadataApps]] = None +class Metadata(BaseModel): + apps: Optional[Dict[str, MetadataApps]] = None expires: Optional[int] = None @@ -34,12 +29,9 @@ class ActiveSessionListResponseItemMetadata(BaseModel): ttl: Optional[int] = None -class ActiveSessionListResponseItem(BaseModel): +class ActiveSessionListResponse(BaseModel): expiration: Optional[int] = None - metadata: Optional[ActiveSessionListResponseItemMetadata] = None + metadata: Optional[Metadata] = None name: Optional[str] = None - - -ActiveSessionListResponse = List[ActiveSessionListResponseItem] diff --git a/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py b/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py index 7554fc42d5b..358f7afc443 100644 --- a/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py +++ b/src/cloudflare/types/zero_trust/access/users/failed_login_list_response.py @@ -1,16 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import Optional from ....._models import BaseModel -__all__ = ["FailedLoginListResponse", "FailedLoginListResponseItem"] +__all__ = ["FailedLoginListResponse"] -class FailedLoginListResponseItem(BaseModel): +class FailedLoginListResponse(BaseModel): expiration: Optional[int] = None metadata: Optional[object] = None - - -FailedLoginListResponse = List[FailedLoginListResponseItem] diff --git a/src/cloudflare/types/zero_trust/device_list_response.py b/src/cloudflare/types/zero_trust/device_list_response.py deleted file mode 100644 index 6d4470567bd..00000000000 --- a/src/cloudflare/types/zero_trust/device_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_devices import ZeroTrustDevices - -__all__ = ["DeviceListResponse"] - -DeviceListResponse = List[ZeroTrustDevices] diff --git a/src/cloudflare/types/zero_trust/devices/__init__.py b/src/cloudflare/types/zero_trust/devices/__init__.py index e2c73206405..138d36d47e8 100644 --- a/src/cloudflare/types/zero_trust/devices/__init__.py +++ b/src/cloudflare/types/zero_trust/devices/__init__.py @@ -5,18 +5,14 @@ from .policy_edit_params import PolicyEditParams as PolicyEditParams from .device_posture_rules import DevicePostureRules as DevicePostureRules from .policy_create_params import PolicyCreateParams as PolicyCreateParams -from .policy_list_response import PolicyListResponse as PolicyListResponse from .revoke_create_params import RevokeCreateParams as RevokeCreateParams from .dex_test_schemas_http import DEXTestSchemasHTTP as DEXTestSchemasHTTP from .network_create_params import NetworkCreateParams as NetworkCreateParams -from .network_list_response import NetworkListResponse as NetworkListResponse from .network_update_params import NetworkUpdateParams as NetworkUpdateParams from .posture_create_params import PostureCreateParams as PostureCreateParams -from .posture_list_response import PostureListResponse as PostureListResponse from .posture_update_params import PostureUpdateParams as PostureUpdateParams from .setting_update_params import SettingUpdateParams as SettingUpdateParams from .dex_test_create_params import DEXTestCreateParams as DEXTestCreateParams -from .dex_test_list_response import DEXTestListResponse as DEXTestListResponse from .dex_test_update_params import DEXTestUpdateParams as DEXTestUpdateParams from .policy_delete_response import PolicyDeleteResponse as PolicyDeleteResponse from .revoke_create_response import RevokeCreateResponse as RevokeCreateResponse diff --git a/src/cloudflare/types/zero_trust/devices/dex_test_list_response.py b/src/cloudflare/types/zero_trust/devices/dex_test_list_response.py deleted file mode 100644 index 2dc36bc019f..00000000000 --- a/src/cloudflare/types/zero_trust/devices/dex_test_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .dex_test_schemas_http import DEXTestSchemasHTTP - -__all__ = ["DEXTestListResponse"] - -DEXTestListResponse = List[DEXTestSchemasHTTP] diff --git a/src/cloudflare/types/zero_trust/devices/network_list_response.py b/src/cloudflare/types/zero_trust/devices/network_list_response.py deleted file mode 100644 index 6a6ace56b12..00000000000 --- a/src/cloudflare/types/zero_trust/devices/network_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .device_managed_networks import DeviceManagedNetworks - -__all__ = ["NetworkListResponse"] - -NetworkListResponse = List[DeviceManagedNetworks] diff --git a/src/cloudflare/types/zero_trust/devices/policies/__init__.py b/src/cloudflare/types/zero_trust/devices/policies/__init__.py index 36cd5be2b66..8e3419b0673 100644 --- a/src/cloudflare/types/zero_trust/devices/policies/__init__.py +++ b/src/cloudflare/types/zero_trust/devices/policies/__init__.py @@ -5,9 +5,7 @@ from .devices_split_tunnel import DevicesSplitTunnel as DevicesSplitTunnel from .exclude_get_response import ExcludeGetResponse as ExcludeGetResponse from .include_get_response import IncludeGetResponse as IncludeGetResponse -from .exclude_list_response import ExcludeListResponse as ExcludeListResponse from .exclude_update_params import ExcludeUpdateParams as ExcludeUpdateParams -from .include_list_response import IncludeListResponse as IncludeListResponse from .include_update_params import IncludeUpdateParams as IncludeUpdateParams from .devices_fallback_domain import DevicesFallbackDomain as DevicesFallbackDomain from .exclude_update_response import ExcludeUpdateResponse as ExcludeUpdateResponse @@ -17,7 +15,6 @@ from .devices_split_tunnel_include import DevicesSplitTunnelInclude as DevicesSplitTunnelInclude from .fallback_domain_get_response import FallbackDomainGetResponse as FallbackDomainGetResponse from .devices_fallback_domain_param import DevicesFallbackDomainParam as DevicesFallbackDomainParam -from .fallback_domain_list_response import FallbackDomainListResponse as FallbackDomainListResponse from .fallback_domain_update_params import FallbackDomainUpdateParams as FallbackDomainUpdateParams from .fallback_domain_update_response import FallbackDomainUpdateResponse as FallbackDomainUpdateResponse from .devices_split_tunnel_include_param import DevicesSplitTunnelIncludeParam as DevicesSplitTunnelIncludeParam diff --git a/src/cloudflare/types/zero_trust/devices/policies/exclude_list_response.py b/src/cloudflare/types/zero_trust/devices/policies/exclude_list_response.py deleted file mode 100644 index b8ed64891e5..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/exclude_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .devices_split_tunnel import DevicesSplitTunnel - -__all__ = ["ExcludeListResponse"] - -ExcludeListResponse = List[DevicesSplitTunnel] diff --git a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_list_response.py b/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_list_response.py deleted file mode 100644 index 3a33387f983..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/fallback_domain_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .devices_fallback_domain import DevicesFallbackDomain - -__all__ = ["FallbackDomainListResponse"] - -FallbackDomainListResponse = List[DevicesFallbackDomain] diff --git a/src/cloudflare/types/zero_trust/devices/policies/include_list_response.py b/src/cloudflare/types/zero_trust/devices/policies/include_list_response.py deleted file mode 100644 index 4173afcf096..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policies/include_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .devices_split_tunnel_include import DevicesSplitTunnelInclude - -__all__ = ["IncludeListResponse"] - -IncludeListResponse = List[DevicesSplitTunnelInclude] diff --git a/src/cloudflare/types/zero_trust/devices/policy_list_response.py b/src/cloudflare/types/zero_trust/devices/policy_list_response.py deleted file mode 100644 index 95cadbca13b..00000000000 --- a/src/cloudflare/types/zero_trust/devices/policy_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .devices_device_settings_policy import DevicesDeviceSettingsPolicy - -__all__ = ["PolicyListResponse"] - -PolicyListResponse = List[DevicesDeviceSettingsPolicy] diff --git a/src/cloudflare/types/zero_trust/devices/posture/__init__.py b/src/cloudflare/types/zero_trust/devices/posture/__init__.py index 666d6d134b2..3771dca8a78 100644 --- a/src/cloudflare/types/zero_trust/devices/posture/__init__.py +++ b/src/cloudflare/types/zero_trust/devices/posture/__init__.py @@ -4,6 +4,5 @@ from .integration_edit_params import IntegrationEditParams as IntegrationEditParams from .integration_create_params import IntegrationCreateParams as IntegrationCreateParams -from .integration_list_response import IntegrationListResponse as IntegrationListResponse from .device_posture_integrations import DevicePostureIntegrations as DevicePostureIntegrations from .integration_delete_response import IntegrationDeleteResponse as IntegrationDeleteResponse diff --git a/src/cloudflare/types/zero_trust/devices/posture/integration_list_response.py b/src/cloudflare/types/zero_trust/devices/posture/integration_list_response.py deleted file mode 100644 index ffbb8633862..00000000000 --- a/src/cloudflare/types/zero_trust/devices/posture/integration_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .device_posture_integrations import DevicePostureIntegrations - -__all__ = ["IntegrationListResponse"] - -IntegrationListResponse = List[DevicePostureIntegrations] diff --git a/src/cloudflare/types/zero_trust/devices/posture_list_response.py b/src/cloudflare/types/zero_trust/devices/posture_list_response.py deleted file mode 100644 index c183e9cd3e9..00000000000 --- a/src/cloudflare/types/zero_trust/devices/posture_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .device_posture_rules import DevicePostureRules - -__all__ = ["PostureListResponse"] - -PostureListResponse = List[DevicePostureRules] diff --git a/src/cloudflare/types/zero_trust/dex/__init__.py b/src/cloudflare/types/zero_trust/dex/__init__.py index 02ea497ebd0..7262361be64 100644 --- a/src/cloudflare/types/zero_trust/dex/__init__.py +++ b/src/cloudflare/types/zero_trust/dex/__init__.py @@ -4,7 +4,6 @@ from .colo_list_params import ColoListParams as ColoListParams from .test_list_params import TestListParams as TestListParams -from .colo_list_response import ColoListResponse as ColoListResponse from .test_list_response import TestListResponse as TestListResponse from .http_test_get_params import HTTPTestGetParams as HTTPTestGetParams from .fleet_status_live_params import FleetStatusLiveParams as FleetStatusLiveParams diff --git a/src/cloudflare/types/zero_trust/dex/colo_list_response.py b/src/cloudflare/types/zero_trust/dex/colo_list_response.py deleted file mode 100644 index 87e34437735..00000000000 --- a/src/cloudflare/types/zero_trust/dex/colo_list_response.py +++ /dev/null @@ -1,7 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -__all__ = ["ColoListResponse"] - -ColoListResponse = List[object] diff --git a/src/cloudflare/types/zero_trust/dlp/__init__.py b/src/cloudflare/types/zero_trust/dlp/__init__.py index 90329580a74..5786dd444be 100644 --- a/src/cloudflare/types/zero_trust/dlp/__init__.py +++ b/src/cloudflare/types/zero_trust/dlp/__init__.py @@ -9,7 +9,6 @@ from .profile_get_response import ProfileGetResponse as ProfileGetResponse from .dataset_create_params import DatasetCreateParams as DatasetCreateParams from .dataset_update_params import DatasetUpdateParams as DatasetUpdateParams -from .profile_list_response import ProfileListResponse as ProfileListResponse from .pattern_validate_params import PatternValidateParams as PatternValidateParams from .payload_log_get_response import PayloadLogGetResponse as PayloadLogGetResponse from .pattern_validate_response import PatternValidateResponse as PatternValidateResponse diff --git a/src/cloudflare/types/zero_trust/dlp/profile_list_response.py b/src/cloudflare/types/zero_trust/dlp/profile_list_response.py deleted file mode 100644 index 453c9f2b820..00000000000 --- a/src/cloudflare/types/zero_trust/dlp/profile_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .dlp_profiles import DLPProfiles - -__all__ = ["ProfileListResponse"] - -ProfileListResponse = List[DLPProfiles] diff --git a/src/cloudflare/types/zero_trust/gateway/__init__.py b/src/cloudflare/types/zero_trust/gateway/__init__.py index a2c2796fa1a..b828b0a8432 100644 --- a/src/cloudflare/types/zero_trust/gateway/__init__.py +++ b/src/cloudflare/types/zero_trust/gateway/__init__.py @@ -4,19 +4,14 @@ from .list_edit_params import ListEditParams as ListEditParams from .list_create_params import ListCreateParams as ListCreateParams -from .list_list_response import ListListResponse as ListListResponse from .list_update_params import ListUpdateParams as ListUpdateParams from .rule_create_params import RuleCreateParams as RuleCreateParams -from .rule_list_response import RuleListResponse as RuleListResponse from .rule_update_params import RuleUpdateParams as RuleUpdateParams from .list_create_response import ListCreateResponse as ListCreateResponse from .list_delete_response import ListDeleteResponse as ListDeleteResponse from .rule_delete_response import RuleDeleteResponse as RuleDeleteResponse from .logging_update_params import LoggingUpdateParams as LoggingUpdateParams -from .app_type_list_response import AppTypeListResponse as AppTypeListResponse -from .category_list_response import CategoryListResponse as CategoryListResponse from .location_create_params import LocationCreateParams as LocationCreateParams -from .location_list_response import LocationListResponse as LocationListResponse from .location_update_params import LocationUpdateParams as LocationUpdateParams from .location_delete_response import LocationDeleteResponse as LocationDeleteResponse from .zero_trust_gateway_lists import ZeroTrustGatewayLists as ZeroTrustGatewayLists @@ -28,7 +23,6 @@ from .configuration_update_params import ConfigurationUpdateParams as ConfigurationUpdateParams from .zero_trust_gateway_settings import ZeroTrustGatewaySettings as ZeroTrustGatewaySettings from .proxy_endpoint_create_params import ProxyEndpointCreateParams as ProxyEndpointCreateParams -from .proxy_endpoint_list_response import ProxyEndpointListResponse as ProxyEndpointListResponse from .zero_trust_gateway_app_types import ZeroTrustGatewayAppTypes as ZeroTrustGatewayAppTypes from .zero_trust_gateway_locations import ZeroTrustGatewayLocations as ZeroTrustGatewayLocations from .configuration_update_response import ConfigurationUpdateResponse as ConfigurationUpdateResponse diff --git a/src/cloudflare/types/zero_trust/gateway/app_type_list_response.py b/src/cloudflare/types/zero_trust/gateway/app_type_list_response.py deleted file mode 100644 index 296c5ffcb44..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/app_type_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_gateway_app_types import ZeroTrustGatewayAppTypes - -__all__ = ["AppTypeListResponse"] - -AppTypeListResponse = List[ZeroTrustGatewayAppTypes] diff --git a/src/cloudflare/types/zero_trust/gateway/category_list_response.py b/src/cloudflare/types/zero_trust/gateway/category_list_response.py deleted file mode 100644 index 4d5d832ca96..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/category_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_gateway_categories import ZeroTrustGatewayCategories - -__all__ = ["CategoryListResponse"] - -CategoryListResponse = List[ZeroTrustGatewayCategories] diff --git a/src/cloudflare/types/zero_trust/gateway/list_list_response.py b/src/cloudflare/types/zero_trust/gateway/list_list_response.py deleted file mode 100644 index 0fcbf124bb0..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/list_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_gateway_lists import ZeroTrustGatewayLists - -__all__ = ["ListListResponse"] - -ListListResponse = List[ZeroTrustGatewayLists] diff --git a/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py b/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py index 5b0373d47e3..a1537bbcdde 100644 --- a/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py +++ b/src/cloudflare/types/zero_trust/gateway/lists/item_list_response.py @@ -15,4 +15,4 @@ class ItemListResponseItem(BaseModel): """The value of the item in a list.""" -ItemListResponse = List[List[ItemListResponseItem]] +ItemListResponse = List[ItemListResponseItem] diff --git a/src/cloudflare/types/zero_trust/gateway/location_list_response.py b/src/cloudflare/types/zero_trust/gateway/location_list_response.py deleted file mode 100644 index 8857a60393c..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/location_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_gateway_locations import ZeroTrustGatewayLocations - -__all__ = ["LocationListResponse"] - -LocationListResponse = List[ZeroTrustGatewayLocations] diff --git a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_list_response.py b/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_list_response.py deleted file mode 100644 index d5fe8f12bd6..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/proxy_endpoint_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_gateway_proxy_endpoints import ZeroTrustGatewayProxyEndpoints - -__all__ = ["ProxyEndpointListResponse"] - -ProxyEndpointListResponse = List[ZeroTrustGatewayProxyEndpoints] diff --git a/src/cloudflare/types/zero_trust/gateway/rule_list_response.py b/src/cloudflare/types/zero_trust/gateway/rule_list_response.py deleted file mode 100644 index 33bf145a3aa..00000000000 --- a/src/cloudflare/types/zero_trust/gateway/rule_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .zero_trust_gateway_rules import ZeroTrustGatewayRules - -__all__ = ["RuleListResponse"] - -RuleListResponse = List[ZeroTrustGatewayRules] diff --git a/src/cloudflare/types/zero_trust/identity_provider_list_response.py b/src/cloudflare/types/zero_trust/identity_provider_list_response.py index 20e74e5ffad..fe476a77ad3 100644 --- a/src/cloudflare/types/zero_trust/identity_provider_list_response.py +++ b/src/cloudflare/types/zero_trust/identity_provider_list_response.py @@ -7,51 +7,50 @@ __all__ = [ "IdentityProviderListResponse", - "IdentityProviderListResponseItem", - "IdentityProviderListResponseItemAccessAzureAd", - "IdentityProviderListResponseItemAccessAzureAdConfig", - "IdentityProviderListResponseItemAccessAzureAdScimConfig", - "IdentityProviderListResponseItemAccessCentrify", - "IdentityProviderListResponseItemAccessCentrifyConfig", - "IdentityProviderListResponseItemAccessCentrifyScimConfig", - "IdentityProviderListResponseItemAccessFacebook", - "IdentityProviderListResponseItemAccessFacebookConfig", - "IdentityProviderListResponseItemAccessFacebookScimConfig", - "IdentityProviderListResponseItemAccessGitHub", - "IdentityProviderListResponseItemAccessGitHubConfig", - "IdentityProviderListResponseItemAccessGitHubScimConfig", - "IdentityProviderListResponseItemAccessGoogle", - "IdentityProviderListResponseItemAccessGoogleConfig", - "IdentityProviderListResponseItemAccessGoogleScimConfig", - "IdentityProviderListResponseItemAccessGoogleApps", - "IdentityProviderListResponseItemAccessGoogleAppsConfig", - "IdentityProviderListResponseItemAccessGoogleAppsScimConfig", - "IdentityProviderListResponseItemAccessLinkedin", - "IdentityProviderListResponseItemAccessLinkedinConfig", - "IdentityProviderListResponseItemAccessLinkedinScimConfig", - "IdentityProviderListResponseItemAccessOidc", - "IdentityProviderListResponseItemAccessOidcConfig", - "IdentityProviderListResponseItemAccessOidcScimConfig", - "IdentityProviderListResponseItemAccessOkta", - "IdentityProviderListResponseItemAccessOktaConfig", - "IdentityProviderListResponseItemAccessOktaScimConfig", - "IdentityProviderListResponseItemAccessOnelogin", - "IdentityProviderListResponseItemAccessOneloginConfig", - "IdentityProviderListResponseItemAccessOneloginScimConfig", - "IdentityProviderListResponseItemAccessPingone", - "IdentityProviderListResponseItemAccessPingoneConfig", - "IdentityProviderListResponseItemAccessPingoneScimConfig", - "IdentityProviderListResponseItemAccessSaml", - "IdentityProviderListResponseItemAccessSamlConfig", - "IdentityProviderListResponseItemAccessSamlConfigHeaderAttribute", - "IdentityProviderListResponseItemAccessSamlScimConfig", - "IdentityProviderListResponseItemAccessYandex", - "IdentityProviderListResponseItemAccessYandexConfig", - "IdentityProviderListResponseItemAccessYandexScimConfig", + "AccessAzureAd", + "AccessAzureAdConfig", + "AccessAzureAdScimConfig", + "AccessCentrify", + "AccessCentrifyConfig", + "AccessCentrifyScimConfig", + "AccessFacebook", + "AccessFacebookConfig", + "AccessFacebookScimConfig", + "AccessGitHub", + "AccessGitHubConfig", + "AccessGitHubScimConfig", + "AccessGoogle", + "AccessGoogleConfig", + "AccessGoogleScimConfig", + "AccessGoogleApps", + "AccessGoogleAppsConfig", + "AccessGoogleAppsScimConfig", + "AccessLinkedin", + "AccessLinkedinConfig", + "AccessLinkedinScimConfig", + "AccessOidc", + "AccessOidcConfig", + "AccessOidcScimConfig", + "AccessOkta", + "AccessOktaConfig", + "AccessOktaScimConfig", + "AccessOnelogin", + "AccessOneloginConfig", + "AccessOneloginScimConfig", + "AccessPingone", + "AccessPingoneConfig", + "AccessPingoneScimConfig", + "AccessSaml", + "AccessSamlConfig", + "AccessSamlConfigHeaderAttribute", + "AccessSamlScimConfig", + "AccessYandex", + "AccessYandexConfig", + "AccessYandexScimConfig", ] -class IdentityProviderListResponseItemAccessAzureAdConfig(BaseModel): +class AccessAzureAdConfig(BaseModel): claims: Optional[List[str]] = None """Custom claims""" @@ -87,7 +86,7 @@ class IdentityProviderListResponseItemAccessAzureAdConfig(BaseModel): """Should Cloudflare try to load groups from your account""" -class IdentityProviderListResponseItemAccessAzureAdScimConfig(BaseModel): +class AccessAzureAdScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -119,8 +118,8 @@ class IdentityProviderListResponseItemAccessAzureAdScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessAzureAd(BaseModel): - config: IdentityProviderListResponseItemAccessAzureAdConfig +class AccessAzureAd(BaseModel): + config: AccessAzureAdConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -155,14 +154,14 @@ class IdentityProviderListResponseItemAccessAzureAd(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessAzureAdScimConfig] = None + scim_config: Optional[AccessAzureAdScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessCentrifyConfig(BaseModel): +class AccessCentrifyConfig(BaseModel): centrify_account: Optional[str] = None """Your centrify account url""" @@ -182,7 +181,7 @@ class IdentityProviderListResponseItemAccessCentrifyConfig(BaseModel): """The claim name for email in the id_token response.""" -class IdentityProviderListResponseItemAccessCentrifyScimConfig(BaseModel): +class AccessCentrifyScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -214,8 +213,8 @@ class IdentityProviderListResponseItemAccessCentrifyScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessCentrify(BaseModel): - config: IdentityProviderListResponseItemAccessCentrifyConfig +class AccessCentrify(BaseModel): + config: AccessCentrifyConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -250,14 +249,14 @@ class IdentityProviderListResponseItemAccessCentrify(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessCentrifyScimConfig] = None + scim_config: Optional[AccessCentrifyScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessFacebookConfig(BaseModel): +class AccessFacebookConfig(BaseModel): client_id: Optional[str] = None """Your OAuth Client ID""" @@ -265,7 +264,7 @@ class IdentityProviderListResponseItemAccessFacebookConfig(BaseModel): """Your OAuth Client Secret""" -class IdentityProviderListResponseItemAccessFacebookScimConfig(BaseModel): +class AccessFacebookScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -297,8 +296,8 @@ class IdentityProviderListResponseItemAccessFacebookScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessFacebook(BaseModel): - config: IdentityProviderListResponseItemAccessFacebookConfig +class AccessFacebook(BaseModel): + config: AccessFacebookConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -333,14 +332,14 @@ class IdentityProviderListResponseItemAccessFacebook(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessFacebookScimConfig] = None + scim_config: Optional[AccessFacebookScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessGitHubConfig(BaseModel): +class AccessGitHubConfig(BaseModel): client_id: Optional[str] = None """Your OAuth Client ID""" @@ -348,7 +347,7 @@ class IdentityProviderListResponseItemAccessGitHubConfig(BaseModel): """Your OAuth Client Secret""" -class IdentityProviderListResponseItemAccessGitHubScimConfig(BaseModel): +class AccessGitHubScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -380,8 +379,8 @@ class IdentityProviderListResponseItemAccessGitHubScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessGitHub(BaseModel): - config: IdentityProviderListResponseItemAccessGitHubConfig +class AccessGitHub(BaseModel): + config: AccessGitHubConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -416,14 +415,14 @@ class IdentityProviderListResponseItemAccessGitHub(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessGitHubScimConfig] = None + scim_config: Optional[AccessGitHubScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessGoogleConfig(BaseModel): +class AccessGoogleConfig(BaseModel): claims: Optional[List[str]] = None """Custom claims""" @@ -437,7 +436,7 @@ class IdentityProviderListResponseItemAccessGoogleConfig(BaseModel): """The claim name for email in the id_token response.""" -class IdentityProviderListResponseItemAccessGoogleScimConfig(BaseModel): +class AccessGoogleScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -469,8 +468,8 @@ class IdentityProviderListResponseItemAccessGoogleScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessGoogle(BaseModel): - config: IdentityProviderListResponseItemAccessGoogleConfig +class AccessGoogle(BaseModel): + config: AccessGoogleConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -505,14 +504,14 @@ class IdentityProviderListResponseItemAccessGoogle(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessGoogleScimConfig] = None + scim_config: Optional[AccessGoogleScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessGoogleAppsConfig(BaseModel): +class AccessGoogleAppsConfig(BaseModel): apps_domain: Optional[str] = None """Your companies TLD""" @@ -529,7 +528,7 @@ class IdentityProviderListResponseItemAccessGoogleAppsConfig(BaseModel): """The claim name for email in the id_token response.""" -class IdentityProviderListResponseItemAccessGoogleAppsScimConfig(BaseModel): +class AccessGoogleAppsScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -561,8 +560,8 @@ class IdentityProviderListResponseItemAccessGoogleAppsScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessGoogleApps(BaseModel): - config: IdentityProviderListResponseItemAccessGoogleAppsConfig +class AccessGoogleApps(BaseModel): + config: AccessGoogleAppsConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -597,14 +596,14 @@ class IdentityProviderListResponseItemAccessGoogleApps(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessGoogleAppsScimConfig] = None + scim_config: Optional[AccessGoogleAppsScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessLinkedinConfig(BaseModel): +class AccessLinkedinConfig(BaseModel): client_id: Optional[str] = None """Your OAuth Client ID""" @@ -612,7 +611,7 @@ class IdentityProviderListResponseItemAccessLinkedinConfig(BaseModel): """Your OAuth Client Secret""" -class IdentityProviderListResponseItemAccessLinkedinScimConfig(BaseModel): +class AccessLinkedinScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -644,8 +643,8 @@ class IdentityProviderListResponseItemAccessLinkedinScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessLinkedin(BaseModel): - config: IdentityProviderListResponseItemAccessLinkedinConfig +class AccessLinkedin(BaseModel): + config: AccessLinkedinConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -680,14 +679,14 @@ class IdentityProviderListResponseItemAccessLinkedin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessLinkedinScimConfig] = None + scim_config: Optional[AccessLinkedinScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessOidcConfig(BaseModel): +class AccessOidcConfig(BaseModel): auth_url: Optional[str] = None """The authorization_endpoint URL of your IdP""" @@ -713,7 +712,7 @@ class IdentityProviderListResponseItemAccessOidcConfig(BaseModel): """The token_endpoint URL of your IdP""" -class IdentityProviderListResponseItemAccessOidcScimConfig(BaseModel): +class AccessOidcScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -745,8 +744,8 @@ class IdentityProviderListResponseItemAccessOidcScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessOidc(BaseModel): - config: IdentityProviderListResponseItemAccessOidcConfig +class AccessOidc(BaseModel): + config: AccessOidcConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -781,14 +780,14 @@ class IdentityProviderListResponseItemAccessOidc(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessOidcScimConfig] = None + scim_config: Optional[AccessOidcScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessOktaConfig(BaseModel): +class AccessOktaConfig(BaseModel): authorization_server_id: Optional[str] = None """Your okta authorization server id""" @@ -808,7 +807,7 @@ class IdentityProviderListResponseItemAccessOktaConfig(BaseModel): """Your okta account url""" -class IdentityProviderListResponseItemAccessOktaScimConfig(BaseModel): +class AccessOktaScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -840,8 +839,8 @@ class IdentityProviderListResponseItemAccessOktaScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessOkta(BaseModel): - config: IdentityProviderListResponseItemAccessOktaConfig +class AccessOkta(BaseModel): + config: AccessOktaConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -876,14 +875,14 @@ class IdentityProviderListResponseItemAccessOkta(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessOktaScimConfig] = None + scim_config: Optional[AccessOktaScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessOneloginConfig(BaseModel): +class AccessOneloginConfig(BaseModel): claims: Optional[List[str]] = None """Custom claims""" @@ -900,7 +899,7 @@ class IdentityProviderListResponseItemAccessOneloginConfig(BaseModel): """Your OneLogin account url""" -class IdentityProviderListResponseItemAccessOneloginScimConfig(BaseModel): +class AccessOneloginScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -932,8 +931,8 @@ class IdentityProviderListResponseItemAccessOneloginScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessOnelogin(BaseModel): - config: IdentityProviderListResponseItemAccessOneloginConfig +class AccessOnelogin(BaseModel): + config: AccessOneloginConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -968,14 +967,14 @@ class IdentityProviderListResponseItemAccessOnelogin(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessOneloginScimConfig] = None + scim_config: Optional[AccessOneloginScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessPingoneConfig(BaseModel): +class AccessPingoneConfig(BaseModel): claims: Optional[List[str]] = None """Custom claims""" @@ -992,7 +991,7 @@ class IdentityProviderListResponseItemAccessPingoneConfig(BaseModel): """Your PingOne environment identifier""" -class IdentityProviderListResponseItemAccessPingoneScimConfig(BaseModel): +class AccessPingoneScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -1024,8 +1023,8 @@ class IdentityProviderListResponseItemAccessPingoneScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessPingone(BaseModel): - config: IdentityProviderListResponseItemAccessPingoneConfig +class AccessPingone(BaseModel): + config: AccessPingoneConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1060,14 +1059,14 @@ class IdentityProviderListResponseItemAccessPingone(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessPingoneScimConfig] = None + scim_config: Optional[AccessPingoneScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessSamlConfigHeaderAttribute(BaseModel): +class AccessSamlConfigHeaderAttribute(BaseModel): attribute_name: Optional[str] = None """attribute name from the IDP""" @@ -1075,7 +1074,7 @@ class IdentityProviderListResponseItemAccessSamlConfigHeaderAttribute(BaseModel) """header that will be added on the request to the origin""" -class IdentityProviderListResponseItemAccessSamlConfig(BaseModel): +class AccessSamlConfig(BaseModel): attributes: Optional[List[str]] = None """ A list of SAML attribute names that will be added to your signed JWT token and @@ -1085,7 +1084,7 @@ class IdentityProviderListResponseItemAccessSamlConfig(BaseModel): email_attribute_name: Optional[str] = None """The attribute name for email in the SAML response.""" - header_attributes: Optional[List[IdentityProviderListResponseItemAccessSamlConfigHeaderAttribute]] = None + header_attributes: Optional[List[AccessSamlConfigHeaderAttribute]] = None """ Add a list of attribute names that will be returned in the response header from the Access callback. @@ -1107,7 +1106,7 @@ class IdentityProviderListResponseItemAccessSamlConfig(BaseModel): """URL to send the SAML authentication requests to""" -class IdentityProviderListResponseItemAccessSamlScimConfig(BaseModel): +class AccessSamlScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -1139,8 +1138,8 @@ class IdentityProviderListResponseItemAccessSamlScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessSaml(BaseModel): - config: IdentityProviderListResponseItemAccessSamlConfig +class AccessSaml(BaseModel): + config: AccessSamlConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1175,14 +1174,14 @@ class IdentityProviderListResponseItemAccessSaml(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessSamlScimConfig] = None + scim_config: Optional[AccessSamlScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -class IdentityProviderListResponseItemAccessYandexConfig(BaseModel): +class AccessYandexConfig(BaseModel): client_id: Optional[str] = None """Your OAuth Client ID""" @@ -1190,7 +1189,7 @@ class IdentityProviderListResponseItemAccessYandexConfig(BaseModel): """Your OAuth Client Secret""" -class IdentityProviderListResponseItemAccessYandexScimConfig(BaseModel): +class AccessYandexScimConfig(BaseModel): enabled: Optional[bool] = None """A flag to enable or disable SCIM for the identity provider.""" @@ -1222,8 +1221,8 @@ class IdentityProviderListResponseItemAccessYandexScimConfig(BaseModel): """ -class IdentityProviderListResponseItemAccessYandex(BaseModel): - config: IdentityProviderListResponseItemAccessYandexConfig +class AccessYandex(BaseModel): + config: AccessYandexConfig """The configuration parameters for the identity provider. To view the required parameters for a specific provider, refer to our @@ -1258,27 +1257,25 @@ class IdentityProviderListResponseItemAccessYandex(BaseModel): id: Optional[str] = None """UUID""" - scim_config: Optional[IdentityProviderListResponseItemAccessYandexScimConfig] = None + scim_config: Optional[AccessYandexScimConfig] = None """ The configuration settings for enabling a System for Cross-Domain Identity Management (SCIM) with the identity provider. """ -IdentityProviderListResponseItem = Union[ - IdentityProviderListResponseItemAccessAzureAd, - IdentityProviderListResponseItemAccessCentrify, - IdentityProviderListResponseItemAccessFacebook, - IdentityProviderListResponseItemAccessGitHub, - IdentityProviderListResponseItemAccessGoogle, - IdentityProviderListResponseItemAccessGoogleApps, - IdentityProviderListResponseItemAccessLinkedin, - IdentityProviderListResponseItemAccessOidc, - IdentityProviderListResponseItemAccessOkta, - IdentityProviderListResponseItemAccessOnelogin, - IdentityProviderListResponseItemAccessPingone, - IdentityProviderListResponseItemAccessSaml, - IdentityProviderListResponseItemAccessYandex, +IdentityProviderListResponse = Union[ + AccessAzureAd, + AccessCentrify, + AccessFacebook, + AccessGitHub, + AccessGoogle, + AccessGoogleApps, + AccessLinkedin, + AccessOidc, + AccessOkta, + AccessOnelogin, + AccessPingone, + AccessSaml, + AccessYandex, ] - -IdentityProviderListResponse = List[IdentityProviderListResponseItem] diff --git a/src/cloudflare/types/zero_trust/networks/__init__.py b/src/cloudflare/types/zero_trust/networks/__init__.py index cb21ec98a51..09faf7e0596 100644 --- a/src/cloudflare/types/zero_trust/networks/__init__.py +++ b/src/cloudflare/types/zero_trust/networks/__init__.py @@ -12,6 +12,5 @@ from .virtual_network_list_params import VirtualNetworkListParams as VirtualNetworkListParams from .virtual_network_create_params import VirtualNetworkCreateParams as VirtualNetworkCreateParams from .virtual_network_edit_response import VirtualNetworkEditResponse as VirtualNetworkEditResponse -from .virtual_network_list_response import VirtualNetworkListResponse as VirtualNetworkListResponse from .virtual_network_create_response import VirtualNetworkCreateResponse as VirtualNetworkCreateResponse from .virtual_network_delete_response import VirtualNetworkDeleteResponse as VirtualNetworkDeleteResponse diff --git a/src/cloudflare/types/zero_trust/networks/virtual_network_list_response.py b/src/cloudflare/types/zero_trust/networks/virtual_network_list_response.py deleted file mode 100644 index c0f9137a410..00000000000 --- a/src/cloudflare/types/zero_trust/networks/virtual_network_list_response.py +++ /dev/null @@ -1,9 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List - -from .tunnel_virtual_network import TunnelVirtualNetwork - -__all__ = ["VirtualNetworkListResponse"] - -VirtualNetworkListResponse = List[TunnelVirtualNetwork] diff --git a/src/cloudflare/types/zones/subscription_list_response.py b/src/cloudflare/types/zones/subscription_list_response.py index 347713570d5..7ba0172a53f 100644 --- a/src/cloudflare/types/zones/subscription_list_response.py +++ b/src/cloudflare/types/zones/subscription_list_response.py @@ -6,22 +6,15 @@ from ..._models import BaseModel -__all__ = [ - "SubscriptionListResponse", - "SubscriptionListResponseItem", - "SubscriptionListResponseItemApp", - "SubscriptionListResponseItemComponentValue", - "SubscriptionListResponseItemRatePlan", - "SubscriptionListResponseItemZone", -] +__all__ = ["SubscriptionListResponse", "App", "ComponentValue", "RatePlan", "Zone"] -class SubscriptionListResponseItemApp(BaseModel): +class App(BaseModel): install_id: Optional[str] = None """app install id.""" -class SubscriptionListResponseItemComponentValue(BaseModel): +class ComponentValue(BaseModel): default: Optional[float] = None """The default amount assigned.""" @@ -35,7 +28,7 @@ class SubscriptionListResponseItemComponentValue(BaseModel): """The amount of the component value assigned.""" -class SubscriptionListResponseItemRatePlan(BaseModel): +class RatePlan(BaseModel): id: Optional[str] = None """The ID of the rate plan.""" @@ -58,7 +51,7 @@ class SubscriptionListResponseItemRatePlan(BaseModel): """The list of sets this rate plan applies to.""" -class SubscriptionListResponseItemZone(BaseModel): +class Zone(BaseModel): id: Optional[str] = None """Identifier""" @@ -66,13 +59,13 @@ class SubscriptionListResponseItemZone(BaseModel): """The domain name""" -class SubscriptionListResponseItem(BaseModel): +class SubscriptionListResponse(BaseModel): id: Optional[str] = None """Subscription identifier tag.""" - app: Optional[SubscriptionListResponseItemApp] = None + app: Optional[App] = None - component_values: Optional[List[SubscriptionListResponseItemComponentValue]] = None + component_values: Optional[List[ComponentValue]] = None """The list of add-ons subscribed to.""" currency: Optional[str] = None @@ -93,14 +86,11 @@ class SubscriptionListResponseItem(BaseModel): price: Optional[float] = None """The price of the subscription that will be billed, in US dollars.""" - rate_plan: Optional[SubscriptionListResponseItemRatePlan] = None + rate_plan: Optional[RatePlan] = None """The rate plan applied to the subscription.""" state: Optional[Literal["Trial", "Provisioned", "Paid", "AwaitingPayment", "Cancelled", "Failed", "Expired"]] = None """The state that the subscription is in.""" - zone: Optional[SubscriptionListResponseItemZone] = None + zone: Optional[Zone] = None """A simple zone object. May have null properties if not a zone subscription.""" - - -SubscriptionListResponse = List[SubscriptionListResponseItem] diff --git a/tests/api_resources/accounts/test_roles.py b/tests/api_resources/accounts/test_roles.py index 2d8a3fd00a6..53121acc6ff 100644 --- a/tests/api_resources/accounts/test_roles.py +++ b/tests/api_resources/accounts/test_roles.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.accounts import RoleGetResponse, RoleListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.accounts import Role, RoleGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: role = client.accounts.roles.list( account_id={}, ) - assert_matches_type(Optional[RoleListResponse], role, path=["response"]) + assert_matches_type(SyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(Optional[RoleListResponse], role, path=["response"]) + assert_matches_type(SyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = response.parse() - assert_matches_type(Optional[RoleListResponse], role, path=["response"]) + assert_matches_type(SyncSinglePage[Role], role, path=["response"]) assert cast(Any, response.is_closed) is True @@ -98,7 +99,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: role = await async_client.accounts.roles.list( account_id={}, ) - assert_matches_type(Optional[RoleListResponse], role, path=["response"]) + assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +111,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(Optional[RoleListResponse], role, path=["response"]) + assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +123,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" role = await response.parse() - assert_matches_type(Optional[RoleListResponse], role, path=["response"]) + assert_matches_type(AsyncSinglePage[Role], role, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py b/tests/api_resources/addressing/prefixes/bgp/test_bindings.py index 7420ef870fd..d73e8c6eb13 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_bindings.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_bindings.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.addressing.prefixes.bgp import ( - BindingListResponse, BindingDeleteResponse, AddressingServiceBinding, ) @@ -91,7 +91,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BindingListResponse, binding, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -104,7 +104,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(BindingListResponse, binding, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +117,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = response.parse() - assert_matches_type(BindingListResponse, binding, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -338,7 +338,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(BindingListResponse, binding, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -351,7 +351,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(BindingListResponse, binding, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingServiceBinding], binding, path=["response"]) @pytest.mark.skip() @parametrize @@ -364,7 +364,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" binding = await response.parse() - assert_matches_type(BindingListResponse, binding, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingServiceBinding], binding, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py b/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py index 6aed448b745..48beb73c29d 100644 --- a/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py +++ b/tests/api_resources/addressing/prefixes/bgp/test_prefixes.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.addressing.prefixes.bgp import PrefixListResponse, AddressingIpamBGPPrefixes +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.addressing.prefixes.bgp import AddressingIpamBGPPrefixes base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +38,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +51,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -219,7 +220,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -232,7 +233,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -245,7 +246,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamBGPPrefixes], prefix, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/prefixes/test_delegations.py b/tests/api_resources/addressing/prefixes/test_delegations.py index 802f8cdf07a..a915d91accc 100644 --- a/tests/api_resources/addressing/prefixes/test_delegations.py +++ b/tests/api_resources/addressing/prefixes/test_delegations.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.addressing.prefixes import ( - DelegationListResponse, DelegationDeleteResponse, AddressingIpamDelegations, ) @@ -90,7 +90,7 @@ def test_method_list(self, client: Cloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DelegationListResponse], delegation, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -103,7 +103,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(Optional[DelegationListResponse], delegation, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -116,7 +116,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = response.parse() - assert_matches_type(Optional[DelegationListResponse], delegation, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True @@ -272,7 +272,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DelegationListResponse], delegation, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +285,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(Optional[DelegationListResponse], delegation, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +298,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" delegation = await response.parse() - assert_matches_type(Optional[DelegationListResponse], delegation, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamDelegations], delegation, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_address_maps.py b/tests/api_resources/addressing/test_address_maps.py index df1b21e2e9c..d45b35475fd 100644 --- a/tests/api_resources/addressing/test_address_maps.py +++ b/tests/api_resources/addressing/test_address_maps.py @@ -9,10 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.addressing import ( AddressingAddressMaps, AddressMapGetResponse, - AddressMapListResponse, AddressMapCreateResponse, AddressMapDeleteResponse, ) @@ -81,7 +81,7 @@ def test_method_list(self, client: Cloudflare) -> None: address_map = client.addressing.address_maps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[AddressMapListResponse], address_map, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(Optional[AddressMapListResponse], address_map, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +105,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = response.parse() - assert_matches_type(Optional[AddressMapListResponse], address_map, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) assert cast(Any, response.is_closed) is True @@ -347,7 +347,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: address_map = await async_client.addressing.address_maps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[AddressMapListResponse], address_map, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -359,7 +359,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(Optional[AddressMapListResponse], address_map, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) @pytest.mark.skip() @parametrize @@ -371,7 +371,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" address_map = await response.parse() - assert_matches_type(Optional[AddressMapListResponse], address_map, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingAddressMaps], address_map, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_prefixes.py b/tests/api_resources/addressing/test_prefixes.py index 1868c45271f..a77715e5a73 100644 --- a/tests/api_resources/addressing/test_prefixes.py +++ b/tests/api_resources/addressing/test_prefixes.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.addressing import ( - PrefixListResponse, PrefixDeleteResponse, AddressingIpamPrefixes, ) @@ -81,7 +81,7 @@ def test_method_list(self, client: Cloudflare) -> None: prefix = client.addressing.prefixes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +93,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +105,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(SyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) assert cast(Any, response.is_closed) is True @@ -342,7 +342,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: prefix = await async_client.addressing.prefixes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -354,7 +354,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) @pytest.mark.skip() @parametrize @@ -366,7 +366,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" prefix = await response.parse() - assert_matches_type(Optional[PrefixListResponse], prefix, path=["response"]) + assert_matches_type(AsyncSinglePage[AddressingIpamPrefixes], prefix, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/addressing/test_services.py b/tests/api_resources/addressing/test_services.py index b9a5e22b345..bab9eef74b0 100644 --- a/tests/api_resources/addressing/test_services.py +++ b/tests/api_resources/addressing/test_services.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.addressing import ServiceListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: service = client.addressing.services.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceListResponse, service, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceListResponse], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceListResponse], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) + assert_matches_type(SyncSinglePage[ServiceListResponse], service, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: service = await async_client.addressing.services.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ServiceListResponse, service, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceListResponse], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = await response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceListResponse], service, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" service = await response.parse() - assert_matches_type(ServiceListResponse, service, path=["response"]) + assert_matches_type(AsyncSinglePage[ServiceListResponse], service, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/alerting/destinations/test_webhooks.py b/tests/api_resources/alerting/destinations/test_webhooks.py index e6875cc2835..315b3c36ea4 100644 --- a/tests/api_resources/alerting/destinations/test_webhooks.py +++ b/tests/api_resources/alerting/destinations/test_webhooks.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.alerting.destinations import ( AlertingWebhooks, - WebhookListResponse, WebhookCreateResponse, WebhookDeleteResponse, WebhookUpdateResponse, @@ -164,7 +164,7 @@ def test_method_list(self, client: Cloudflare) -> None: webhook = client.alerting.destinations.webhooks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WebhookListResponse], webhook, path=["response"]) + assert_matches_type(SyncSinglePage[AlertingWebhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +176,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(Optional[WebhookListResponse], webhook, path=["response"]) + assert_matches_type(SyncSinglePage[AlertingWebhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -188,7 +188,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = response.parse() - assert_matches_type(Optional[WebhookListResponse], webhook, path=["response"]) + assert_matches_type(SyncSinglePage[AlertingWebhooks], webhook, path=["response"]) assert cast(Any, response.is_closed) is True @@ -449,7 +449,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: webhook = await async_client.alerting.destinations.webhooks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WebhookListResponse], webhook, path=["response"]) + assert_matches_type(AsyncSinglePage[AlertingWebhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +461,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(Optional[WebhookListResponse], webhook, path=["response"]) + assert_matches_type(AsyncSinglePage[AlertingWebhooks], webhook, path=["response"]) @pytest.mark.skip() @parametrize @@ -473,7 +473,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" webhook = await response.parse() - assert_matches_type(Optional[WebhookListResponse], webhook, path=["response"]) + assert_matches_type(AsyncSinglePage[AlertingWebhooks], webhook, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/alerting/test_policies.py b/tests/api_resources/alerting/test_policies.py index a186b043a67..3668367e996 100644 --- a/tests/api_resources/alerting/test_policies.py +++ b/tests/api_resources/alerting/test_policies.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.alerting import ( AlertingPolicies, - PolicyListResponse, PolicyCreateResponse, PolicyDeleteResponse, PolicyUpdateResponse, @@ -274,7 +274,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.alerting.policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -286,7 +286,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +298,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[AlertingPolicies], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -669,7 +669,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: policy = await async_client.alerting.policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -681,7 +681,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -693,7 +693,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[AlertingPolicies], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/durable_objects/test_namespaces.py b/tests/api_resources/durable_objects/test_namespaces.py index c2fabb9447c..75327428664 100644 --- a/tests/api_resources/durable_objects/test_namespaces.py +++ b/tests/api_resources/durable_objects/test_namespaces.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.durable_objects import NamespaceListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.durable_objects import DurableObjectNamespace base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: namespace = client.durable_objects.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[NamespaceListResponse], namespace, path=["response"]) + assert_matches_type(SyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(Optional[NamespaceListResponse], namespace, path=["response"]) + assert_matches_type(SyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(Optional[NamespaceListResponse], namespace, path=["response"]) + assert_matches_type(SyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: namespace = await async_client.durable_objects.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[NamespaceListResponse], namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(Optional[NamespaceListResponse], namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(Optional[NamespaceListResponse], namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[DurableObjectNamespace], namespace, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/hyperdrive/test_configs.py b/tests/api_resources/hyperdrive/test_configs.py index 00fe83e9b0a..5871ea95f2f 100644 --- a/tests/api_resources/hyperdrive/test_configs.py +++ b/tests/api_resources/hyperdrive/test_configs.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.hyperdrive import ( ConfigGetResponse, ConfigEditResponse, @@ -133,7 +134,7 @@ def test_method_list(self, client: Cloudflare) -> None: config = client.hyperdrive.configs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ConfigListResponse, config, path=["response"]) + assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -145,7 +146,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(ConfigListResponse, config, path=["response"]) + assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -157,7 +158,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = response.parse() - assert_matches_type(ConfigListResponse, config, path=["response"]) + assert_matches_type(SyncSinglePage[ConfigListResponse], config, path=["response"]) assert cast(Any, response.is_closed) is True @@ -448,7 +449,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: config = await async_client.hyperdrive.configs.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ConfigListResponse, config, path=["response"]) + assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -460,7 +461,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(ConfigListResponse, config, path=["response"]) + assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"]) @pytest.mark.skip() @parametrize @@ -472,7 +473,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" config = await response.parse() - assert_matches_type(ConfigListResponse, config, path=["response"]) + assert_matches_type(AsyncSinglePage[ConfigListResponse], config, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_indicator_feeds.py b/tests/api_resources/intel/test_indicator_feeds.py index ad28b0440fe..956f15c0233 100644 --- a/tests/api_resources/intel/test_indicator_feeds.py +++ b/tests/api_resources/intel/test_indicator_feeds.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.intel import ( IndicatorFeedGetResponse, IndicatorFeedListResponse, @@ -136,7 +137,7 @@ def test_method_list(self, client: Cloudflare) -> None: indicator_feed = client.intel.indicator_feeds.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndicatorFeedListResponse, indicator_feed, path=["response"]) + assert_matches_type(SyncSinglePage[IndicatorFeedListResponse], indicator_feed, path=["response"]) @pytest.mark.skip() @parametrize @@ -148,7 +149,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" indicator_feed = response.parse() - assert_matches_type(IndicatorFeedListResponse, indicator_feed, path=["response"]) + assert_matches_type(SyncSinglePage[IndicatorFeedListResponse], indicator_feed, path=["response"]) @pytest.mark.skip() @parametrize @@ -160,7 +161,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" indicator_feed = response.parse() - assert_matches_type(IndicatorFeedListResponse, indicator_feed, path=["response"]) + assert_matches_type(SyncSinglePage[IndicatorFeedListResponse], indicator_feed, path=["response"]) assert cast(Any, response.is_closed) is True @@ -382,7 +383,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: indicator_feed = await async_client.intel.indicator_feeds.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndicatorFeedListResponse, indicator_feed, path=["response"]) + assert_matches_type(AsyncSinglePage[IndicatorFeedListResponse], indicator_feed, path=["response"]) @pytest.mark.skip() @parametrize @@ -394,7 +395,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" indicator_feed = await response.parse() - assert_matches_type(IndicatorFeedListResponse, indicator_feed, path=["response"]) + assert_matches_type(AsyncSinglePage[IndicatorFeedListResponse], indicator_feed, path=["response"]) @pytest.mark.skip() @parametrize @@ -406,7 +407,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" indicator_feed = await response.parse() - assert_matches_type(IndicatorFeedListResponse, indicator_feed, path=["response"]) + assert_matches_type(AsyncSinglePage[IndicatorFeedListResponse], indicator_feed, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/intel/test_sinkholes.py b/tests/api_resources/intel/test_sinkholes.py index 21f61ff3a9b..7486df7c274 100644 --- a/tests/api_resources/intel/test_sinkholes.py +++ b/tests/api_resources/intel/test_sinkholes.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.intel import SinkholeListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.intel import IntelSinkholeItem base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: sinkhole = client.intel.sinkholes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SinkholeListResponse, sinkhole, path=["response"]) + assert_matches_type(SyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = response.parse() - assert_matches_type(SinkholeListResponse, sinkhole, path=["response"]) + assert_matches_type(SyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = response.parse() - assert_matches_type(SinkholeListResponse, sinkhole, path=["response"]) + assert_matches_type(SyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: sinkhole = await async_client.intel.sinkholes.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SinkholeListResponse, sinkhole, path=["response"]) + assert_matches_type(AsyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = await response.parse() - assert_matches_type(SinkholeListResponse, sinkhole, path=["response"]) + assert_matches_type(AsyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" sinkhole = await response.parse() - assert_matches_type(SinkholeListResponse, sinkhole, path=["response"]) + assert_matches_type(AsyncSinglePage[IntelSinkholeItem], sinkhole, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/load_balancers/test_monitors.py b/tests/api_resources/load_balancers/test_monitors.py index 0e3f9490ccd..3fb7491a8c8 100644 --- a/tests/api_resources/load_balancers/test_monitors.py +++ b/tests/api_resources/load_balancers/test_monitors.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.load_balancers import ( - MonitorListResponse, MonitorDeleteResponse, ) from cloudflare.types.user.load_balancers import LoadBalancingMonitor @@ -185,7 +185,7 @@ def test_method_list(self, client: Cloudflare) -> None: monitor = client.load_balancers.monitors.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +197,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -209,7 +209,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -578,7 +578,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: monitor = await async_client.load_balancers.monitors.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -590,7 +590,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -602,7 +602,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/load_balancers/test_pools.py b/tests/api_resources/load_balancers/test_pools.py index 1f7bc7482ee..ee970e0cc7e 100644 --- a/tests/api_resources/load_balancers/test_pools.py +++ b/tests/api_resources/load_balancers/test_pools.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.load_balancers import ( - PoolListResponse, PoolDeleteResponse, ) from cloudflare.types.user.load_balancers import LoadBalancingPool @@ -259,7 +259,7 @@ def test_method_list(self, client: Cloudflare) -> None: pool = client.load_balancers.pools.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -268,7 +268,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", monitor={}, ) - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -280,7 +280,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -292,7 +292,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -763,7 +763,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: pool = await async_client.load_balancers.pools.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -772,7 +772,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", monitor={}, ) - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -784,7 +784,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -796,7 +796,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/logpush/test_jobs.py b/tests/api_resources/logpush/test_jobs.py index d0d382b8fe1..a8239d273d1 100644 --- a/tests/api_resources/logpush/test_jobs.py +++ b/tests/api_resources/logpush/test_jobs.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.logpush import JobListResponse, JobDeleteResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.logpush import JobDeleteResponse from cloudflare.types.logpush.datasets import LogpushJob base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -198,7 +199,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncSinglePage[Optional[LogpushJob]], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -207,7 +208,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncSinglePage[Optional[LogpushJob]], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -220,7 +221,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncSinglePage[Optional[LogpushJob]], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(SyncSinglePage[Optional[LogpushJob]], job, path=["response"]) assert cast(Any, response.is_closed) is True @@ -570,7 +571,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncSinglePage[Optional[LogpushJob]], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -579,7 +580,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncSinglePage[Optional[LogpushJob]], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -592,7 +593,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncSinglePage[Optional[LogpushJob]], job, path=["response"]) @pytest.mark.skip() @parametrize @@ -605,7 +606,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" job = await response.parse() - assert_matches_type(JobListResponse, job, path=["response"]) + assert_matches_type(AsyncSinglePage[Optional[LogpushJob]], job, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/magic_network_monitoring/test_rules.py b/tests/api_resources/magic_network_monitoring/test_rules.py index fde54d8a3f9..f5002da51fa 100644 --- a/tests/api_resources/magic_network_monitoring/test_rules.py +++ b/tests/api_resources/magic_network_monitoring/test_rules.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.magic_network_monitoring import RuleListResponse, MagicNetworkMonitoringRule +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.magic_network_monitoring import MagicNetworkMonitoringRule base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -107,7 +108,7 @@ def test_method_list(self, client: Cloudflare) -> None: rule = client.magic_network_monitoring.rules.list( account_id="6f91088a406011ed95aed352566e8d4c", ) - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[Optional[MagicNetworkMonitoringRule]], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -119,7 +120,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[Optional[MagicNetworkMonitoringRule]], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -131,7 +132,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[Optional[MagicNetworkMonitoringRule]], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -393,7 +394,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.magic_network_monitoring.rules.list( account_id="6f91088a406011ed95aed352566e8d4c", ) - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[Optional[MagicNetworkMonitoringRule]], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -405,7 +406,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[Optional[MagicNetworkMonitoringRule]], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,7 +418,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[Optional[MagicNetworkMonitoringRule]], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py b/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py index e4b70f13e45..dbbd7ee9e78 100644 --- a/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py +++ b/tests/api_resources/origin_tls_client_auth/hostnames/test_certificates.py @@ -3,16 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.origin_tls_client_auth.hostnames import ( - CertificateListResponse, - OriginTLSClientCertificate, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.origin_tls_client_auth import OriginTLSClientCertificateID +from cloudflare.types.origin_tls_client_auth.hostnames import OriginTLSClientCertificate base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -76,7 +75,7 @@ def test_method_list(self, client: Cloudflare) -> None: certificate = client.origin_tls_client_auth.hostnames.certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -88,7 +87,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +99,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -276,7 +275,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: certificate = await async_client.origin_tls_client_auth.hostnames.certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -288,7 +287,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -300,7 +299,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginTLSClientCertificateID], certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/page_shield/test_connections.py b/tests/api_resources/page_shield/test_connections.py index e77a8cb74ae..bf65f2d82ac 100644 --- a/tests/api_resources/page_shield/test_connections.py +++ b/tests/api_resources/page_shield/test_connections.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.page_shield import PageShieldConnection, ConnectionListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.page_shield import PageShieldConnection base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: connection = client.page_shield.connections.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -43,7 +44,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -55,7 +56,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -67,7 +68,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = response.parse() - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldConnection], connection, path=["response"]) assert cast(Any, response.is_closed) is True @@ -141,7 +142,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: connection = await async_client.page_shield.connections.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +162,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +174,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) @pytest.mark.skip() @parametrize @@ -185,7 +186,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" connection = await response.parse() - assert_matches_type(Optional[ConnectionListResponse], connection, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldConnection], connection, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/page_shield/test_policies.py b/tests/api_resources/page_shield/test_policies.py index c531d102cdf..6a3a5dc7153 100644 --- a/tests/api_resources/page_shield/test_policies.py +++ b/tests/api_resources/page_shield/test_policies.py @@ -3,16 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.page_shield import ( - PageShieldPolicy, - PolicyListResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.page_shield import PageShieldPolicy base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -147,7 +145,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.page_shield.policies.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +157,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +169,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -418,7 +416,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: policy = await async_client.page_shield.policies.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -430,7 +428,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -442,7 +440,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/page_shield/test_scripts.py b/tests/api_resources/page_shield/test_scripts.py index 5fc356d87af..832d6445cf0 100644 --- a/tests/api_resources/page_shield/test_scripts.py +++ b/tests/api_resources/page_shield/test_scripts.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.page_shield import ScriptGetResponse, ScriptListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.page_shield import PageShieldScript, ScriptGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: script = client.page_shield.scripts.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -44,7 +45,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +57,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -68,7 +69,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(SyncSinglePage[PageShieldScript], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -142,7 +143,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: script = await async_client.page_shield.scripts.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -163,7 +164,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="active,inactive", urls="blog.cloudflare.com,www.example", ) - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -175,7 +176,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +188,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(Optional[ScriptListResponse], script, path=["response"]) + assert_matches_type(AsyncSinglePage[PageShieldScript], script, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/pages/projects/test_deployments.py b/tests/api_resources/pages/projects/test_deployments.py index e883433ddd1..8cfb0f16fbe 100644 --- a/tests/api_resources/pages/projects/test_deployments.py +++ b/tests/api_resources/pages/projects/test_deployments.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.pages import PagesDeployments -from cloudflare.types.pages.projects import DeploymentListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -87,7 +87,7 @@ def test_method_list(self, client: Cloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +97,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="023e105f4ecef8ad9ca31a8372d0c353", env="preview", ) - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +110,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -123,7 +123,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = response.parse() - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(SyncSinglePage[PagesDeployments], deployment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -471,7 +471,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -481,7 +481,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="023e105f4ecef8ad9ca31a8372d0c353", env="preview", ) - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -494,7 +494,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) @pytest.mark.skip() @parametrize @@ -507,7 +507,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" deployment = await response.parse() - assert_matches_type(DeploymentListResponse, deployment, path=["response"]) + assert_matches_type(AsyncSinglePage[PagesDeployments], deployment, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/pages/projects/test_domains.py b/tests/api_resources/pages/projects/test_domains.py index c8d6157ad1c..2bd272a95f0 100644 --- a/tests/api_resources/pages/projects/test_domains.py +++ b/tests/api_resources/pages/projects/test_domains.py @@ -9,10 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.pages.projects import ( DomainGetResponse, DomainEditResponse, - DomainListResponse, DomainCreateResponse, ) @@ -86,7 +86,7 @@ def test_method_list(self, client: Cloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(SyncSinglePage[object], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +99,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(SyncSinglePage[object], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(SyncSinglePage[object], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -391,7 +391,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "this-is-my-project-01", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(AsyncSinglePage[object], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -404,7 +404,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(AsyncSinglePage[object], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,7 +417,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(AsyncSinglePage[object], domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/pages/test_projects.py b/tests/api_resources/pages/test_projects.py index 1a4093fbd97..cb7cb108582 100644 --- a/tests/api_resources/pages/test_projects.py +++ b/tests/api_resources/pages/test_projects.py @@ -9,10 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.pages import ( PagesProjects, + PagesDeployments, ProjectEditResponse, - ProjectListResponse, ProjectCreateResponse, ) @@ -150,7 +151,7 @@ def test_method_list(self, client: Cloudflare) -> None: project = client.pages.projects.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(SyncSinglePage[PagesDeployments], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -162,7 +163,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(SyncSinglePage[PagesDeployments], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +175,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(SyncSinglePage[PagesDeployments], project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -606,7 +607,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: project = await async_client.pages.projects.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(AsyncSinglePage[PagesDeployments], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -618,7 +619,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(AsyncSinglePage[PagesDeployments], project, path=["response"]) @pytest.mark.skip() @parametrize @@ -630,7 +631,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectListResponse, project, path=["response"]) + assert_matches_type(AsyncSinglePage[PagesDeployments], project, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/registrar/test_domains.py b/tests/api_resources/registrar/test_domains.py index cac1d01a8e6..69435a7178b 100644 --- a/tests/api_resources/registrar/test_domains.py +++ b/tests/api_resources/registrar/test_domains.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.registrar import DomainGetResponse, DomainListResponse, DomainUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -87,7 +88,7 @@ def test_method_list(self, client: Cloudflare) -> None: domain = client.registrar.domains.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DomainListResponse], domain, path=["response"]) + assert_matches_type(SyncSinglePage[DomainListResponse], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -99,7 +100,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(Optional[DomainListResponse], domain, path=["response"]) + assert_matches_type(SyncSinglePage[DomainListResponse], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -111,7 +112,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(Optional[DomainListResponse], domain, path=["response"]) + assert_matches_type(SyncSinglePage[DomainListResponse], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -249,7 +250,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: domain = await async_client.registrar.domains.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[DomainListResponse], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[DomainListResponse], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -261,7 +262,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(Optional[DomainListResponse], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[DomainListResponse], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -273,7 +274,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(Optional[DomainListResponse], domain, path=["response"]) + assert_matches_type(AsyncSinglePage[DomainListResponse], domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rules/test_lists.py b/tests/api_resources/rules/test_lists.py index 022c7dd705b..a3284737579 100644 --- a/tests/api_resources/rules/test_lists.py +++ b/tests/api_resources/rules/test_lists.py @@ -9,11 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.rules import ( - ListsList, - ListListResponse, - ListDeleteResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.rules import ListsList, ListDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -150,7 +147,7 @@ def test_method_list(self, client: Cloudflare) -> None: list = client.rules.lists.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(SyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -162,7 +159,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(SyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +171,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(SyncSinglePage[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -423,7 +420,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: list = await async_client.rules.lists.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -435,7 +432,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ListsList], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -447,7 +444,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ListsList], list, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/phases/test_versions.py b/tests/api_resources/rulesets/phases/test_versions.py index d8972f5554d..796957cd2b1 100644 --- a/tests/api_resources/rulesets/phases/test_versions.py +++ b/tests/api_resources/rulesets/phases/test_versions.py @@ -9,7 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import RulesetsRulesetResponse, RulesetsRulesetsResponse +from cloudflare.types import RulesetsRulesetResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.rulesets.phases import VersionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +51,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +65,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -177,7 +179,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -187,7 +189,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -201,7 +203,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -215,7 +217,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/rulesets/test_versions.py b/tests/api_resources/rulesets/test_versions.py index 6372f99dab6..a8812cc8df4 100644 --- a/tests/api_resources/rulesets/test_versions.py +++ b/tests/api_resources/rulesets/test_versions.py @@ -9,7 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import RulesetsRulesetResponse, RulesetsRulesetsResponse +from cloudflare.types import RulesetsRulesetResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.rulesets import VersionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +27,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +51,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +65,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(SyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True @@ -281,7 +283,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -291,7 +293,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -305,7 +307,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) @pytest.mark.skip() @parametrize @@ -319,7 +321,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" version = await response.parse() - assert_matches_type(RulesetsRulesetsResponse, version, path=["response"]) + assert_matches_type(AsyncSinglePage[VersionListResponse], version, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_acls.py b/tests/api_resources/secondary_dns/test_acls.py index 50e534495c7..81e4b8297c0 100644 --- a/tests/api_resources/secondary_dns/test_acls.py +++ b/tests/api_resources/secondary_dns/test_acls.py @@ -3,17 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.secondary_dns import ( - ACLListResponse, - SecondaryDNSACL, - ACLDeleteResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.secondary_dns import SecondaryDNSACL, ACLDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -135,7 +132,7 @@ def test_method_list(self, client: Cloudflare) -> None: acl = client.secondary_dns.acls.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(Optional[ACLListResponse], acl, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -147,7 +144,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(Optional[ACLListResponse], acl, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +156,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = response.parse() - assert_matches_type(Optional[ACLListResponse], acl, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True @@ -393,7 +390,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: acl = await async_client.secondary_dns.acls.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(Optional[ACLListResponse], acl, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -405,7 +402,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(Optional[ACLListResponse], acl, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSACL], acl, path=["response"]) @pytest.mark.skip() @parametrize @@ -417,7 +414,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" acl = await response.parse() - assert_matches_type(Optional[ACLListResponse], acl, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSACL], acl, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_peers.py b/tests/api_resources/secondary_dns/test_peers.py index efbb8aeb073..ac16741dc7a 100644 --- a/tests/api_resources/secondary_dns/test_peers.py +++ b/tests/api_resources/secondary_dns/test_peers.py @@ -3,17 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.secondary_dns import ( - PeerListResponse, - SecondaryDNSPeer, - PeerDeleteResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.secondary_dns import SecondaryDNSPeer, PeerDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -144,7 +141,7 @@ def test_method_list(self, client: Cloudflare) -> None: peer = client.secondary_dns.peers.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(Optional[PeerListResponse], peer, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +153,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(Optional[PeerListResponse], peer, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -168,7 +165,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = response.parse() - assert_matches_type(Optional[PeerListResponse], peer, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -411,7 +408,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: peer = await async_client.secondary_dns.peers.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(Optional[PeerListResponse], peer, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -423,7 +420,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(Optional[PeerListResponse], peer, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) @pytest.mark.skip() @parametrize @@ -435,7 +432,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" peer = await response.parse() - assert_matches_type(Optional[PeerListResponse], peer, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSPeer], peer, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/secondary_dns/test_tsigs.py b/tests/api_resources/secondary_dns/test_tsigs.py index 51f0c9ba49c..b80d8acaf5e 100644 --- a/tests/api_resources/secondary_dns/test_tsigs.py +++ b/tests/api_resources/secondary_dns/test_tsigs.py @@ -3,17 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.secondary_dns import ( - SecondaryDNSTSIG, - TSIGListResponse, - TSIGDeleteResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.secondary_dns import SecondaryDNSTSIG, TSIGDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -148,7 +145,7 @@ def test_method_list(self, client: Cloudflare) -> None: tsig = client.secondary_dns.tsigs.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(Optional[TSIGListResponse], tsig, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -160,7 +157,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(Optional[TSIGListResponse], tsig, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -172,7 +169,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = response.parse() - assert_matches_type(Optional[TSIGListResponse], tsig, path=["response"]) + assert_matches_type(SyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True @@ -419,7 +416,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: tsig = await async_client.secondary_dns.tsigs.list( account_id="01a7362d577a6c3019a474fd6f485823", ) - assert_matches_type(Optional[TSIGListResponse], tsig, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -431,7 +428,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(Optional[TSIGListResponse], tsig, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) @pytest.mark.skip() @parametrize @@ -443,7 +440,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tsig = await response.parse() - assert_matches_type(Optional[TSIGListResponse], tsig, path=["response"]) + assert_matches_type(AsyncSinglePage[SecondaryDNSTSIG], tsig, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/snippets/test_rules.py b/tests/api_resources/snippets/test_rules.py index 7fcfdef7f29..83e10168142 100644 --- a/tests/api_resources/snippets/test_rules.py +++ b/tests/api_resources/snippets/test_rules.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.snippets import RuleListResponse, RuleUpdateResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -93,7 +94,7 @@ def test_method_list(self, client: Cloudflare) -> None: rule = client.snippets.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -105,7 +106,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -117,7 +118,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(SyncSinglePage[RuleListResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -209,7 +210,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.snippets.rules.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -221,7 +222,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -233,7 +234,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(RuleListResponse, rule, path=["response"]) + assert_matches_type(AsyncSinglePage[RuleListResponse], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/speed/test_pages.py b/tests/api_resources/speed/test_pages.py index afc0ae668e6..cee5ec5833e 100644 --- a/tests/api_resources/speed/test_pages.py +++ b/tests/api_resources/speed/test_pages.py @@ -3,12 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.speed import PageListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: page = client.speed.pages.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PageListResponse], page, path=["response"]) + assert_matches_type(SyncSinglePage[PageListResponse], page, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" page = response.parse() - assert_matches_type(Optional[PageListResponse], page, path=["response"]) + assert_matches_type(SyncSinglePage[PageListResponse], page, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" page = response.parse() - assert_matches_type(Optional[PageListResponse], page, path=["response"]) + assert_matches_type(SyncSinglePage[PageListResponse], page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: page = await async_client.speed.pages.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PageListResponse], page, path=["response"]) + assert_matches_type(AsyncSinglePage[PageListResponse], page, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" page = await response.parse() - assert_matches_type(Optional[PageListResponse], page, path=["response"]) + assert_matches_type(AsyncSinglePage[PageListResponse], page, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" page = await response.parse() - assert_matches_type(Optional[PageListResponse], page, path=["response"]) + assert_matches_type(AsyncSinglePage[PageListResponse], page, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/ssl/test_certificate_packs.py b/tests/api_resources/ssl/test_certificate_packs.py index 6f98b0454ec..20180cc88f5 100644 --- a/tests/api_resources/ssl/test_certificate_packs.py +++ b/tests/api_resources/ssl/test_certificate_packs.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -12,9 +12,9 @@ from cloudflare.types.ssl import ( CertificatePackGetResponse, CertificatePackEditResponse, - CertificatePackListResponse, CertificatePackDeleteResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -28,7 +28,7 @@ def test_method_list(self, client: Cloudflare) -> None: certificate_pack = client.ssl.certificate_packs.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(SyncSinglePage[object], certificate_pack, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: zone_id="023e105f4ecef8ad9ca31a8372d0c353", status="all", ) - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(SyncSinglePage[object], certificate_pack, path=["response"]) @pytest.mark.skip() @parametrize @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate_pack = response.parse() - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(SyncSinglePage[object], certificate_pack, path=["response"]) @pytest.mark.skip() @parametrize @@ -61,7 +61,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate_pack = response.parse() - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(SyncSinglePage[object], certificate_pack, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,7 +239,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: certificate_pack = await async_client.ssl.certificate_packs.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(AsyncSinglePage[object], certificate_pack, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +248,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) zone_id="023e105f4ecef8ad9ca31a8372d0c353", status="all", ) - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(AsyncSinglePage[object], certificate_pack, path=["response"]) @pytest.mark.skip() @parametrize @@ -260,7 +260,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate_pack = await response.parse() - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(AsyncSinglePage[object], certificate_pack, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +272,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate_pack = await response.parse() - assert_matches_type(Optional[CertificatePackListResponse], certificate_pack, path=["response"]) + assert_matches_type(AsyncSinglePage[object], certificate_pack, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/live_inputs/test_outputs.py b/tests/api_resources/stream/live_inputs/test_outputs.py index e7b73c5be61..486e740b60b 100644 --- a/tests/api_resources/stream/live_inputs/test_outputs.py +++ b/tests/api_resources/stream/live_inputs/test_outputs.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.stream.live_inputs import ( - StreamOutput, - OutputListResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.stream.live_inputs import StreamOutput base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -171,7 +169,7 @@ def test_method_list(self, client: Cloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OutputListResponse, output, path=["response"]) + assert_matches_type(SyncSinglePage[StreamOutput], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -184,7 +182,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(OutputListResponse, output, path=["response"]) + assert_matches_type(SyncSinglePage[StreamOutput], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -197,7 +195,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = response.parse() - assert_matches_type(OutputListResponse, output, path=["response"]) + assert_matches_type(SyncSinglePage[StreamOutput], output, path=["response"]) assert cast(Any, response.is_closed) is True @@ -435,7 +433,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "66be4bf738797e01e1fca35a7bdecdcd", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(OutputListResponse, output, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamOutput], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -448,7 +446,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(OutputListResponse, output, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamOutput], output, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +459,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" output = await response.parse() - assert_matches_type(OutputListResponse, output, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamOutput], output, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/stream/test_watermarks.py b/tests/api_resources/stream/test_watermarks.py index 23974c7f5d7..80af89c021d 100644 --- a/tests/api_resources/stream/test_watermarks.py +++ b/tests/api_resources/stream/test_watermarks.py @@ -9,9 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.stream import ( + StreamWatermarks, WatermarkGetResponse, - WatermarkListResponse, WatermarkCreateResponse, WatermarkDeleteResponse, ) @@ -88,7 +89,7 @@ def test_method_list(self, client: Cloudflare) -> None: watermark = client.stream.watermarks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WatermarkListResponse, watermark, path=["response"]) + assert_matches_type(SyncSinglePage[StreamWatermarks], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +101,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkListResponse, watermark, path=["response"]) + assert_matches_type(SyncSinglePage[StreamWatermarks], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +113,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = response.parse() - assert_matches_type(WatermarkListResponse, watermark, path=["response"]) + assert_matches_type(SyncSinglePage[StreamWatermarks], watermark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -298,7 +299,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: watermark = await async_client.stream.watermarks.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(WatermarkListResponse, watermark, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamWatermarks], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -310,7 +311,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkListResponse, watermark, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamWatermarks], watermark, path=["response"]) @pytest.mark.skip() @parametrize @@ -322,7 +323,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" watermark = await response.parse() - assert_matches_type(WatermarkListResponse, watermark, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamWatermarks], watermark, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_calls.py b/tests/api_resources/test_calls.py index 60858d4072d..49df39e2a8b 100644 --- a/tests/api_resources/test_calls.py +++ b/tests/api_resources/test_calls.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import CallsApp, CallListResponse, CallsAppWithSecret +from cloudflare.types import CallsApp, CallsAppWithSecret +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -136,7 +137,7 @@ def test_method_list(self, client: Cloudflare) -> None: call = client.calls.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallListResponse, call, path=["response"]) + assert_matches_type(SyncSinglePage[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -148,7 +149,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallListResponse, call, path=["response"]) + assert_matches_type(SyncSinglePage[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -160,7 +161,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = response.parse() - assert_matches_type(CallListResponse, call, path=["response"]) + assert_matches_type(SyncSinglePage[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True @@ -399,7 +400,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: call = await async_client.calls.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(CallListResponse, call, path=["response"]) + assert_matches_type(AsyncSinglePage[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -411,7 +412,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallListResponse, call, path=["response"]) + assert_matches_type(AsyncSinglePage[CallsApp], call, path=["response"]) @pytest.mark.skip() @parametrize @@ -423,7 +424,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" call = await response.parse() - assert_matches_type(CallListResponse, call, path=["response"]) + assert_matches_type(AsyncSinglePage[CallsApp], call, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_healthchecks.py b/tests/api_resources/test_healthchecks.py index 15fff51ea85..7e5754cb6c0 100644 --- a/tests/api_resources/test_healthchecks.py +++ b/tests/api_resources/test_healthchecks.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -11,9 +11,9 @@ from tests.utils import assert_matches_type from cloudflare.types import ( Healthcheck, - HealthcheckListResponse, HealthcheckDeleteResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -212,7 +212,7 @@ def test_method_list(self, client: Cloudflare) -> None: healthcheck = client.healthchecks.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) + assert_matches_type(SyncSinglePage[Healthcheck], healthcheck, path=["response"]) @pytest.mark.skip() @parametrize @@ -224,7 +224,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" healthcheck = response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) + assert_matches_type(SyncSinglePage[Healthcheck], healthcheck, path=["response"]) @pytest.mark.skip() @parametrize @@ -236,7 +236,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" healthcheck = response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) + assert_matches_type(SyncSinglePage[Healthcheck], healthcheck, path=["response"]) assert cast(Any, response.is_closed) is True @@ -646,7 +646,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: healthcheck = await async_client.healthchecks.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) + assert_matches_type(AsyncSinglePage[Healthcheck], healthcheck, path=["response"]) @pytest.mark.skip() @parametrize @@ -658,7 +658,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" healthcheck = await response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) + assert_matches_type(AsyncSinglePage[Healthcheck], healthcheck, path=["response"]) @pytest.mark.skip() @parametrize @@ -670,7 +670,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" healthcheck = await response.parse() - assert_matches_type(Optional[HealthcheckListResponse], healthcheck, path=["response"]) + assert_matches_type(AsyncSinglePage[Healthcheck], healthcheck, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_keyless_certificates.py b/tests/api_resources/test_keyless_certificates.py index 61398a313e3..6003a52d371 100644 --- a/tests/api_resources/test_keyless_certificates.py +++ b/tests/api_resources/test_keyless_certificates.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -11,9 +11,9 @@ from tests.utils import assert_matches_type from cloudflare.types import ( KeylessCertificateHostname, - KeylessCertificateListResponse, KeylessCertificateDeleteResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -98,7 +98,7 @@ def test_method_list(self, client: Cloudflare) -> None: keyless_certificate = client.keyless_certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[KeylessCertificateListResponse], keyless_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +110,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = response.parse() - assert_matches_type(Optional[KeylessCertificateListResponse], keyless_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -122,7 +122,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = response.parse() - assert_matches_type(Optional[KeylessCertificateListResponse], keyless_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -394,7 +394,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: keyless_certificate = await async_client.keyless_certificates.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[KeylessCertificateListResponse], keyless_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -406,7 +406,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = await response.parse() - assert_matches_type(Optional[KeylessCertificateListResponse], keyless_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -418,7 +418,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" keyless_certificate = await response.parse() - assert_matches_type(Optional[KeylessCertificateListResponse], keyless_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[KeylessCertificateHostname], keyless_certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_load_balancers.py b/tests/api_resources/test_load_balancers.py index 946a45cf92c..6ef827e239a 100644 --- a/tests/api_resources/test_load_balancers.py +++ b/tests/api_resources/test_load_balancers.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -11,9 +11,9 @@ from tests.utils import assert_matches_type from cloudflare.types import ( LoadBalancer, - LoadBalancerListResponse, LoadBalancerDeleteResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -646,7 +646,7 @@ def test_method_list(self, client: Cloudflare) -> None: load_balancer = client.load_balancers.list( zone_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[LoadBalancerListResponse], load_balancer, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancer], load_balancer, path=["response"]) @pytest.mark.skip() @parametrize @@ -658,7 +658,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" load_balancer = response.parse() - assert_matches_type(Optional[LoadBalancerListResponse], load_balancer, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancer], load_balancer, path=["response"]) @pytest.mark.skip() @parametrize @@ -670,7 +670,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" load_balancer = response.parse() - assert_matches_type(Optional[LoadBalancerListResponse], load_balancer, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancer], load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True @@ -1699,7 +1699,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: load_balancer = await async_client.load_balancers.list( zone_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[LoadBalancerListResponse], load_balancer, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancer], load_balancer, path=["response"]) @pytest.mark.skip() @parametrize @@ -1711,7 +1711,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" load_balancer = await response.parse() - assert_matches_type(Optional[LoadBalancerListResponse], load_balancer, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancer], load_balancer, path=["response"]) @pytest.mark.skip() @parametrize @@ -1723,7 +1723,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" load_balancer = await response.parse() - assert_matches_type(Optional[LoadBalancerListResponse], load_balancer, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancer], load_balancer, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_mtls_certificates.py b/tests/api_resources/test_mtls_certificates.py index e3cdca8326b..ca3dbc38d35 100644 --- a/tests/api_resources/test_mtls_certificates.py +++ b/tests/api_resources/test_mtls_certificates.py @@ -3,17 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - MTLSCertificate, - MTLSCertificateUpdate, - MTLSCertificateListResponse, -) +from cloudflare.types import MTLSCertificate, MTLSCertificateUpdate +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -89,7 +86,7 @@ def test_method_list(self, client: Cloudflare) -> None: mtls_certificate = client.mtls_certificates.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[MTLSCertificateListResponse], mtls_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[MTLSCertificate], mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,7 +98,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" mtls_certificate = response.parse() - assert_matches_type(Optional[MTLSCertificateListResponse], mtls_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[MTLSCertificate], mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -113,7 +110,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" mtls_certificate = response.parse() - assert_matches_type(Optional[MTLSCertificateListResponse], mtls_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[MTLSCertificate], mtls_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -301,7 +298,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: mtls_certificate = await async_client.mtls_certificates.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[MTLSCertificateListResponse], mtls_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[MTLSCertificate], mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -313,7 +310,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" mtls_certificate = await response.parse() - assert_matches_type(Optional[MTLSCertificateListResponse], mtls_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[MTLSCertificate], mtls_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -325,7 +322,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" mtls_certificate = await response.parse() - assert_matches_type(Optional[MTLSCertificateListResponse], mtls_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[MTLSCertificate], mtls_certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_origin_ca_certificates.py b/tests/api_resources/test_origin_ca_certificates.py index 65ddd6292f4..b20f9c59221 100644 --- a/tests/api_resources/test_origin_ca_certificates.py +++ b/tests/api_resources/test_origin_ca_certificates.py @@ -3,18 +3,19 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types import ( + OriginCACertificate, OriginCACertificateGetResponse, - OriginCACertificateListResponse, OriginCACertificateCreateResponse, OriginCACertificateDeleteResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -65,7 +66,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: origin_ca_certificate = client.origin_ca_certificates.list() - assert_matches_type(Optional[OriginCACertificateListResponse], origin_ca_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -75,7 +76,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_ca_certificate = response.parse() - assert_matches_type(Optional[OriginCACertificateListResponse], origin_ca_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -85,7 +86,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_ca_certificate = response.parse() - assert_matches_type(Optional[OriginCACertificateListResponse], origin_ca_certificate, path=["response"]) + assert_matches_type(SyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -220,7 +221,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: origin_ca_certificate = await async_client.origin_ca_certificates.list() - assert_matches_type(Optional[OriginCACertificateListResponse], origin_ca_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -230,7 +231,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_ca_certificate = await response.parse() - assert_matches_type(Optional[OriginCACertificateListResponse], origin_ca_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -240,7 +241,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_ca_certificate = await response.parse() - assert_matches_type(Optional[OriginCACertificateListResponse], origin_ca_certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginCACertificate], origin_ca_certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_origin_tls_client_auth.py b/tests/api_resources/test_origin_tls_client_auth.py index b038c8d3551..e75e32b30bc 100644 --- a/tests/api_resources/test_origin_tls_client_auth.py +++ b/tests/api_resources/test_origin_tls_client_auth.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -15,6 +15,7 @@ OriginTLSClientAuthCreateResponse, OriginTLSClientAuthDeleteResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -78,7 +79,7 @@ def test_method_list(self, client: Cloudflare) -> None: origin_tls_client_auth = client.origin_tls_client_auth.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(SyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -90,7 +91,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = response.parse() - assert_matches_type(Optional[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(SyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +103,9 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = response.parse() - assert_matches_type(Optional[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type( + SyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"] + ) assert cast(Any, response.is_closed) is True @@ -278,7 +281,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: origin_tls_client_auth = await async_client.origin_tls_client_auth.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -290,7 +293,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = await response.parse() - assert_matches_type(Optional[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type(AsyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) @pytest.mark.skip() @parametrize @@ -302,7 +305,9 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" origin_tls_client_auth = await response.parse() - assert_matches_type(Optional[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"]) + assert_matches_type( + AsyncSinglePage[OriginTLSClientAuthListResponse], origin_tls_client_auth, path=["response"] + ) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_pcaps.py b/tests/api_resources/test_pcaps.py index ecb68279f4f..2db05d99367 100644 --- a/tests/api_resources/test_pcaps.py +++ b/tests/api_resources/test_pcaps.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare.types import PCAPGetResponse, PCAPListResponse, PCAPCreateResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -184,7 +185,7 @@ def test_method_list(self, client: Cloudflare) -> None: pcap = client.pcaps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PCAPListResponse], pcap, path=["response"]) + assert_matches_type(SyncSinglePage[PCAPListResponse], pcap, path=["response"]) @pytest.mark.skip() @parametrize @@ -196,7 +197,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pcap = response.parse() - assert_matches_type(Optional[PCAPListResponse], pcap, path=["response"]) + assert_matches_type(SyncSinglePage[PCAPListResponse], pcap, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +209,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pcap = response.parse() - assert_matches_type(Optional[PCAPListResponse], pcap, path=["response"]) + assert_matches_type(SyncSinglePage[PCAPListResponse], pcap, path=["response"]) assert cast(Any, response.is_closed) is True @@ -443,7 +444,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: pcap = await async_client.pcaps.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PCAPListResponse], pcap, path=["response"]) + assert_matches_type(AsyncSinglePage[PCAPListResponse], pcap, path=["response"]) @pytest.mark.skip() @parametrize @@ -455,7 +456,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pcap = await response.parse() - assert_matches_type(Optional[PCAPListResponse], pcap, path=["response"]) + assert_matches_type(AsyncSinglePage[PCAPListResponse], pcap, path=["response"]) @pytest.mark.skip() @parametrize @@ -467,7 +468,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pcap = await response.parse() - assert_matches_type(Optional[PCAPListResponse], pcap, path=["response"]) + assert_matches_type(AsyncSinglePage[PCAPListResponse], pcap, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_plans.py b/tests/api_resources/test_plans.py index 06a9beb548f..68d14414ec9 100644 --- a/tests/api_resources/test_plans.py +++ b/tests/api_resources/test_plans.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import PlanListResponse, AvailableRatePlan +from cloudflare.types import AvailableRatePlan +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: plan = client.plans.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PlanListResponse], plan, path=["response"]) + assert_matches_type(SyncSinglePage[AvailableRatePlan], plan, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" plan = response.parse() - assert_matches_type(Optional[PlanListResponse], plan, path=["response"]) + assert_matches_type(SyncSinglePage[AvailableRatePlan], plan, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" plan = response.parse() - assert_matches_type(Optional[PlanListResponse], plan, path=["response"]) + assert_matches_type(SyncSinglePage[AvailableRatePlan], plan, path=["response"]) assert cast(Any, response.is_closed) is True @@ -121,7 +122,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: plan = await async_client.plans.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[PlanListResponse], plan, path=["response"]) + assert_matches_type(AsyncSinglePage[AvailableRatePlan], plan, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +134,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" plan = await response.parse() - assert_matches_type(Optional[PlanListResponse], plan, path=["response"]) + assert_matches_type(AsyncSinglePage[AvailableRatePlan], plan, path=["response"]) @pytest.mark.skip() @parametrize @@ -145,7 +146,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" plan = await response.parse() - assert_matches_type(Optional[PlanListResponse], plan, path=["response"]) + assert_matches_type(AsyncSinglePage[AvailableRatePlan], plan, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_queues.py b/tests/api_resources/test_queues.py index 0d2b8b65738..2204fc81cdb 100644 --- a/tests/api_resources/test_queues.py +++ b/tests/api_resources/test_queues.py @@ -16,6 +16,7 @@ QueueDeleteResponse, QueueUpdateResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -132,7 +133,7 @@ def test_method_list(self, client: Cloudflare) -> None: queue = client.queues.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[QueueListResponse], queue, path=["response"]) + assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -144,7 +145,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(Optional[QueueListResponse], queue, path=["response"]) + assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -156,7 +157,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = response.parse() - assert_matches_type(Optional[QueueListResponse], queue, path=["response"]) + assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"]) assert cast(Any, response.is_closed) is True @@ -385,7 +386,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: queue = await async_client.queues.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[QueueListResponse], queue, path=["response"]) + assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -397,7 +398,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(Optional[QueueListResponse], queue, path=["response"]) + assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"]) @pytest.mark.skip() @parametrize @@ -409,7 +410,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" queue = await response.parse() - assert_matches_type(Optional[QueueListResponse], queue, path=["response"]) + assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_rulesets.py b/tests/api_resources/test_rulesets.py index dc218794d84..67251b5ccf2 100644 --- a/tests/api_resources/test_rulesets.py +++ b/tests/api_resources/test_rulesets.py @@ -9,10 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import ( - RulesetsRulesetResponse, - RulesetsRulesetsResponse, -) +from cloudflare.types import RulesetListResponse, RulesetsRulesetResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -303,7 +301,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -312,7 +310,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -325,7 +323,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -338,7 +336,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = response.parse() - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(SyncSinglePage[RulesetListResponse], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -792,7 +790,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -801,7 +799,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -814,7 +812,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) @pytest.mark.skip() @parametrize @@ -827,7 +825,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ruleset = await response.parse() - assert_matches_type(RulesetsRulesetsResponse, ruleset, path=["response"]) + assert_matches_type(AsyncSinglePage[RulesetListResponse], ruleset, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_snippets.py b/tests/api_resources/test_snippets.py index 3a49b592b81..a47c07cf315 100644 --- a/tests/api_resources/test_snippets.py +++ b/tests/api_resources/test_snippets.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import Snippet, SnippetListResponse, SnippetDeleteResponse +from cloudflare.types import Snippet, SnippetDeleteResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -86,7 +87,7 @@ def test_method_list(self, client: Cloudflare) -> None: snippet = client.snippets.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SnippetListResponse, snippet, path=["response"]) + assert_matches_type(SyncSinglePage[Snippet], snippet, path=["response"]) @pytest.mark.skip() @parametrize @@ -98,7 +99,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" snippet = response.parse() - assert_matches_type(SnippetListResponse, snippet, path=["response"]) + assert_matches_type(SyncSinglePage[Snippet], snippet, path=["response"]) @pytest.mark.skip() @parametrize @@ -110,7 +111,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" snippet = response.parse() - assert_matches_type(SnippetListResponse, snippet, path=["response"]) + assert_matches_type(SyncSinglePage[Snippet], snippet, path=["response"]) assert cast(Any, response.is_closed) is True @@ -299,7 +300,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: snippet = await async_client.snippets.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(SnippetListResponse, snippet, path=["response"]) + assert_matches_type(AsyncSinglePage[Snippet], snippet, path=["response"]) @pytest.mark.skip() @parametrize @@ -311,7 +312,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" snippet = await response.parse() - assert_matches_type(SnippetListResponse, snippet, path=["response"]) + assert_matches_type(AsyncSinglePage[Snippet], snippet, path=["response"]) @pytest.mark.skip() @parametrize @@ -323,7 +324,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" snippet = await response.parse() - assert_matches_type(SnippetListResponse, snippet, path=["response"]) + assert_matches_type(AsyncSinglePage[Snippet], snippet, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_stream.py b/tests/api_resources/test_stream.py index 5df1fee24d2..118641ae1d8 100644 --- a/tests/api_resources/test_stream.py +++ b/tests/api_resources/test_stream.py @@ -9,8 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types import StreamVideos, StreamListResponse +from cloudflare.types import StreamVideos from cloudflare._utils import parse_datetime +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -66,7 +67,7 @@ def test_method_list(self, client: Cloudflare) -> None: stream = client.stream.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +83,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: status="inprogress", type="live", ) - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +95,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = response.parse() - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +107,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = response.parse() - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(SyncSinglePage[StreamVideos], stream, path=["response"]) assert cast(Any, response.is_closed) is True @@ -274,7 +275,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: stream = await async_client.stream.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -290,7 +291,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) status="inprogress", type="live", ) - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -302,7 +303,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = await response.parse() - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) @pytest.mark.skip() @parametrize @@ -314,7 +315,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" stream = await response.parse() - assert_matches_type(StreamListResponse, stream, path=["response"]) + assert_matches_type(AsyncSinglePage[StreamVideos], stream, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_subscriptions.py b/tests/api_resources/test_subscriptions.py index 7fbd8484de2..ed9927ed618 100644 --- a/tests/api_resources/test_subscriptions.py +++ b/tests/api_resources/test_subscriptions.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -16,6 +16,7 @@ SubscriptionDeleteResponse, SubscriptionUpdateResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -206,7 +207,7 @@ def test_method_list(self, client: Cloudflare) -> None: subscription = client.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -218,7 +219,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -230,7 +231,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) assert cast(Any, response.is_closed) is True @@ -525,7 +526,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: subscription = await async_client.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -537,7 +538,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -549,7 +550,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_waiting_rooms.py b/tests/api_resources/test_waiting_rooms.py index 610dd7a3ab8..b1cbfb03038 100644 --- a/tests/api_resources/test_waiting_rooms.py +++ b/tests/api_resources/test_waiting_rooms.py @@ -3,7 +3,7 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest @@ -11,9 +11,9 @@ from tests.utils import assert_matches_type from cloudflare.types import ( WaitingRoom, - WaitingRoomListResponse, WaitingRoomDeleteResponse, ) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -242,7 +242,7 @@ def test_method_list(self, client: Cloudflare) -> None: waiting_room = client.waiting_rooms.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WaitingRoomListResponse], waiting_room, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) @pytest.mark.skip() @parametrize @@ -254,7 +254,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" waiting_room = response.parse() - assert_matches_type(Optional[WaitingRoomListResponse], waiting_room, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) @pytest.mark.skip() @parametrize @@ -266,7 +266,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" waiting_room = response.parse() - assert_matches_type(Optional[WaitingRoomListResponse], waiting_room, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingRoom], waiting_room, path=["response"]) assert cast(Any, response.is_closed) is True @@ -722,7 +722,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: waiting_room = await async_client.waiting_rooms.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[WaitingRoomListResponse], waiting_room, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) @pytest.mark.skip() @parametrize @@ -734,7 +734,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" waiting_room = await response.parse() - assert_matches_type(Optional[WaitingRoomListResponse], waiting_room, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) @pytest.mark.skip() @parametrize @@ -746,7 +746,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" waiting_room = await response.parse() - assert_matches_type(Optional[WaitingRoomListResponse], waiting_room, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingRoom], waiting_room, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/load_balancers/analytics/test_events.py b/tests/api_resources/user/load_balancers/analytics/test_events.py index 08188629f93..26e4e169ef3 100644 --- a/tests/api_resources/user/load_balancers/analytics/test_events.py +++ b/tests/api_resources/user/load_balancers/analytics/test_events.py @@ -3,14 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type from cloudflare._utils import parse_datetime -from cloudflare.types.user.load_balancers.analytics import EventListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.user.load_balancers.analytics import LoadBalancingAnalytics base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -22,7 +23,7 @@ class TestEvents: @parametrize def test_method_list(self, client: Cloudflare) -> None: event = client.user.load_balancers.analytics.events.list() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +37,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: since=parse_datetime("2016-11-11T12:00:00Z"), until=parse_datetime("2016-11-11T13:00:00Z"), ) - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -46,7 +47,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -56,7 +57,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) assert cast(Any, response.is_closed) is True @@ -68,7 +69,7 @@ class TestAsyncEvents: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: event = await async_client.user.load_balancers.analytics.events.list() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -82,7 +83,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) since=parse_datetime("2016-11-11T12:00:00Z"), until=parse_datetime("2016-11-11T13:00:00Z"), ) - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -92,7 +93,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,6 +103,6 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingAnalytics], event, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/load_balancers/test_monitors.py b/tests/api_resources/user/load_balancers/test_monitors.py index 7c0f1b49ab5..359d83209c7 100644 --- a/tests/api_resources/user/load_balancers/test_monitors.py +++ b/tests/api_resources/user/load_balancers/test_monitors.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.user.load_balancers import ( - MonitorListResponse, LoadBalancingMonitor, MonitorDeleteResponse, MonitorPreviewResponse, @@ -160,7 +160,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: monitor = client.user.load_balancers.monitors.list() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +170,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -180,7 +180,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) assert cast(Any, response.is_closed) is True @@ -597,7 +597,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: monitor = await async_client.user.load_balancers.monitors.list() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -607,7 +607,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) @pytest.mark.skip() @parametrize @@ -617,7 +617,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" monitor = await response.parse() - assert_matches_type(Optional[MonitorListResponse], monitor, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingMonitor], monitor, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/load_balancers/test_pools.py b/tests/api_resources/user/load_balancers/test_pools.py index a421610df7f..213bc1b0df2 100644 --- a/tests/api_resources/user/load_balancers/test_pools.py +++ b/tests/api_resources/user/load_balancers/test_pools.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.user.load_balancers import ( - PoolListResponse, LoadBalancingPool, PoolDeleteResponse, PoolHealthResponse, @@ -234,7 +234,7 @@ def test_path_params_update(self, client: Cloudflare) -> None: @parametrize def test_method_list(self, client: Cloudflare) -> None: pool = client.user.load_balancers.pools.list() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +242,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: pool = client.user.load_balancers.pools.list( monitor={}, ) - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -252,7 +252,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -262,7 +262,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(SyncSinglePage[LoadBalancingPool], pool, path=["response"]) assert cast(Any, response.is_closed) is True @@ -823,7 +823,7 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: pool = await async_client.user.load_balancers.pools.list() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -831,7 +831,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) pool = await async_client.user.load_balancers.pools.list( monitor={}, ) - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -841,7 +841,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) @pytest.mark.skip() @parametrize @@ -851,7 +851,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" pool = await response.parse() - assert_matches_type(Optional[PoolListResponse], pool, path=["response"]) + assert_matches_type(AsyncSinglePage[LoadBalancingPool], pool, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/test_invites.py b/tests/api_resources/user/test_invites.py index 1ca3d5d8e27..9527cdf4a38 100644 --- a/tests/api_resources/user/test_invites.py +++ b/tests/api_resources/user/test_invites.py @@ -3,12 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.user import InviteGetResponse, InviteEditResponse, InviteListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +22,7 @@ class TestInvites: @parametrize def test_method_list(self, client: Cloudflare) -> None: invite = client.user.invites.list() - assert_matches_type(Optional[InviteListResponse], invite, path=["response"]) + assert_matches_type(SyncSinglePage[InviteListResponse], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -31,7 +32,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(Optional[InviteListResponse], invite, path=["response"]) + assert_matches_type(SyncSinglePage[InviteListResponse], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +42,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = response.parse() - assert_matches_type(Optional[InviteListResponse], invite, path=["response"]) + assert_matches_type(SyncSinglePage[InviteListResponse], invite, path=["response"]) assert cast(Any, response.is_closed) is True @@ -141,7 +142,7 @@ class TestAsyncInvites: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: invite = await async_client.user.invites.list() - assert_matches_type(Optional[InviteListResponse], invite, path=["response"]) + assert_matches_type(AsyncSinglePage[InviteListResponse], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -151,7 +152,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(Optional[InviteListResponse], invite, path=["response"]) + assert_matches_type(AsyncSinglePage[InviteListResponse], invite, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +162,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" invite = await response.parse() - assert_matches_type(Optional[InviteListResponse], invite, path=["response"]) + assert_matches_type(AsyncSinglePage[InviteListResponse], invite, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/user/tokens/test_permission_groups.py b/tests/api_resources/user/tokens/test_permission_groups.py index 402d2d372bb..fc5c12aeb29 100644 --- a/tests/api_resources/user/tokens/test_permission_groups.py +++ b/tests/api_resources/user/tokens/test_permission_groups.py @@ -3,13 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.user.tokens import PermissionGroupListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -21,7 +21,7 @@ class TestPermissionGroups: @parametrize def test_method_list(self, client: Cloudflare) -> None: permission_group = client.user.tokens.permission_groups.list() - assert_matches_type(Optional[PermissionGroupListResponse], permission_group, path=["response"]) + assert_matches_type(SyncSinglePage[object], permission_group, path=["response"]) @pytest.mark.skip() @parametrize @@ -31,7 +31,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" permission_group = response.parse() - assert_matches_type(Optional[PermissionGroupListResponse], permission_group, path=["response"]) + assert_matches_type(SyncSinglePage[object], permission_group, path=["response"]) @pytest.mark.skip() @parametrize @@ -41,7 +41,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" permission_group = response.parse() - assert_matches_type(Optional[PermissionGroupListResponse], permission_group, path=["response"]) + assert_matches_type(SyncSinglePage[object], permission_group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -53,7 +53,7 @@ class TestAsyncPermissionGroups: @parametrize async def test_method_list(self, async_client: AsyncCloudflare) -> None: permission_group = await async_client.user.tokens.permission_groups.list() - assert_matches_type(Optional[PermissionGroupListResponse], permission_group, path=["response"]) + assert_matches_type(AsyncSinglePage[object], permission_group, path=["response"]) @pytest.mark.skip() @parametrize @@ -63,7 +63,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" permission_group = await response.parse() - assert_matches_type(Optional[PermissionGroupListResponse], permission_group, path=["response"]) + assert_matches_type(AsyncSinglePage[object], permission_group, path=["response"]) @pytest.mark.skip() @parametrize @@ -73,6 +73,6 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" permission_group = await response.parse() - assert_matches_type(Optional[PermissionGroupListResponse], permission_group, path=["response"]) + assert_matches_type(AsyncSinglePage[object], permission_group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/vectorize/test_indexes.py b/tests/api_resources/vectorize/test_indexes.py index 7024f1d0f18..019423f0773 100644 --- a/tests/api_resources/vectorize/test_indexes.py +++ b/tests/api_resources/vectorize/test_indexes.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.vectorize import ( - IndexListResponse, IndexDeleteResponse, VectorizeIndexQuery, VectorizeCreateIndex, @@ -149,7 +149,7 @@ def test_method_list(self, client: Cloudflare) -> None: index = client.vectorize.indexes.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndexListResponse, index, path=["response"]) + assert_matches_type(SyncSinglePage[VectorizeCreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize @@ -161,7 +161,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(IndexListResponse, index, path=["response"]) + assert_matches_type(SyncSinglePage[VectorizeCreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize @@ -173,7 +173,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = response.parse() - assert_matches_type(IndexListResponse, index, path=["response"]) + assert_matches_type(SyncSinglePage[VectorizeCreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True @@ -710,7 +710,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: index = await async_client.vectorize.indexes.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(IndexListResponse, index, path=["response"]) + assert_matches_type(AsyncSinglePage[VectorizeCreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize @@ -722,7 +722,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(IndexListResponse, index, path=["response"]) + assert_matches_type(AsyncSinglePage[VectorizeCreateIndex], index, path=["response"]) @pytest.mark.skip() @parametrize @@ -734,7 +734,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" index = await response.parse() - assert_matches_type(IndexListResponse, index, path=["response"]) + assert_matches_type(AsyncSinglePage[VectorizeCreateIndex], index, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waiting_rooms/test_events.py b/tests/api_resources/waiting_rooms/test_events.py index b74a62410d6..85413cb8950 100644 --- a/tests/api_resources/waiting_rooms/test_events.py +++ b/tests/api_resources/waiting_rooms/test_events.py @@ -3,15 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.waiting_rooms import ( WaitingroomEvent, - EventListResponse, EventDeleteResponse, ) @@ -222,7 +222,7 @@ def test_method_list(self, client: Cloudflare) -> None: "699d98642c564d2e855e9661899b7252", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -235,7 +235,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -248,7 +248,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingroomEvent], event, path=["response"]) assert cast(Any, response.is_closed) is True @@ -705,7 +705,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "699d98642c564d2e855e9661899b7252", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -718,7 +718,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) @pytest.mark.skip() @parametrize @@ -731,7 +731,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" event = await response.parse() - assert_matches_type(Optional[EventListResponse], event, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingroomEvent], event, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/waiting_rooms/test_rules.py b/tests/api_resources/waiting_rooms/test_rules.py index eb1537f9dfb..cbd401c1043 100644 --- a/tests/api_resources/waiting_rooms/test_rules.py +++ b/tests/api_resources/waiting_rooms/test_rules.py @@ -9,9 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.waiting_rooms import ( + WaitingroomRule, RuleEditResponse, - RuleListResponse, RuleCreateResponse, RuleDeleteResponse, RuleUpdateResponse, @@ -227,7 +228,7 @@ def test_method_list(self, client: Cloudflare) -> None: "699d98642c564d2e855e9661899b7252", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -240,7 +241,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -253,7 +254,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[WaitingroomRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -635,7 +636,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "699d98642c564d2e855e9661899b7252", zone_identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -648,7 +649,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -661,7 +662,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[WaitingroomRule], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/web3/test_hostnames.py b/tests/api_resources/web3/test_hostnames.py index ea1c6bc3f40..8b90939ee6c 100644 --- a/tests/api_resources/web3/test_hostnames.py +++ b/tests/api_resources/web3/test_hostnames.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.web3 import ( - HostnameListResponse, DistributedWebHostname, HostnameDeleteResponse, ) @@ -84,7 +84,7 @@ def test_method_list(self, client: Cloudflare) -> None: hostname = client.web3.hostnames.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[HostnameListResponse], hostname, path=["response"]) + assert_matches_type(SyncSinglePage[DistributedWebHostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -96,7 +96,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(Optional[HostnameListResponse], hostname, path=["response"]) + assert_matches_type(SyncSinglePage[DistributedWebHostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -108,7 +108,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = response.parse() - assert_matches_type(Optional[HostnameListResponse], hostname, path=["response"]) + assert_matches_type(SyncSinglePage[DistributedWebHostname], hostname, path=["response"]) assert cast(Any, response.is_closed) is True @@ -354,7 +354,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: hostname = await async_client.web3.hostnames.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[HostnameListResponse], hostname, path=["response"]) + assert_matches_type(AsyncSinglePage[DistributedWebHostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -366,7 +366,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(Optional[HostnameListResponse], hostname, path=["response"]) + assert_matches_type(AsyncSinglePage[DistributedWebHostname], hostname, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +378,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" hostname = await response.parse() - assert_matches_type(Optional[HostnameListResponse], hostname, path=["response"]) + assert_matches_type(AsyncSinglePage[DistributedWebHostname], hostname, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_domains.py b/tests/api_resources/workers/test_domains.py index 20907df2d87..f96dbc6dbbb 100644 --- a/tests/api_resources/workers/test_domains.py +++ b/tests/api_resources/workers/test_domains.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.workers import WorkersDomain, DomainListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.workers import WorkersDomain base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -81,7 +82,7 @@ def test_method_list(self, client: Cloudflare) -> None: domain = client.workers.domains.list( account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -94,7 +95,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: zone_id="593c9c94de529bbbfaac7c53ced0447d", zone_name="example.com", ) - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +107,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -118,7 +119,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersDomain], domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -302,7 +303,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: domain = await async_client.workers.domains.list( account_id="9a7806061c88ada191ed06f989cc3dac", ) - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -315,7 +316,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) zone_id="593c9c94de529bbbfaac7c53ced0447d", zone_name="example.com", ) - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -327,7 +328,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -339,7 +340,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" domain = await response.parse() - assert_matches_type(DomainListResponse, domain, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersDomain], domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_filters.py b/tests/api_resources/workers/test_filters.py index b8cc1e4144a..8b1f32106c5 100644 --- a/tests/api_resources/workers/test_filters.py +++ b/tests/api_resources/workers/test_filters.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.workers import ( WorkersFilter, - FilterListResponse, FilterCreateResponse, FilterDeleteResponse, ) @@ -140,7 +140,7 @@ def test_method_list(self, client: Cloudflare) -> None: filter = client.workers.filters.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(FilterListResponse, filter, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -152,7 +152,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = response.parse() - assert_matches_type(FilterListResponse, filter, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +164,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = response.parse() - assert_matches_type(FilterListResponse, filter, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersFilter], filter, path=["response"]) assert cast(Any, response.is_closed) is True @@ -350,7 +350,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: filter = await async_client.workers.filters.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(FilterListResponse, filter, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -362,7 +362,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = await response.parse() - assert_matches_type(FilterListResponse, filter, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) @pytest.mark.skip() @parametrize @@ -374,7 +374,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" filter = await response.parse() - assert_matches_type(FilterListResponse, filter, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersFilter], filter, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_routes.py b/tests/api_resources/workers/test_routes.py index 7fc7824e396..96ec8968fa7 100644 --- a/tests/api_resources/workers/test_routes.py +++ b/tests/api_resources/workers/test_routes.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.workers import ( WorkersRoute, - RouteListResponse, RouteCreateResponse, RouteDeleteResponse, ) @@ -152,7 +152,7 @@ def test_method_list(self, client: Cloudflare) -> None: route = client.workers.routes.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RouteListResponse, route, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersRoute], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -164,7 +164,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(RouteListResponse, route, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersRoute], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -176,7 +176,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = response.parse() - assert_matches_type(RouteListResponse, route, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersRoute], route, path=["response"]) assert cast(Any, response.is_closed) is True @@ -426,7 +426,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: route = await async_client.workers.routes.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(RouteListResponse, route, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersRoute], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -438,7 +438,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(RouteListResponse, route, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersRoute], route, path=["response"]) @pytest.mark.skip() @parametrize @@ -450,7 +450,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" route = await response.parse() - assert_matches_type(RouteListResponse, route, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersRoute], route, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers/test_scripts.py b/tests/api_resources/workers/test_scripts.py index 8ff9ba6b84c..e6cb951422b 100644 --- a/tests/api_resources/workers/test_scripts.py +++ b/tests/api_resources/workers/test_scripts.py @@ -17,7 +17,8 @@ StreamedBinaryAPIResponse, AsyncStreamedBinaryAPIResponse, ) -from cloudflare.types.workers import WorkersScript, ScriptListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.workers import WorkersScript base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -230,7 +231,7 @@ def test_method_list(self, client: Cloudflare) -> None: script = client.workers.scripts.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptListResponse, script, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -242,7 +243,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(ScriptListResponse, script, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -254,7 +255,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = response.parse() - assert_matches_type(ScriptListResponse, script, path=["response"]) + assert_matches_type(SyncSinglePage[WorkersScript], script, path=["response"]) assert cast(Any, response.is_closed) is True @@ -607,7 +608,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: script = await async_client.workers.scripts.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(ScriptListResponse, script, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -619,7 +620,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(ScriptListResponse, script, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersScript], script, path=["response"]) @pytest.mark.skip() @parametrize @@ -631,7 +632,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" script = await response.parse() - assert_matches_type(ScriptListResponse, script, path=["response"]) + assert_matches_type(AsyncSinglePage[WorkersScript], script, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py b/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py index cbf799783ad..f4a211a5829 100644 --- a/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py +++ b/tests/api_resources/workers_for_platforms/dispatch/test_namespaces.py @@ -9,6 +9,7 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.workers_for_platforms.dispatch import ( NamespaceGetResponse, NamespaceListResponse, @@ -78,7 +79,7 @@ def test_method_list(self, client: Cloudflare) -> None: namespace = client.workers_for_platforms.dispatch.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceListResponse, namespace, path=["response"]) + assert_matches_type(SyncSinglePage[NamespaceListResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -90,7 +91,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceListResponse, namespace, path=["response"]) + assert_matches_type(SyncSinglePage[NamespaceListResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -102,7 +103,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = response.parse() - assert_matches_type(NamespaceListResponse, namespace, path=["response"]) + assert_matches_type(SyncSinglePage[NamespaceListResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True @@ -279,7 +280,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: namespace = await async_client.workers_for_platforms.dispatch.namespaces.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(NamespaceListResponse, namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[NamespaceListResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -291,7 +292,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceListResponse, namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[NamespaceListResponse], namespace, path=["response"]) @pytest.mark.skip() @parametrize @@ -303,7 +304,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" namespace = await response.parse() - assert_matches_type(NamespaceListResponse, namespace, path=["response"]) + assert_matches_type(AsyncSinglePage[NamespaceListResponse], namespace, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/applications/test_cas.py b/tests/api_resources/zero_trust/access/applications/test_cas.py index 86540de1f96..3ac1aafb0b7 100644 --- a/tests/api_resources/zero_trust/access/applications/test_cas.py +++ b/tests/api_resources/zero_trust/access/applications/test_cas.py @@ -3,15 +3,16 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access.applications import ( + ZeroTrustCA, CAGetResponse, - CAListResponse, CACreateResponse, CADeleteResponse, ) @@ -103,7 +104,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +113,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -125,7 +126,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = response.parse() - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -138,7 +139,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = response.parse() - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCA], ca, path=["response"]) assert cast(Any, response.is_closed) is True @@ -390,7 +391,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -399,7 +400,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -412,7 +413,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = await response.parse() - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) @pytest.mark.skip() @parametrize @@ -425,7 +426,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" ca = await response.parse() - assert_matches_type(Optional[CAListResponse], ca, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCA], ca, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/applications/test_policies.py b/tests/api_resources/zero_trust/access/applications/test_policies.py index a61a2e24960..be668123b97 100644 --- a/tests/api_resources/zero_trust/access/applications/test_policies.py +++ b/tests/api_resources/zero_trust/access/applications/test_policies.py @@ -3,15 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access.applications import ( ZeroTrustPolicies, - PolicyListResponse, PolicyDeleteResponse, ) @@ -353,7 +353,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -363,7 +363,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -377,7 +377,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -391,7 +391,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -933,7 +933,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -943,7 +943,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -957,7 +957,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -971,7 +971,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustPolicies], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_applications.py b/tests/api_resources/zero_trust/access/test_applications.py index cd481f558e1..883a2dc7233 100644 --- a/tests/api_resources/zero_trust/access/test_applications.py +++ b/tests/api_resources/zero_trust/access/test_applications.py @@ -3,15 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access import ( ZeroTrustApps, - ApplicationListResponse, ApplicationDeleteResponse, ) @@ -1502,7 +1502,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1511,7 +1511,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1524,7 +1524,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -1537,7 +1537,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = response.parse() - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustApps], application, path=["response"]) assert cast(Any, response.is_closed) is True @@ -3242,7 +3242,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3251,7 +3251,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3264,7 +3264,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) @pytest.mark.skip() @parametrize @@ -3277,7 +3277,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" application = await response.parse() - assert_matches_type(Optional[ApplicationListResponse], application, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustApps], application, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_bookmarks.py b/tests/api_resources/zero_trust/access/test_bookmarks.py index af1d5cafa7f..64a3451ab3c 100644 --- a/tests/api_resources/zero_trust/access/test_bookmarks.py +++ b/tests/api_resources/zero_trust/access/test_bookmarks.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access import ZeroTrustBookmarks, BookmarkListResponse, BookmarkDeleteResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.access import ZeroTrustBookmarks, BookmarkDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -127,7 +128,7 @@ def test_method_list(self, client: Cloudflare) -> None: bookmark = client.zero_trust.access.bookmarks.list( "699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[BookmarkListResponse], bookmark, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -139,7 +140,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(Optional[BookmarkListResponse], bookmark, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -151,7 +152,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = response.parse() - assert_matches_type(Optional[BookmarkListResponse], bookmark, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True @@ -381,7 +382,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: bookmark = await async_client.zero_trust.access.bookmarks.list( "699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[BookmarkListResponse], bookmark, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -393,7 +394,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(Optional[BookmarkListResponse], bookmark, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) @pytest.mark.skip() @parametrize @@ -405,7 +406,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" bookmark = await response.parse() - assert_matches_type(Optional[BookmarkListResponse], bookmark, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustBookmarks], bookmark, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_certificates.py b/tests/api_resources/zero_trust/access/test_certificates.py index c60a9faf351..2a92155a407 100644 --- a/tests/api_resources/zero_trust/access/test_certificates.py +++ b/tests/api_resources/zero_trust/access/test_certificates.py @@ -3,15 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access import ( ZeroTrustCertificates, - CertificateListResponse, CertificateDeleteResponse, ) @@ -184,7 +184,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -193,7 +193,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +206,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -219,7 +219,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) assert cast(Any, response.is_closed) is True @@ -553,7 +553,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -562,7 +562,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -575,7 +575,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) @pytest.mark.skip() @parametrize @@ -588,7 +588,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" certificate = await response.parse() - assert_matches_type(Optional[CertificateListResponse], certificate, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCertificates], certificate, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_custom_pages.py b/tests/api_resources/zero_trust/access/test_custom_pages.py index b3837e153f5..ccd44ae7fe9 100644 --- a/tests/api_resources/zero_trust/access/test_custom_pages.py +++ b/tests/api_resources/zero_trust/access/test_custom_pages.py @@ -3,15 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access import ( ZeroTrustCustomPage, - CustomPageListResponse, CustomPageDeleteResponse, ZeroTrustCustomPageWithoutHTML, ) @@ -174,7 +174,7 @@ def test_method_list(self, client: Cloudflare) -> None: custom_page = client.zero_trust.access.custom_pages.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CustomPageListResponse], custom_page, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +186,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(Optional[CustomPageListResponse], custom_page, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -198,7 +198,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = response.parse() - assert_matches_type(Optional[CustomPageListResponse], custom_page, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True @@ -470,7 +470,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: custom_page = await async_client.zero_trust.access.custom_pages.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CustomPageListResponse], custom_page, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -482,7 +482,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(Optional[CustomPageListResponse], custom_page, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) @pytest.mark.skip() @parametrize @@ -494,7 +494,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_page = await response.parse() - assert_matches_type(Optional[CustomPageListResponse], custom_page, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustCustomPageWithoutHTML], custom_page, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_groups.py b/tests/api_resources/zero_trust/access/test_groups.py index dfbd4b9ca0e..ab5b3adbc4e 100644 --- a/tests/api_resources/zero_trust/access/test_groups.py +++ b/tests/api_resources/zero_trust/access/test_groups.py @@ -3,15 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access import ( ZeroTrustGroups, - GroupListResponse, GroupDeleteResponse, ) @@ -263,7 +263,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -272,7 +272,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -285,7 +285,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -298,7 +298,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = response.parse() - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGroups], group, path=["response"]) assert cast(Any, response.is_closed) is True @@ -711,7 +711,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -720,7 +720,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -733,7 +733,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) @pytest.mark.skip() @parametrize @@ -746,7 +746,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" group = await response.parse() - assert_matches_type(Optional[GroupListResponse], group, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGroups], group, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_service_tokens.py b/tests/api_resources/zero_trust/access/test_service_tokens.py index 0d5090665c0..4815e282fff 100644 --- a/tests/api_resources/zero_trust/access/test_service_tokens.py +++ b/tests/api_resources/zero_trust/access/test_service_tokens.py @@ -3,15 +3,15 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access import ( ZeroTrustServiceTokens, - ServiceTokenListResponse, ServiceTokenCreateResponse, ServiceTokenRotateResponse, ) @@ -173,7 +173,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +182,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -195,7 +195,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -208,7 +208,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = response.parse() - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) assert cast(Any, response.is_closed) is True @@ -560,7 +560,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -569,7 +569,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -582,7 +582,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) @pytest.mark.skip() @parametrize @@ -595,7 +595,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" service_token = await response.parse() - assert_matches_type(Optional[ServiceTokenListResponse], service_token, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustServiceTokens], service_token, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_tags.py b/tests/api_resources/zero_trust/access/test_tags.py index d8d355d0b29..57c7961ae67 100644 --- a/tests/api_resources/zero_trust/access/test_tags.py +++ b/tests/api_resources/zero_trust/access/test_tags.py @@ -3,17 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access import ( - ZeroTrustTag, - TagListResponse, - TagDeleteResponse, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.access import ZeroTrustTag, TagDeleteResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -130,7 +127,7 @@ def test_method_list(self, client: Cloudflare) -> None: tag = client.zero_trust.access.tags.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[TagListResponse], tag, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustTag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -142,7 +139,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(Optional[TagListResponse], tag, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustTag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -154,7 +151,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = response.parse() - assert_matches_type(Optional[TagListResponse], tag, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustTag], tag, path=["response"]) assert cast(Any, response.is_closed) is True @@ -383,7 +380,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: tag = await async_client.zero_trust.access.tags.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[TagListResponse], tag, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustTag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -395,7 +392,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(Optional[TagListResponse], tag, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustTag], tag, path=["response"]) @pytest.mark.skip() @parametrize @@ -407,7 +404,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" tag = await response.parse() - assert_matches_type(Optional[TagListResponse], tag, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustTag], tag, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/test_users.py b/tests/api_resources/zero_trust/access/test_users.py index 59f1e45767f..5787f3daf8b 100644 --- a/tests/api_resources/zero_trust/access/test_users.py +++ b/tests/api_resources/zero_trust/access/test_users.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.access import UserListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.access import ZeroTrustUsers base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: user = client.zero_trust.access.users.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[UserListResponse], user, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustUsers], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(Optional[UserListResponse], user, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustUsers], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = response.parse() - assert_matches_type(Optional[UserListResponse], user, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustUsers], user, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: user = await async_client.zero_trust.access.users.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[UserListResponse], user, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustUsers], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(Optional[UserListResponse], user, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustUsers], user, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" user = await response.parse() - assert_matches_type(Optional[UserListResponse], user, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustUsers], user, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/users/test_active_sessions.py b/tests/api_resources/zero_trust/access/users/test_active_sessions.py index 3b7b67a00e6..724da335d7c 100644 --- a/tests/api_resources/zero_trust/access/users/test_active_sessions.py +++ b/tests/api_resources/zero_trust/access/users/test_active_sessions.py @@ -3,12 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access.users import ActiveSessionGetResponse, ActiveSessionListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ActiveSessionListResponse], active_session, path=["response"]) + assert_matches_type(SyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +38,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" active_session = response.parse() - assert_matches_type(Optional[ActiveSessionListResponse], active_session, path=["response"]) + assert_matches_type(SyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +51,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" active_session = response.parse() - assert_matches_type(Optional[ActiveSessionListResponse], active_session, path=["response"]) + assert_matches_type(SyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) assert cast(Any, response.is_closed) is True @@ -144,7 +145,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ActiveSessionListResponse], active_session, path=["response"]) + assert_matches_type(AsyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -157,7 +158,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" active_session = await response.parse() - assert_matches_type(Optional[ActiveSessionListResponse], active_session, path=["response"]) + assert_matches_type(AsyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +171,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" active_session = await response.parse() - assert_matches_type(Optional[ActiveSessionListResponse], active_session, path=["response"]) + assert_matches_type(AsyncSinglePage[ActiveSessionListResponse], active_session, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/access/users/test_failed_logins.py b/tests/api_resources/zero_trust/access/users/test_failed_logins.py index 9595e61edcf..34259b8225d 100644 --- a/tests/api_resources/zero_trust/access/users/test_failed_logins.py +++ b/tests/api_resources/zero_trust/access/users/test_failed_logins.py @@ -3,12 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.access.users import FailedLoginListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FailedLoginListResponse], failed_login, path=["response"]) + assert_matches_type(SyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +38,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" failed_login = response.parse() - assert_matches_type(Optional[FailedLoginListResponse], failed_login, path=["response"]) + assert_matches_type(SyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +51,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" failed_login = response.parse() - assert_matches_type(Optional[FailedLoginListResponse], failed_login, path=["response"]) + assert_matches_type(SyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +81,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", identifier="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[FailedLoginListResponse], failed_login, path=["response"]) + assert_matches_type(AsyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" failed_login = await response.parse() - assert_matches_type(Optional[FailedLoginListResponse], failed_login, path=["response"]) + assert_matches_type(AsyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +107,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" failed_login = await response.parse() - assert_matches_type(Optional[FailedLoginListResponse], failed_login, path=["response"]) + assert_matches_type(AsyncSinglePage[FailedLoginListResponse], failed_login, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/policies/test_excludes.py b/tests/api_resources/zero_trust/devices/policies/test_excludes.py index 489b9c52146..b154f08001b 100644 --- a/tests/api_resources/zero_trust/devices/policies/test_excludes.py +++ b/tests/api_resources/zero_trust/devices/policies/test_excludes.py @@ -9,9 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices.policies import ( + DevicesSplitTunnel, ExcludeGetResponse, - ExcludeListResponse, ExcludeUpdateResponse, ) @@ -125,7 +126,7 @@ def test_method_list(self, client: Cloudflare) -> None: exclude = client.zero_trust.devices.policies.excludes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ExcludeListResponse], exclude, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -137,7 +138,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = response.parse() - assert_matches_type(Optional[ExcludeListResponse], exclude, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -149,7 +150,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = response.parse() - assert_matches_type(Optional[ExcludeListResponse], exclude, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) assert cast(Any, response.is_closed) is True @@ -321,7 +322,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: exclude = await async_client.zero_trust.devices.policies.excludes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ExcludeListResponse], exclude, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -333,7 +334,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = await response.parse() - assert_matches_type(Optional[ExcludeListResponse], exclude, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) @pytest.mark.skip() @parametrize @@ -345,7 +346,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" exclude = await response.parse() - assert_matches_type(Optional[ExcludeListResponse], exclude, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesSplitTunnel], exclude, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py b/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py index 539a25224c1..1fb852868b0 100644 --- a/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py +++ b/tests/api_resources/zero_trust/devices/policies/test_fallback_domains.py @@ -9,9 +9,10 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices.policies import ( + DevicesFallbackDomain, FallbackDomainGetResponse, - FallbackDomainListResponse, FallbackDomainUpdateResponse, ) @@ -84,7 +85,7 @@ def test_method_list(self, client: Cloudflare) -> None: fallback_domain = client.zero_trust.devices.policies.fallback_domains.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[FallbackDomainListResponse], fallback_domain, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -96,7 +97,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = response.parse() - assert_matches_type(Optional[FallbackDomainListResponse], fallback_domain, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -108,7 +109,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = response.parse() - assert_matches_type(Optional[FallbackDomainListResponse], fallback_domain, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) assert cast(Any, response.is_closed) is True @@ -239,7 +240,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: fallback_domain = await async_client.zero_trust.devices.policies.fallback_domains.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[FallbackDomainListResponse], fallback_domain, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -251,7 +252,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = await response.parse() - assert_matches_type(Optional[FallbackDomainListResponse], fallback_domain, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) @pytest.mark.skip() @parametrize @@ -263,7 +264,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" fallback_domain = await response.parse() - assert_matches_type(Optional[FallbackDomainListResponse], fallback_domain, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesFallbackDomain], fallback_domain, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/policies/test_includes.py b/tests/api_resources/zero_trust/devices/policies/test_includes.py index 1a6e8a7f0a3..41d15bd2c83 100644 --- a/tests/api_resources/zero_trust/devices/policies/test_includes.py +++ b/tests/api_resources/zero_trust/devices/policies/test_includes.py @@ -9,10 +9,11 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices.policies import ( IncludeGetResponse, - IncludeListResponse, IncludeUpdateResponse, + DevicesSplitTunnelInclude, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -125,7 +126,7 @@ def test_method_list(self, client: Cloudflare) -> None: include = client.zero_trust.devices.policies.includes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[IncludeListResponse], include, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -137,7 +138,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = response.parse() - assert_matches_type(Optional[IncludeListResponse], include, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -149,7 +150,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = response.parse() - assert_matches_type(Optional[IncludeListResponse], include, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) assert cast(Any, response.is_closed) is True @@ -321,7 +322,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: include = await async_client.zero_trust.devices.policies.includes.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[IncludeListResponse], include, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -333,7 +334,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = await response.parse() - assert_matches_type(Optional[IncludeListResponse], include, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) @pytest.mark.skip() @parametrize @@ -345,7 +346,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" include = await response.parse() - assert_matches_type(Optional[IncludeListResponse], include, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesSplitTunnelInclude], include, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/posture/test_integrations.py b/tests/api_resources/zero_trust/devices/posture/test_integrations.py index fd4e734bc86..2094d8b4161 100644 --- a/tests/api_resources/zero_trust/devices/posture/test_integrations.py +++ b/tests/api_resources/zero_trust/devices/posture/test_integrations.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices.posture import ( - IntegrationListResponse, DevicePostureIntegrations, IntegrationDeleteResponse, ) @@ -122,7 +122,7 @@ def test_method_list(self, client: Cloudflare) -> None: integration = client.zero_trust.devices.posture.integrations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[IntegrationListResponse], integration, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -134,7 +134,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Optional[IntegrationListResponse], integration, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -146,7 +146,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = response.parse() - assert_matches_type(Optional[IntegrationListResponse], integration, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -437,7 +437,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: integration = await async_client.zero_trust.devices.posture.integrations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[IntegrationListResponse], integration, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -449,7 +449,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Optional[IntegrationListResponse], integration, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) @pytest.mark.skip() @parametrize @@ -461,7 +461,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" integration = await response.parse() - assert_matches_type(Optional[IntegrationListResponse], integration, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureIntegrations], integration, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_dex_tests.py b/tests/api_resources/zero_trust/devices/test_dex_tests.py index 9e8ccfa5ead..749e995456c 100644 --- a/tests/api_resources/zero_trust/devices/test_dex_tests.py +++ b/tests/api_resources/zero_trust/devices/test_dex_tests.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices import ( DEXTestSchemasHTTP, - DEXTestListResponse, DEXTestDeleteResponse, ) @@ -192,7 +192,7 @@ def test_method_list(self, client: Cloudflare) -> None: dex_test = client.zero_trust.devices.dex_tests.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DEXTestListResponse], dex_test, path=["response"]) + assert_matches_type(SyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -204,7 +204,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(Optional[DEXTestListResponse], dex_test, path=["response"]) + assert_matches_type(SyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -216,7 +216,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = response.parse() - assert_matches_type(Optional[DEXTestListResponse], dex_test, path=["response"]) + assert_matches_type(SyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True @@ -507,7 +507,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: dex_test = await async_client.zero_trust.devices.dex_tests.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DEXTestListResponse], dex_test, path=["response"]) + assert_matches_type(AsyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -519,7 +519,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestListResponse], dex_test, path=["response"]) + assert_matches_type(AsyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) @pytest.mark.skip() @parametrize @@ -531,7 +531,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" dex_test = await response.parse() - assert_matches_type(Optional[DEXTestListResponse], dex_test, path=["response"]) + assert_matches_type(AsyncSinglePage[DEXTestSchemasHTTP], dex_test, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_networks.py b/tests/api_resources/zero_trust/devices/test_networks.py index dcff69ee7ba..232e6be1425 100644 --- a/tests/api_resources/zero_trust/devices/test_networks.py +++ b/tests/api_resources/zero_trust/devices/test_networks.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices import ( - NetworkListResponse, DeviceManagedNetworks, NetworkDeleteResponse, ) @@ -162,7 +162,7 @@ def test_method_list(self, client: Cloudflare) -> None: network = client.zero_trust.devices.networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[NetworkListResponse], network, path=["response"]) + assert_matches_type(SyncSinglePage[DeviceManagedNetworks], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -174,7 +174,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(Optional[NetworkListResponse], network, path=["response"]) + assert_matches_type(SyncSinglePage[DeviceManagedNetworks], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -186,7 +186,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = response.parse() - assert_matches_type(Optional[NetworkListResponse], network, path=["response"]) + assert_matches_type(SyncSinglePage[DeviceManagedNetworks], network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -447,7 +447,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: network = await async_client.zero_trust.devices.networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[NetworkListResponse], network, path=["response"]) + assert_matches_type(AsyncSinglePage[DeviceManagedNetworks], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -459,7 +459,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(Optional[NetworkListResponse], network, path=["response"]) + assert_matches_type(AsyncSinglePage[DeviceManagedNetworks], network, path=["response"]) @pytest.mark.skip() @parametrize @@ -471,7 +471,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" network = await response.parse() - assert_matches_type(Optional[NetworkListResponse], network, path=["response"]) + assert_matches_type(AsyncSinglePage[DeviceManagedNetworks], network, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_policies.py b/tests/api_resources/zero_trust/devices/test_policies.py index 9dd46518c65..2fcbeec752d 100644 --- a/tests/api_resources/zero_trust/devices/test_policies.py +++ b/tests/api_resources/zero_trust/devices/test_policies.py @@ -9,8 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices import ( - PolicyListResponse, PolicyDeleteResponse, DevicesDeviceSettingsPolicy, ) @@ -109,7 +109,7 @@ def test_method_list(self, client: Cloudflare) -> None: policy = client.zero_trust.devices.policies.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +121,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +133,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(SyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True @@ -420,7 +420,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: policy = await async_client.zero_trust.devices.policies.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -432,7 +432,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) @pytest.mark.skip() @parametrize @@ -444,7 +444,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" policy = await response.parse() - assert_matches_type(Optional[PolicyListResponse], policy, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicesDeviceSettingsPolicy], policy, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/devices/test_posture.py b/tests/api_resources/zero_trust/devices/test_posture.py index 01f053a9399..22dc0343f2d 100644 --- a/tests/api_resources/zero_trust/devices/test_posture.py +++ b/tests/api_resources/zero_trust/devices/test_posture.py @@ -9,9 +9,9 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.devices import ( DevicePostureRules, - PostureListResponse, PostureDeleteResponse, ) @@ -182,7 +182,7 @@ def test_method_list(self, client: Cloudflare) -> None: posture = client.zero_trust.devices.posture.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[PostureListResponse], posture, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureRules], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -194,7 +194,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(Optional[PostureListResponse], posture, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureRules], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -206,7 +206,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = response.parse() - assert_matches_type(Optional[PostureListResponse], posture, path=["response"]) + assert_matches_type(SyncSinglePage[DevicePostureRules], posture, path=["response"]) assert cast(Any, response.is_closed) is True @@ -487,7 +487,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: posture = await async_client.zero_trust.devices.posture.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[PostureListResponse], posture, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureRules], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -499,7 +499,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(Optional[PostureListResponse], posture, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureRules], posture, path=["response"]) @pytest.mark.skip() @parametrize @@ -511,7 +511,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" posture = await response.parse() - assert_matches_type(Optional[PostureListResponse], posture, path=["response"]) + assert_matches_type(AsyncSinglePage[DevicePostureRules], posture, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dex/test_colos.py b/tests/api_resources/zero_trust/dex/test_colos.py index 743e557aa1d..2a700707496 100644 --- a/tests/api_resources/zero_trust/dex/test_colos.py +++ b/tests/api_resources/zero_trust/dex/test_colos.py @@ -3,13 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.dex import ColoListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -25,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: time_end="2023-08-24T20:45:00Z", time_start="2023-08-20T20:45:00Z", ) - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(SyncSinglePage[object], colo, path=["response"]) @pytest.mark.skip() @parametrize @@ -36,7 +36,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: time_start="2023-08-20T20:45:00Z", sort_by="fleet-status-usage", ) - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(SyncSinglePage[object], colo, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +50,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" colo = response.parse() - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(SyncSinglePage[object], colo, path=["response"]) @pytest.mark.skip() @parametrize @@ -64,7 +64,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" colo = response.parse() - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(SyncSinglePage[object], colo, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,7 +90,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: time_end="2023-08-24T20:45:00Z", time_start="2023-08-20T20:45:00Z", ) - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(AsyncSinglePage[object], colo, path=["response"]) @pytest.mark.skip() @parametrize @@ -101,7 +101,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) time_start="2023-08-20T20:45:00Z", sort_by="fleet-status-usage", ) - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(AsyncSinglePage[object], colo, path=["response"]) @pytest.mark.skip() @parametrize @@ -115,7 +115,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" colo = await response.parse() - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(AsyncSinglePage[object], colo, path=["response"]) @pytest.mark.skip() @parametrize @@ -129,7 +129,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" colo = await response.parse() - assert_matches_type(Optional[ColoListResponse], colo, path=["response"]) + assert_matches_type(AsyncSinglePage[object], colo, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dlp/test_datasets.py b/tests/api_resources/zero_trust/dlp/test_datasets.py index 41c95702da4..6a9e3a59c4e 100644 --- a/tests/api_resources/zero_trust/dlp/test_datasets.py +++ b/tests/api_resources/zero_trust/dlp/test_datasets.py @@ -9,11 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.dlp import ( - DLPDataset, - DLPDatasetArray, - DLPDatasetCreation, -) +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.dlp import DLPDataset, DLPDatasetCreation base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -147,7 +144,7 @@ def test_method_list(self, client: Cloudflare) -> None: dataset = client.zero_trust.dlp.datasets.list( account_id="string", ) - assert_matches_type(Optional[DLPDatasetArray], dataset, path=["response"]) + assert_matches_type(SyncSinglePage[DLPDataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -159,7 +156,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(Optional[DLPDatasetArray], dataset, path=["response"]) + assert_matches_type(SyncSinglePage[DLPDataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -171,7 +168,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = response.parse() - assert_matches_type(Optional[DLPDatasetArray], dataset, path=["response"]) + assert_matches_type(SyncSinglePage[DLPDataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True @@ -417,7 +414,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: dataset = await async_client.zero_trust.dlp.datasets.list( account_id="string", ) - assert_matches_type(Optional[DLPDatasetArray], dataset, path=["response"]) + assert_matches_type(AsyncSinglePage[DLPDataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -429,7 +426,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(Optional[DLPDatasetArray], dataset, path=["response"]) + assert_matches_type(AsyncSinglePage[DLPDataset], dataset, path=["response"]) @pytest.mark.skip() @parametrize @@ -441,7 +438,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" dataset = await response.parse() - assert_matches_type(Optional[DLPDatasetArray], dataset, path=["response"]) + assert_matches_type(AsyncSinglePage[DLPDataset], dataset, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/dlp/test_profiles.py b/tests/api_resources/zero_trust/dlp/test_profiles.py index 0c9f30725ef..d4aba3617f9 100644 --- a/tests/api_resources/zero_trust/dlp/test_profiles.py +++ b/tests/api_resources/zero_trust/dlp/test_profiles.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.dlp import ProfileGetResponse, ProfileListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.dlp import DLPProfiles, ProfileGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: profile = client.zero_trust.dlp.profiles.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ProfileListResponse], profile, path=["response"]) + assert_matches_type(SyncSinglePage[DLPProfiles], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = response.parse() - assert_matches_type(Optional[ProfileListResponse], profile, path=["response"]) + assert_matches_type(SyncSinglePage[DLPProfiles], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = response.parse() - assert_matches_type(Optional[ProfileListResponse], profile, path=["response"]) + assert_matches_type(SyncSinglePage[DLPProfiles], profile, path=["response"]) assert cast(Any, response.is_closed) is True @@ -121,7 +122,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: profile = await async_client.zero_trust.dlp.profiles.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[ProfileListResponse], profile, path=["response"]) + assert_matches_type(AsyncSinglePage[DLPProfiles], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +134,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = await response.parse() - assert_matches_type(Optional[ProfileListResponse], profile, path=["response"]) + assert_matches_type(AsyncSinglePage[DLPProfiles], profile, path=["response"]) @pytest.mark.skip() @parametrize @@ -145,7 +146,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" profile = await response.parse() - assert_matches_type(Optional[ProfileListResponse], profile, path=["response"]) + assert_matches_type(AsyncSinglePage[DLPProfiles], profile, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/lists/test_items.py b/tests/api_resources/zero_trust/gateway/lists/test_items.py index 897c1cd5eba..e16f44bd1ce 100644 --- a/tests/api_resources/zero_trust/gateway/lists/test_items.py +++ b/tests/api_resources/zero_trust/gateway/lists/test_items.py @@ -3,12 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.gateway.lists import ItemListResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,7 +25,7 @@ def test_method_list(self, client: Cloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ItemListResponse], item, path=["response"]) + assert_matches_type(SyncSinglePage[ItemListResponse], item, path=["response"]) @pytest.mark.skip() @parametrize @@ -37,7 +38,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = response.parse() - assert_matches_type(Optional[ItemListResponse], item, path=["response"]) + assert_matches_type(SyncSinglePage[ItemListResponse], item, path=["response"]) @pytest.mark.skip() @parametrize @@ -50,7 +51,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = response.parse() - assert_matches_type(Optional[ItemListResponse], item, path=["response"]) + assert_matches_type(SyncSinglePage[ItemListResponse], item, path=["response"]) assert cast(Any, response.is_closed) is True @@ -80,7 +81,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ItemListResponse], item, path=["response"]) + assert_matches_type(AsyncSinglePage[ItemListResponse], item, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = await response.parse() - assert_matches_type(Optional[ItemListResponse], item, path=["response"]) + assert_matches_type(AsyncSinglePage[ItemListResponse], item, path=["response"]) @pytest.mark.skip() @parametrize @@ -106,7 +107,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" item = await response.parse() - assert_matches_type(Optional[ItemListResponse], item, path=["response"]) + assert_matches_type(AsyncSinglePage[ItemListResponse], item, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_app_types.py b/tests/api_resources/zero_trust/gateway/test_app_types.py index 4a31c39d68c..1c07ff95dc2 100644 --- a/tests/api_resources/zero_trust/gateway/test_app_types.py +++ b/tests/api_resources/zero_trust/gateway/test_app_types.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.gateway import AppTypeListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayAppTypes base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: app_type = client.zero_trust.gateway.app_types.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[AppTypeListResponse], app_type, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = response.parse() - assert_matches_type(Optional[AppTypeListResponse], app_type, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = response.parse() - assert_matches_type(Optional[AppTypeListResponse], app_type, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: app_type = await async_client.zero_trust.gateway.app_types.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[AppTypeListResponse], app_type, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = await response.parse() - assert_matches_type(Optional[AppTypeListResponse], app_type, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" app_type = await response.parse() - assert_matches_type(Optional[AppTypeListResponse], app_type, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayAppTypes], app_type, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_categories.py b/tests/api_resources/zero_trust/gateway/test_categories.py index ea56415fa87..597b08b3c5d 100644 --- a/tests/api_resources/zero_trust/gateway/test_categories.py +++ b/tests/api_resources/zero_trust/gateway/test_categories.py @@ -3,13 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust.gateway import CategoryListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust.gateway import ZeroTrustGatewayCategories base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: category = client.zero_trust.gateway.categories.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CategoryListResponse], category, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = response.parse() - assert_matches_type(Optional[CategoryListResponse], category, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = response.parse() - assert_matches_type(Optional[CategoryListResponse], category, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) assert cast(Any, response.is_closed) is True @@ -69,7 +70,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: category = await async_client.zero_trust.gateway.categories.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[CategoryListResponse], category, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -81,7 +82,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = await response.parse() - assert_matches_type(Optional[CategoryListResponse], category, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) @pytest.mark.skip() @parametrize @@ -93,7 +94,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" category = await response.parse() - assert_matches_type(Optional[CategoryListResponse], category, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayCategories], category, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_lists.py b/tests/api_resources/zero_trust/gateway/test_lists.py index 93252fb2077..3744b856256 100644 --- a/tests/api_resources/zero_trust/gateway/test_lists.py +++ b/tests/api_resources/zero_trust/gateway/test_lists.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.gateway import ( - ListListResponse, ListCreateResponse, ListDeleteResponse, ZeroTrustGatewayLists, @@ -158,7 +158,7 @@ def test_method_list(self, client: Cloudflare) -> None: list = client.zero_trust.gateway.lists.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -170,7 +170,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -182,7 +182,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) assert cast(Any, response.is_closed) is True @@ -501,7 +501,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: list = await async_client.zero_trust.gateway.lists.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -513,7 +513,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) @pytest.mark.skip() @parametrize @@ -525,7 +525,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" list = await response.parse() - assert_matches_type(Optional[ListListResponse], list, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLists], list, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_locations.py b/tests/api_resources/zero_trust/gateway/test_locations.py index eac3bc084ca..fcc448b5063 100644 --- a/tests/api_resources/zero_trust/gateway/test_locations.py +++ b/tests/api_resources/zero_trust/gateway/test_locations.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.gateway import ( - LocationListResponse, LocationDeleteResponse, ZeroTrustGatewayLocations, ) @@ -155,7 +155,7 @@ def test_method_list(self, client: Cloudflare) -> None: location = client.zero_trust.gateway.locations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[LocationListResponse], location, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -167,7 +167,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(Optional[LocationListResponse], location, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -179,7 +179,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = response.parse() - assert_matches_type(Optional[LocationListResponse], location, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) assert cast(Any, response.is_closed) is True @@ -433,7 +433,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: location = await async_client.zero_trust.gateway.locations.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[LocationListResponse], location, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -445,7 +445,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(Optional[LocationListResponse], location, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) @pytest.mark.skip() @parametrize @@ -457,7 +457,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" location = await response.parse() - assert_matches_type(Optional[LocationListResponse], location, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayLocations], location, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py b/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py index 4165f99f68e..8b9d29867c4 100644 --- a/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py +++ b/tests/api_resources/zero_trust/gateway/test_proxy_endpoints.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.gateway import ( - ProxyEndpointListResponse, ProxyEndpointDeleteResponse, ZeroTrustGatewayProxyEndpoints, ) @@ -88,7 +88,7 @@ def test_method_list(self, client: Cloudflare) -> None: proxy_endpoint = client.zero_trust.gateway.proxy_endpoints.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ProxyEndpointListResponse], proxy_endpoint, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -100,7 +100,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(Optional[ProxyEndpointListResponse], proxy_endpoint, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -112,7 +112,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = response.parse() - assert_matches_type(Optional[ProxyEndpointListResponse], proxy_endpoint, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True @@ -363,7 +363,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: proxy_endpoint = await async_client.zero_trust.gateway.proxy_endpoints.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[ProxyEndpointListResponse], proxy_endpoint, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -375,7 +375,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(Optional[ProxyEndpointListResponse], proxy_endpoint, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) @pytest.mark.skip() @parametrize @@ -387,7 +387,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" proxy_endpoint = await response.parse() - assert_matches_type(Optional[ProxyEndpointListResponse], proxy_endpoint, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayProxyEndpoints], proxy_endpoint, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/gateway/test_rules.py b/tests/api_resources/zero_trust/gateway/test_rules.py index 0855ed25352..c6ba3450655 100644 --- a/tests/api_resources/zero_trust/gateway/test_rules.py +++ b/tests/api_resources/zero_trust/gateway/test_rules.py @@ -3,14 +3,14 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.gateway import ( - RuleListResponse, RuleDeleteResponse, ZeroTrustGatewayRules, ) @@ -366,7 +366,7 @@ def test_method_list(self, client: Cloudflare) -> None: rule = client.zero_trust.gateway.rules.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -378,7 +378,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -390,7 +390,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) assert cast(Any, response.is_closed) is True @@ -855,7 +855,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: rule = await async_client.zero_trust.gateway.rules.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -867,7 +867,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) @pytest.mark.skip() @parametrize @@ -879,7 +879,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" rule = await response.parse() - assert_matches_type(Optional[RuleListResponse], rule, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustGatewayRules], rule, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/networks/test_virtual_networks.py b/tests/api_resources/zero_trust/networks/test_virtual_networks.py index 7303c7ba480..0f9798517cb 100644 --- a/tests/api_resources/zero_trust/networks/test_virtual_networks.py +++ b/tests/api_resources/zero_trust/networks/test_virtual_networks.py @@ -3,15 +3,16 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust.networks import ( + TunnelVirtualNetwork, VirtualNetworkEditResponse, - VirtualNetworkListResponse, VirtualNetworkCreateResponse, VirtualNetworkDeleteResponse, ) @@ -85,7 +86,7 @@ def test_method_list(self, client: Cloudflare) -> None: virtual_network = client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +98,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: name="us-east-1-vpc", vnet_name="us-east-1-vpc", ) - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +110,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = response.parse() - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +122,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = response.parse() - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(SyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) assert cast(Any, response.is_closed) is True @@ -316,7 +317,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: virtual_network = await async_client.zero_trust.networks.virtual_networks.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -328,7 +329,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) name="us-east-1-vpc", vnet_name="us-east-1-vpc", ) - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -340,7 +341,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = await response.parse() - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) @pytest.mark.skip() @parametrize @@ -352,7 +353,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" virtual_network = await response.parse() - assert_matches_type(Optional[VirtualNetworkListResponse], virtual_network, path=["response"]) + assert_matches_type(AsyncSinglePage[TunnelVirtualNetwork], virtual_network, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_devices.py b/tests/api_resources/zero_trust/test_devices.py index 4906f8a07c7..bdc426140f6 100644 --- a/tests/api_resources/zero_trust/test_devices.py +++ b/tests/api_resources/zero_trust/test_devices.py @@ -9,7 +9,8 @@ from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type -from cloudflare.types.zero_trust import DeviceGetResponse, DeviceListResponse +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage +from cloudflare.types.zero_trust import ZeroTrustDevices, DeviceGetResponse base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +24,7 @@ def test_method_list(self, client: Cloudflare) -> None: device = client.zero_trust.devices.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceListResponse], device, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustDevices], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -35,7 +36,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(Optional[DeviceListResponse], device, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustDevices], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -47,7 +48,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = response.parse() - assert_matches_type(Optional[DeviceListResponse], device, path=["response"]) + assert_matches_type(SyncSinglePage[ZeroTrustDevices], device, path=["response"]) assert cast(Any, response.is_closed) is True @@ -121,7 +122,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: device = await async_client.zero_trust.devices.list( account_id="699d98642c564d2e855e9661899b7252", ) - assert_matches_type(Optional[DeviceListResponse], device, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustDevices], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +134,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(Optional[DeviceListResponse], device, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustDevices], device, path=["response"]) @pytest.mark.skip() @parametrize @@ -145,7 +146,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" device = await response.parse() - assert_matches_type(Optional[DeviceListResponse], device, path=["response"]) + assert_matches_type(AsyncSinglePage[ZeroTrustDevices], device, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zero_trust/test_identity_providers.py b/tests/api_resources/zero_trust/test_identity_providers.py index 88f99fd5541..39ad381c741 100644 --- a/tests/api_resources/zero_trust/test_identity_providers.py +++ b/tests/api_resources/zero_trust/test_identity_providers.py @@ -3,12 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zero_trust import ( ZeroTrustIdentityProviders, IdentityProviderListResponse, @@ -2836,7 +2837,7 @@ def test_method_list(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2845,7 +2846,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2858,7 +2859,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -2871,7 +2872,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = response.parse() - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(SyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True @@ -5857,7 +5858,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: account_id="string", zone_id="string", ) - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(AsyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5866,7 +5867,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) account_id="string", zone_id="string", ) - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(AsyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5879,7 +5880,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(AsyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) @pytest.mark.skip() @parametrize @@ -5892,7 +5893,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" identity_provider = await response.parse() - assert_matches_type(Optional[IdentityProviderListResponse], identity_provider, path=["response"]) + assert_matches_type(AsyncSinglePage[IdentityProviderListResponse], identity_provider, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/zones/test_subscriptions.py b/tests/api_resources/zones/test_subscriptions.py index 4466dd2d214..969e48d0ee7 100644 --- a/tests/api_resources/zones/test_subscriptions.py +++ b/tests/api_resources/zones/test_subscriptions.py @@ -3,12 +3,13 @@ from __future__ import annotations import os -from typing import Any, Optional, cast +from typing import Any, cast import pytest from cloudflare import Cloudflare, AsyncCloudflare from tests.utils import assert_matches_type +from cloudflare.pagination import SyncSinglePage, AsyncSinglePage from cloudflare.types.zones import ( SubscriptionGetResponse, SubscriptionListResponse, @@ -109,7 +110,7 @@ def test_method_list(self, client: Cloudflare) -> None: subscription = client.zones.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -121,7 +122,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -133,7 +134,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(SyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) assert cast(Any, response.is_closed) is True @@ -279,7 +280,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None: subscription = await async_client.zones.subscriptions.list( "023e105f4ecef8ad9ca31a8372d0c353", ) - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -291,7 +292,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) @pytest.mark.skip() @parametrize @@ -303,7 +304,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N assert response.http_request.headers.get("X-Stainless-Lang") == "python" subscription = await response.parse() - assert_matches_type(Optional[SubscriptionListResponse], subscription, path=["response"]) + assert_matches_type(AsyncSinglePage[SubscriptionListResponse], subscription, path=["response"]) assert cast(Any, response.is_closed) is True