gcore 0.13.0__py3-none-any.whl → 0.14.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gcore might be problematic. Click here for more details.

Files changed (334) hide show
  1. gcore/__init__.py +3 -1
  2. gcore/_base_client.py +9 -9
  3. gcore/_client.py +25 -10
  4. gcore/_models.py +10 -4
  5. gcore/_qs.py +7 -7
  6. gcore/_types.py +18 -11
  7. gcore/_utils/_transform.py +2 -2
  8. gcore/_utils/_utils.py +4 -4
  9. gcore/_version.py +1 -1
  10. gcore/pagination.py +137 -0
  11. gcore/resources/__init__.py +14 -0
  12. gcore/resources/cdn/__init__.py +201 -0
  13. gcore/resources/cdn/audit_log.py +406 -0
  14. gcore/resources/cdn/cdn.py +957 -0
  15. gcore/resources/cdn/certificates.py +1062 -0
  16. gcore/resources/cdn/ip_ranges.py +224 -0
  17. gcore/resources/cdn/logs/__init__.py +33 -0
  18. gcore/resources/cdn/logs/logs.py +1424 -0
  19. gcore/resources/cdn/logs/settings.py +1081 -0
  20. gcore/resources/cdn/logs_uploader/__init__.py +61 -0
  21. gcore/resources/cdn/logs_uploader/configs.py +868 -0
  22. gcore/resources/cdn/logs_uploader/logs_uploader.py +166 -0
  23. gcore/resources/cdn/logs_uploader/policies.py +1060 -0
  24. gcore/resources/cdn/logs_uploader/targets.py +811 -0
  25. gcore/resources/cdn/metrics.py +419 -0
  26. gcore/resources/cdn/network_capacity.py +139 -0
  27. gcore/resources/cdn/origin_groups.py +1496 -0
  28. gcore/resources/cdn/resources/__init__.py +47 -0
  29. gcore/resources/cdn/resources/resources.py +2060 -0
  30. gcore/resources/cdn/resources/rules.py +1027 -0
  31. gcore/resources/cdn/resources/shield.py +259 -0
  32. gcore/resources/cdn/rule_templates.py +883 -0
  33. gcore/resources/cdn/shields.py +139 -0
  34. gcore/resources/cdn/statistics.py +1408 -0
  35. gcore/resources/cdn/trusted_ca_certificates.py +592 -0
  36. gcore/resources/cloud/audit_logs.py +33 -29
  37. gcore/resources/cloud/baremetal/flavors.py +21 -17
  38. gcore/resources/cloud/baremetal/images.py +19 -15
  39. gcore/resources/cloud/baremetal/servers.py +141 -119
  40. gcore/resources/cloud/billing_reservations.py +41 -33
  41. gcore/resources/cloud/cloud.py +24 -0
  42. gcore/resources/cloud/cost_reports.py +149 -119
  43. gcore/resources/cloud/file_shares/access_rules.py +25 -13
  44. gcore/resources/cloud/file_shares/file_shares.py +107 -71
  45. gcore/resources/cloud/floating_ips.py +101 -59
  46. gcore/resources/cloud/gpu_baremetal_clusters/flavors.py +13 -9
  47. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +275 -65
  48. gcore/resources/cloud/gpu_baremetal_clusters/images.py +69 -53
  49. gcore/resources/cloud/gpu_baremetal_clusters/interfaces.py +9 -5
  50. gcore/resources/cloud/gpu_baremetal_clusters/servers.py +151 -127
  51. gcore/resources/cloud/inference/api_keys.py +51 -31
  52. gcore/resources/cloud/inference/applications/deployments.py +49 -31
  53. gcore/resources/cloud/inference/applications/templates.py +17 -9
  54. gcore/resources/cloud/inference/deployments/deployments.py +171 -139
  55. gcore/resources/cloud/inference/deployments/logs.py +17 -13
  56. gcore/resources/cloud/inference/flavors.py +21 -13
  57. gcore/resources/cloud/inference/inference.py +9 -5
  58. gcore/resources/cloud/inference/registry_credentials.py +45 -25
  59. gcore/resources/cloud/inference/secrets.py +45 -25
  60. gcore/resources/cloud/instances/flavors.py +17 -13
  61. gcore/resources/cloud/instances/images.py +153 -129
  62. gcore/resources/cloud/instances/instances.py +287 -213
  63. gcore/resources/cloud/instances/interfaces.py +165 -161
  64. gcore/resources/cloud/instances/metrics.py +9 -5
  65. gcore/resources/cloud/ip_ranges.py +25 -15
  66. gcore/resources/cloud/k8s/clusters/clusters.py +151 -87
  67. gcore/resources/cloud/k8s/clusters/nodes.py +19 -11
  68. gcore/resources/cloud/k8s/clusters/pools/nodes.py +19 -11
  69. gcore/resources/cloud/k8s/clusters/pools/pools.py +83 -59
  70. gcore/resources/cloud/k8s/flavors.py +13 -9
  71. gcore/resources/cloud/k8s/k8s.py +9 -5
  72. gcore/resources/cloud/load_balancers/flavors.py +11 -7
  73. gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +103 -83
  74. gcore/resources/cloud/load_balancers/l7_policies/rules.py +77 -57
  75. gcore/resources/cloud/load_balancers/listeners.py +125 -105
  76. gcore/resources/cloud/load_balancers/load_balancers.py +155 -123
  77. gcore/resources/cloud/load_balancers/metrics.py +9 -5
  78. gcore/resources/cloud/load_balancers/pools/health_monitors.py +25 -17
  79. gcore/resources/cloud/load_balancers/pools/members.py +31 -23
  80. gcore/resources/cloud/load_balancers/pools/pools.py +155 -129
  81. gcore/resources/cloud/load_balancers/statuses.py +17 -9
  82. gcore/resources/cloud/networks/networks.py +79 -55
  83. gcore/resources/cloud/networks/routers.py +75 -47
  84. gcore/resources/cloud/networks/subnets.py +105 -81
  85. gcore/resources/cloud/placement_groups.py +33 -17
  86. gcore/resources/cloud/projects.py +53 -41
  87. gcore/resources/cloud/quotas/quotas.py +25 -13
  88. gcore/resources/cloud/quotas/requests.py +41 -25
  89. gcore/resources/cloud/regions.py +25 -23
  90. gcore/resources/cloud/registries/artifacts.py +17 -9
  91. gcore/resources/cloud/registries/registries.py +55 -29
  92. gcore/resources/cloud/registries/repositories.py +17 -9
  93. gcore/resources/cloud/registries/tags.py +9 -5
  94. gcore/resources/cloud/registries/users.py +65 -35
  95. gcore/resources/cloud/reserved_fixed_ips/reserved_fixed_ips.py +123 -107
  96. gcore/resources/cloud/reserved_fixed_ips/vip.py +45 -25
  97. gcore/resources/cloud/secrets.py +43 -27
  98. gcore/resources/cloud/security_groups/rules.py +55 -43
  99. gcore/resources/cloud/security_groups/security_groups.py +79 -47
  100. gcore/resources/cloud/ssh_keys.py +51 -31
  101. gcore/resources/cloud/tasks.py +57 -45
  102. gcore/resources/cloud/usage_reports.py +27 -23
  103. gcore/resources/cloud/users/role_assignments.py +49 -33
  104. gcore/resources/cloud/volumes.py +237 -201
  105. gcore/resources/dns/dns.py +17 -13
  106. gcore/resources/dns/locations.py +29 -17
  107. gcore/resources/dns/metrics.py +13 -9
  108. gcore/resources/dns/pickers/pickers.py +5 -5
  109. gcore/resources/dns/pickers/presets.py +9 -5
  110. gcore/resources/dns/zones/dnssec.py +19 -11
  111. gcore/resources/dns/zones/rrsets.py +149 -91
  112. gcore/resources/dns/zones/zones.py +245 -187
  113. gcore/resources/fastedge/apps/apps.py +105 -89
  114. gcore/resources/fastedge/apps/logs.py +25 -21
  115. gcore/resources/fastedge/binaries.py +33 -17
  116. gcore/resources/fastedge/fastedge.py +5 -5
  117. gcore/resources/fastedge/kv_stores.py +43 -31
  118. gcore/resources/fastedge/secrets.py +69 -45
  119. gcore/resources/fastedge/statistics.py +25 -17
  120. gcore/resources/fastedge/templates.py +59 -39
  121. gcore/resources/iam/api_tokens.py +43 -27
  122. gcore/resources/iam/iam.py +5 -5
  123. gcore/resources/iam/users.py +97 -65
  124. gcore/resources/security/bgp_announces.py +27 -19
  125. gcore/resources/security/events.py +23 -19
  126. gcore/resources/security/profile_templates.py +9 -5
  127. gcore/resources/security/profiles.py +69 -45
  128. gcore/resources/storage/buckets/buckets.py +37 -25
  129. gcore/resources/storage/buckets/cors.py +19 -11
  130. gcore/resources/storage/buckets/lifecycle.py +19 -11
  131. gcore/resources/storage/buckets/policy.py +25 -13
  132. gcore/resources/storage/credentials.py +19 -15
  133. gcore/resources/storage/locations.py +13 -9
  134. gcore/resources/storage/statistics.py +39 -31
  135. gcore/resources/storage/storage.py +105 -69
  136. gcore/resources/streaming/ai_tasks.py +307 -197
  137. gcore/resources/streaming/broadcasts.py +63 -35
  138. gcore/resources/streaming/directories.py +65 -39
  139. gcore/resources/streaming/players.py +47 -31
  140. gcore/resources/streaming/playlists.py +189 -123
  141. gcore/resources/streaming/quality_sets.py +69 -39
  142. gcore/resources/streaming/restreams.py +47 -27
  143. gcore/resources/streaming/statistics.py +613 -407
  144. gcore/resources/streaming/streams/overlays.py +107 -67
  145. gcore/resources/streaming/streams/streams.py +403 -263
  146. gcore/resources/streaming/videos/subtitles.py +131 -75
  147. gcore/resources/streaming/videos/videos.py +429 -279
  148. gcore/resources/waap/advanced_rules.py +9 -5
  149. gcore/resources/waap/custom_page_sets.py +99 -75
  150. gcore/resources/waap/domains/advanced_rules.py +157 -99
  151. gcore/resources/waap/domains/api_discovery.py +71 -47
  152. gcore/resources/waap/domains/api_path_groups.py +9 -5
  153. gcore/resources/waap/domains/api_paths.py +79 -83
  154. gcore/resources/waap/domains/custom_rules.py +89 -59
  155. gcore/resources/waap/domains/domains.py +59 -41
  156. gcore/resources/waap/domains/firewall_rules.py +83 -55
  157. gcore/resources/waap/domains/insight_silences.py +59 -39
  158. gcore/resources/waap/domains/insights.py +39 -27
  159. gcore/resources/waap/domains/settings.py +21 -13
  160. gcore/resources/waap/domains/statistics.py +99 -75
  161. gcore/resources/waap/insights.py +23 -21
  162. gcore/resources/waap/ip_info/ip_info.py +65 -33
  163. gcore/resources/waap/ip_info/metrics.py +11 -7
  164. gcore/resources/waap/organizations.py +17 -13
  165. gcore/resources/waap/statistics.py +9 -5
  166. gcore/resources/waap/tags.py +17 -17
  167. gcore/resources/waap/waap.py +5 -5
  168. gcore/types/cdn/__init__.py +80 -0
  169. gcore/types/cdn/audit_log_list_params.py +73 -0
  170. gcore/types/cdn/ca_certificate.py +53 -0
  171. gcore/types/cdn/ca_certificate_list.py +10 -0
  172. gcore/types/cdn/cdn_account.py +86 -0
  173. gcore/types/cdn/cdn_account_limits.py +27 -0
  174. gcore/types/cdn/cdn_audit_log_entry.py +66 -0
  175. gcore/types/cdn/cdn_available_features.py +46 -0
  176. gcore/types/cdn/cdn_list_purge_statuses_params.py +67 -0
  177. gcore/types/cdn/cdn_log_entry.py +70 -0
  178. gcore/types/cdn/cdn_metrics.py +22 -0
  179. gcore/types/cdn/cdn_metrics_groups.py +13 -0
  180. gcore/types/cdn/cdn_metrics_values.py +19 -0
  181. gcore/types/cdn/cdn_resource.py +1977 -0
  182. gcore/types/cdn/cdn_resource_list.py +10 -0
  183. gcore/types/cdn/cdn_update_account_params.py +15 -0
  184. gcore/types/cdn/certificate_create_params.py +51 -0
  185. gcore/types/cdn/certificate_get_status_params.py +14 -0
  186. gcore/types/cdn/certificate_list_params.py +29 -0
  187. gcore/types/cdn/certificate_replace_params.py +39 -0
  188. gcore/types/cdn/log_download_params.py +279 -0
  189. gcore/types/cdn/log_list_params.py +273 -0
  190. gcore/types/cdn/logs/__init__.py +7 -0
  191. gcore/types/cdn/logs/log_settings.py +172 -0
  192. gcore/types/cdn/logs/setting_create_params.py +200 -0
  193. gcore/types/cdn/logs/setting_update_params.py +200 -0
  194. gcore/types/cdn/logs_aggregated_stats.py +23 -0
  195. gcore/types/cdn/logs_uploader/__init__.py +23 -0
  196. gcore/types/cdn/logs_uploader/config_create_params.py +32 -0
  197. gcore/types/cdn/logs_uploader/config_list_params.py +16 -0
  198. gcore/types/cdn/logs_uploader/config_replace_params.py +32 -0
  199. gcore/types/cdn/logs_uploader/config_update_params.py +32 -0
  200. gcore/types/cdn/logs_uploader/logs_uploader_config.py +51 -0
  201. gcore/types/cdn/logs_uploader/logs_uploader_config_list.py +10 -0
  202. gcore/types/cdn/logs_uploader/logs_uploader_policy.py +73 -0
  203. gcore/types/cdn/logs_uploader/logs_uploader_policy_list.py +10 -0
  204. gcore/types/cdn/logs_uploader/logs_uploader_target.py +236 -0
  205. gcore/types/cdn/logs_uploader/logs_uploader_target_list.py +10 -0
  206. gcore/types/cdn/logs_uploader/policy_create_params.py +61 -0
  207. gcore/types/cdn/logs_uploader/policy_list_fields_response.py +8 -0
  208. gcore/types/cdn/logs_uploader/policy_list_params.py +16 -0
  209. gcore/types/cdn/logs_uploader/policy_replace_params.py +61 -0
  210. gcore/types/cdn/logs_uploader/policy_update_params.py +61 -0
  211. gcore/types/cdn/logs_uploader/target_create_params.py +249 -0
  212. gcore/types/cdn/logs_uploader/target_list_params.py +16 -0
  213. gcore/types/cdn/logs_uploader/target_replace_params.py +249 -0
  214. gcore/types/cdn/logs_uploader/target_update_params.py +249 -0
  215. gcore/types/cdn/logs_uploader_validation.py +23 -0
  216. gcore/types/cdn/metric_list_params.py +168 -0
  217. gcore/types/cdn/network_capacity.py +22 -0
  218. gcore/types/cdn/origin_group_create_params.py +184 -0
  219. gcore/types/cdn/origin_group_list_params.py +24 -0
  220. gcore/types/cdn/origin_group_replace_params.py +190 -0
  221. gcore/types/cdn/origin_group_update_params.py +190 -0
  222. gcore/types/cdn/origin_groups.py +212 -0
  223. gcore/types/cdn/origin_groups_list.py +10 -0
  224. gcore/types/cdn/public_ip_list.py +15 -0
  225. gcore/types/cdn/public_network_list.py +15 -0
  226. gcore/types/cdn/purge_status.py +55 -0
  227. gcore/types/cdn/resource_aggregated_stats.py +80 -0
  228. gcore/types/cdn/resource_create_params.py +1825 -0
  229. gcore/types/cdn/resource_list_params.py +107 -0
  230. gcore/types/cdn/resource_prefetch_params.py +17 -0
  231. gcore/types/cdn/resource_purge_params.py +71 -0
  232. gcore/types/cdn/resource_replace_params.py +1803 -0
  233. gcore/types/cdn/resource_update_params.py +1794 -0
  234. gcore/types/cdn/resource_usage_stats.py +111 -0
  235. gcore/types/cdn/resources/__init__.py +11 -0
  236. gcore/types/cdn/resources/cdn_resource_rule.py +1695 -0
  237. gcore/types/cdn/resources/origin_shielding.py +15 -0
  238. gcore/types/cdn/resources/rule_create_params.py +1652 -0
  239. gcore/types/cdn/resources/rule_list_response.py +10 -0
  240. gcore/types/cdn/resources/rule_replace_params.py +1654 -0
  241. gcore/types/cdn/resources/rule_update_params.py +1654 -0
  242. gcore/types/cdn/resources/shield_replace_params.py +16 -0
  243. gcore/types/cdn/rule_template.py +1666 -0
  244. gcore/types/cdn/rule_template_create_params.py +1636 -0
  245. gcore/types/cdn/rule_template_list.py +10 -0
  246. gcore/types/cdn/rule_template_replace_params.py +1636 -0
  247. gcore/types/cdn/rule_template_update_params.py +1636 -0
  248. gcore/types/cdn/shield_aggregated_stats.py +23 -0
  249. gcore/types/cdn/shield_list_response.py +25 -0
  250. gcore/types/cdn/ssl_detail.py +62 -0
  251. gcore/types/cdn/ssl_detail_list.py +10 -0
  252. gcore/types/cdn/ssl_request_status.py +135 -0
  253. gcore/types/cdn/statistic_get_logs_usage_aggregated_params.py +42 -0
  254. gcore/types/cdn/statistic_get_logs_usage_series_params.py +35 -0
  255. gcore/types/cdn/statistic_get_resource_usage_aggregated_params.py +151 -0
  256. gcore/types/cdn/statistic_get_resource_usage_series_params.py +131 -0
  257. gcore/types/cdn/statistic_get_shield_usage_aggregated_params.py +42 -0
  258. gcore/types/cdn/statistic_get_shield_usage_series_params.py +25 -0
  259. gcore/types/cdn/trusted_ca_certificate_create_params.py +23 -0
  260. gcore/types/cdn/trusted_ca_certificate_list_params.py +29 -0
  261. gcore/types/cdn/trusted_ca_certificate_replace_params.py +15 -0
  262. gcore/types/cdn/usage_series_stats.py +31 -0
  263. gcore/types/cloud/__init__.py +1 -0
  264. gcore/types/cloud/file_share.py +4 -0
  265. gcore/types/cloud/file_share_create_params.py +20 -0
  266. gcore/types/cloud/file_share_update_params.py +40 -3
  267. gcore/types/cloud/floating_ip_update_params.py +3 -1
  268. gcore/types/cloud/gpu_baremetal_cluster_action_params.py +46 -0
  269. gcore/types/cloud/inference/inference_deployment.py +3 -1
  270. gcore/types/cloud/instance_create_params.py +3 -1
  271. gcore/types/cloud/k8s/cluster_create_params.py +46 -4
  272. gcore/types/cloud/k8s/cluster_update_params.py +60 -6
  273. gcore/types/cloud/k8s/clusters/pool_update_params.py +1 -1
  274. gcore/types/cloud/k8s/k8s_cluster.py +40 -3
  275. gcore/types/cloud/load_balancer_update_params.py +3 -1
  276. gcore/types/cloud/network_update_params.py +3 -1
  277. gcore/types/cloud/networks/subnet_update_params.py +3 -1
  278. gcore/types/cloud/registries/user_create_multiple_params.py +5 -3
  279. gcore/types/cloud/registries/user_create_params.py +5 -3
  280. gcore/types/cloud/registry_create_params.py +5 -3
  281. gcore/types/cloud/security_group_update_params.py +3 -1
  282. gcore/types/cloud/ssh_key_created.py +6 -3
  283. gcore/types/cloud/volume_update_params.py +3 -1
  284. gcore/types/dns/zone_get_statistics_params.py +12 -9
  285. gcore/types/dns/zone_get_statistics_response.py +3 -1
  286. gcore/types/dns/zone_import_params.py +21 -15
  287. gcore/types/dns/zones/dns_output_rrset.py +7 -3
  288. gcore/types/iam/account_overview.py +7 -2
  289. gcore/types/iam/user.py +7 -2
  290. gcore/types/iam/user_detailed.py +7 -2
  291. gcore/types/iam/user_invite_params.py +4 -1
  292. gcore/types/iam/user_update.py +7 -2
  293. gcore/types/iam/user_update_params.py +7 -2
  294. gcore/types/streaming/ai_contentmoderation_hardnudity.py +6 -4
  295. gcore/types/streaming/ai_contentmoderation_nsfw.py +6 -4
  296. gcore/types/streaming/ai_contentmoderation_softnudity.py +6 -4
  297. gcore/types/streaming/ai_contentmoderation_sport.py +6 -4
  298. gcore/types/streaming/ai_task.py +20 -11
  299. gcore/types/streaming/ai_task_create_params.py +20 -11
  300. gcore/types/streaming/ai_task_get_response.py +5 -4
  301. gcore/types/streaming/ai_task_list_params.py +11 -5
  302. gcore/types/streaming/clip.py +33 -22
  303. gcore/types/streaming/create_video_param.py +75 -43
  304. gcore/types/streaming/playlist.py +7 -5
  305. gcore/types/streaming/playlist_create_params.py +7 -5
  306. gcore/types/streaming/playlist_update_params.py +7 -5
  307. gcore/types/streaming/playlist_video.py +75 -43
  308. gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +7 -4
  309. gcore/types/streaming/stream.py +207 -136
  310. gcore/types/streaming/stream_create_clip_params.py +33 -22
  311. gcore/types/streaming/stream_create_params.py +41 -24
  312. gcore/types/streaming/stream_update_params.py +41 -24
  313. gcore/types/streaming/video.py +138 -76
  314. gcore/types/streaming/video_list_params.py +4 -2
  315. gcore/types/streaming/video_update_params.py +75 -43
  316. gcore/types/waap/domain_update_params.py +2 -2
  317. gcore/types/waap/domains/advanced_rule_create_params.py +26 -18
  318. gcore/types/waap/domains/advanced_rule_list_params.py +10 -7
  319. gcore/types/waap/domains/advanced_rule_update_params.py +22 -17
  320. gcore/types/waap/domains/api_path_create_params.py +0 -3
  321. gcore/types/waap/domains/api_path_update_params.py +1 -3
  322. gcore/types/waap/domains/custom_rule_create_params.py +36 -35
  323. gcore/types/waap/domains/custom_rule_update_params.py +31 -33
  324. gcore/types/waap/domains/firewall_rule_create_params.py +6 -6
  325. gcore/types/waap/domains/firewall_rule_update_params.py +5 -5
  326. gcore/types/waap/domains/waap_advanced_rule.py +17 -9
  327. gcore/types/waap/domains/waap_custom_rule.py +5 -2
  328. gcore/types/waap/domains/waap_firewall_rule.py +1 -1
  329. gcore/types/waap/domains/waap_insight.py +1 -1
  330. gcore/types/waap/insight_list_types_params.py +1 -1
  331. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/METADATA +1 -1
  332. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/RECORD +334 -214
  333. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/WHEEL +0 -0
  334. {gcore-0.13.0.dist-info → gcore-0.14.0.dist-info}/licenses/LICENSE +0 -0
gcore/__init__.py CHANGED
@@ -3,7 +3,7 @@
3
3
  import typing as _t
4
4
 
5
5
  from . import types
6
- from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
6
+ from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
7
7
  from ._utils import file_from_path
8
8
  from ._client import Gcore, Client, Stream, Timeout, Transport, AsyncGcore, AsyncClient, AsyncStream, RequestOptions
9
9
  from ._models import BaseModel
@@ -38,7 +38,9 @@ __all__ = [
38
38
  "ProxiesTypes",
39
39
  "NotGiven",
40
40
  "NOT_GIVEN",
41
+ "not_given",
41
42
  "Omit",
43
+ "omit",
42
44
  "GcoreError",
43
45
  "APIError",
44
46
  "APIStatusError",
gcore/_base_client.py CHANGED
@@ -42,7 +42,6 @@ from . import _exceptions
42
42
  from ._qs import Querystring
43
43
  from ._files import to_httpx_files, async_to_httpx_files
44
44
  from ._types import (
45
- NOT_GIVEN,
46
45
  Body,
47
46
  Omit,
48
47
  Query,
@@ -57,6 +56,7 @@ from ._types import (
57
56
  RequestOptions,
58
57
  HttpxRequestFiles,
59
58
  ModelBuilderProtocol,
59
+ not_given,
60
60
  )
61
61
  from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping
62
62
  from ._compat import PYDANTIC_V1, model_copy, model_dump
@@ -145,9 +145,9 @@ class PageInfo:
145
145
  def __init__(
146
146
  self,
147
147
  *,
148
- url: URL | NotGiven = NOT_GIVEN,
149
- json: Body | NotGiven = NOT_GIVEN,
150
- params: Query | NotGiven = NOT_GIVEN,
148
+ url: URL | NotGiven = not_given,
149
+ json: Body | NotGiven = not_given,
150
+ params: Query | NotGiven = not_given,
151
151
  ) -> None:
152
152
  self.url = url
153
153
  self.json = json
@@ -595,7 +595,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
595
595
  # we internally support defining a temporary header to override the
596
596
  # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response`
597
597
  # see _response.py for implementation details
598
- override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN)
598
+ override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given)
599
599
  if is_given(override_cast_to):
600
600
  options.headers = headers
601
601
  return cast(Type[ResponseT], override_cast_to)
@@ -825,7 +825,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
825
825
  version: str,
826
826
  base_url: str | URL,
827
827
  max_retries: int = DEFAULT_MAX_RETRIES,
828
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
828
+ timeout: float | Timeout | None | NotGiven = not_given,
829
829
  http_client: httpx.Client | None = None,
830
830
  custom_headers: Mapping[str, str] | None = None,
831
831
  custom_query: Mapping[str, object] | None = None,
@@ -1356,7 +1356,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
1356
1356
  base_url: str | URL,
1357
1357
  _strict_response_validation: bool,
1358
1358
  max_retries: int = DEFAULT_MAX_RETRIES,
1359
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
1359
+ timeout: float | Timeout | None | NotGiven = not_given,
1360
1360
  http_client: httpx.AsyncClient | None = None,
1361
1361
  custom_headers: Mapping[str, str] | None = None,
1362
1362
  custom_query: Mapping[str, object] | None = None,
@@ -1818,8 +1818,8 @@ def make_request_options(
1818
1818
  extra_query: Query | None = None,
1819
1819
  extra_body: Body | None = None,
1820
1820
  idempotency_key: str | None = None,
1821
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1822
- post_parser: PostParser | NotGiven = NOT_GIVEN,
1821
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1822
+ post_parser: PostParser | NotGiven = not_given,
1823
1823
  ) -> RequestOptions:
1824
1824
  """Create a dict of type RequestOptions without keys of NotGiven values."""
1825
1825
  options: RequestOptions = {}
gcore/_client.py CHANGED
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import os
6
- from typing import Any, Union, Mapping
6
+ from typing import Any, Mapping
7
7
  from typing_extensions import Self, override
8
8
 
9
9
  import httpx
@@ -11,13 +11,13 @@ import httpx
11
11
  from . import _exceptions
12
12
  from ._qs import Querystring
13
13
  from ._types import (
14
- NOT_GIVEN,
15
14
  Omit,
16
15
  Timeout,
17
16
  NotGiven,
18
17
  Transport,
19
18
  ProxiesTypes,
20
19
  RequestOptions,
20
+ not_given,
21
21
  )
22
22
  from ._utils import is_given, get_async_library, maybe_coerce_integer
23
23
  from ._version import __version__
@@ -28,6 +28,7 @@ from ._base_client import (
28
28
  SyncAPIClient,
29
29
  AsyncAPIClient,
30
30
  )
31
+ from .resources.cdn import cdn
31
32
  from .resources.dns import dns
32
33
  from .resources.iam import iam
33
34
  from .resources.waap import waap
@@ -49,6 +50,7 @@ class Gcore(SyncAPIClient):
49
50
  security: security.SecurityResource
50
51
  dns: dns.DNSResource
51
52
  storage: storage.StorageResource
53
+ cdn: cdn.CdnResource
52
54
  with_raw_response: GcoreWithRawResponse
53
55
  with_streaming_response: GcoreWithStreamedResponse
54
56
 
@@ -66,7 +68,7 @@ class Gcore(SyncAPIClient):
66
68
  cloud_region_id: int | None = None,
67
69
  cloud_polling_interval_seconds: int | None = 3,
68
70
  base_url: str | httpx.URL | None = None,
69
- timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
71
+ timeout: float | Timeout | None | NotGiven = not_given,
70
72
  max_retries: int = DEFAULT_MAX_RETRIES,
71
73
  default_headers: Mapping[str, str] | None = None,
72
74
  default_query: Mapping[str, object] | None = None,
@@ -113,6 +115,7 @@ class Gcore(SyncAPIClient):
113
115
 
114
116
  if base_url is None:
115
117
  base_url = os.environ.get("GCORE_BASE_URL")
118
+ self._base_url_overridden = base_url is not None
116
119
  if base_url is None:
117
120
  base_url = f"https://api.gcore.com"
118
121
 
@@ -135,6 +138,7 @@ class Gcore(SyncAPIClient):
135
138
  self.security = security.SecurityResource(self)
136
139
  self.dns = dns.DNSResource(self)
137
140
  self.storage = storage.StorageResource(self)
141
+ self.cdn = cdn.CdnResource(self)
138
142
  self.with_raw_response = GcoreWithRawResponse(self)
139
143
  self.with_streaming_response = GcoreWithStreamedResponse(self)
140
144
 
@@ -166,9 +170,9 @@ class Gcore(SyncAPIClient):
166
170
  cloud_region_id: int | None = None,
167
171
  cloud_polling_interval_seconds: int | None = None,
168
172
  base_url: str | httpx.URL | None = None,
169
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
173
+ timeout: float | Timeout | None | NotGiven = not_given,
170
174
  http_client: httpx.Client | None = None,
171
- max_retries: int | NotGiven = NOT_GIVEN,
175
+ max_retries: int | NotGiven = not_given,
172
176
  default_headers: Mapping[str, str] | None = None,
173
177
  set_default_headers: Mapping[str, str] | None = None,
174
178
  default_query: Mapping[str, object] | None = None,
@@ -197,7 +201,7 @@ class Gcore(SyncAPIClient):
197
201
  params = set_default_query
198
202
 
199
203
  http_client = http_client or self._client
200
- return self.__class__(
204
+ client = self.__class__(
201
205
  api_key=api_key or self.api_key,
202
206
  cloud_project_id=cloud_project_id or self.cloud_project_id,
203
207
  cloud_region_id=cloud_region_id or self.cloud_region_id,
@@ -210,6 +214,8 @@ class Gcore(SyncAPIClient):
210
214
  default_query=params,
211
215
  **_extra_kwargs,
212
216
  )
217
+ client._base_url_overridden = self._base_url_overridden or base_url is not None
218
+ return client
213
219
 
214
220
  # Alias for `copy` for nicer inline usage, e.g.
215
221
  # client.with_options(timeout=10).foo.create(...)
@@ -276,6 +282,7 @@ class AsyncGcore(AsyncAPIClient):
276
282
  security: security.AsyncSecurityResource
277
283
  dns: dns.AsyncDNSResource
278
284
  storage: storage.AsyncStorageResource
285
+ cdn: cdn.AsyncCdnResource
279
286
  with_raw_response: AsyncGcoreWithRawResponse
280
287
  with_streaming_response: AsyncGcoreWithStreamedResponse
281
288
 
@@ -293,7 +300,7 @@ class AsyncGcore(AsyncAPIClient):
293
300
  cloud_region_id: int | None = None,
294
301
  cloud_polling_interval_seconds: int | None = 3,
295
302
  base_url: str | httpx.URL | None = None,
296
- timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
303
+ timeout: float | Timeout | None | NotGiven = not_given,
297
304
  max_retries: int = DEFAULT_MAX_RETRIES,
298
305
  default_headers: Mapping[str, str] | None = None,
299
306
  default_query: Mapping[str, object] | None = None,
@@ -340,6 +347,7 @@ class AsyncGcore(AsyncAPIClient):
340
347
 
341
348
  if base_url is None:
342
349
  base_url = os.environ.get("GCORE_BASE_URL")
350
+ self._base_url_overridden = base_url is not None
343
351
  if base_url is None:
344
352
  base_url = f"https://api.gcore.com"
345
353
 
@@ -362,6 +370,7 @@ class AsyncGcore(AsyncAPIClient):
362
370
  self.security = security.AsyncSecurityResource(self)
363
371
  self.dns = dns.AsyncDNSResource(self)
364
372
  self.storage = storage.AsyncStorageResource(self)
373
+ self.cdn = cdn.AsyncCdnResource(self)
365
374
  self.with_raw_response = AsyncGcoreWithRawResponse(self)
366
375
  self.with_streaming_response = AsyncGcoreWithStreamedResponse(self)
367
376
 
@@ -393,9 +402,9 @@ class AsyncGcore(AsyncAPIClient):
393
402
  cloud_region_id: int | None = None,
394
403
  cloud_polling_interval_seconds: int | None = None,
395
404
  base_url: str | httpx.URL | None = None,
396
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
405
+ timeout: float | Timeout | None | NotGiven = not_given,
397
406
  http_client: httpx.AsyncClient | None = None,
398
- max_retries: int | NotGiven = NOT_GIVEN,
407
+ max_retries: int | NotGiven = not_given,
399
408
  default_headers: Mapping[str, str] | None = None,
400
409
  set_default_headers: Mapping[str, str] | None = None,
401
410
  default_query: Mapping[str, object] | None = None,
@@ -424,7 +433,7 @@ class AsyncGcore(AsyncAPIClient):
424
433
  params = set_default_query
425
434
 
426
435
  http_client = http_client or self._client
427
- return self.__class__(
436
+ client = self.__class__(
428
437
  api_key=api_key or self.api_key,
429
438
  cloud_project_id=cloud_project_id or self.cloud_project_id,
430
439
  cloud_region_id=cloud_region_id or self.cloud_region_id,
@@ -437,6 +446,8 @@ class AsyncGcore(AsyncAPIClient):
437
446
  default_query=params,
438
447
  **_extra_kwargs,
439
448
  )
449
+ client._base_url_overridden = self._base_url_overridden or base_url is not None
450
+ return client
440
451
 
441
452
  # Alias for `copy` for nicer inline usage, e.g.
442
453
  # client.with_options(timeout=10).foo.create(...)
@@ -504,6 +515,7 @@ class GcoreWithRawResponse:
504
515
  self.security = security.SecurityResourceWithRawResponse(client.security)
505
516
  self.dns = dns.DNSResourceWithRawResponse(client.dns)
506
517
  self.storage = storage.StorageResourceWithRawResponse(client.storage)
518
+ self.cdn = cdn.CdnResourceWithRawResponse(client.cdn)
507
519
 
508
520
 
509
521
  class AsyncGcoreWithRawResponse:
@@ -516,6 +528,7 @@ class AsyncGcoreWithRawResponse:
516
528
  self.security = security.AsyncSecurityResourceWithRawResponse(client.security)
517
529
  self.dns = dns.AsyncDNSResourceWithRawResponse(client.dns)
518
530
  self.storage = storage.AsyncStorageResourceWithRawResponse(client.storage)
531
+ self.cdn = cdn.AsyncCdnResourceWithRawResponse(client.cdn)
519
532
 
520
533
 
521
534
  class GcoreWithStreamedResponse:
@@ -528,6 +541,7 @@ class GcoreWithStreamedResponse:
528
541
  self.security = security.SecurityResourceWithStreamingResponse(client.security)
529
542
  self.dns = dns.DNSResourceWithStreamingResponse(client.dns)
530
543
  self.storage = storage.StorageResourceWithStreamingResponse(client.storage)
544
+ self.cdn = cdn.CdnResourceWithStreamingResponse(client.cdn)
531
545
 
532
546
 
533
547
  class AsyncGcoreWithStreamedResponse:
@@ -540,6 +554,7 @@ class AsyncGcoreWithStreamedResponse:
540
554
  self.security = security.AsyncSecurityResourceWithStreamingResponse(client.security)
541
555
  self.dns = dns.AsyncDNSResourceWithStreamingResponse(client.dns)
542
556
  self.storage = storage.AsyncStorageResourceWithStreamingResponse(client.storage)
557
+ self.cdn = cdn.AsyncCdnResourceWithStreamingResponse(client.cdn)
543
558
 
544
559
 
545
560
  Client = Gcore
gcore/_models.py CHANGED
@@ -256,7 +256,7 @@ class BaseModel(pydantic.BaseModel):
256
256
  mode: Literal["json", "python"] | str = "python",
257
257
  include: IncEx | None = None,
258
258
  exclude: IncEx | None = None,
259
- by_alias: bool = False,
259
+ by_alias: bool | None = None,
260
260
  exclude_unset: bool = False,
261
261
  exclude_defaults: bool = False,
262
262
  exclude_none: bool = False,
@@ -264,6 +264,7 @@ class BaseModel(pydantic.BaseModel):
264
264
  warnings: bool | Literal["none", "warn", "error"] = True,
265
265
  context: dict[str, Any] | None = None,
266
266
  serialize_as_any: bool = False,
267
+ fallback: Callable[[Any], Any] | None = None,
267
268
  ) -> dict[str, Any]:
268
269
  """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
269
270
 
@@ -295,10 +296,12 @@ class BaseModel(pydantic.BaseModel):
295
296
  raise ValueError("context is only supported in Pydantic v2")
296
297
  if serialize_as_any != False:
297
298
  raise ValueError("serialize_as_any is only supported in Pydantic v2")
299
+ if fallback is not None:
300
+ raise ValueError("fallback is only supported in Pydantic v2")
298
301
  dumped = super().dict( # pyright: ignore[reportDeprecated]
299
302
  include=include,
300
303
  exclude=exclude,
301
- by_alias=by_alias,
304
+ by_alias=by_alias if by_alias is not None else False,
302
305
  exclude_unset=exclude_unset,
303
306
  exclude_defaults=exclude_defaults,
304
307
  exclude_none=exclude_none,
@@ -313,13 +316,14 @@ class BaseModel(pydantic.BaseModel):
313
316
  indent: int | None = None,
314
317
  include: IncEx | None = None,
315
318
  exclude: IncEx | None = None,
316
- by_alias: bool = False,
319
+ by_alias: bool | None = None,
317
320
  exclude_unset: bool = False,
318
321
  exclude_defaults: bool = False,
319
322
  exclude_none: bool = False,
320
323
  round_trip: bool = False,
321
324
  warnings: bool | Literal["none", "warn", "error"] = True,
322
325
  context: dict[str, Any] | None = None,
326
+ fallback: Callable[[Any], Any] | None = None,
323
327
  serialize_as_any: bool = False,
324
328
  ) -> str:
325
329
  """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json
@@ -348,11 +352,13 @@ class BaseModel(pydantic.BaseModel):
348
352
  raise ValueError("context is only supported in Pydantic v2")
349
353
  if serialize_as_any != False:
350
354
  raise ValueError("serialize_as_any is only supported in Pydantic v2")
355
+ if fallback is not None:
356
+ raise ValueError("fallback is only supported in Pydantic v2")
351
357
  return super().json( # type: ignore[reportDeprecated]
352
358
  indent=indent,
353
359
  include=include,
354
360
  exclude=exclude,
355
- by_alias=by_alias,
361
+ by_alias=by_alias if by_alias is not None else False,
356
362
  exclude_unset=exclude_unset,
357
363
  exclude_defaults=exclude_defaults,
358
364
  exclude_none=exclude_none,
gcore/_qs.py CHANGED
@@ -4,7 +4,7 @@ from typing import Any, List, Tuple, Union, Mapping, TypeVar
4
4
  from urllib.parse import parse_qs, urlencode
5
5
  from typing_extensions import Literal, get_args
6
6
 
7
- from ._types import NOT_GIVEN, NotGiven, NotGivenOr
7
+ from ._types import NotGiven, not_given
8
8
  from ._utils import flatten
9
9
 
10
10
  _T = TypeVar("_T")
@@ -41,8 +41,8 @@ class Querystring:
41
41
  self,
42
42
  params: Params,
43
43
  *,
44
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
45
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
44
+ array_format: ArrayFormat | NotGiven = not_given,
45
+ nested_format: NestedFormat | NotGiven = not_given,
46
46
  ) -> str:
47
47
  return urlencode(
48
48
  self.stringify_items(
@@ -56,8 +56,8 @@ class Querystring:
56
56
  self,
57
57
  params: Params,
58
58
  *,
59
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
60
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
59
+ array_format: ArrayFormat | NotGiven = not_given,
60
+ nested_format: NestedFormat | NotGiven = not_given,
61
61
  ) -> list[tuple[str, str]]:
62
62
  opts = Options(
63
63
  qs=self,
@@ -143,8 +143,8 @@ class Options:
143
143
  self,
144
144
  qs: Querystring = _qs,
145
145
  *,
146
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
147
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
146
+ array_format: ArrayFormat | NotGiven = not_given,
147
+ nested_format: NestedFormat | NotGiven = not_given,
148
148
  ) -> None:
149
149
  self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format
150
150
  self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format
gcore/_types.py CHANGED
@@ -117,18 +117,21 @@ class RequestOptions(TypedDict, total=False):
117
117
  # Sentinel class used until PEP 0661 is accepted
118
118
  class NotGiven:
119
119
  """
120
- A sentinel singleton class used to distinguish omitted keyword arguments
121
- from those passed in with the value None (which may have different behavior).
120
+ For parameters with a meaningful None value, we need to distinguish between
121
+ the user explicitly passing None, and the user not passing the parameter at
122
+ all.
123
+
124
+ User code shouldn't need to use not_given directly.
122
125
 
123
126
  For example:
124
127
 
125
128
  ```py
126
- def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...
129
+ def create(timeout: Timeout | None | NotGiven = not_given): ...
127
130
 
128
131
 
129
- get(timeout=1) # 1s timeout
130
- get(timeout=None) # No timeout
131
- get() # Default timeout behavior, which may not be statically known at the method definition.
132
+ create(timeout=1) # 1s timeout
133
+ create(timeout=None) # No timeout
134
+ create() # Default timeout behavior
132
135
  ```
133
136
  """
134
137
 
@@ -140,13 +143,14 @@ class NotGiven:
140
143
  return "NOT_GIVEN"
141
144
 
142
145
 
143
- NotGivenOr = Union[_T, NotGiven]
146
+ not_given = NotGiven()
147
+ # for backwards compatibility:
144
148
  NOT_GIVEN = NotGiven()
145
149
 
146
150
 
147
151
  class Omit:
148
- """In certain situations you need to be able to represent a case where a default value has
149
- to be explicitly removed and `None` is not an appropriate substitute, for example:
152
+ """
153
+ To explicitly omit something from being sent in a request, use `omit`.
150
154
 
151
155
  ```py
152
156
  # as the default `Content-Type` header is `application/json` that will be sent
@@ -156,8 +160,8 @@ class Omit:
156
160
  # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983'
157
161
  client.post(..., headers={"Content-Type": "multipart/form-data"})
158
162
 
159
- # instead you can remove the default `application/json` header by passing Omit
160
- client.post(..., headers={"Content-Type": Omit()})
163
+ # instead you can remove the default `application/json` header by passing omit
164
+ client.post(..., headers={"Content-Type": omit})
161
165
  ```
162
166
  """
163
167
 
@@ -165,6 +169,9 @@ class Omit:
165
169
  return False
166
170
 
167
171
 
172
+ omit = Omit()
173
+
174
+
168
175
  @runtime_checkable
169
176
  class ModelBuilderProtocol(Protocol):
170
177
  @classmethod
@@ -268,7 +268,7 @@ def _transform_typeddict(
268
268
  annotations = get_type_hints(expected_type, include_extras=True)
269
269
  for key, value in data.items():
270
270
  if not is_given(value):
271
- # we don't need to include `NotGiven` values here as they'll
271
+ # we don't need to include omitted values here as they'll
272
272
  # be stripped out before the request is sent anyway
273
273
  continue
274
274
 
@@ -434,7 +434,7 @@ async def _async_transform_typeddict(
434
434
  annotations = get_type_hints(expected_type, include_extras=True)
435
435
  for key, value in data.items():
436
436
  if not is_given(value):
437
- # we don't need to include `NotGiven` values here as they'll
437
+ # we don't need to include omitted values here as they'll
438
438
  # be stripped out before the request is sent anyway
439
439
  continue
440
440
 
gcore/_utils/_utils.py CHANGED
@@ -21,7 +21,7 @@ from typing_extensions import TypeGuard
21
21
 
22
22
  import sniffio
23
23
 
24
- from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
24
+ from .._types import Omit, NotGiven, FileTypes, HeadersLike
25
25
 
26
26
  _T = TypeVar("_T")
27
27
  _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
@@ -63,7 +63,7 @@ def _extract_items(
63
63
  try:
64
64
  key = path[index]
65
65
  except IndexError:
66
- if isinstance(obj, NotGiven):
66
+ if not is_given(obj):
67
67
  # no value was provided - we can safely ignore
68
68
  return []
69
69
 
@@ -126,8 +126,8 @@ def _extract_items(
126
126
  return []
127
127
 
128
128
 
129
- def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]:
130
- return not isinstance(obj, NotGiven)
129
+ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
130
+ return not isinstance(obj, NotGiven) and not isinstance(obj, Omit)
131
131
 
132
132
 
133
133
  # Type safe methods for narrowing types with TypeVars.
gcore/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "gcore"
4
- __version__ = "0.13.0" # x-release-please-version
4
+ __version__ = "0.14.0" # x-release-please-version
gcore/pagination.py CHANGED
@@ -22,6 +22,11 @@ __all__ = [
22
22
  "AsyncPageStreamingAI",
23
23
  "SyncPageStreaming",
24
24
  "AsyncPageStreaming",
25
+ "SyncOffsetPageCdn",
26
+ "AsyncOffsetPageCdn",
27
+ "OffsetPageCdnLogsMeta",
28
+ "SyncOffsetPageCdnLogs",
29
+ "AsyncOffsetPageCdnLogs",
25
30
  ]
26
31
 
27
32
  _BaseModelT = TypeVar("_BaseModelT", bound=BaseModel)
@@ -357,3 +362,135 @@ class AsyncPageStreaming(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
357
362
  **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
358
363
  },
359
364
  )
365
+
366
+
367
+ class SyncOffsetPageCdn(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
368
+ items: List[_T]
369
+
370
+ @override
371
+ def _get_page_items(self) -> List[_T]:
372
+ items = self.items
373
+ if not items:
374
+ return []
375
+ return items
376
+
377
+ @override
378
+ def next_page_info(self) -> Optional[PageInfo]:
379
+ offset = self._options.params.get("offset") or 0
380
+ if not isinstance(offset, int):
381
+ raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
382
+
383
+ length = len(self._get_page_items())
384
+ current_count = offset + length
385
+
386
+ return PageInfo(params={"offset": current_count})
387
+
388
+ @classmethod
389
+ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
390
+ return cls.construct(
391
+ None,
392
+ **{
393
+ **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
394
+ },
395
+ )
396
+
397
+
398
+ class AsyncOffsetPageCdn(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
399
+ items: List[_T]
400
+
401
+ @override
402
+ def _get_page_items(self) -> List[_T]:
403
+ items = self.items
404
+ if not items:
405
+ return []
406
+ return items
407
+
408
+ @override
409
+ def next_page_info(self) -> Optional[PageInfo]:
410
+ offset = self._options.params.get("offset") or 0
411
+ if not isinstance(offset, int):
412
+ raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
413
+
414
+ length = len(self._get_page_items())
415
+ current_count = offset + length
416
+
417
+ return PageInfo(params={"offset": current_count})
418
+
419
+ @classmethod
420
+ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseModelT: # noqa: ARG003
421
+ return cls.construct(
422
+ None,
423
+ **{
424
+ **(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
425
+ },
426
+ )
427
+
428
+
429
+ class OffsetPageCdnLogsMeta(BaseModel):
430
+ count: Optional[int] = None
431
+
432
+
433
+ class SyncOffsetPageCdnLogs(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
434
+ data: List[_T]
435
+ meta: Optional[OffsetPageCdnLogsMeta] = None
436
+
437
+ @override
438
+ def _get_page_items(self) -> List[_T]:
439
+ data = self.data
440
+ if not data:
441
+ return []
442
+ return data
443
+
444
+ @override
445
+ def next_page_info(self) -> Optional[PageInfo]:
446
+ offset = self._options.params.get("offset") or 0
447
+ if not isinstance(offset, int):
448
+ raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
449
+
450
+ length = len(self._get_page_items())
451
+ current_count = offset + length
452
+
453
+ count = None
454
+ if self.meta is not None:
455
+ if self.meta.count is not None:
456
+ count = self.meta.count
457
+ if count is None:
458
+ return None
459
+
460
+ if current_count < count:
461
+ return PageInfo(params={"offset": current_count})
462
+
463
+ return None
464
+
465
+
466
+ class AsyncOffsetPageCdnLogs(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
467
+ data: List[_T]
468
+ meta: Optional[OffsetPageCdnLogsMeta] = None
469
+
470
+ @override
471
+ def _get_page_items(self) -> List[_T]:
472
+ data = self.data
473
+ if not data:
474
+ return []
475
+ return data
476
+
477
+ @override
478
+ def next_page_info(self) -> Optional[PageInfo]:
479
+ offset = self._options.params.get("offset") or 0
480
+ if not isinstance(offset, int):
481
+ raise ValueError(f'Expected "offset" param to be an integer but got {offset}')
482
+
483
+ length = len(self._get_page_items())
484
+ current_count = offset + length
485
+
486
+ count = None
487
+ if self.meta is not None:
488
+ if self.meta.count is not None:
489
+ count = self.meta.count
490
+ if count is None:
491
+ return None
492
+
493
+ if current_count < count:
494
+ return PageInfo(params={"offset": current_count})
495
+
496
+ return None
@@ -1,5 +1,13 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ from .cdn import (
4
+ CdnResource,
5
+ AsyncCdnResource,
6
+ CdnResourceWithRawResponse,
7
+ AsyncCdnResourceWithRawResponse,
8
+ CdnResourceWithStreamingResponse,
9
+ AsyncCdnResourceWithStreamingResponse,
10
+ )
3
11
  from .dns import (
4
12
  DNSResource,
5
13
  AsyncDNSResource,
@@ -114,4 +122,10 @@ __all__ = [
114
122
  "AsyncStorageResourceWithRawResponse",
115
123
  "StorageResourceWithStreamingResponse",
116
124
  "AsyncStorageResourceWithStreamingResponse",
125
+ "CdnResource",
126
+ "AsyncCdnResource",
127
+ "CdnResourceWithRawResponse",
128
+ "AsyncCdnResourceWithRawResponse",
129
+ "CdnResourceWithStreamingResponse",
130
+ "AsyncCdnResourceWithStreamingResponse",
117
131
  ]