cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
68cb54c388f51234fe9df91df6cdcaa967b22660

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/variants.ts

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