-
Notifications
You must be signed in to change notification settings - Fork 13
/
main.tea
256 lines (218 loc) · 6.94 KB
/
main.tea
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/**
* This is a utility module
*/
model ExtendsParameters {
headers?: map[string]string,
queries?: map[string]string,
}
/**
* The common runtime options model
*/
model RuntimeOptions {
autoretry?: boolean(description='whether to try again', name='autoretry'),
ignoreSSL?: boolean(description='ignore SSL validation', name='ignoreSSL'),
key?: string(description='privite key for client certificate', name='key'),
cert?: string(description='client certificate', name='cert'),
ca?: string(description='server certificate', name='ca'),
maxAttempts?: number(description='maximum number of retries', name='max_attempts'),
backoffPolicy?: string(description='backoff policy', name='backoff_policy'),
backoffPeriod?: number(description='backoff period', name='backoff_period'),
readTimeout?: number(description='read timeout', name='readTimeout'),
connectTimeout?: number(description='connect timeout', name='connectTimeout'),
httpProxy?: string(description='http proxy url', name='httpProxy'),
httpsProxy?: string(description='https Proxy url', name='httpsProxy'),
noProxy?: string(description='agent blacklist', name='noProxy'),
maxIdleConns?: number(description='maximum number of connections', name='maxIdleConns'),
localAddr?: string(description='local addr', name='localAddr'),
socks5Proxy?: string(description='SOCKS5 proxy', name='socks5Proxy'),
socks5NetWork?: string(description='SOCKS5 netWork', name='socks5NetWork'),
keepAlive?: boolean(description='whether to enable keep-alive', name='keepAlive'),
extendsParameters?: ExtendsParameters(description='Extends Parameters'),
}
/**
* Convert a string(utf8) to bytes
* @return the return bytes
*/
static function toBytes(val: string): bytes;
/**
* Convert a bytes to string(utf8)
* @return the return string
*/
static function toString(val: bytes): string;
/**
* Parse it by JSON format
* @return the parsed result
*/
static function parseJSON(val: string): any;
/**
* Read data from a readable stream, and compose it to a bytes
* @param stream the readable stream
* @return the bytes result
*/
static async function readAsBytes(stream: readable): bytes;
/**
* Read data from a readable stream, and compose it to a string
* @param stream the readable stream
* @return the string result
*/
static async function readAsString(stream: readable): string {
var buff = readAsBytes(stream);
return toString(buff);
}
/**
* Read data from a readable stream, and parse it by JSON format
* @param stream the readable stream
* @return the parsed result
*/
static async function readAsJSON(stream: readable): any {
return parseJSON(readAsString(stream));
}
/**
* Read data from a readable stream, and parse it by event iterator format
* @param stream the readable stream
* @return the parsed result
*/
static async function readAsSSE(stream: readable): asyncIterator[object];
/**
* Generate a nonce string
* @return the nonce string
*/
static function getNonce(): string;
/**
* Get an UTC format string by current date, e.g. 'Thu, 06 Feb 2020 07:32:54 GMT'
* @return the UTC format string
*/
static function getDateUTCString(): string;
/**
* If not set the real, use default value
* @return the return string
*/
static function defaultString(real: string, default: string): string;
/**
* If not set the real, use default value
* @return the return number
*/
static function defaultNumber(real: number, default: number): number;
/**
* Format a map to form string, like a=a%20b%20c
* @return the form string
*/
static function toFormString(val: object): string;
/**
* Stringify a value by JSON format
* @return the JSON format string
*/
static function toJSONString(val: any): string;
/**
* Check the string is empty?
* @return if string is null or zero length, return true
*/
static function empty(val: string): boolean;
/**
* Check one string equals another one?
* @return if equals, return true
*/
static function equalString(val1: string, val2: string): boolean;
/**
* Check one number equals another one?
* @return if equals, return true
*/
static function equalNumber(val1: number, val2: number): boolean;
/**
* Check one value is unset
* @return if unset, return true
*/
static function isUnset(value: any): boolean;
/**
* Stringify the value of map
* @return the new stringified map
*/
static function stringifyMapValue(m: map[string]any): map[string]string;
/**
* Anyify the value of map
* @return the new anyfied map
*/
static function anyifyMapValue(m: map[string]string): map[string]any;
/**
* Assert a value, if it is a boolean, return it, otherwise throws
* @return the boolean value
*/
static function assertAsBoolean(value: any)throws : boolean;
/**
* Assert a value, if it is a string, return it, otherwise throws
* @return the string value
*/
static function assertAsString(value: any)throws : string;
/**
* Assert a value, if it is a bytes, return it, otherwise throws
* @return the bytes value
*/
static function assertAsBytes(value: any)throws : bytes;
/**
* Assert a value, if it is a number, return it, otherwise throws
* @return the number value
*/
static function assertAsNumber(value: any)throws : number;
/**
* Assert a value, if it is a integer, return it, otherwise throws
* @return the integer value
*/
static function assertAsInteger(value: any)throws : integer;
/**
* Assert a value, if it is a map, return it, otherwise throws
* @return the map value
*/
static function assertAsMap(value: any)throws : map[string]any;
/**
* Assert a value, if it is a array, return it, otherwise throws
* @return the array value
*/
static function assertAsArray(value: any)throws : [ any ];
/**
* Get user agent, if it userAgent is not null, splice it with defaultUserAgent and return, otherwise return defaultUserAgent
* @return the string value
*/
static function getUserAgent(userAgent: string): string;
/**
* If the code between 200 and 300, return true, or return false
* @return boolean
*/
static function is2xx(code: number): boolean;
/**
* If the code between 300 and 400, return true, or return false
* @return boolean
*/
static function is3xx(code: number): boolean;
/**
* If the code between 400 and 500, return true, or return false
* @return boolean
*/
static function is4xx(code: number): boolean;
/**
* If the code between 500 and 600, return true, or return false
* @return boolean
*/
static function is5xx(code: number): boolean;
/**
* Validate model
* @return void
*/
static function validateModel(m: $Model) throws: void;
/**
* Model transforms to map[string]any
* @return map[string]any
*/
static function toMap(in: $Model): map[string]any;
/**
* Suspends the current thread for the specified number of milliseconds.
*/
static async function sleep(millisecond: number): void;
/**
* Transform input as array.
*/
static function toArray(input: any): [ map[string]any ];
/**
* Assert a value, if it is a readable, return it, otherwise throws
* @return the readable value
*/
static function assertAsReadable(value: any)throws : readable;