cloudflare/cloudflare-typescript
Publicmirrored fromhttps://github.com/cloudflare/cloudflare-typescriptAvailable
src/resources/argo/smart-routing.ts
123lines · 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 | * Configures the value of the Argo Smart Routing enablement setting. |
| 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 | * Retrieves the value of Argo Smart Routing enablement 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 interface SmartRoutingEditResponse { |
| 54 | /** |
| 55 | * Specifies the identifier of the Argo Smart Routing setting. |
| 56 | */ |
| 57 | id: string; |
| 58 | |
| 59 | /** |
| 60 | * Specifies if the setting is editable. |
| 61 | */ |
| 62 | editable: boolean; |
| 63 | |
| 64 | /** |
| 65 | * Specifies the enablement value of Argo Smart Routing. |
| 66 | */ |
| 67 | value: 'on' | 'off'; |
| 68 | |
| 69 | /** |
| 70 | * Specifies the time when the setting was last modified. |
| 71 | */ |
| 72 | modified_on?: string; |
| 73 | } |
| 74 | |
| 75 | export interface SmartRoutingGetResponse { |
| 76 | /** |
| 77 | * Specifies the identifier of the Argo Smart Routing setting. |
| 78 | */ |
| 79 | id: string; |
| 80 | |
| 81 | /** |
| 82 | * Specifies if the setting is editable. |
| 83 | */ |
| 84 | editable: boolean; |
| 85 | |
| 86 | /** |
| 87 | * Specifies the enablement value of Argo Smart Routing. |
| 88 | */ |
| 89 | value: 'on' | 'off'; |
| 90 | |
| 91 | /** |
| 92 | * Specifies the time when the setting was last modified. |
| 93 | */ |
| 94 | modified_on?: string; |
| 95 | } |
| 96 | |
| 97 | export interface SmartRoutingEditParams { |
| 98 | /** |
| 99 | * Path param: Specifies the zone associated with the API call. |
| 100 | */ |
| 101 | zone_id: string; |
| 102 | |
| 103 | /** |
| 104 | * Body param: Specifies the enablement value of Argo Smart Routing. |
| 105 | */ |
| 106 | value: 'on' | 'off'; |
| 107 | } |
| 108 | |
| 109 | export interface SmartRoutingGetParams { |
| 110 | /** |
| 111 | * Specifies the zone associated with the API call. |
| 112 | */ |
| 113 | zone_id: string; |
| 114 | } |
| 115 | |
| 116 | export declare namespace SmartRouting { |
| 117 | export { |
| 118 | type SmartRoutingEditResponse as SmartRoutingEditResponse, |
| 119 | type SmartRoutingGetResponse as SmartRoutingGetResponse, |
| 120 | type SmartRoutingEditParams as SmartRoutingEditParams, |
| 121 | type SmartRoutingGetParams as SmartRoutingGetParams, |
| 122 | }; |
| 123 | } |
| 124 | |