-
Notifications
You must be signed in to change notification settings - Fork 19
/
main.tea
118 lines (100 loc) · 3.09 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
/**
*
*/
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;
extends OpenApi;
init(config: OpenApi.Config){
super(config);
@endpointRule = '';
checkConfig(config);
@endpoint = getEndpoint('aquila', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}
function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
if (!Util.empty(endpoint)) {
return endpoint;
}
if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
return endpointMap[regionId];
}
return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model DoInferenceRequest {
body?: map[string]any(name='body'),
}
model DoInferenceResponseBody = {
code?: long(name='Code'),
data?: {
risk?: string(name='Risk'),
}(name='Data'),
requestId?: string(name='RequestId'),
}
model DoInferenceResponse = {
headers: map[string]string(name='headers'),
body: DoInferenceResponseBody(name='body'),
}
async function doInference(request: DoInferenceRequest): DoInferenceResponse {
var runtime = new Util.RuntimeOptions{};
var headers : map[string]string = {};
return doInferenceWithOptions(request, headers, runtime);
}
async function doInferenceWithOptions(request: DoInferenceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DoInferenceResponse {
Util.validateModel(request);
var body : map[string]any= {};
if (!Util.isUnset(request.body)) {
body['body'] = request.body;
}
var req = new OpenApi.OpenApiRequest{
headers = headers,
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'DoInference',
version = '2020-01-04',
protocol = 'HTTPS',
pathname = `/nlp-filter/v3190/nlp_filter`,
method = 'POST',
authType = 'AK',
style = 'ROA',
reqBodyType = 'json',
bodyType = 'json',
};
return callApi(params, req, runtime);
}
model DoIntentionRequest {
body?: map[string]any(name='body'),
}
model DoIntentionResponse = {
headers: map[string]string(name='headers'),
body: object(name='body'),
}
async function doIntention(request: DoIntentionRequest): DoIntentionResponse {
var runtime = new Util.RuntimeOptions{};
var headers : map[string]string = {};
return doIntentionWithOptions(request, headers, runtime);
}
async function doIntentionWithOptions(request: DoIntentionRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DoIntentionResponse {
Util.validateModel(request);
var body : map[string]any= {};
if (!Util.isUnset(request.body)) {
body['body'] = request.body;
}
var req = new OpenApi.OpenApiRequest{
headers = headers,
body = OpenApiUtil.parseToMap(body),
};
var params = new OpenApi.Params{
action = 'DoIntention',
version = '2020-01-04',
protocol = 'HTTPS',
pathname = `/intention/v7918/intention`,
method = 'POST',
authType = 'AK',
style = 'ROA',
reqBodyType = 'json',
bodyType = 'json',
};
return callApi(params, req, runtime);
}