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