cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
587eda705ee1190b14f0fb45882b1c4c6ecb2bac

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/variants.ts

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