UNPKG

@alicloud/openapi-client

Version:

English | [简体中文](README-CN.md)

292 lines (291 loc) 8.66 kB
/// <reference types="node" /> /** * This is for OpenApi SDK */ import * as $Util from '@alicloud/tea-util'; import Credential from '@alicloud/credentials'; import SPI from '@alicloud/gateway-spi'; import { Readable } from 'stream'; import * as $tea from '@alicloud/tea-typescript'; export declare class GlobalParameters extends $tea.Model { headers?: { [key: string]: string; }; queries?: { [key: string]: string; }; static names(): { [key: string]: string; }; static types(): { [key: string]: any; }; constructor(map?: { [key: string]: any; }); } /** * Model for initing client */ export declare class Config extends $tea.Model { accessKeyId?: string; accessKeySecret?: string; securityToken?: string; protocol?: string; method?: string; regionId?: string; readTimeout?: number; connectTimeout?: number; httpProxy?: string; httpsProxy?: string; credential?: Credential; endpoint?: string; noProxy?: string; maxIdleConns?: number; network?: string; userAgent?: string; suffix?: string; socks5Proxy?: string; socks5NetWork?: string; endpointType?: string; openPlatformEndpoint?: string; type?: string; signatureVersion?: string; signatureAlgorithm?: string; globalParameters?: GlobalParameters; key?: string; cert?: string; ca?: string; static names(): { [key: string]: string; }; static types(): { [key: string]: any; }; constructor(map?: { [key: string]: any; }); } export declare class OpenApiRequest extends $tea.Model { headers?: { [key: string]: string; }; query?: { [key: string]: string; }; body?: any; stream?: Readable; hostMap?: { [key: string]: string; }; endpointOverride?: string; static names(): { [key: string]: string; }; static types(): { [key: string]: any; }; constructor(map?: { [key: string]: any; }); } export declare class Params extends $tea.Model { action: string; version: string; protocol: string; pathname: string; method: string; authType: string; bodyType: string; reqBodyType: string; style?: string; static names(): { [key: string]: string; }; static types(): { [key: string]: any; }; constructor(map?: { [key: string]: any; }); } export default class Client { _endpoint: string; _regionId: string; _protocol: string; _method: string; _userAgent: string; _endpointRule: string; _endpointMap: { [key: string]: string; }; _suffix: string; _readTimeout: number; _connectTimeout: number; _httpProxy: string; _httpsProxy: string; _socks5Proxy: string; _socks5NetWork: string; _noProxy: string; _network: string; _productId: string; _maxIdleConns: number; _endpointType: string; _openPlatformEndpoint: string; _credential: Credential; _signatureVersion: string; _signatureAlgorithm: string; _headers: { [key: string]: string; }; _spi: SPI; _globalParameters: GlobalParameters; _key: string; _cert: string; _ca: string; /** * Init client with Config * @param config config contains the necessary information to create a client */ constructor(config: Config); /** * Encapsulate the request and invoke the network * @param action api name * @param version product version * @param protocol http or https * @param method e.g. GET * @param authType authorization type e.g. AK * @param bodyType response body type e.g. String * @param request object of OpenApiRequest * @param runtime which controls some details of call api, such as retry times * @return the response */ doRPCRequest(action: string, version: string, protocol: string, method: string, authType: string, bodyType: string, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{ [key: string]: any; }>; /** * Encapsulate the request and invoke the network * @param action api name * @param version product version * @param protocol http or https * @param method e.g. GET * @param authType authorization type e.g. AK * @param pathname pathname of every api * @param bodyType response body type e.g. String * @param request object of OpenApiRequest * @param runtime which controls some details of call api, such as retry times * @return the response */ doROARequest(action: string, version: string, protocol: string, method: string, authType: string, pathname: string, bodyType: string, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{ [key: string]: any; }>; /** * Encapsulate the request and invoke the network with form body * @param action api name * @param version product version * @param protocol http or https * @param method e.g. GET * @param authType authorization type e.g. AK * @param pathname pathname of every api * @param bodyType response body type e.g. String * @param request object of OpenApiRequest * @param runtime which controls some details of call api, such as retry times * @return the response */ doROARequestWithForm(action: string, version: string, protocol: string, method: string, authType: string, pathname: string, bodyType: string, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{ [key: string]: any; }>; /** * Encapsulate the request and invoke the network * @param action api name * @param version product version * @param protocol http or https * @param method e.g. GET * @param authType authorization type e.g. AK * @param bodyType response body type e.g. String * @param request object of OpenApiRequest * @param runtime which controls some details of call api, such as retry times * @return the response */ doRequest(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{ [key: string]: any; }>; /** * Encapsulate the request and invoke the network * @param action api name * @param version product version * @param protocol http or https * @param method e.g. GET * @param authType authorization type e.g. AK * @param bodyType response body type e.g. String * @param request object of OpenApiRequest * @param runtime which controls some details of call api, such as retry times * @return the response */ execute(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{ [key: string]: any; }>; callApi(params: Params, request: OpenApiRequest, runtime: $Util.RuntimeOptions): Promise<{ [key: string]: any; }>; /** * Get user agent * @return user agent */ getUserAgent(): string; /** * Get accesskey id by using credential * @return accesskey id */ getAccessKeyId(): Promise<string>; /** * Get accesskey secret by using credential * @return accesskey secret */ getAccessKeySecret(): Promise<string>; /** * Get security token by using credential * @return security token */ getSecurityToken(): Promise<string>; /** * Get bearer token by credential * @return bearer token */ getBearerToken(): Promise<string>; /** * Get credential type by credential * @return credential type e.g. access_key */ getType(): Promise<string>; /** * If inputValue is not null, return it or return defaultValue * @param inputValue users input value * @param defaultValue default value * @return the final result */ static defaultAny(inputValue: any, defaultValue: any): any; /** * If the endpointRule and config.endpoint are empty, throw error * @param config config contains the necessary information to create a client */ checkConfig(config: Config): void; /** * set gateway client * @param spi. */ setGatewayClient(spi: SPI): void; /** * set RPC header for debug * @param headers headers for debug, this header can be used only once. */ setRpcHeaders(headers: { [key: string]: string; }): void; /** * get RPC header for debug */ getRpcHeaders(): { [key: string]: string; }; }