cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/cache/smart-tiered-cache.ts
96lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import * as Core from 'cloudflare/core'; |
| 4 | import { APIResource } from 'cloudflare/resource'; |
| 5 | import * as SmartTieredCacheAPI from 'cloudflare/resources/cache/smart-tiered-cache'; |
| 6 | |
| 7 | export class SmartTieredCache extends APIResource { |
| 8 | /** |
| 9 | * Remvoves enablement of Smart Tiered Cache |
| 10 | */ |
| 11 | delete( |
| 12 | params: SmartTieredCacheDeleteParams, |
| 13 | options?: Core.RequestOptions, |
| 14 | ): Core.APIPromise<SmartTieredCacheDeleteResponse> { |
| 15 | const { zone_id } = params; |
| 16 | return ( |
| 17 | this._client.delete( |
| 18 | `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, |
| 19 | options, |
| 20 | ) as Core.APIPromise<{ result: SmartTieredCacheDeleteResponse }> |
| 21 | )._thenUnwrap((obj) => obj.result); |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Updates enablement of Tiered Cache |
| 26 | */ |
| 27 | edit( |
| 28 | params: SmartTieredCacheEditParams, |
| 29 | options?: Core.RequestOptions, |
| 30 | ): Core.APIPromise<SmartTieredCacheEditResponse> { |
| 31 | const { zone_id, ...body } = params; |
| 32 | return ( |
| 33 | this._client.patch(`/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, { |
| 34 | body, |
| 35 | ...options, |
| 36 | }) as Core.APIPromise<{ result: SmartTieredCacheEditResponse }> |
| 37 | )._thenUnwrap((obj) => obj.result); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Get Smart Tiered Cache setting |
| 42 | */ |
| 43 | get( |
| 44 | params: SmartTieredCacheGetParams, |
| 45 | options?: Core.RequestOptions, |
| 46 | ): Core.APIPromise<SmartTieredCacheGetResponse> { |
| 47 | const { zone_id } = params; |
| 48 | return ( |
| 49 | this._client.get( |
| 50 | `/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, |
| 51 | options, |
| 52 | ) as Core.APIPromise<{ result: SmartTieredCacheGetResponse }> |
| 53 | )._thenUnwrap((obj) => obj.result); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | export type SmartTieredCacheDeleteResponse = unknown | string | null; |
| 58 | |
| 59 | export type SmartTieredCacheEditResponse = unknown | string | null; |
| 60 | |
| 61 | export type SmartTieredCacheGetResponse = unknown | string | null; |
| 62 | |
| 63 | export interface SmartTieredCacheDeleteParams { |
| 64 | /** |
| 65 | * Identifier |
| 66 | */ |
| 67 | zone_id: string; |
| 68 | } |
| 69 | |
| 70 | export interface SmartTieredCacheEditParams { |
| 71 | /** |
| 72 | * Path param: Identifier |
| 73 | */ |
| 74 | zone_id: string; |
| 75 | |
| 76 | /** |
| 77 | * Body param: Enables Tiered Cache. |
| 78 | */ |
| 79 | value: 'on' | 'off'; |
| 80 | } |
| 81 | |
| 82 | export interface SmartTieredCacheGetParams { |
| 83 | /** |
| 84 | * Identifier |
| 85 | */ |
| 86 | zone_id: string; |
| 87 | } |
| 88 | |
| 89 | export namespace SmartTieredCache { |
| 90 | export import SmartTieredCacheDeleteResponse = SmartTieredCacheAPI.SmartTieredCacheDeleteResponse; |
| 91 | export import SmartTieredCacheEditResponse = SmartTieredCacheAPI.SmartTieredCacheEditResponse; |
| 92 | export import SmartTieredCacheGetResponse = SmartTieredCacheAPI.SmartTieredCacheGetResponse; |
| 93 | export import SmartTieredCacheDeleteParams = SmartTieredCacheAPI.SmartTieredCacheDeleteParams; |
| 94 | export import SmartTieredCacheEditParams = SmartTieredCacheAPI.SmartTieredCacheEditParams; |
| 95 | export import SmartTieredCacheGetParams = SmartTieredCacheAPI.SmartTieredCacheGetParams; |
| 96 | } |
| 97 | |