@openfort/openfort-node 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/api/apis.d.ts +26 -0
- package/dist/api/apis.js +54 -0
- package/dist/api/apis.js.map +1 -0
- package/dist/api/contractsApi.d.ts +82 -0
- package/dist/api/contractsApi.js +317 -0
- package/dist/api/contractsApi.js.map +1 -0
- package/dist/api/defaultApi.d.ts +142 -0
- package/dist/api/defaultApi.js +653 -0
- package/dist/api/defaultApi.js.map +1 -0
- package/dist/api/logsApi.d.ts +52 -0
- package/dist/api/logsApi.js +155 -0
- package/dist/api/logsApi.js.map +1 -0
- package/dist/api/playersApi.d.ts +157 -0
- package/dist/api/playersApi.js +722 -0
- package/dist/api/playersApi.js.map +1 -0
- package/dist/api/policiesApi.d.ts +175 -0
- package/dist/api/policiesApi.js +812 -0
- package/dist/api/policiesApi.js.map +1 -0
- package/dist/api/projectsApi.d.ts +104 -0
- package/dist/api/projectsApi.js +450 -0
- package/dist/api/projectsApi.js.map +1 -0
- package/dist/api/sessionsApi.d.ts +70 -0
- package/dist/api/sessionsApi.js +276 -0
- package/dist/api/sessionsApi.js.map +1 -0
- package/dist/api/transactionIntentsApi.d.ts +124 -0
- package/dist/api/transactionIntentsApi.js +565 -0
- package/dist/api/transactionIntentsApi.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +66 -0
- package/dist/index.js.map +1 -0
- package/dist/model/accountResponse.d.ts +33 -0
- package/dist/model/accountResponse.js +64 -0
- package/dist/model/accountResponse.js.map +1 -0
- package/dist/model/accountsResponse.d.ts +28 -0
- package/dist/model/accountsResponse.js +39 -0
- package/dist/model/accountsResponse.js.map +1 -0
- package/dist/model/allowFunctionResponse.d.ts +31 -0
- package/dist/model/allowFunctionResponse.js +54 -0
- package/dist/model/allowFunctionResponse.js.map +1 -0
- package/dist/model/allowFunctionsResponse.d.ts +28 -0
- package/dist/model/allowFunctionsResponse.js +39 -0
- package/dist/model/allowFunctionsResponse.js.map +1 -0
- package/dist/model/apiKeyResponse.d.ts +28 -0
- package/dist/model/apiKeyResponse.js +44 -0
- package/dist/model/apiKeyResponse.js.map +1 -0
- package/dist/model/assetInventory.d.ts +34 -0
- package/dist/model/assetInventory.js +44 -0
- package/dist/model/assetInventory.js.map +1 -0
- package/dist/model/assetType.d.ts +17 -0
- package/dist/model/assetType.js +22 -0
- package/dist/model/assetType.js.map +1 -0
- package/dist/model/authResponse.d.ts +26 -0
- package/dist/model/authResponse.js +34 -0
- package/dist/model/authResponse.js.map +1 -0
- package/dist/model/contractResponse.d.ts +33 -0
- package/dist/model/contractResponse.js +64 -0
- package/dist/model/contractResponse.js.map +1 -0
- package/dist/model/contractResponseAbi.d.ts +24 -0
- package/dist/model/contractResponseAbi.js +23 -0
- package/dist/model/contractResponseAbi.js.map +1 -0
- package/dist/model/contractResponseAbiAnyOfInner.d.ts +34 -0
- package/dist/model/contractResponseAbiAnyOfInner.js +74 -0
- package/dist/model/contractResponseAbiAnyOfInner.js.map +1 -0
- package/dist/model/contractsResponse.d.ts +28 -0
- package/dist/model/contractsResponse.js +39 -0
- package/dist/model/contractsResponse.js.map +1 -0
- package/dist/model/createSessionPlayerRequest.d.ts +31 -0
- package/dist/model/createSessionPlayerRequest.js +59 -0
- package/dist/model/createSessionPlayerRequest.js.map +1 -0
- package/dist/model/fragment.d.ts +29 -0
- package/dist/model/fragment.js +44 -0
- package/dist/model/fragment.js.map +1 -0
- package/dist/model/gas.d.ts +29 -0
- package/dist/model/gas.js +39 -0
- package/dist/model/gas.js.map +1 -0
- package/dist/model/getProjectResponse.d.ts +27 -0
- package/dist/model/getProjectResponse.js +39 -0
- package/dist/model/getProjectResponse.js.map +1 -0
- package/dist/model/interaction.d.ts +27 -0
- package/dist/model/interaction.js +39 -0
- package/dist/model/interaction.js.map +1 -0
- package/dist/model/inventoryResponse.d.ts +29 -0
- package/dist/model/inventoryResponse.js +44 -0
- package/dist/model/inventoryResponse.js.map +1 -0
- package/dist/model/jsonFragment.d.ts +33 -0
- package/dist/model/jsonFragment.js +69 -0
- package/dist/model/jsonFragment.js.map +1 -0
- package/dist/model/log.d.ts +31 -0
- package/dist/model/log.js +59 -0
- package/dist/model/log.js.map +1 -0
- package/dist/model/models.d.ts +83 -0
- package/dist/model/models.js +324 -0
- package/dist/model/models.js.map +1 -0
- package/dist/model/paramType.d.ts +32 -0
- package/dist/model/paramType.js +64 -0
- package/dist/model/paramType.js.map +1 -0
- package/dist/model/playerResponse.d.ts +36 -0
- package/dist/model/playerResponse.js +74 -0
- package/dist/model/playerResponse.js.map +1 -0
- package/dist/model/playersResponse.d.ts +28 -0
- package/dist/model/playersResponse.js +39 -0
- package/dist/model/playersResponse.js.map +1 -0
- package/dist/model/policiesResponse.d.ts +28 -0
- package/dist/model/policiesResponse.js +39 -0
- package/dist/model/policiesResponse.js.map +1 -0
- package/dist/model/policyResponse.d.ts +34 -0
- package/dist/model/policyResponse.js +64 -0
- package/dist/model/policyResponse.js.map +1 -0
- package/dist/model/projectLogs.d.ts +28 -0
- package/dist/model/projectLogs.js +39 -0
- package/dist/model/projectLogs.js.map +1 -0
- package/dist/model/projectResponse.d.ts +32 -0
- package/dist/model/projectResponse.js +59 -0
- package/dist/model/projectResponse.js.map +1 -0
- package/dist/model/projectsResponse.d.ts +28 -0
- package/dist/model/projectsResponse.js +39 -0
- package/dist/model/projectsResponse.js.map +1 -0
- package/dist/model/responseResponse.d.ts +32 -0
- package/dist/model/responseResponse.js +64 -0
- package/dist/model/responseResponse.js.map +1 -0
- package/dist/model/sessionResponse.d.ts +32 -0
- package/dist/model/sessionResponse.js +64 -0
- package/dist/model/sessionResponse.js.map +1 -0
- package/dist/model/strategy.d.ts +27 -0
- package/dist/model/strategy.js +39 -0
- package/dist/model/strategy.js.map +1 -0
- package/dist/model/sumGas.d.ts +27 -0
- package/dist/model/sumGas.js +39 -0
- package/dist/model/sumGas.js.map +1 -0
- package/dist/model/transactionIntentResponse.d.ts +40 -0
- package/dist/model/transactionIntentResponse.js +89 -0
- package/dist/model/transactionIntentResponse.js.map +1 -0
- package/dist/model/transactionIntentsResponse.d.ts +28 -0
- package/dist/model/transactionIntentsResponse.js +39 -0
- package/dist/model/transactionIntentsResponse.js.map +1 -0
- package/dist/model/userOpResult.d.ts +26 -0
- package/dist/model/userOpResult.js +34 -0
- package/dist/model/userOpResult.js.map +1 -0
- package/package.json +40 -0
- package/tsconfig.json +38 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Openfort API
|
|
4
|
+
* Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
|
|
5
|
+
*
|
|
6
|
+
* The version of the OpenAPI document: 1.0.0
|
|
7
|
+
* Contact: founders@openfort.xyz
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
10
|
+
* https://openapi-generator.tech
|
|
11
|
+
* Do not edit the class manually.
|
|
12
|
+
*/
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.PoliciesApi = exports.PoliciesApiApiKeys = void 0;
|
|
18
|
+
const request_1 = __importDefault(require("request"));
|
|
19
|
+
const models_1 = require("../model/models");
|
|
20
|
+
const models_2 = require("../model/models");
|
|
21
|
+
const apis_1 = require("./apis");
|
|
22
|
+
let defaultBasePath = "https://api.openfort.xyz";
|
|
23
|
+
// ===============================================
|
|
24
|
+
// This file is autogenerated - Please do not edit
|
|
25
|
+
// ===============================================
|
|
26
|
+
var PoliciesApiApiKeys;
|
|
27
|
+
(function (PoliciesApiApiKeys) {
|
|
28
|
+
})(PoliciesApiApiKeys = exports.PoliciesApiApiKeys || (exports.PoliciesApiApiKeys = {}));
|
|
29
|
+
class PoliciesApi {
|
|
30
|
+
constructor(basePathOrUsername, password, basePath) {
|
|
31
|
+
this._basePath = defaultBasePath;
|
|
32
|
+
this._defaultHeaders = {};
|
|
33
|
+
this._useQuerystring = false;
|
|
34
|
+
this.authentications = {
|
|
35
|
+
default: new models_1.VoidAuth(),
|
|
36
|
+
pk: new models_2.HttpBearerAuth(),
|
|
37
|
+
};
|
|
38
|
+
this.interceptors = [];
|
|
39
|
+
if (password) {
|
|
40
|
+
if (basePath) {
|
|
41
|
+
this.basePath = basePath;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
if (basePathOrUsername) {
|
|
46
|
+
this.basePath = basePathOrUsername;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
set useQuerystring(value) {
|
|
51
|
+
this._useQuerystring = value;
|
|
52
|
+
}
|
|
53
|
+
set basePath(basePath) {
|
|
54
|
+
this._basePath = basePath;
|
|
55
|
+
}
|
|
56
|
+
set defaultHeaders(defaultHeaders) {
|
|
57
|
+
this._defaultHeaders = defaultHeaders;
|
|
58
|
+
}
|
|
59
|
+
get defaultHeaders() {
|
|
60
|
+
return this._defaultHeaders;
|
|
61
|
+
}
|
|
62
|
+
get basePath() {
|
|
63
|
+
return this._basePath;
|
|
64
|
+
}
|
|
65
|
+
setDefaultAuthentication(auth) {
|
|
66
|
+
this.authentications.default = auth;
|
|
67
|
+
}
|
|
68
|
+
setApiKey(key, value) {
|
|
69
|
+
this.authentications[PoliciesApiApiKeys[key]].apiKey = value;
|
|
70
|
+
}
|
|
71
|
+
set accessToken(accessToken) {
|
|
72
|
+
this.authentications.pk.accessToken = accessToken;
|
|
73
|
+
}
|
|
74
|
+
addInterceptor(interceptor) {
|
|
75
|
+
this.interceptors.push(interceptor);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a policy object.
|
|
79
|
+
* @param name
|
|
80
|
+
* @param chainId
|
|
81
|
+
* @param strategy
|
|
82
|
+
* @param project
|
|
83
|
+
*/
|
|
84
|
+
async createPolicy(name, chainId, strategy, project, options = { headers: {} }) {
|
|
85
|
+
const localVarPath = this.basePath + "/v1/policies";
|
|
86
|
+
let localVarQueryParameters = {};
|
|
87
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
88
|
+
const produces = ["application/json"];
|
|
89
|
+
// give precedence to 'application/json'
|
|
90
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
91
|
+
localVarHeaderParams.Accept = "application/json";
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
95
|
+
}
|
|
96
|
+
let localVarFormParams = {};
|
|
97
|
+
// verify required parameter 'name' is not null or undefined
|
|
98
|
+
if (name === null || name === undefined) {
|
|
99
|
+
throw new Error("Required parameter name was null or undefined when calling createPolicy.");
|
|
100
|
+
}
|
|
101
|
+
// verify required parameter 'chainId' is not null or undefined
|
|
102
|
+
if (chainId === null || chainId === undefined) {
|
|
103
|
+
throw new Error("Required parameter chainId was null or undefined when calling createPolicy.");
|
|
104
|
+
}
|
|
105
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
106
|
+
let localVarUseFormData = false;
|
|
107
|
+
if (name !== undefined) {
|
|
108
|
+
localVarFormParams["name"] = models_1.ObjectSerializer.serialize(name, "string");
|
|
109
|
+
}
|
|
110
|
+
if (chainId !== undefined) {
|
|
111
|
+
localVarFormParams["chain_id"] = models_1.ObjectSerializer.serialize(chainId, "number");
|
|
112
|
+
}
|
|
113
|
+
if (strategy !== undefined) {
|
|
114
|
+
localVarFormParams["strategy"] = models_1.ObjectSerializer.serialize(strategy, "Strategy");
|
|
115
|
+
}
|
|
116
|
+
if (project !== undefined) {
|
|
117
|
+
localVarFormParams["project"] = models_1.ObjectSerializer.serialize(project, "string");
|
|
118
|
+
}
|
|
119
|
+
let localVarRequestOptions = {
|
|
120
|
+
method: "POST",
|
|
121
|
+
qs: localVarQueryParameters,
|
|
122
|
+
headers: localVarHeaderParams,
|
|
123
|
+
uri: localVarPath,
|
|
124
|
+
useQuerystring: this._useQuerystring,
|
|
125
|
+
json: true,
|
|
126
|
+
};
|
|
127
|
+
let authenticationPromise = Promise.resolve();
|
|
128
|
+
if (this.authentications.pk.accessToken) {
|
|
129
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
130
|
+
}
|
|
131
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
132
|
+
let interceptorPromise = authenticationPromise;
|
|
133
|
+
for (const interceptor of this.interceptors) {
|
|
134
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
135
|
+
}
|
|
136
|
+
return interceptorPromise.then(() => {
|
|
137
|
+
if (Object.keys(localVarFormParams).length) {
|
|
138
|
+
if (localVarUseFormData) {
|
|
139
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return new Promise((resolve, reject) => {
|
|
146
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
147
|
+
if (error) {
|
|
148
|
+
reject(error);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
if (response.statusCode &&
|
|
152
|
+
response.statusCode >= 200 &&
|
|
153
|
+
response.statusCode <= 299) {
|
|
154
|
+
body = models_1.ObjectSerializer.deserialize(body, "PolicyResponse");
|
|
155
|
+
resolve({ response: response, body: body });
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
*
|
|
167
|
+
* @param policy
|
|
168
|
+
* @param type
|
|
169
|
+
* @param functionName
|
|
170
|
+
* @param project
|
|
171
|
+
* @param contract
|
|
172
|
+
*/
|
|
173
|
+
async createPolicyAllowFunction(policy, type, functionName, project, contract, options = { headers: {} }) {
|
|
174
|
+
const localVarPath = this.basePath +
|
|
175
|
+
"/v1/policies/{policy}/allow_functions".replace("{" + "policy" + "}", encodeURIComponent(String(policy)));
|
|
176
|
+
let localVarQueryParameters = {};
|
|
177
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
178
|
+
const produces = ["application/json"];
|
|
179
|
+
// give precedence to 'application/json'
|
|
180
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
181
|
+
localVarHeaderParams.Accept = "application/json";
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
185
|
+
}
|
|
186
|
+
let localVarFormParams = {};
|
|
187
|
+
// verify required parameter 'policy' is not null or undefined
|
|
188
|
+
if (policy === null || policy === undefined) {
|
|
189
|
+
throw new Error("Required parameter policy was null or undefined when calling createPolicyAllowFunction.");
|
|
190
|
+
}
|
|
191
|
+
// verify required parameter 'type' is not null or undefined
|
|
192
|
+
if (type === null || type === undefined) {
|
|
193
|
+
throw new Error("Required parameter type was null or undefined when calling createPolicyAllowFunction.");
|
|
194
|
+
}
|
|
195
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
196
|
+
let localVarUseFormData = false;
|
|
197
|
+
if (type !== undefined) {
|
|
198
|
+
localVarFormParams["type"] = models_1.ObjectSerializer.serialize(type, "string");
|
|
199
|
+
}
|
|
200
|
+
if (functionName !== undefined) {
|
|
201
|
+
localVarFormParams["function_name"] = models_1.ObjectSerializer.serialize(functionName, "string");
|
|
202
|
+
}
|
|
203
|
+
if (project !== undefined) {
|
|
204
|
+
localVarFormParams["project"] = models_1.ObjectSerializer.serialize(project, "string");
|
|
205
|
+
}
|
|
206
|
+
if (contract !== undefined) {
|
|
207
|
+
localVarFormParams["contract"] = models_1.ObjectSerializer.serialize(contract, "string");
|
|
208
|
+
}
|
|
209
|
+
let localVarRequestOptions = {
|
|
210
|
+
method: "POST",
|
|
211
|
+
qs: localVarQueryParameters,
|
|
212
|
+
headers: localVarHeaderParams,
|
|
213
|
+
uri: localVarPath,
|
|
214
|
+
useQuerystring: this._useQuerystring,
|
|
215
|
+
json: true,
|
|
216
|
+
};
|
|
217
|
+
let authenticationPromise = Promise.resolve();
|
|
218
|
+
if (this.authentications.pk.accessToken) {
|
|
219
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
220
|
+
}
|
|
221
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
222
|
+
let interceptorPromise = authenticationPromise;
|
|
223
|
+
for (const interceptor of this.interceptors) {
|
|
224
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
225
|
+
}
|
|
226
|
+
return interceptorPromise.then(() => {
|
|
227
|
+
if (Object.keys(localVarFormParams).length) {
|
|
228
|
+
if (localVarUseFormData) {
|
|
229
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return new Promise((resolve, reject) => {
|
|
236
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
237
|
+
if (error) {
|
|
238
|
+
reject(error);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
if (response.statusCode &&
|
|
242
|
+
response.statusCode >= 200 &&
|
|
243
|
+
response.statusCode <= 299) {
|
|
244
|
+
body = models_1.ObjectSerializer.deserialize(body, "AllowFunctionResponse");
|
|
245
|
+
resolve({ response: response, body: body });
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
*
|
|
257
|
+
* @param project
|
|
258
|
+
*/
|
|
259
|
+
async getPolicies(project, options = { headers: {} }) {
|
|
260
|
+
const localVarPath = this.basePath + "/v1/policies";
|
|
261
|
+
let localVarQueryParameters = {};
|
|
262
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
263
|
+
const produces = ["application/json"];
|
|
264
|
+
// give precedence to 'application/json'
|
|
265
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
266
|
+
localVarHeaderParams.Accept = "application/json";
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
270
|
+
}
|
|
271
|
+
let localVarFormParams = {};
|
|
272
|
+
if (project !== undefined) {
|
|
273
|
+
localVarQueryParameters["project"] = models_1.ObjectSerializer.serialize(project, "string");
|
|
274
|
+
}
|
|
275
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
276
|
+
let localVarUseFormData = false;
|
|
277
|
+
let localVarRequestOptions = {
|
|
278
|
+
method: "GET",
|
|
279
|
+
qs: localVarQueryParameters,
|
|
280
|
+
headers: localVarHeaderParams,
|
|
281
|
+
uri: localVarPath,
|
|
282
|
+
useQuerystring: this._useQuerystring,
|
|
283
|
+
json: true,
|
|
284
|
+
};
|
|
285
|
+
let authenticationPromise = Promise.resolve();
|
|
286
|
+
if (this.authentications.pk.accessToken) {
|
|
287
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
288
|
+
}
|
|
289
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
290
|
+
let interceptorPromise = authenticationPromise;
|
|
291
|
+
for (const interceptor of this.interceptors) {
|
|
292
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
293
|
+
}
|
|
294
|
+
return interceptorPromise.then(() => {
|
|
295
|
+
if (Object.keys(localVarFormParams).length) {
|
|
296
|
+
if (localVarUseFormData) {
|
|
297
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return new Promise((resolve, reject) => {
|
|
304
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
305
|
+
if (error) {
|
|
306
|
+
reject(error);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
if (response.statusCode &&
|
|
310
|
+
response.statusCode >= 200 &&
|
|
311
|
+
response.statusCode <= 299) {
|
|
312
|
+
body = models_1.ObjectSerializer.deserialize(body, "PoliciesResponse");
|
|
313
|
+
resolve({ response: response, body: body });
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
*
|
|
325
|
+
* @param id
|
|
326
|
+
* @param project
|
|
327
|
+
*/
|
|
328
|
+
async getPolicy(id, project, options = { headers: {} }) {
|
|
329
|
+
const localVarPath = this.basePath +
|
|
330
|
+
"/v1/policies/{id}".replace("{" + "id" + "}", encodeURIComponent(String(id)));
|
|
331
|
+
let localVarQueryParameters = {};
|
|
332
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
333
|
+
const produces = ["application/json"];
|
|
334
|
+
// give precedence to 'application/json'
|
|
335
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
336
|
+
localVarHeaderParams.Accept = "application/json";
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
340
|
+
}
|
|
341
|
+
let localVarFormParams = {};
|
|
342
|
+
// verify required parameter 'id' is not null or undefined
|
|
343
|
+
if (id === null || id === undefined) {
|
|
344
|
+
throw new Error("Required parameter id was null or undefined when calling getPolicy.");
|
|
345
|
+
}
|
|
346
|
+
if (project !== undefined) {
|
|
347
|
+
localVarQueryParameters["project"] = models_1.ObjectSerializer.serialize(project, "string");
|
|
348
|
+
}
|
|
349
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
350
|
+
let localVarUseFormData = false;
|
|
351
|
+
let localVarRequestOptions = {
|
|
352
|
+
method: "GET",
|
|
353
|
+
qs: localVarQueryParameters,
|
|
354
|
+
headers: localVarHeaderParams,
|
|
355
|
+
uri: localVarPath,
|
|
356
|
+
useQuerystring: this._useQuerystring,
|
|
357
|
+
json: true,
|
|
358
|
+
};
|
|
359
|
+
let authenticationPromise = Promise.resolve();
|
|
360
|
+
if (this.authentications.pk.accessToken) {
|
|
361
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
362
|
+
}
|
|
363
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
364
|
+
let interceptorPromise = authenticationPromise;
|
|
365
|
+
for (const interceptor of this.interceptors) {
|
|
366
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
367
|
+
}
|
|
368
|
+
return interceptorPromise.then(() => {
|
|
369
|
+
if (Object.keys(localVarFormParams).length) {
|
|
370
|
+
if (localVarUseFormData) {
|
|
371
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
return new Promise((resolve, reject) => {
|
|
378
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
379
|
+
if (error) {
|
|
380
|
+
reject(error);
|
|
381
|
+
}
|
|
382
|
+
else {
|
|
383
|
+
if (response.statusCode &&
|
|
384
|
+
response.statusCode >= 200 &&
|
|
385
|
+
response.statusCode <= 299) {
|
|
386
|
+
body = models_1.ObjectSerializer.deserialize(body, "PolicyResponse");
|
|
387
|
+
resolve({ response: response, body: body });
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
});
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
*
|
|
399
|
+
* @param policy
|
|
400
|
+
* @param project
|
|
401
|
+
*/
|
|
402
|
+
async getPolicyAllowFunctions(policy, project, options = { headers: {} }) {
|
|
403
|
+
const localVarPath = this.basePath +
|
|
404
|
+
"/v1/policies/{policy}/allow_functions".replace("{" + "policy" + "}", encodeURIComponent(String(policy)));
|
|
405
|
+
let localVarQueryParameters = {};
|
|
406
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
407
|
+
const produces = ["application/json"];
|
|
408
|
+
// give precedence to 'application/json'
|
|
409
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
410
|
+
localVarHeaderParams.Accept = "application/json";
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
414
|
+
}
|
|
415
|
+
let localVarFormParams = {};
|
|
416
|
+
// verify required parameter 'policy' is not null or undefined
|
|
417
|
+
if (policy === null || policy === undefined) {
|
|
418
|
+
throw new Error("Required parameter policy was null or undefined when calling getPolicyAllowFunctions.");
|
|
419
|
+
}
|
|
420
|
+
if (project !== undefined) {
|
|
421
|
+
localVarQueryParameters["project"] = models_1.ObjectSerializer.serialize(project, "string");
|
|
422
|
+
}
|
|
423
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
424
|
+
let localVarUseFormData = false;
|
|
425
|
+
let localVarRequestOptions = {
|
|
426
|
+
method: "GET",
|
|
427
|
+
qs: localVarQueryParameters,
|
|
428
|
+
headers: localVarHeaderParams,
|
|
429
|
+
uri: localVarPath,
|
|
430
|
+
useQuerystring: this._useQuerystring,
|
|
431
|
+
json: true,
|
|
432
|
+
};
|
|
433
|
+
let authenticationPromise = Promise.resolve();
|
|
434
|
+
if (this.authentications.pk.accessToken) {
|
|
435
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
436
|
+
}
|
|
437
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
438
|
+
let interceptorPromise = authenticationPromise;
|
|
439
|
+
for (const interceptor of this.interceptors) {
|
|
440
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
441
|
+
}
|
|
442
|
+
return interceptorPromise.then(() => {
|
|
443
|
+
if (Object.keys(localVarFormParams).length) {
|
|
444
|
+
if (localVarUseFormData) {
|
|
445
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
446
|
+
}
|
|
447
|
+
else {
|
|
448
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return new Promise((resolve, reject) => {
|
|
452
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
453
|
+
if (error) {
|
|
454
|
+
reject(error);
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
if (response.statusCode &&
|
|
458
|
+
response.statusCode >= 200 &&
|
|
459
|
+
response.statusCode <= 299) {
|
|
460
|
+
body = models_1.ObjectSerializer.deserialize(body, "AllowFunctionsResponse");
|
|
461
|
+
resolve({ response: response, body: body });
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
*
|
|
473
|
+
* @param policy
|
|
474
|
+
* @param from
|
|
475
|
+
* @param to
|
|
476
|
+
*/
|
|
477
|
+
async getPolicyDailyGasUsage(policy, from, to, options = { headers: {} }) {
|
|
478
|
+
const localVarPath = this.basePath +
|
|
479
|
+
"/v1/policies/{policy}/daily_gas_usage".replace("{" + "policy" + "}", encodeURIComponent(String(policy)));
|
|
480
|
+
let localVarQueryParameters = {};
|
|
481
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
482
|
+
const produces = ["application/json"];
|
|
483
|
+
// give precedence to 'application/json'
|
|
484
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
485
|
+
localVarHeaderParams.Accept = "application/json";
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
489
|
+
}
|
|
490
|
+
let localVarFormParams = {};
|
|
491
|
+
// verify required parameter 'policy' is not null or undefined
|
|
492
|
+
if (policy === null || policy === undefined) {
|
|
493
|
+
throw new Error("Required parameter policy was null or undefined when calling getPolicyDailyGasUsage.");
|
|
494
|
+
}
|
|
495
|
+
if (from !== undefined) {
|
|
496
|
+
localVarQueryParameters["from"] = models_1.ObjectSerializer.serialize(from, "string");
|
|
497
|
+
}
|
|
498
|
+
if (to !== undefined) {
|
|
499
|
+
localVarQueryParameters["to"] = models_1.ObjectSerializer.serialize(to, "string");
|
|
500
|
+
}
|
|
501
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
502
|
+
let localVarUseFormData = false;
|
|
503
|
+
let localVarRequestOptions = {
|
|
504
|
+
method: "GET",
|
|
505
|
+
qs: localVarQueryParameters,
|
|
506
|
+
headers: localVarHeaderParams,
|
|
507
|
+
uri: localVarPath,
|
|
508
|
+
useQuerystring: this._useQuerystring,
|
|
509
|
+
json: true,
|
|
510
|
+
};
|
|
511
|
+
let authenticationPromise = Promise.resolve();
|
|
512
|
+
if (this.authentications.pk.accessToken) {
|
|
513
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
514
|
+
}
|
|
515
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
516
|
+
let interceptorPromise = authenticationPromise;
|
|
517
|
+
for (const interceptor of this.interceptors) {
|
|
518
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
519
|
+
}
|
|
520
|
+
return interceptorPromise.then(() => {
|
|
521
|
+
if (Object.keys(localVarFormParams).length) {
|
|
522
|
+
if (localVarUseFormData) {
|
|
523
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return new Promise((resolve, reject) => {
|
|
530
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
531
|
+
if (error) {
|
|
532
|
+
reject(error);
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
if (response.statusCode &&
|
|
536
|
+
response.statusCode >= 200 &&
|
|
537
|
+
response.statusCode <= 299) {
|
|
538
|
+
body = models_1.ObjectSerializer.deserialize(body, "Gas");
|
|
539
|
+
resolve({ response: response, body: body });
|
|
540
|
+
}
|
|
541
|
+
else {
|
|
542
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
*
|
|
551
|
+
* @param policy
|
|
552
|
+
* @param from
|
|
553
|
+
* @param to
|
|
554
|
+
*/
|
|
555
|
+
async getPolicyTotalGasUsage(policy, from, to, options = { headers: {} }) {
|
|
556
|
+
const localVarPath = this.basePath +
|
|
557
|
+
"/v1/policies/{policy}/gas_usage".replace("{" + "policy" + "}", encodeURIComponent(String(policy)));
|
|
558
|
+
let localVarQueryParameters = {};
|
|
559
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
560
|
+
const produces = ["application/json"];
|
|
561
|
+
// give precedence to 'application/json'
|
|
562
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
563
|
+
localVarHeaderParams.Accept = "application/json";
|
|
564
|
+
}
|
|
565
|
+
else {
|
|
566
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
567
|
+
}
|
|
568
|
+
let localVarFormParams = {};
|
|
569
|
+
// verify required parameter 'policy' is not null or undefined
|
|
570
|
+
if (policy === null || policy === undefined) {
|
|
571
|
+
throw new Error("Required parameter policy was null or undefined when calling getPolicyTotalGasUsage.");
|
|
572
|
+
}
|
|
573
|
+
if (from !== undefined) {
|
|
574
|
+
localVarQueryParameters["from"] = models_1.ObjectSerializer.serialize(from, "string");
|
|
575
|
+
}
|
|
576
|
+
if (to !== undefined) {
|
|
577
|
+
localVarQueryParameters["to"] = models_1.ObjectSerializer.serialize(to, "string");
|
|
578
|
+
}
|
|
579
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
580
|
+
let localVarUseFormData = false;
|
|
581
|
+
let localVarRequestOptions = {
|
|
582
|
+
method: "GET",
|
|
583
|
+
qs: localVarQueryParameters,
|
|
584
|
+
headers: localVarHeaderParams,
|
|
585
|
+
uri: localVarPath,
|
|
586
|
+
useQuerystring: this._useQuerystring,
|
|
587
|
+
json: true,
|
|
588
|
+
};
|
|
589
|
+
let authenticationPromise = Promise.resolve();
|
|
590
|
+
if (this.authentications.pk.accessToken) {
|
|
591
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
592
|
+
}
|
|
593
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
594
|
+
let interceptorPromise = authenticationPromise;
|
|
595
|
+
for (const interceptor of this.interceptors) {
|
|
596
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
597
|
+
}
|
|
598
|
+
return interceptorPromise.then(() => {
|
|
599
|
+
if (Object.keys(localVarFormParams).length) {
|
|
600
|
+
if (localVarUseFormData) {
|
|
601
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
return new Promise((resolve, reject) => {
|
|
608
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
609
|
+
if (error) {
|
|
610
|
+
reject(error);
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
if (response.statusCode &&
|
|
614
|
+
response.statusCode >= 200 &&
|
|
615
|
+
response.statusCode <= 299) {
|
|
616
|
+
body = models_1.ObjectSerializer.deserialize(body, "SumGas");
|
|
617
|
+
resolve({ response: response, body: body });
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Updates a policy object.
|
|
629
|
+
* @param id
|
|
630
|
+
* @param name
|
|
631
|
+
* @param chainId
|
|
632
|
+
* @param strategy
|
|
633
|
+
* @param project
|
|
634
|
+
*/
|
|
635
|
+
async updatePolicy(id, name, chainId, strategy, project, options = { headers: {} }) {
|
|
636
|
+
const localVarPath = this.basePath +
|
|
637
|
+
"/v1/policies/{id}".replace("{" + "id" + "}", encodeURIComponent(String(id)));
|
|
638
|
+
let localVarQueryParameters = {};
|
|
639
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
640
|
+
const produces = ["application/json"];
|
|
641
|
+
// give precedence to 'application/json'
|
|
642
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
643
|
+
localVarHeaderParams.Accept = "application/json";
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
647
|
+
}
|
|
648
|
+
let localVarFormParams = {};
|
|
649
|
+
// verify required parameter 'id' is not null or undefined
|
|
650
|
+
if (id === null || id === undefined) {
|
|
651
|
+
throw new Error("Required parameter id was null or undefined when calling updatePolicy.");
|
|
652
|
+
}
|
|
653
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
654
|
+
let localVarUseFormData = false;
|
|
655
|
+
if (name !== undefined) {
|
|
656
|
+
localVarFormParams["name"] = models_1.ObjectSerializer.serialize(name, "string");
|
|
657
|
+
}
|
|
658
|
+
if (chainId !== undefined) {
|
|
659
|
+
localVarFormParams["chain_id"] = models_1.ObjectSerializer.serialize(chainId, "number");
|
|
660
|
+
}
|
|
661
|
+
if (strategy !== undefined) {
|
|
662
|
+
localVarFormParams["strategy"] = models_1.ObjectSerializer.serialize(strategy, "Strategy");
|
|
663
|
+
}
|
|
664
|
+
if (project !== undefined) {
|
|
665
|
+
localVarFormParams["project"] = models_1.ObjectSerializer.serialize(project, "string");
|
|
666
|
+
}
|
|
667
|
+
let localVarRequestOptions = {
|
|
668
|
+
method: "POST",
|
|
669
|
+
qs: localVarQueryParameters,
|
|
670
|
+
headers: localVarHeaderParams,
|
|
671
|
+
uri: localVarPath,
|
|
672
|
+
useQuerystring: this._useQuerystring,
|
|
673
|
+
json: true,
|
|
674
|
+
};
|
|
675
|
+
let authenticationPromise = Promise.resolve();
|
|
676
|
+
if (this.authentications.pk.accessToken) {
|
|
677
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
678
|
+
}
|
|
679
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
680
|
+
let interceptorPromise = authenticationPromise;
|
|
681
|
+
for (const interceptor of this.interceptors) {
|
|
682
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
683
|
+
}
|
|
684
|
+
return interceptorPromise.then(() => {
|
|
685
|
+
if (Object.keys(localVarFormParams).length) {
|
|
686
|
+
if (localVarUseFormData) {
|
|
687
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
688
|
+
}
|
|
689
|
+
else {
|
|
690
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return new Promise((resolve, reject) => {
|
|
694
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
695
|
+
if (error) {
|
|
696
|
+
reject(error);
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
if (response.statusCode &&
|
|
700
|
+
response.statusCode >= 200 &&
|
|
701
|
+
response.statusCode <= 299) {
|
|
702
|
+
body = models_1.ObjectSerializer.deserialize(body, "PolicyResponse");
|
|
703
|
+
resolve({ response: response, body: body });
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
});
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
*
|
|
715
|
+
* @param policy
|
|
716
|
+
* @param id
|
|
717
|
+
* @param type
|
|
718
|
+
* @param functionName
|
|
719
|
+
* @param policy2
|
|
720
|
+
* @param project
|
|
721
|
+
* @param contract
|
|
722
|
+
*/
|
|
723
|
+
async updatePolicyAllowFunction(policy, id, type, functionName, policy2, project, contract, options = { headers: {} }) {
|
|
724
|
+
const localVarPath = this.basePath +
|
|
725
|
+
"/v1/policies/{policy}/allow_functions/{id}"
|
|
726
|
+
.replace("{" + "policy" + "}", encodeURIComponent(String(policy)))
|
|
727
|
+
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
|
|
728
|
+
let localVarQueryParameters = {};
|
|
729
|
+
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
|
|
730
|
+
const produces = ["application/json"];
|
|
731
|
+
// give precedence to 'application/json'
|
|
732
|
+
if (produces.indexOf("application/json") >= 0) {
|
|
733
|
+
localVarHeaderParams.Accept = "application/json";
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
localVarHeaderParams.Accept = produces.join(",");
|
|
737
|
+
}
|
|
738
|
+
let localVarFormParams = {};
|
|
739
|
+
// verify required parameter 'policy' is not null or undefined
|
|
740
|
+
if (policy === null || policy === undefined) {
|
|
741
|
+
throw new Error("Required parameter policy was null or undefined when calling updatePolicyAllowFunction.");
|
|
742
|
+
}
|
|
743
|
+
// verify required parameter 'id' is not null or undefined
|
|
744
|
+
if (id === null || id === undefined) {
|
|
745
|
+
throw new Error("Required parameter id was null or undefined when calling updatePolicyAllowFunction.");
|
|
746
|
+
}
|
|
747
|
+
Object.assign(localVarHeaderParams, options.headers);
|
|
748
|
+
let localVarUseFormData = false;
|
|
749
|
+
if (type !== undefined) {
|
|
750
|
+
localVarFormParams["type"] = models_1.ObjectSerializer.serialize(type, "string");
|
|
751
|
+
}
|
|
752
|
+
if (functionName !== undefined) {
|
|
753
|
+
localVarFormParams["function_name"] = models_1.ObjectSerializer.serialize(functionName, "string");
|
|
754
|
+
}
|
|
755
|
+
if (policy2 !== undefined) {
|
|
756
|
+
localVarFormParams["policy"] = models_1.ObjectSerializer.serialize(policy2, "string");
|
|
757
|
+
}
|
|
758
|
+
if (project !== undefined) {
|
|
759
|
+
localVarFormParams["project"] = models_1.ObjectSerializer.serialize(project, "string");
|
|
760
|
+
}
|
|
761
|
+
if (contract !== undefined) {
|
|
762
|
+
localVarFormParams["contract"] = models_1.ObjectSerializer.serialize(contract, "string");
|
|
763
|
+
}
|
|
764
|
+
let localVarRequestOptions = {
|
|
765
|
+
method: "POST",
|
|
766
|
+
qs: localVarQueryParameters,
|
|
767
|
+
headers: localVarHeaderParams,
|
|
768
|
+
uri: localVarPath,
|
|
769
|
+
useQuerystring: this._useQuerystring,
|
|
770
|
+
json: true,
|
|
771
|
+
};
|
|
772
|
+
let authenticationPromise = Promise.resolve();
|
|
773
|
+
if (this.authentications.pk.accessToken) {
|
|
774
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
|
|
775
|
+
}
|
|
776
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
777
|
+
let interceptorPromise = authenticationPromise;
|
|
778
|
+
for (const interceptor of this.interceptors) {
|
|
779
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
780
|
+
}
|
|
781
|
+
return interceptorPromise.then(() => {
|
|
782
|
+
if (Object.keys(localVarFormParams).length) {
|
|
783
|
+
if (localVarUseFormData) {
|
|
784
|
+
localVarRequestOptions.formData = localVarFormParams;
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return new Promise((resolve, reject) => {
|
|
791
|
+
(0, request_1.default)(localVarRequestOptions, (error, response, body) => {
|
|
792
|
+
if (error) {
|
|
793
|
+
reject(error);
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
if (response.statusCode &&
|
|
797
|
+
response.statusCode >= 200 &&
|
|
798
|
+
response.statusCode <= 299) {
|
|
799
|
+
body = models_1.ObjectSerializer.deserialize(body, "AllowFunctionResponse");
|
|
800
|
+
resolve({ response: response, body: body });
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
reject(new apis_1.HttpError(response, body, response.statusCode));
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
exports.PoliciesApi = PoliciesApi;
|
|
812
|
+
//# sourceMappingURL=policiesApi.js.map
|