cloudflare/cloudflare-typescript

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
6cd645879ba28ec5e88cbb9be29b7bd86350e1ee

Branches

Tags

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

Clone

HTTPS

Download ZIP

src/resources/cache/variants.ts

356lines · modecode

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