@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.
Files changed (142) hide show
  1. package/README.md +46 -0
  2. package/dist/api/apis.d.ts +26 -0
  3. package/dist/api/apis.js +54 -0
  4. package/dist/api/apis.js.map +1 -0
  5. package/dist/api/contractsApi.d.ts +82 -0
  6. package/dist/api/contractsApi.js +317 -0
  7. package/dist/api/contractsApi.js.map +1 -0
  8. package/dist/api/defaultApi.d.ts +142 -0
  9. package/dist/api/defaultApi.js +653 -0
  10. package/dist/api/defaultApi.js.map +1 -0
  11. package/dist/api/logsApi.d.ts +52 -0
  12. package/dist/api/logsApi.js +155 -0
  13. package/dist/api/logsApi.js.map +1 -0
  14. package/dist/api/playersApi.d.ts +157 -0
  15. package/dist/api/playersApi.js +722 -0
  16. package/dist/api/playersApi.js.map +1 -0
  17. package/dist/api/policiesApi.d.ts +175 -0
  18. package/dist/api/policiesApi.js +812 -0
  19. package/dist/api/policiesApi.js.map +1 -0
  20. package/dist/api/projectsApi.d.ts +104 -0
  21. package/dist/api/projectsApi.js +450 -0
  22. package/dist/api/projectsApi.js.map +1 -0
  23. package/dist/api/sessionsApi.d.ts +70 -0
  24. package/dist/api/sessionsApi.js +276 -0
  25. package/dist/api/sessionsApi.js.map +1 -0
  26. package/dist/api/transactionIntentsApi.d.ts +124 -0
  27. package/dist/api/transactionIntentsApi.js +565 -0
  28. package/dist/api/transactionIntentsApi.js.map +1 -0
  29. package/dist/index.d.ts +26 -0
  30. package/dist/index.js +66 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/model/accountResponse.d.ts +33 -0
  33. package/dist/model/accountResponse.js +64 -0
  34. package/dist/model/accountResponse.js.map +1 -0
  35. package/dist/model/accountsResponse.d.ts +28 -0
  36. package/dist/model/accountsResponse.js +39 -0
  37. package/dist/model/accountsResponse.js.map +1 -0
  38. package/dist/model/allowFunctionResponse.d.ts +31 -0
  39. package/dist/model/allowFunctionResponse.js +54 -0
  40. package/dist/model/allowFunctionResponse.js.map +1 -0
  41. package/dist/model/allowFunctionsResponse.d.ts +28 -0
  42. package/dist/model/allowFunctionsResponse.js +39 -0
  43. package/dist/model/allowFunctionsResponse.js.map +1 -0
  44. package/dist/model/apiKeyResponse.d.ts +28 -0
  45. package/dist/model/apiKeyResponse.js +44 -0
  46. package/dist/model/apiKeyResponse.js.map +1 -0
  47. package/dist/model/assetInventory.d.ts +34 -0
  48. package/dist/model/assetInventory.js +44 -0
  49. package/dist/model/assetInventory.js.map +1 -0
  50. package/dist/model/assetType.d.ts +17 -0
  51. package/dist/model/assetType.js +22 -0
  52. package/dist/model/assetType.js.map +1 -0
  53. package/dist/model/authResponse.d.ts +26 -0
  54. package/dist/model/authResponse.js +34 -0
  55. package/dist/model/authResponse.js.map +1 -0
  56. package/dist/model/contractResponse.d.ts +33 -0
  57. package/dist/model/contractResponse.js +64 -0
  58. package/dist/model/contractResponse.js.map +1 -0
  59. package/dist/model/contractResponseAbi.d.ts +24 -0
  60. package/dist/model/contractResponseAbi.js +23 -0
  61. package/dist/model/contractResponseAbi.js.map +1 -0
  62. package/dist/model/contractResponseAbiAnyOfInner.d.ts +34 -0
  63. package/dist/model/contractResponseAbiAnyOfInner.js +74 -0
  64. package/dist/model/contractResponseAbiAnyOfInner.js.map +1 -0
  65. package/dist/model/contractsResponse.d.ts +28 -0
  66. package/dist/model/contractsResponse.js +39 -0
  67. package/dist/model/contractsResponse.js.map +1 -0
  68. package/dist/model/createSessionPlayerRequest.d.ts +31 -0
  69. package/dist/model/createSessionPlayerRequest.js +59 -0
  70. package/dist/model/createSessionPlayerRequest.js.map +1 -0
  71. package/dist/model/fragment.d.ts +29 -0
  72. package/dist/model/fragment.js +44 -0
  73. package/dist/model/fragment.js.map +1 -0
  74. package/dist/model/gas.d.ts +29 -0
  75. package/dist/model/gas.js +39 -0
  76. package/dist/model/gas.js.map +1 -0
  77. package/dist/model/getProjectResponse.d.ts +27 -0
  78. package/dist/model/getProjectResponse.js +39 -0
  79. package/dist/model/getProjectResponse.js.map +1 -0
  80. package/dist/model/interaction.d.ts +27 -0
  81. package/dist/model/interaction.js +39 -0
  82. package/dist/model/interaction.js.map +1 -0
  83. package/dist/model/inventoryResponse.d.ts +29 -0
  84. package/dist/model/inventoryResponse.js +44 -0
  85. package/dist/model/inventoryResponse.js.map +1 -0
  86. package/dist/model/jsonFragment.d.ts +33 -0
  87. package/dist/model/jsonFragment.js +69 -0
  88. package/dist/model/jsonFragment.js.map +1 -0
  89. package/dist/model/log.d.ts +31 -0
  90. package/dist/model/log.js +59 -0
  91. package/dist/model/log.js.map +1 -0
  92. package/dist/model/models.d.ts +83 -0
  93. package/dist/model/models.js +324 -0
  94. package/dist/model/models.js.map +1 -0
  95. package/dist/model/paramType.d.ts +32 -0
  96. package/dist/model/paramType.js +64 -0
  97. package/dist/model/paramType.js.map +1 -0
  98. package/dist/model/playerResponse.d.ts +36 -0
  99. package/dist/model/playerResponse.js +74 -0
  100. package/dist/model/playerResponse.js.map +1 -0
  101. package/dist/model/playersResponse.d.ts +28 -0
  102. package/dist/model/playersResponse.js +39 -0
  103. package/dist/model/playersResponse.js.map +1 -0
  104. package/dist/model/policiesResponse.d.ts +28 -0
  105. package/dist/model/policiesResponse.js +39 -0
  106. package/dist/model/policiesResponse.js.map +1 -0
  107. package/dist/model/policyResponse.d.ts +34 -0
  108. package/dist/model/policyResponse.js +64 -0
  109. package/dist/model/policyResponse.js.map +1 -0
  110. package/dist/model/projectLogs.d.ts +28 -0
  111. package/dist/model/projectLogs.js +39 -0
  112. package/dist/model/projectLogs.js.map +1 -0
  113. package/dist/model/projectResponse.d.ts +32 -0
  114. package/dist/model/projectResponse.js +59 -0
  115. package/dist/model/projectResponse.js.map +1 -0
  116. package/dist/model/projectsResponse.d.ts +28 -0
  117. package/dist/model/projectsResponse.js +39 -0
  118. package/dist/model/projectsResponse.js.map +1 -0
  119. package/dist/model/responseResponse.d.ts +32 -0
  120. package/dist/model/responseResponse.js +64 -0
  121. package/dist/model/responseResponse.js.map +1 -0
  122. package/dist/model/sessionResponse.d.ts +32 -0
  123. package/dist/model/sessionResponse.js +64 -0
  124. package/dist/model/sessionResponse.js.map +1 -0
  125. package/dist/model/strategy.d.ts +27 -0
  126. package/dist/model/strategy.js +39 -0
  127. package/dist/model/strategy.js.map +1 -0
  128. package/dist/model/sumGas.d.ts +27 -0
  129. package/dist/model/sumGas.js +39 -0
  130. package/dist/model/sumGas.js.map +1 -0
  131. package/dist/model/transactionIntentResponse.d.ts +40 -0
  132. package/dist/model/transactionIntentResponse.js +89 -0
  133. package/dist/model/transactionIntentResponse.js.map +1 -0
  134. package/dist/model/transactionIntentsResponse.d.ts +28 -0
  135. package/dist/model/transactionIntentsResponse.js +39 -0
  136. package/dist/model/transactionIntentsResponse.js.map +1 -0
  137. package/dist/model/userOpResult.d.ts +26 -0
  138. package/dist/model/userOpResult.js +34 -0
  139. package/dist/model/userOpResult.js.map +1 -0
  140. package/package.json +40 -0
  141. package/tsconfig.json +38 -0
  142. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,653 @@
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.DefaultApi = exports.DefaultApiApiKeys = 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 DefaultApiApiKeys;
27
+ (function (DefaultApiApiKeys) {
28
+ })(DefaultApiApiKeys = exports.DefaultApiApiKeys || (exports.DefaultApiApiKeys = {}));
29
+ class DefaultApi {
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[DefaultApiApiKeys[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
+ * Creates an account object.
79
+ * @param chainId The chain_id
80
+ * @param player The player ID
81
+ * @param project The project ID
82
+ * @param externalOwnerAddress The address of the external owner
83
+ */
84
+ async createAccount(chainId, player, project, externalOwnerAddress, options = { headers: {} }) {
85
+ const localVarPath = this.basePath + "/v1/accounts";
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 'chainId' is not null or undefined
98
+ if (chainId === null || chainId === undefined) {
99
+ throw new Error("Required parameter chainId was null or undefined when calling createAccount.");
100
+ }
101
+ // verify required parameter 'player' is not null or undefined
102
+ if (player === null || player === undefined) {
103
+ throw new Error("Required parameter player was null or undefined when calling createAccount.");
104
+ }
105
+ Object.assign(localVarHeaderParams, options.headers);
106
+ let localVarUseFormData = false;
107
+ if (project !== undefined) {
108
+ localVarFormParams["project"] = models_1.ObjectSerializer.serialize(project, "string");
109
+ }
110
+ if (chainId !== undefined) {
111
+ localVarFormParams["chain_id"] = models_1.ObjectSerializer.serialize(chainId, "number");
112
+ }
113
+ if (player !== undefined) {
114
+ localVarFormParams["player"] = models_1.ObjectSerializer.serialize(player, "string");
115
+ }
116
+ if (externalOwnerAddress !== undefined) {
117
+ localVarFormParams["external_owner_address"] = models_1.ObjectSerializer.serialize(externalOwnerAddress, "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, "AccountResponse");
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
+ * Creates an allow function object.
167
+ * @param type
168
+ * @param policy
169
+ * @param functionName
170
+ * @param project
171
+ * @param contract
172
+ */
173
+ async createAllowFunction(type, policy, functionName, project, contract, options = { headers: {} }) {
174
+ const localVarPath = this.basePath + "/v1/allow_functions";
175
+ let localVarQueryParameters = {};
176
+ let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
177
+ const produces = ["application/json"];
178
+ // give precedence to 'application/json'
179
+ if (produces.indexOf("application/json") >= 0) {
180
+ localVarHeaderParams.Accept = "application/json";
181
+ }
182
+ else {
183
+ localVarHeaderParams.Accept = produces.join(",");
184
+ }
185
+ let localVarFormParams = {};
186
+ // verify required parameter 'type' is not null or undefined
187
+ if (type === null || type === undefined) {
188
+ throw new Error("Required parameter type was null or undefined when calling createAllowFunction.");
189
+ }
190
+ // verify required parameter 'policy' is not null or undefined
191
+ if (policy === null || policy === undefined) {
192
+ throw new Error("Required parameter policy was null or undefined when calling createAllowFunction.");
193
+ }
194
+ Object.assign(localVarHeaderParams, options.headers);
195
+ let localVarUseFormData = false;
196
+ if (type !== undefined) {
197
+ localVarFormParams["type"] = models_1.ObjectSerializer.serialize(type, "string");
198
+ }
199
+ if (functionName !== undefined) {
200
+ localVarFormParams["function_name"] = models_1.ObjectSerializer.serialize(functionName, "string");
201
+ }
202
+ if (policy !== undefined) {
203
+ localVarFormParams["policy"] = models_1.ObjectSerializer.serialize(policy, "string");
204
+ }
205
+ if (project !== undefined) {
206
+ localVarFormParams["project"] = models_1.ObjectSerializer.serialize(project, "string");
207
+ }
208
+ if (contract !== undefined) {
209
+ localVarFormParams["contract"] = models_1.ObjectSerializer.serialize(contract, "string");
210
+ }
211
+ let localVarRequestOptions = {
212
+ method: "POST",
213
+ qs: localVarQueryParameters,
214
+ headers: localVarHeaderParams,
215
+ uri: localVarPath,
216
+ useQuerystring: this._useQuerystring,
217
+ json: true,
218
+ };
219
+ let authenticationPromise = Promise.resolve();
220
+ if (this.authentications.pk.accessToken) {
221
+ authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
222
+ }
223
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
224
+ let interceptorPromise = authenticationPromise;
225
+ for (const interceptor of this.interceptors) {
226
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
227
+ }
228
+ return interceptorPromise.then(() => {
229
+ if (Object.keys(localVarFormParams).length) {
230
+ if (localVarUseFormData) {
231
+ localVarRequestOptions.formData = localVarFormParams;
232
+ }
233
+ else {
234
+ localVarRequestOptions.form = localVarFormParams;
235
+ }
236
+ }
237
+ return new Promise((resolve, reject) => {
238
+ (0, request_1.default)(localVarRequestOptions, (error, response, body) => {
239
+ if (error) {
240
+ reject(error);
241
+ }
242
+ else {
243
+ if (response.statusCode &&
244
+ response.statusCode >= 200 &&
245
+ response.statusCode <= 299) {
246
+ body = models_1.ObjectSerializer.deserialize(body, "AllowFunctionResponse");
247
+ resolve({ response: response, body: body });
248
+ }
249
+ else {
250
+ reject(new apis_1.HttpError(response, body, response.statusCode));
251
+ }
252
+ }
253
+ });
254
+ });
255
+ });
256
+ }
257
+ /**
258
+ * Retrieves the details of an existing account. Supply the unique account ID from either a account creation request or the account list, and Openfort will return the corresponding account information.
259
+ * @param id Specifies the unique account ID.
260
+ * @param project Specifies the unique project ID.
261
+ */
262
+ async getAccount(id, project, options = { headers: {} }) {
263
+ const localVarPath = this.basePath +
264
+ "/v1/accounts/{id}".replace("{" + "id" + "}", encodeURIComponent(String(id)));
265
+ let localVarQueryParameters = {};
266
+ let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
267
+ const produces = ["application/json"];
268
+ // give precedence to 'application/json'
269
+ if (produces.indexOf("application/json") >= 0) {
270
+ localVarHeaderParams.Accept = "application/json";
271
+ }
272
+ else {
273
+ localVarHeaderParams.Accept = produces.join(",");
274
+ }
275
+ let localVarFormParams = {};
276
+ // verify required parameter 'id' is not null or undefined
277
+ if (id === null || id === undefined) {
278
+ throw new Error("Required parameter id was null or undefined when calling getAccount.");
279
+ }
280
+ if (project !== undefined) {
281
+ localVarQueryParameters["project"] = models_1.ObjectSerializer.serialize(project, "string");
282
+ }
283
+ Object.assign(localVarHeaderParams, options.headers);
284
+ let localVarUseFormData = false;
285
+ let localVarRequestOptions = {
286
+ method: "GET",
287
+ qs: localVarQueryParameters,
288
+ headers: localVarHeaderParams,
289
+ uri: localVarPath,
290
+ useQuerystring: this._useQuerystring,
291
+ json: true,
292
+ };
293
+ let authenticationPromise = Promise.resolve();
294
+ if (this.authentications.pk.accessToken) {
295
+ authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
296
+ }
297
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
298
+ let interceptorPromise = authenticationPromise;
299
+ for (const interceptor of this.interceptors) {
300
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
301
+ }
302
+ return interceptorPromise.then(() => {
303
+ if (Object.keys(localVarFormParams).length) {
304
+ if (localVarUseFormData) {
305
+ localVarRequestOptions.formData = localVarFormParams;
306
+ }
307
+ else {
308
+ localVarRequestOptions.form = localVarFormParams;
309
+ }
310
+ }
311
+ return new Promise((resolve, reject) => {
312
+ (0, request_1.default)(localVarRequestOptions, (error, response, body) => {
313
+ if (error) {
314
+ reject(error);
315
+ }
316
+ else {
317
+ if (response.statusCode &&
318
+ response.statusCode >= 200 &&
319
+ response.statusCode <= 299) {
320
+ body = models_1.ObjectSerializer.deserialize(body, "AccountResponse");
321
+ resolve({ response: response, body: body });
322
+ }
323
+ else {
324
+ reject(new apis_1.HttpError(response, body, response.statusCode));
325
+ }
326
+ }
327
+ });
328
+ });
329
+ });
330
+ }
331
+ /**
332
+ * Retrieves the inventory of an existing account. Supply the unique account ID from either a account creation request or the account list, and Openfort will return the corresponding account information.
333
+ * @param id Specifies the unique account ID.
334
+ * @param project Specifies the unique project ID.
335
+ */
336
+ async getAccountInventory(id, project, options = { headers: {} }) {
337
+ const localVarPath = this.basePath +
338
+ "/v1/accounts/{id}/inventory".replace("{" + "id" + "}", encodeURIComponent(String(id)));
339
+ let localVarQueryParameters = {};
340
+ let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
341
+ const produces = ["application/json"];
342
+ // give precedence to 'application/json'
343
+ if (produces.indexOf("application/json") >= 0) {
344
+ localVarHeaderParams.Accept = "application/json";
345
+ }
346
+ else {
347
+ localVarHeaderParams.Accept = produces.join(",");
348
+ }
349
+ let localVarFormParams = {};
350
+ // verify required parameter 'id' is not null or undefined
351
+ if (id === null || id === undefined) {
352
+ throw new Error("Required parameter id was null or undefined when calling getAccountInventory.");
353
+ }
354
+ if (project !== undefined) {
355
+ localVarQueryParameters["project"] = models_1.ObjectSerializer.serialize(project, "string");
356
+ }
357
+ Object.assign(localVarHeaderParams, options.headers);
358
+ let localVarUseFormData = false;
359
+ let localVarRequestOptions = {
360
+ method: "GET",
361
+ qs: localVarQueryParameters,
362
+ headers: localVarHeaderParams,
363
+ uri: localVarPath,
364
+ useQuerystring: this._useQuerystring,
365
+ json: true,
366
+ };
367
+ let authenticationPromise = Promise.resolve();
368
+ if (this.authentications.pk.accessToken) {
369
+ authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
370
+ }
371
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
372
+ let interceptorPromise = authenticationPromise;
373
+ for (const interceptor of this.interceptors) {
374
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
375
+ }
376
+ return interceptorPromise.then(() => {
377
+ if (Object.keys(localVarFormParams).length) {
378
+ if (localVarUseFormData) {
379
+ localVarRequestOptions.formData = localVarFormParams;
380
+ }
381
+ else {
382
+ localVarRequestOptions.form = localVarFormParams;
383
+ }
384
+ }
385
+ return new Promise((resolve, reject) => {
386
+ (0, request_1.default)(localVarRequestOptions, (error, response, body) => {
387
+ if (error) {
388
+ reject(error);
389
+ }
390
+ else {
391
+ if (response.statusCode &&
392
+ response.statusCode >= 200 &&
393
+ response.statusCode <= 299) {
394
+ body = models_1.ObjectSerializer.deserialize(body, "InventoryResponse");
395
+ resolve({ response: response, body: body });
396
+ }
397
+ else {
398
+ reject(new apis_1.HttpError(response, body, response.statusCode));
399
+ }
400
+ }
401
+ });
402
+ });
403
+ });
404
+ }
405
+ /**
406
+ * Returns a list of your accounts for the given player. The accounts are returned sorted by creation date, with the most recently created accounts appearing first.
407
+ * @param player Specifies the unique player ID.
408
+ * @param project Specifies the unique project ID.
409
+ */
410
+ async getAccounts(player, project, options = { headers: {} }) {
411
+ const localVarPath = this.basePath + "/v1/accounts";
412
+ let localVarQueryParameters = {};
413
+ let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
414
+ const produces = ["application/json"];
415
+ // give precedence to 'application/json'
416
+ if (produces.indexOf("application/json") >= 0) {
417
+ localVarHeaderParams.Accept = "application/json";
418
+ }
419
+ else {
420
+ localVarHeaderParams.Accept = produces.join(",");
421
+ }
422
+ let localVarFormParams = {};
423
+ // verify required parameter 'player' is not null or undefined
424
+ if (player === null || player === undefined) {
425
+ throw new Error("Required parameter player was null or undefined when calling getAccounts.");
426
+ }
427
+ if (player !== undefined) {
428
+ localVarQueryParameters["player"] = models_1.ObjectSerializer.serialize(player, "string");
429
+ }
430
+ if (project !== undefined) {
431
+ localVarQueryParameters["project"] = models_1.ObjectSerializer.serialize(project, "string");
432
+ }
433
+ Object.assign(localVarHeaderParams, options.headers);
434
+ let localVarUseFormData = false;
435
+ let localVarRequestOptions = {
436
+ method: "GET",
437
+ qs: localVarQueryParameters,
438
+ headers: localVarHeaderParams,
439
+ uri: localVarPath,
440
+ useQuerystring: this._useQuerystring,
441
+ json: true,
442
+ };
443
+ let authenticationPromise = Promise.resolve();
444
+ if (this.authentications.pk.accessToken) {
445
+ authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
446
+ }
447
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
448
+ let interceptorPromise = authenticationPromise;
449
+ for (const interceptor of this.interceptors) {
450
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
451
+ }
452
+ return interceptorPromise.then(() => {
453
+ if (Object.keys(localVarFormParams).length) {
454
+ if (localVarUseFormData) {
455
+ localVarRequestOptions.formData = localVarFormParams;
456
+ }
457
+ else {
458
+ localVarRequestOptions.form = localVarFormParams;
459
+ }
460
+ }
461
+ return new Promise((resolve, reject) => {
462
+ (0, request_1.default)(localVarRequestOptions, (error, response, body) => {
463
+ if (error) {
464
+ reject(error);
465
+ }
466
+ else {
467
+ if (response.statusCode &&
468
+ response.statusCode >= 200 &&
469
+ response.statusCode <= 299) {
470
+ body = models_1.ObjectSerializer.deserialize(body, "AccountsResponse");
471
+ resolve({ response: response, body: body });
472
+ }
473
+ else {
474
+ reject(new apis_1.HttpError(response, body, response.statusCode));
475
+ }
476
+ }
477
+ });
478
+ });
479
+ });
480
+ }
481
+ /**
482
+ * Returns a list of your allow functions for the given policy. The allow functions are returned sorted by creation date, with the most recently created allow functions appearing first.
483
+ * @param project Specifies the unique project ID.
484
+ * @param policy Specifies the unique policy ID.
485
+ */
486
+ async getAllowFunctions(project, policy, options = { headers: {} }) {
487
+ const localVarPath = this.basePath + "/v1/allow_functions";
488
+ let localVarQueryParameters = {};
489
+ let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
490
+ const produces = ["application/json"];
491
+ // give precedence to 'application/json'
492
+ if (produces.indexOf("application/json") >= 0) {
493
+ localVarHeaderParams.Accept = "application/json";
494
+ }
495
+ else {
496
+ localVarHeaderParams.Accept = produces.join(",");
497
+ }
498
+ let localVarFormParams = {};
499
+ if (project !== undefined) {
500
+ localVarQueryParameters["project"] = models_1.ObjectSerializer.serialize(project, "string");
501
+ }
502
+ if (policy !== undefined) {
503
+ localVarQueryParameters["policy"] = models_1.ObjectSerializer.serialize(policy, "string");
504
+ }
505
+ Object.assign(localVarHeaderParams, options.headers);
506
+ let localVarUseFormData = false;
507
+ let localVarRequestOptions = {
508
+ method: "GET",
509
+ qs: localVarQueryParameters,
510
+ headers: localVarHeaderParams,
511
+ uri: localVarPath,
512
+ useQuerystring: this._useQuerystring,
513
+ json: true,
514
+ };
515
+ let authenticationPromise = Promise.resolve();
516
+ if (this.authentications.pk.accessToken) {
517
+ authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
518
+ }
519
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
520
+ let interceptorPromise = authenticationPromise;
521
+ for (const interceptor of this.interceptors) {
522
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
523
+ }
524
+ return interceptorPromise.then(() => {
525
+ if (Object.keys(localVarFormParams).length) {
526
+ if (localVarUseFormData) {
527
+ localVarRequestOptions.formData = localVarFormParams;
528
+ }
529
+ else {
530
+ localVarRequestOptions.form = localVarFormParams;
531
+ }
532
+ }
533
+ return new Promise((resolve, reject) => {
534
+ (0, request_1.default)(localVarRequestOptions, (error, response, body) => {
535
+ if (error) {
536
+ reject(error);
537
+ }
538
+ else {
539
+ if (response.statusCode &&
540
+ response.statusCode >= 200 &&
541
+ response.statusCode <= 299) {
542
+ body = models_1.ObjectSerializer.deserialize(body, "AllowFunctionsResponse");
543
+ resolve({ response: response, body: body });
544
+ }
545
+ else {
546
+ reject(new apis_1.HttpError(response, body, response.statusCode));
547
+ }
548
+ }
549
+ });
550
+ });
551
+ });
552
+ }
553
+ /**
554
+ * Updates your allow functions object.
555
+ * @param id Specifies the unique allow function ID.
556
+ * @param type
557
+ * @param policy
558
+ * @param functionName
559
+ * @param project
560
+ * @param contract
561
+ */
562
+ async updateAllowFunction(id, type, policy, functionName, project, contract, options = { headers: {} }) {
563
+ const localVarPath = this.basePath +
564
+ "/v1/allow_functions/{id}".replace("{" + "id" + "}", encodeURIComponent(String(id)));
565
+ let localVarQueryParameters = {};
566
+ let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
567
+ const produces = ["application/json"];
568
+ // give precedence to 'application/json'
569
+ if (produces.indexOf("application/json") >= 0) {
570
+ localVarHeaderParams.Accept = "application/json";
571
+ }
572
+ else {
573
+ localVarHeaderParams.Accept = produces.join(",");
574
+ }
575
+ let localVarFormParams = {};
576
+ // verify required parameter 'id' is not null or undefined
577
+ if (id === null || id === undefined) {
578
+ throw new Error("Required parameter id was null or undefined when calling updateAllowFunction.");
579
+ }
580
+ // verify required parameter 'type' is not null or undefined
581
+ if (type === null || type === undefined) {
582
+ throw new Error("Required parameter type was null or undefined when calling updateAllowFunction.");
583
+ }
584
+ // verify required parameter 'policy' is not null or undefined
585
+ if (policy === null || policy === undefined) {
586
+ throw new Error("Required parameter policy was null or undefined when calling updateAllowFunction.");
587
+ }
588
+ Object.assign(localVarHeaderParams, options.headers);
589
+ let localVarUseFormData = false;
590
+ if (type !== undefined) {
591
+ localVarFormParams["type"] = models_1.ObjectSerializer.serialize(type, "string");
592
+ }
593
+ if (functionName !== undefined) {
594
+ localVarFormParams["function_name"] = models_1.ObjectSerializer.serialize(functionName, "string");
595
+ }
596
+ if (policy !== undefined) {
597
+ localVarFormParams["policy"] = models_1.ObjectSerializer.serialize(policy, "string");
598
+ }
599
+ if (project !== undefined) {
600
+ localVarFormParams["project"] = models_1.ObjectSerializer.serialize(project, "string");
601
+ }
602
+ if (contract !== undefined) {
603
+ localVarFormParams["contract"] = models_1.ObjectSerializer.serialize(contract, "string");
604
+ }
605
+ let localVarRequestOptions = {
606
+ method: "POST",
607
+ qs: localVarQueryParameters,
608
+ headers: localVarHeaderParams,
609
+ uri: localVarPath,
610
+ useQuerystring: this._useQuerystring,
611
+ json: true,
612
+ };
613
+ let authenticationPromise = Promise.resolve();
614
+ if (this.authentications.pk.accessToken) {
615
+ authenticationPromise = authenticationPromise.then(() => this.authentications.pk.applyToRequest(localVarRequestOptions));
616
+ }
617
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
618
+ let interceptorPromise = authenticationPromise;
619
+ for (const interceptor of this.interceptors) {
620
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
621
+ }
622
+ return interceptorPromise.then(() => {
623
+ if (Object.keys(localVarFormParams).length) {
624
+ if (localVarUseFormData) {
625
+ localVarRequestOptions.formData = localVarFormParams;
626
+ }
627
+ else {
628
+ localVarRequestOptions.form = localVarFormParams;
629
+ }
630
+ }
631
+ return new Promise((resolve, reject) => {
632
+ (0, request_1.default)(localVarRequestOptions, (error, response, body) => {
633
+ if (error) {
634
+ reject(error);
635
+ }
636
+ else {
637
+ if (response.statusCode &&
638
+ response.statusCode >= 200 &&
639
+ response.statusCode <= 299) {
640
+ body = models_1.ObjectSerializer.deserialize(body, "AllowFunctionResponse");
641
+ resolve({ response: response, body: body });
642
+ }
643
+ else {
644
+ reject(new apis_1.HttpError(response, body, response.statusCode));
645
+ }
646
+ }
647
+ });
648
+ });
649
+ });
650
+ }
651
+ }
652
+ exports.DefaultApi = DefaultApi;
653
+ //# sourceMappingURL=defaultApi.js.map