cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
3f1fb340dd883cb28533e8ec7d2fe1c670fd59f3

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/variants.ts

383lines · modecode

1// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3import { APIResource } from '../../resource';
4import * as Core from '../../core';
5
6export class Variants extends APIResource {
7 /**
8 * Variant support enables caching variants of images with certain file extensions
9 * in addition to the original. This only applies when the origin server sends the
10 * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but
11 * does not serve the variant requested, the response will not be cached. This will
12 * be indicated with BYPASS cache status in the response headers.
13 */
14 delete(params: VariantDeleteParams, options?: Core.RequestOptions): Core.APIPromise<VariantDeleteResponse> {
15 const { zone_id } = params;
16 return (
17 this._client.delete(`/zones/${zone_id}/cache/variants`, options) as Core.APIPromise<{
18 result: VariantDeleteResponse;
19 }>
20 )._thenUnwrap((obj) => obj.result);
21 }
22
23 /**
24 * Variant support enables caching variants of images with certain file extensions
25 * in addition to the original. This only applies when the origin server sends the
26 * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but
27 * does not serve the variant requested, the response will not be cached. This will
28 * be indicated with BYPASS cache status in the response headers.
29 */
30 edit(params: VariantEditParams, options?: Core.RequestOptions): Core.APIPromise<VariantEditResponse> {
31 const { zone_id, ...body } = params;
32 return (
33 this._client.patch(`/zones/${zone_id}/cache/variants`, { body, ...options }) as Core.APIPromise<{
34 result: VariantEditResponse;
35 }>
36 )._thenUnwrap((obj) => obj.result);
37 }
38
39 /**
40 * Variant support enables caching variants of images with certain file extensions
41 * in addition to the original. This only applies when the origin server sends the
42 * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but
43 * does not serve the variant requested, the response will not be cached. This will
44 * be indicated with BYPASS cache status in the response headers.
45 */
46 get(params: VariantGetParams, options?: Core.RequestOptions): Core.APIPromise<VariantGetResponse> {
47 const { zone_id } = params;
48 return (
49 this._client.get(`/zones/${zone_id}/cache/variants`, options) as Core.APIPromise<{
50 result: VariantGetResponse;
51 }>
52 )._thenUnwrap((obj) => obj.result);
53 }
54}
55
56/**
57 * ID of the zone setting.
58 */
59export type CacheVariantIdentifier = 'variants';
60
61/**
62 * Variant support enables caching variants of images with certain file extensions
63 * in addition to the original. This only applies when the origin server sends the
64 * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but
65 * does not serve the variant requested, the response will not be cached. This will
66 * be indicated with BYPASS cache status in the response headers.
67 */
68export interface VariantDeleteResponse {
69 /**
70 * ID of the zone setting.
71 */
72 id: CacheVariantIdentifier;
73
74 /**
75 * last time this setting was modified.
76 */
77 modified_on: string | null;
78}
79
80/**
81 * Variant support enables caching variants of images with certain file extensions
82 * in addition to the original. This only applies when the origin server sends the
83 * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but
84 * does not serve the variant requested, the response will not be cached. This will
85 * be indicated with BYPASS cache status in the response headers.
86 */
87export interface VariantEditResponse {
88 /**
89 * ID of the zone setting.
90 */
91 id: CacheVariantIdentifier;
92
93 /**
94 * last time this setting was modified.
95 */
96 modified_on: string | null;
97
98 /**
99 * Value of the zone setting.
100 */
101 value: VariantEditResponse.Value;
102}
103
104export namespace VariantEditResponse {
105 /**
106 * Value of the zone setting.
107 */
108 export interface Value {
109 /**
110 * List of strings with the MIME types of all the variants that should be served
111 * for avif.
112 */
113 avif?: Array<string>;
114
115 /**
116 * List of strings with the MIME types of all the variants that should be served
117 * for bmp.
118 */
119 bmp?: Array<string>;
120
121 /**
122 * List of strings with the MIME types of all the variants that should be served
123 * for gif.
124 */
125 gif?: Array<string>;
126
127 /**
128 * List of strings with the MIME types of all the variants that should be served
129 * for jp2.
130 */
131 jp2?: Array<string>;
132
133 /**
134 * List of strings with the MIME types of all the variants that should be served
135 * for jpeg.
136 */
137 jpeg?: Array<string>;
138
139 /**
140 * List of strings with the MIME types of all the variants that should be served
141 * for jpg.
142 */
143 jpg?: Array<string>;
144
145 /**
146 * List of strings with the MIME types of all the variants that should be served
147 * for jpg2.
148 */
149 jpg2?: Array<string>;
150
151 /**
152 * List of strings with the MIME types of all the variants that should be served
153 * for png.
154 */
155 png?: Array<string>;
156
157 /**
158 * List of strings with the MIME types of all the variants that should be served
159 * for tif.
160 */
161 tif?: Array<string>;
162
163 /**
164 * List of strings with the MIME types of all the variants that should be served
165 * for tiff.
166 */
167 tiff?: Array<string>;
168
169 /**
170 * List of strings with the MIME types of all the variants that should be served
171 * for webp.
172 */
173 webp?: Array<string>;
174 }
175}
176
177/**
178 * Variant support enables caching variants of images with certain file extensions
179 * in addition to the original. This only applies when the origin server sends the
180 * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but
181 * does not serve the variant requested, the response will not be cached. This will
182 * be indicated with BYPASS cache status in the response headers.
183 */
184export interface VariantGetResponse {
185 /**
186 * ID of the zone setting.
187 */
188 id: CacheVariantIdentifier;
189
190 /**
191 * last time this setting was modified.
192 */
193 modified_on: string | null;
194
195 /**
196 * Value of the zone setting.
197 */
198 value: VariantGetResponse.Value;
199}
200
201export namespace VariantGetResponse {
202 /**
203 * Value of the zone setting.
204 */
205 export interface Value {
206 /**
207 * List of strings with the MIME types of all the variants that should be served
208 * for avif.
209 */
210 avif?: Array<string>;
211
212 /**
213 * List of strings with the MIME types of all the variants that should be served
214 * for bmp.
215 */
216 bmp?: Array<string>;
217
218 /**
219 * List of strings with the MIME types of all the variants that should be served
220 * for gif.
221 */
222 gif?: Array<string>;
223
224 /**
225 * List of strings with the MIME types of all the variants that should be served
226 * for jp2.
227 */
228 jp2?: Array<string>;
229
230 /**
231 * List of strings with the MIME types of all the variants that should be served
232 * for jpeg.
233 */
234 jpeg?: Array<string>;
235
236 /**
237 * List of strings with the MIME types of all the variants that should be served
238 * for jpg.
239 */
240 jpg?: Array<string>;
241
242 /**
243 * List of strings with the MIME types of all the variants that should be served
244 * for jpg2.
245 */
246 jpg2?: Array<string>;
247
248 /**
249 * List of strings with the MIME types of all the variants that should be served
250 * for png.
251 */
252 png?: Array<string>;
253
254 /**
255 * List of strings with the MIME types of all the variants that should be served
256 * for tif.
257 */
258 tif?: Array<string>;
259
260 /**
261 * List of strings with the MIME types of all the variants that should be served
262 * for tiff.
263 */
264 tiff?: Array<string>;
265
266 /**
267 * List of strings with the MIME types of all the variants that should be served
268 * for webp.
269 */
270 webp?: Array<string>;
271 }
272}
273
274export interface VariantDeleteParams {
275 /**
276 * Identifier
277 */
278 zone_id: string;
279}
280
281export interface VariantEditParams {
282 /**
283 * Path param: Identifier
284 */
285 zone_id: string;
286
287 /**
288 * Body param: Value of the zone setting.
289 */
290 value: VariantEditParams.Value;
291}
292
293export namespace VariantEditParams {
294 /**
295 * Value of the zone setting.
296 */
297 export interface Value {
298 /**
299 * List of strings with the MIME types of all the variants that should be served
300 * for avif.
301 */
302 avif?: Array<string>;
303
304 /**
305 * List of strings with the MIME types of all the variants that should be served
306 * for bmp.
307 */
308 bmp?: Array<string>;
309
310 /**
311 * List of strings with the MIME types of all the variants that should be served
312 * for gif.
313 */
314 gif?: Array<string>;
315
316 /**
317 * List of strings with the MIME types of all the variants that should be served
318 * for jp2.
319 */
320 jp2?: Array<string>;
321
322 /**
323 * List of strings with the MIME types of all the variants that should be served
324 * for jpeg.
325 */
326 jpeg?: Array<string>;
327
328 /**
329 * List of strings with the MIME types of all the variants that should be served
330 * for jpg.
331 */
332 jpg?: Array<string>;
333
334 /**
335 * List of strings with the MIME types of all the variants that should be served
336 * for jpg2.
337 */
338 jpg2?: Array<string>;
339
340 /**
341 * List of strings with the MIME types of all the variants that should be served
342 * for png.
343 */
344 png?: Array<string>;
345
346 /**
347 * List of strings with the MIME types of all the variants that should be served
348 * for tif.
349 */
350 tif?: Array<string>;
351
352 /**
353 * List of strings with the MIME types of all the variants that should be served
354 * for tiff.
355 */
356 tiff?: Array<string>;
357
358 /**
359 * List of strings with the MIME types of all the variants that should be served
360 * for webp.
361 */
362 webp?: Array<string>;
363 }
364}
365
366export interface VariantGetParams {
367 /**
368 * Identifier
369 */
370 zone_id: string;
371}
372
373export declare namespace Variants {
374 export {
375 type CacheVariantIdentifier as CacheVariantIdentifier,
376 type VariantDeleteResponse as VariantDeleteResponse,
377 type VariantEditResponse as VariantEditResponse,
378 type VariantGetResponse as VariantGetResponse,
379 type VariantDeleteParams as VariantDeleteParams,
380 type VariantEditParams as VariantEditParams,
381 type VariantGetParams as VariantGetParams,
382 };
383}