cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/cache/regional-tiered-cache.ts
145lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import { APIResource } from '../../resource'; |
| 4 | import { isRequestOptions } from '../../core'; |
| 5 | import * as Core from '../../core'; |
| 6 | |
| 7 | export class RegionalTieredCacheResource extends APIResource { |
| 8 | /** |
| 9 | * Instructs Cloudflare to check a regional hub data center on the way to your |
| 10 | * upper tier. This can help improve performance for smart and custom tiered cache |
| 11 | * topologies. |
| 12 | * |
| 13 | * @example |
| 14 | * ```ts |
| 15 | * const response = |
| 16 | * await client.cache.regionalTieredCache.edit({ |
| 17 | * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 18 | * value: 'on', |
| 19 | * }); |
| 20 | * ``` |
| 21 | */ |
| 22 | edit( |
| 23 | params: RegionalTieredCacheEditParams, |
| 24 | options?: Core.RequestOptions, |
| 25 | ): Core.APIPromise<RegionalTieredCacheEditResponse> { |
| 26 | const { zone_id = this._client.zoneId, ...body } = params; |
| 27 | return ( |
| 28 | this._client.patch(`/zones/${zone_id}/cache/regional_tiered_cache`, { |
| 29 | body, |
| 30 | ...options, |
| 31 | }) as Core.APIPromise<{ result: RegionalTieredCacheEditResponse }> |
| 32 | )._thenUnwrap((obj) => obj.result); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Instructs Cloudflare to check a regional hub data center on the way to your |
| 37 | * upper tier. This can help improve performance for smart and custom tiered cache |
| 38 | * topologies. |
| 39 | * |
| 40 | * @example |
| 41 | * ```ts |
| 42 | * const regionalTieredCache = |
| 43 | * await client.cache.regionalTieredCache.get({ |
| 44 | * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', |
| 45 | * }); |
| 46 | * ``` |
| 47 | */ |
| 48 | get( |
| 49 | params?: RegionalTieredCacheGetParams, |
| 50 | options?: Core.RequestOptions, |
| 51 | ): Core.APIPromise<RegionalTieredCacheGetResponse>; |
| 52 | get(options?: Core.RequestOptions): Core.APIPromise<RegionalTieredCacheGetResponse>; |
| 53 | get( |
| 54 | params: RegionalTieredCacheGetParams | Core.RequestOptions = {}, |
| 55 | options?: Core.RequestOptions, |
| 56 | ): Core.APIPromise<RegionalTieredCacheGetResponse> { |
| 57 | if (isRequestOptions(params)) { |
| 58 | return this.get({}, params); |
| 59 | } |
| 60 | const { zone_id = this._client.zoneId } = params; |
| 61 | return ( |
| 62 | this._client.get(`/zones/${zone_id}/cache/regional_tiered_cache`, options) as Core.APIPromise<{ |
| 63 | result: RegionalTieredCacheGetResponse; |
| 64 | }> |
| 65 | )._thenUnwrap((obj) => obj.result); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * The identifier of the caching setting. |
| 71 | */ |
| 72 | export type RegionalTieredCache = 'tc_regional'; |
| 73 | |
| 74 | export interface RegionalTieredCacheEditResponse { |
| 75 | /** |
| 76 | * The identifier of the caching setting. |
| 77 | */ |
| 78 | id: RegionalTieredCache; |
| 79 | |
| 80 | /** |
| 81 | * Whether the setting is editable. |
| 82 | */ |
| 83 | editable: boolean; |
| 84 | |
| 85 | /** |
| 86 | * Value of the Regional Tiered Cache zone setting. |
| 87 | */ |
| 88 | value: 'on' | 'off'; |
| 89 | |
| 90 | /** |
| 91 | * Last time this setting was modified. |
| 92 | */ |
| 93 | modified_on?: string | null; |
| 94 | } |
| 95 | |
| 96 | export interface RegionalTieredCacheGetResponse { |
| 97 | /** |
| 98 | * The identifier of the caching setting. |
| 99 | */ |
| 100 | id: RegionalTieredCache; |
| 101 | |
| 102 | /** |
| 103 | * Whether the setting is editable. |
| 104 | */ |
| 105 | editable: boolean; |
| 106 | |
| 107 | /** |
| 108 | * Value of the Regional Tiered Cache zone setting. |
| 109 | */ |
| 110 | value: 'on' | 'off'; |
| 111 | |
| 112 | /** |
| 113 | * Last time this setting was modified. |
| 114 | */ |
| 115 | modified_on?: string | null; |
| 116 | } |
| 117 | |
| 118 | export interface RegionalTieredCacheEditParams { |
| 119 | /** |
| 120 | * Path param: Identifier. |
| 121 | */ |
| 122 | zone_id?: string; |
| 123 | |
| 124 | /** |
| 125 | * Body param: Value of the Regional Tiered Cache zone setting. |
| 126 | */ |
| 127 | value: 'on' | 'off'; |
| 128 | } |
| 129 | |
| 130 | export interface RegionalTieredCacheGetParams { |
| 131 | /** |
| 132 | * Identifier. |
| 133 | */ |
| 134 | zone_id?: string; |
| 135 | } |
| 136 | |
| 137 | export declare namespace RegionalTieredCacheResource { |
| 138 | export { |
| 139 | type RegionalTieredCache as RegionalTieredCache, |
| 140 | type RegionalTieredCacheEditResponse as RegionalTieredCacheEditResponse, |
| 141 | type RegionalTieredCacheGetResponse as RegionalTieredCacheGetResponse, |
| 142 | type RegionalTieredCacheEditParams as RegionalTieredCacheEditParams, |
| 143 | type RegionalTieredCacheGetParams as RegionalTieredCacheGetParams, |
| 144 | }; |
| 145 | } |
| 146 | |