cloudflare/cloudflare-typescript

Public

mirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v3.5.0

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/variants.ts

382lines · 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';
5import * as VariantsAPI from './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 } = params;
17 return (
18 this._client.delete(`/zones/${zone_id}/cache/variants`, 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 * Identifier
278 */
279 zone_id: string;
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<string>;
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<string>;
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<string>;
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<string>;
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<string>;
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<string>;
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<string>;
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<string>;
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<string>;
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<string>;
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<string>;
364 }
365}
366
367export interface VariantGetParams {
368 /**
369 * Identifier
370 */
371 zone_id: string;
372}
373
374export namespace Variants {
375 export import CacheVariant = VariantsAPI.CacheVariant;
376 export import CacheVariantIdentifier = VariantsAPI.CacheVariantIdentifier;
377 export import VariantEditResponse = VariantsAPI.VariantEditResponse;
378 export import VariantGetResponse = VariantsAPI.VariantGetResponse;
379 export import VariantDeleteParams = VariantsAPI.VariantDeleteParams;
380 export import VariantEditParams = VariantsAPI.VariantEditParams;
381 export import VariantGetParams = VariantsAPI.VariantGetParams;
382}
383