cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
dee3057bf3dcc911bd6a16ad12f5c079ef887bcc

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/variants.ts

387lines · modecode

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