cloudflare/cloudflare-typescript
Publicmirrored from https://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/cache/variants.ts
356lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. |
| 2 | |
| 3 | import * as Core from 'cloudflare/core'; |
| 4 | import { APIResource } from 'cloudflare/resource'; |
| 5 | import * as VariantsAPI from 'cloudflare/resources/cache/variants'; |
| 6 | |
| 7 | export 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 | update( |
| 16 | zoneId: string, |
| 17 | body: VariantUpdateParams, |
| 18 | options?: Core.RequestOptions, |
| 19 | ): Core.APIPromise<VariantUpdateResponse> { |
| 20 | return ( |
| 21 | this._client.patch(`/zones/${zoneId}/cache/variants`, { body, ...options }) as Core.APIPromise<{ |
| 22 | result: VariantUpdateResponse; |
| 23 | }> |
| 24 | )._thenUnwrap((obj) => obj.result); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Variant support enables caching variants of images with certain file extensions |
| 29 | * in addition to the original. This only applies when the origin server sends the |
| 30 | * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but |
| 31 | * does not serve the variant requested, the response will not be cached. This will |
| 32 | * be indicated with BYPASS cache status in the response headers. |
| 33 | */ |
| 34 | list(zoneId: string, options?: Core.RequestOptions): Core.APIPromise<VariantListResponse> { |
| 35 | return ( |
| 36 | this._client.get(`/zones/${zoneId}/cache/variants`, options) as Core.APIPromise<{ |
| 37 | result: VariantListResponse; |
| 38 | }> |
| 39 | )._thenUnwrap((obj) => obj.result); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Variant support enables caching variants of images with certain file extensions |
| 44 | * in addition to the original. This only applies when the origin server sends the |
| 45 | * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but |
| 46 | * does not serve the variant requested, the response will not be cached. This will |
| 47 | * be indicated with BYPASS cache status in the response headers. |
| 48 | */ |
| 49 | delete(zoneId: string, options?: Core.RequestOptions): Core.APIPromise<VariantDeleteResponse> { |
| 50 | return ( |
| 51 | this._client.delete(`/zones/${zoneId}/cache/variants`, options) as Core.APIPromise<{ |
| 52 | result: VariantDeleteResponse; |
| 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 | */ |
| 65 | export interface VariantUpdateResponse { |
| 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: VariantUpdateResponse.Value; |
| 80 | } |
| 81 | |
| 82 | export namespace VariantUpdateResponse { |
| 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 | */ |
| 162 | export interface VariantListResponse { |
| 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 | * Value of the zone setting. |
| 175 | */ |
| 176 | value: VariantListResponse.Value; |
| 177 | } |
| 178 | |
| 179 | export namespace VariantListResponse { |
| 180 | /** |
| 181 | * Value of the zone setting. |
| 182 | */ |
| 183 | export interface Value { |
| 184 | /** |
| 185 | * List of strings with the MIME types of all the variants that should be served |
| 186 | * for avif. |
| 187 | */ |
| 188 | avif?: Array<unknown>; |
| 189 | |
| 190 | /** |
| 191 | * List of strings with the MIME types of all the variants that should be served |
| 192 | * for bmp. |
| 193 | */ |
| 194 | bmp?: Array<unknown>; |
| 195 | |
| 196 | /** |
| 197 | * List of strings with the MIME types of all the variants that should be served |
| 198 | * for gif. |
| 199 | */ |
| 200 | gif?: Array<unknown>; |
| 201 | |
| 202 | /** |
| 203 | * List of strings with the MIME types of all the variants that should be served |
| 204 | * for jp2. |
| 205 | */ |
| 206 | jp2?: Array<unknown>; |
| 207 | |
| 208 | /** |
| 209 | * List of strings with the MIME types of all the variants that should be served |
| 210 | * for jpeg. |
| 211 | */ |
| 212 | jpeg?: Array<unknown>; |
| 213 | |
| 214 | /** |
| 215 | * List of strings with the MIME types of all the variants that should be served |
| 216 | * for jpg. |
| 217 | */ |
| 218 | jpg?: Array<unknown>; |
| 219 | |
| 220 | /** |
| 221 | * List of strings with the MIME types of all the variants that should be served |
| 222 | * for jpg2. |
| 223 | */ |
| 224 | jpg2?: Array<unknown>; |
| 225 | |
| 226 | /** |
| 227 | * List of strings with the MIME types of all the variants that should be served |
| 228 | * for png. |
| 229 | */ |
| 230 | png?: Array<unknown>; |
| 231 | |
| 232 | /** |
| 233 | * List of strings with the MIME types of all the variants that should be served |
| 234 | * for tif. |
| 235 | */ |
| 236 | tif?: Array<unknown>; |
| 237 | |
| 238 | /** |
| 239 | * List of strings with the MIME types of all the variants that should be served |
| 240 | * for tiff. |
| 241 | */ |
| 242 | tiff?: Array<unknown>; |
| 243 | |
| 244 | /** |
| 245 | * List of strings with the MIME types of all the variants that should be served |
| 246 | * for webp. |
| 247 | */ |
| 248 | webp?: Array<unknown>; |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * Variant support enables caching variants of images with certain file extensions |
| 254 | * in addition to the original. This only applies when the origin server sends the |
| 255 | * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but |
| 256 | * does not serve the variant requested, the response will not be cached. This will |
| 257 | * be indicated with BYPASS cache status in the response headers. |
| 258 | */ |
| 259 | export interface VariantDeleteResponse { |
| 260 | /** |
| 261 | * ID of the zone setting. |
| 262 | */ |
| 263 | id: 'variants'; |
| 264 | |
| 265 | /** |
| 266 | * last time this setting was modified. |
| 267 | */ |
| 268 | modified_on: string | null; |
| 269 | } |
| 270 | |
| 271 | export interface VariantUpdateParams { |
| 272 | /** |
| 273 | * Value of the zone setting. |
| 274 | */ |
| 275 | value: VariantUpdateParams.Value; |
| 276 | } |
| 277 | |
| 278 | export namespace VariantUpdateParams { |
| 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 | |
| 351 | export namespace Variants { |
| 352 | export import VariantUpdateResponse = VariantsAPI.VariantUpdateResponse; |
| 353 | export import VariantListResponse = VariantsAPI.VariantListResponse; |
| 354 | export import VariantDeleteResponse = VariantsAPI.VariantDeleteResponse; |
| 355 | export import VariantUpdateParams = VariantsAPI.VariantUpdateParams; |
| 356 | } |
| 357 | |