cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/argo/smart-routing.ts
67lines · modecode
| 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
| 2 | |
| 3 | import * as Core from 'cloudflare/core'; |
| 4 | import { APIResource } from 'cloudflare/resource'; |
| 5 | import * as SmartRoutingAPI from 'cloudflare/resources/argo/smart-routing'; |
| 6 | |
| 7 | export class SmartRouting extends APIResource { |
| 8 | /** |
| 9 | * Updates enablement of Argo Smart Routing. |
| 10 | */ |
| 11 | edit( |
| 12 | params: SmartRoutingEditParams, |
| 13 | options?: Core.RequestOptions, |
| 14 | ): Core.APIPromise<SmartRoutingEditResponse> { |
| 15 | const { zone_id, ...body } = params; |
| 16 | return ( |
| 17 | this._client.patch(`/zones/${zone_id}/argo/smart_routing`, { body, ...options }) as Core.APIPromise<{ |
| 18 | result: SmartRoutingEditResponse; |
| 19 | }> |
| 20 | )._thenUnwrap((obj) => obj.result); |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Get Argo Smart Routing setting |
| 25 | */ |
| 26 | get( |
| 27 | params: SmartRoutingGetParams, |
| 28 | options?: Core.RequestOptions, |
| 29 | ): Core.APIPromise<SmartRoutingGetResponse> { |
| 30 | const { zone_id } = params; |
| 31 | return ( |
| 32 | this._client.get(`/zones/${zone_id}/argo/smart_routing`, options) as Core.APIPromise<{ |
| 33 | result: SmartRoutingGetResponse; |
| 34 | }> |
| 35 | )._thenUnwrap((obj) => obj.result); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | export type SmartRoutingEditResponse = unknown | string | null; |
| 40 | |
| 41 | export type SmartRoutingGetResponse = unknown | string | null; |
| 42 | |
| 43 | export interface SmartRoutingEditParams { |
| 44 | /** |
| 45 | * Path param: Identifier |
| 46 | */ |
| 47 | zone_id: string; |
| 48 | |
| 49 | /** |
| 50 | * Body param: Enables Argo Smart Routing. |
| 51 | */ |
| 52 | value: 'on' | 'off'; |
| 53 | } |
| 54 | |
| 55 | export interface SmartRoutingGetParams { |
| 56 | /** |
| 57 | * Identifier |
| 58 | */ |
| 59 | zone_id: string; |
| 60 | } |
| 61 | |
| 62 | export namespace SmartRouting { |
| 63 | export import SmartRoutingEditResponse = SmartRoutingAPI.SmartRoutingEditResponse; |
| 64 | export import SmartRoutingGetResponse = SmartRoutingAPI.SmartRoutingGetResponse; |
| 65 | export import SmartRoutingEditParams = SmartRoutingAPI.SmartRoutingEditParams; |
| 66 | export import SmartRoutingGetParams = SmartRoutingAPI.SmartRoutingGetParams; |
| 67 | } |
| 68 | |