-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathinterface.ts
More file actions
executable file
·128 lines (122 loc) · 2.73 KB
/
interface.ts
File metadata and controls
executable file
·128 lines (122 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import { Agent } from "http"
/**
* Configuration type for initializing client object
*/
export interface ClientConfig {
/**
* @param {Credential} credential Authentication information
*/
credential: Credential | DynamicCredential
/**
* @param {string} region Product region
* Required for region-specific products (e.g. CVM), optional for non-region products (e.g. SMS)
*/
region?: string
/**
* @param {ClientProfile} profile Optional configuration instance
* Optional, can be skipped if no special requirements
*/
profile?: ClientProfile
}
/**
* Optional configuration instance
*/
export interface ClientProfile {
/**
* Signature method (TC3-HMAC-SHA256 HmacSHA1 HmacSHA256)
* @type {string}
* Optional
*/
signMethod?: "TC3-HMAC-SHA256" | "HmacSHA256" | "HmacSHA1"
/**
* HTTP related options instance
* @type {HttpProfile}
* Optional
*/
httpProfile?: HttpProfile
/**
* Language field attached to API requests
* @type {"zh-CN" | "en-US"}
* Optional
*/
language?: "zh-CN" | "en-US"
}
export interface HttpProfile {
/**
* Request method
* @type {"POST" | "GET"}
* Optional
*/
reqMethod?: "POST" | "GET"
/**
* The service endpoint URL (e.g. "cvm.tencentcloudapi.com")
* @type {string}
* Optional
*/
endpoint?: string
/**
* Protocol, currently supports "https://"
* @type {string}
* Optional
*/
protocol?: string
/**
* Request timeout in seconds, default 60s
* @type {number}
* Optional
*/
reqTimeout?: number
/**
* Custom headers, e.g. { "X-TC-TraceId": "ffe0c072-8a5d-4e17-8887-a8a60252abca" }
* @type {Record<string, string>}
* Optional
*/
headers?: Record<string, string>
/**
* Advanced request agent, e.g. new HttpsProxyAgent("http://127.0.0.1:8899")
*
* Higher priority than proxy configuration
*/
agent?: Agent
/**
* HTTP request proxy, e.g. "http://127.0.0.1:8899"
*/
proxy?: string
}
/**
* Supported values for ClientProfile.language property
*/
export const SUPPORT_LANGUAGE_LIST = ["zh-CN", "en-US"]
/**
* Credential information class
*/
export interface Credential {
/**
* Tencent Cloud account secretId and secretKey
* Optional, mutually exclusive with token
*/
secretId?: string
/**
* Tencent Cloud account secretKey
* Optional, mutually exclusive with token
*/
secretKey?: string
/**
* Tencent Cloud account token
* Optional, mutually exclusive with secretId
*/
token?: string
}
/**
* Dynamic credential information
*/
export interface DynamicCredential {
getCredential(): Promise<Credential>
}
export interface CredentialResult {
TmpSecretId: string
TmpSecretKey: string
ExpiredTime: number
Expiration: string
Token: string
}