cloudflare/cloudflare-typescript

Public

mirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v7

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/resources/cache/regional-tiered-cache.ts

144lines · modecode

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