@morabr/mora-sdk 1.0.0
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 +32 -0
- package/dist/cjs/api/api.js +491 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/interfaces.js +2 -0
- package/dist/cjs/sdk.js +353 -0
- package/dist/esm/api/api.js +485 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/interfaces.js +1 -0
- package/dist/esm/sdk.js +324 -0
- package/dist/types/api/api.d.ts +925 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/interfaces.d.ts +22 -0
- package/dist/types/sdk.d.ts +45 -0
- package/dist/umd/index.ts +28464 -0
- package/package.json +106 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Mora SDK
|
|
2
|
+
## Installation
|
|
3
|
+
|
|
4
|
+
Install the package with npm
|
|
5
|
+
```
|
|
6
|
+
npm i @morabr/mora-sdk --save
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Use the package in the project
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
import 'dotenv/config'
|
|
13
|
+
import { MoraSDK } from '@morabr/mora-sdk'
|
|
14
|
+
|
|
15
|
+
async function main() {
|
|
16
|
+
const sdk = new MoraSDK({
|
|
17
|
+
baseURL: 'http://localhost:3000',
|
|
18
|
+
autoRefresh: true
|
|
19
|
+
});
|
|
20
|
+
await sdk.authenticate({ email: 'example@example.com', password: 'P@ssw0rd' })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
main().then(() => {
|
|
24
|
+
console.log('script running with success')
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Generate Api from Swagger
|
|
31
|
+
|
|
32
|
+
`SWAGGER_JSON_PATH=http://localhost:3000/docs-json npm run gen:api`
|
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
/*
|
|
6
|
+
* ---------------------------------------------------------------
|
|
7
|
+
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
|
|
8
|
+
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
|
|
9
|
+
* ---------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
var __extends = (this && this.__extends) || (function () {
|
|
12
|
+
var extendStatics = function (d, b) {
|
|
13
|
+
extendStatics = Object.setPrototypeOf ||
|
|
14
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
15
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
16
|
+
return extendStatics(d, b);
|
|
17
|
+
};
|
|
18
|
+
return function (d, b) {
|
|
19
|
+
if (typeof b !== "function" && b !== null)
|
|
20
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
21
|
+
extendStatics(d, b);
|
|
22
|
+
function __() { this.constructor = d; }
|
|
23
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
var __assign = (this && this.__assign) || function () {
|
|
27
|
+
__assign = Object.assign || function(t) {
|
|
28
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
29
|
+
s = arguments[i];
|
|
30
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
31
|
+
t[p] = s[p];
|
|
32
|
+
}
|
|
33
|
+
return t;
|
|
34
|
+
};
|
|
35
|
+
return __assign.apply(this, arguments);
|
|
36
|
+
};
|
|
37
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
38
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
41
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
42
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
43
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
47
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
48
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
49
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
50
|
+
function step(op) {
|
|
51
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
52
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
53
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
54
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
55
|
+
switch (op[0]) {
|
|
56
|
+
case 0: case 1: t = op; break;
|
|
57
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
58
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
59
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
60
|
+
default:
|
|
61
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
62
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
63
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
64
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
65
|
+
if (t[2]) _.ops.pop();
|
|
66
|
+
_.trys.pop(); continue;
|
|
67
|
+
}
|
|
68
|
+
op = body.call(thisArg, _);
|
|
69
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
70
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
74
|
+
var t = {};
|
|
75
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
76
|
+
t[p] = s[p];
|
|
77
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
78
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
79
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
80
|
+
t[p[i]] = s[p[i]];
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
83
|
+
};
|
|
84
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
85
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
86
|
+
};
|
|
87
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
88
|
+
exports.Api = exports.HttpClient = exports.ContentType = exports.WithdrawalAccountTypeEnum = exports.TenantUserStatusEnum = exports.TenantRoleEnum = exports.PaymentMethodEnum = exports.OrderByEnum = exports.ChargeStatusEnum = void 0;
|
|
89
|
+
var ChargeStatusEnum;
|
|
90
|
+
(function (ChargeStatusEnum) {
|
|
91
|
+
ChargeStatusEnum["Pending"] = "pending";
|
|
92
|
+
ChargeStatusEnum["Processing"] = "processing";
|
|
93
|
+
ChargeStatusEnum["Paid"] = "paid";
|
|
94
|
+
})(ChargeStatusEnum = exports.ChargeStatusEnum || (exports.ChargeStatusEnum = {}));
|
|
95
|
+
var OrderByEnum;
|
|
96
|
+
(function (OrderByEnum) {
|
|
97
|
+
OrderByEnum["ASC"] = "ASC";
|
|
98
|
+
OrderByEnum["DESC"] = "DESC";
|
|
99
|
+
})(OrderByEnum = exports.OrderByEnum || (exports.OrderByEnum = {}));
|
|
100
|
+
var PaymentMethodEnum;
|
|
101
|
+
(function (PaymentMethodEnum) {
|
|
102
|
+
PaymentMethodEnum["Pix"] = "pix";
|
|
103
|
+
PaymentMethodEnum["CreditCard"] = "credit_card";
|
|
104
|
+
})(PaymentMethodEnum = exports.PaymentMethodEnum || (exports.PaymentMethodEnum = {}));
|
|
105
|
+
var TenantRoleEnum;
|
|
106
|
+
(function (TenantRoleEnum) {
|
|
107
|
+
TenantRoleEnum["Operator"] = "operator";
|
|
108
|
+
TenantRoleEnum["Admin"] = "admin";
|
|
109
|
+
TenantRoleEnum["Owner"] = "owner";
|
|
110
|
+
TenantRoleEnum["Receiver"] = "receiver";
|
|
111
|
+
})(TenantRoleEnum = exports.TenantRoleEnum || (exports.TenantRoleEnum = {}));
|
|
112
|
+
var TenantUserStatusEnum;
|
|
113
|
+
(function (TenantUserStatusEnum) {
|
|
114
|
+
TenantUserStatusEnum["Enabled"] = "enabled";
|
|
115
|
+
TenantUserStatusEnum["Blocked"] = "blocked";
|
|
116
|
+
})(TenantUserStatusEnum = exports.TenantUserStatusEnum || (exports.TenantUserStatusEnum = {}));
|
|
117
|
+
var WithdrawalAccountTypeEnum;
|
|
118
|
+
(function (WithdrawalAccountTypeEnum) {
|
|
119
|
+
WithdrawalAccountTypeEnum["Pix"] = "pix";
|
|
120
|
+
})(WithdrawalAccountTypeEnum = exports.WithdrawalAccountTypeEnum || (exports.WithdrawalAccountTypeEnum = {}));
|
|
121
|
+
var axios_1 = __importDefault(require("axios"));
|
|
122
|
+
var ContentType;
|
|
123
|
+
(function (ContentType) {
|
|
124
|
+
ContentType["Json"] = "application/json";
|
|
125
|
+
ContentType["JsonApi"] = "application/vnd.api+json";
|
|
126
|
+
ContentType["FormData"] = "multipart/form-data";
|
|
127
|
+
ContentType["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
128
|
+
ContentType["Text"] = "text/plain";
|
|
129
|
+
})(ContentType = exports.ContentType || (exports.ContentType = {}));
|
|
130
|
+
var HttpClient = /** @class */ (function () {
|
|
131
|
+
function HttpClient(_a) {
|
|
132
|
+
if (_a === void 0) { _a = {}; }
|
|
133
|
+
var _this = this;
|
|
134
|
+
var securityWorker = _a.securityWorker, secure = _a.secure, format = _a.format, axiosConfig = __rest(_a, ["securityWorker", "secure", "format"]);
|
|
135
|
+
this.securityData = null;
|
|
136
|
+
this.setSecurityData = function (data) {
|
|
137
|
+
_this.securityData = data;
|
|
138
|
+
};
|
|
139
|
+
this.request = function (_a) { return __awaiter(_this, void 0, void 0, function () {
|
|
140
|
+
var secureParams, _b, requestParams, responseFormat;
|
|
141
|
+
var secure = _a.secure, path = _a.path, type = _a.type, query = _a.query, format = _a.format, body = _a.body, params = __rest(_a, ["secure", "path", "type", "query", "format", "body"]);
|
|
142
|
+
return __generator(this, function (_c) {
|
|
143
|
+
switch (_c.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
_b = (typeof secure === "boolean" ? secure : this.secure) &&
|
|
146
|
+
this.securityWorker;
|
|
147
|
+
if (!_b) return [3 /*break*/, 2];
|
|
148
|
+
return [4 /*yield*/, this.securityWorker(this.securityData)];
|
|
149
|
+
case 1:
|
|
150
|
+
_b = (_c.sent());
|
|
151
|
+
_c.label = 2;
|
|
152
|
+
case 2:
|
|
153
|
+
secureParams = (_b) ||
|
|
154
|
+
{};
|
|
155
|
+
requestParams = this.mergeRequestParams(params, secureParams);
|
|
156
|
+
responseFormat = format || this.format || undefined;
|
|
157
|
+
if (type === ContentType.FormData &&
|
|
158
|
+
body &&
|
|
159
|
+
body !== null &&
|
|
160
|
+
typeof body === "object") {
|
|
161
|
+
body = this.createFormData(body);
|
|
162
|
+
}
|
|
163
|
+
if (type === ContentType.Text &&
|
|
164
|
+
body &&
|
|
165
|
+
body !== null &&
|
|
166
|
+
typeof body !== "string") {
|
|
167
|
+
body = JSON.stringify(body);
|
|
168
|
+
}
|
|
169
|
+
return [2 /*return*/, this.instance
|
|
170
|
+
.request(__assign(__assign({}, requestParams), { headers: __assign(__assign({}, (requestParams.headers || {})), (type ? { "Content-Type": type } : {})), params: query, responseType: responseFormat, data: body, url: path }))
|
|
171
|
+
.then(function (response) { return response.data; })];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}); };
|
|
175
|
+
this.instance = axios_1.default.create(__assign(__assign({}, axiosConfig), { baseURL: axiosConfig.baseURL || "http://localhost:3000" }));
|
|
176
|
+
this.secure = secure;
|
|
177
|
+
this.format = format;
|
|
178
|
+
this.securityWorker = securityWorker;
|
|
179
|
+
}
|
|
180
|
+
HttpClient.prototype.mergeRequestParams = function (params1, params2) {
|
|
181
|
+
var method = params1.method || (params2 && params2.method);
|
|
182
|
+
return __assign(__assign(__assign(__assign({}, this.instance.defaults), params1), (params2 || {})), { headers: __assign(__assign(__assign({}, ((method &&
|
|
183
|
+
this.instance.defaults.headers[method.toLowerCase()]) ||
|
|
184
|
+
{})), (params1.headers || {})), ((params2 && params2.headers) || {})) });
|
|
185
|
+
};
|
|
186
|
+
HttpClient.prototype.stringifyFormItem = function (formItem) {
|
|
187
|
+
if (typeof formItem === "object" && formItem !== null) {
|
|
188
|
+
return JSON.stringify(formItem);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
return "".concat(formItem);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
HttpClient.prototype.createFormData = function (input) {
|
|
195
|
+
var _this = this;
|
|
196
|
+
if (input instanceof FormData) {
|
|
197
|
+
return input;
|
|
198
|
+
}
|
|
199
|
+
return Object.keys(input || {}).reduce(function (formData, key) {
|
|
200
|
+
var property = input[key];
|
|
201
|
+
var propertyContent = property instanceof Array ? property : [property];
|
|
202
|
+
for (var _i = 0, propertyContent_1 = propertyContent; _i < propertyContent_1.length; _i++) {
|
|
203
|
+
var formItem = propertyContent_1[_i];
|
|
204
|
+
var isFileType = formItem instanceof Blob || formItem instanceof File;
|
|
205
|
+
formData.append(key, isFileType ? formItem : _this.stringifyFormItem(formItem));
|
|
206
|
+
}
|
|
207
|
+
return formData;
|
|
208
|
+
}, new FormData());
|
|
209
|
+
};
|
|
210
|
+
return HttpClient;
|
|
211
|
+
}());
|
|
212
|
+
exports.HttpClient = HttpClient;
|
|
213
|
+
/**
|
|
214
|
+
* @title mora-backend
|
|
215
|
+
* @version 0.0.1
|
|
216
|
+
* @baseUrl http://localhost:3000
|
|
217
|
+
* @contact
|
|
218
|
+
*/
|
|
219
|
+
var Api = /** @class */ (function (_super) {
|
|
220
|
+
__extends(Api, _super);
|
|
221
|
+
function Api() {
|
|
222
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
223
|
+
/**
|
|
224
|
+
* No description
|
|
225
|
+
*
|
|
226
|
+
* @tags App
|
|
227
|
+
* @name Index
|
|
228
|
+
* @request GET:/
|
|
229
|
+
* @response `200` `void`
|
|
230
|
+
*/
|
|
231
|
+
_this.index = function (params) {
|
|
232
|
+
if (params === void 0) { params = {}; }
|
|
233
|
+
return _this.request(__assign({ path: "/", method: "GET" }, params));
|
|
234
|
+
};
|
|
235
|
+
_this.webhooks = {
|
|
236
|
+
/**
|
|
237
|
+
* @description Receives ASAAS events webhooks to validate and sync states
|
|
238
|
+
*
|
|
239
|
+
* @tags Integration Webhooks
|
|
240
|
+
* @name ReceiveAsaasEventWebhook
|
|
241
|
+
* @request POST:/webhooks/asaas/events
|
|
242
|
+
* @secure
|
|
243
|
+
* @response `200` `void`
|
|
244
|
+
* @response `403` `void` Invalid ASAAS access token
|
|
245
|
+
*/
|
|
246
|
+
receiveAsaasEventWebhook: function (data, params) {
|
|
247
|
+
if (params === void 0) { params = {}; }
|
|
248
|
+
return _this.request(__assign({ path: "/webhooks/asaas/events", method: "POST", body: data, secure: true, type: ContentType.Json }, params));
|
|
249
|
+
},
|
|
250
|
+
/**
|
|
251
|
+
* @description Receives ASAAS webhooks to validate withdraws on receiver account
|
|
252
|
+
*
|
|
253
|
+
* @tags Integration Webhooks
|
|
254
|
+
* @name ReceiveAsaasWithdrawValidationWebhook
|
|
255
|
+
* @request POST:/webhooks/asaas/withdraw-validation
|
|
256
|
+
* @secure
|
|
257
|
+
* @response `200` `void`
|
|
258
|
+
* @response `403` `void` Invalid ASAAS access token
|
|
259
|
+
*/
|
|
260
|
+
receiveAsaasWithdrawValidationWebhook: function (data, params) {
|
|
261
|
+
if (params === void 0) { params = {}; }
|
|
262
|
+
return _this.request(__assign({ path: "/webhooks/asaas/withdraw-validation", method: "POST", body: data, secure: true, type: ContentType.Json }, params));
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
_this.tenants = {
|
|
266
|
+
/**
|
|
267
|
+
* No description
|
|
268
|
+
*
|
|
269
|
+
* @tags Users Withdrawal Accounts
|
|
270
|
+
* @name AddUserWithdrawalAccount
|
|
271
|
+
* @request POST:/tenants/{tenantId}/users/{userId}/withdrawal-accounts
|
|
272
|
+
* @secure
|
|
273
|
+
* @response `201` `WithdrawalAccountEntityDto`
|
|
274
|
+
* @response `403` `HttpExceptionDto` You're not enabled to make this operation.
|
|
275
|
+
*/
|
|
276
|
+
addUserWithdrawalAccount: function (tenantId, userId, data, params) {
|
|
277
|
+
if (params === void 0) { params = {}; }
|
|
278
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users/").concat(userId, "/withdrawal-accounts"), method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params));
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* No description
|
|
282
|
+
*
|
|
283
|
+
* @tags Users Withdrawal Accounts
|
|
284
|
+
* @name DeleteUserWithdrawalAccount
|
|
285
|
+
* @request DELETE:/tenants/{tenantId}/users/{userId}/withdrawal-accounts/{accountId}
|
|
286
|
+
* @secure
|
|
287
|
+
* @response `204` `void`
|
|
288
|
+
* @response `403` `HttpExceptionDto` You're not enabled to make this operation.
|
|
289
|
+
*/
|
|
290
|
+
deleteUserWithdrawalAccount: function (tenantId, userId, accountId, params) {
|
|
291
|
+
if (params === void 0) { params = {}; }
|
|
292
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users/").concat(userId, "/withdrawal-accounts/").concat(accountId), method: "DELETE", secure: true }, params));
|
|
293
|
+
},
|
|
294
|
+
/**
|
|
295
|
+
* No description
|
|
296
|
+
*
|
|
297
|
+
* @tags Tenant Users
|
|
298
|
+
* @name DisableTenantUser
|
|
299
|
+
* @request PATCH:/tenants/{tenantId}/users/{userId}/disable
|
|
300
|
+
* @secure
|
|
301
|
+
* @response `204` `void`
|
|
302
|
+
* @response `403` `HttpExceptionDto` Need user with one of these roles: owner
|
|
303
|
+
*/
|
|
304
|
+
disableTenantUser: function (tenantId, userId, params) {
|
|
305
|
+
if (params === void 0) { params = {}; }
|
|
306
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users/").concat(userId, "/disable"), method: "PATCH", secure: true }, params));
|
|
307
|
+
},
|
|
308
|
+
/**
|
|
309
|
+
* No description
|
|
310
|
+
*
|
|
311
|
+
* @tags Tenant Users
|
|
312
|
+
* @name EnableTenantUser
|
|
313
|
+
* @request PATCH:/tenants/{tenantId}/users/{userId}/enable
|
|
314
|
+
* @secure
|
|
315
|
+
* @response `204` `void`
|
|
316
|
+
* @response `403` `HttpExceptionDto` Need user with one of these roles: owner
|
|
317
|
+
*/
|
|
318
|
+
enableTenantUser: function (tenantId, userId, params) {
|
|
319
|
+
if (params === void 0) { params = {}; }
|
|
320
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users/").concat(userId, "/enable"), method: "PATCH", secure: true }, params));
|
|
321
|
+
},
|
|
322
|
+
/**
|
|
323
|
+
* No description
|
|
324
|
+
*
|
|
325
|
+
* @tags Tenant Users
|
|
326
|
+
* @name GetTenantUser
|
|
327
|
+
* @request GET:/tenants/{tenantId}/users/{userId}
|
|
328
|
+
* @secure
|
|
329
|
+
* @response `200` `UserEntityDto`
|
|
330
|
+
* @response `403` `HttpExceptionDto` You're not enabled to make this operation.
|
|
331
|
+
*/
|
|
332
|
+
getTenantUser: function (tenantId, userId, params) {
|
|
333
|
+
if (params === void 0) { params = {}; }
|
|
334
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users/").concat(userId), method: "GET", secure: true, format: "json" }, params));
|
|
335
|
+
},
|
|
336
|
+
/**
|
|
337
|
+
* No description
|
|
338
|
+
*
|
|
339
|
+
* @tags Users Withdrawal Accounts
|
|
340
|
+
* @name GetUserWithdrawalAccountById
|
|
341
|
+
* @request GET:/tenants/{tenantId}/users/{userId}/withdrawal-accounts/{accountId}
|
|
342
|
+
* @secure
|
|
343
|
+
* @response `200` `WithdrawalAccountEntityDto`
|
|
344
|
+
* @response `403` `HttpExceptionDto` You're not enabled to make this operation.
|
|
345
|
+
*/
|
|
346
|
+
getUserWithdrawalAccountById: function (tenantId, userId, accountId, params) {
|
|
347
|
+
if (params === void 0) { params = {}; }
|
|
348
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users/").concat(userId, "/withdrawal-accounts/").concat(accountId), method: "GET", secure: true, format: "json" }, params));
|
|
349
|
+
},
|
|
350
|
+
/**
|
|
351
|
+
* No description
|
|
352
|
+
*
|
|
353
|
+
* @tags Tenant Users
|
|
354
|
+
* @name ListTenantUsers
|
|
355
|
+
* @request GET:/tenants/{tenantId}/users
|
|
356
|
+
* @secure
|
|
357
|
+
* @response `200` `UserEntityPaginatedDto`
|
|
358
|
+
* @response `403` `HttpExceptionDto` Need user with one of these roles: owner, admin, operator
|
|
359
|
+
*/
|
|
360
|
+
listTenantUsers: function (tenantId, query, params) {
|
|
361
|
+
if (params === void 0) { params = {}; }
|
|
362
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users"), method: "GET", query: query, secure: true, format: "json" }, params));
|
|
363
|
+
},
|
|
364
|
+
/**
|
|
365
|
+
* No description
|
|
366
|
+
*
|
|
367
|
+
* @tags Users Withdrawal Accounts
|
|
368
|
+
* @name ListUserWithdrawalAccounts
|
|
369
|
+
* @request GET:/tenants/{tenantId}/users/{userId}/withdrawal-accounts
|
|
370
|
+
* @secure
|
|
371
|
+
* @response `200` `WithdrawalAccountEntityPaginatedDto`
|
|
372
|
+
* @response `403` `HttpExceptionDto` You're not enabled to make this operation.
|
|
373
|
+
*/
|
|
374
|
+
listUserWithdrawalAccounts: function (tenantId, userId, query, params) {
|
|
375
|
+
if (params === void 0) { params = {}; }
|
|
376
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/users/").concat(userId, "/withdrawal-accounts"), method: "GET", query: query, secure: true, format: "json" }, params));
|
|
377
|
+
},
|
|
378
|
+
/**
|
|
379
|
+
* No description
|
|
380
|
+
*
|
|
381
|
+
* @tags Integration Webhooks
|
|
382
|
+
* @name ReceiveStatusCallback
|
|
383
|
+
* @request POST:/tenants/{tenantId}/webhooks/twilio/message-status
|
|
384
|
+
* @secure
|
|
385
|
+
* @response `200` `void`
|
|
386
|
+
*/
|
|
387
|
+
receiveStatusCallback: function (tenantId, data, params) {
|
|
388
|
+
if (params === void 0) { params = {}; }
|
|
389
|
+
return _this.request(__assign({ path: "/tenants/".concat(tenantId, "/webhooks/twilio/message-status"), method: "POST", body: data, secure: true, type: ContentType.Json }, params));
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
_this.public = {
|
|
393
|
+
/**
|
|
394
|
+
* No description
|
|
395
|
+
*
|
|
396
|
+
* @tags [Public] Tenant Charges
|
|
397
|
+
* @name GetPublicChargeById
|
|
398
|
+
* @request GET:/public/tenants/{tenantId}/charges/{document}/{chargeId}
|
|
399
|
+
* @secure
|
|
400
|
+
* @response `200` `PublicFullChargeEntityDto`
|
|
401
|
+
*/
|
|
402
|
+
getPublicChargeById: function (tenantId, document, chargeId, params) {
|
|
403
|
+
if (params === void 0) { params = {}; }
|
|
404
|
+
return _this.request(__assign({ path: "/public/tenants/".concat(tenantId, "/charges/").concat(document, "/").concat(chargeId), method: "GET", secure: true, format: "json" }, params));
|
|
405
|
+
},
|
|
406
|
+
/**
|
|
407
|
+
* No description
|
|
408
|
+
*
|
|
409
|
+
* @tags [Public] Tenant Charges
|
|
410
|
+
* @name ListPublicChargesByDocument
|
|
411
|
+
* @request GET:/public/tenants/{tenantId}/charges/{document}
|
|
412
|
+
* @secure
|
|
413
|
+
* @response `200` `PublicChargeEntityPaginatedDto`
|
|
414
|
+
*/
|
|
415
|
+
listPublicChargesByDocument: function (tenantId, document, query, params) {
|
|
416
|
+
if (params === void 0) { params = {}; }
|
|
417
|
+
return _this.request(__assign({ path: "/public/tenants/".concat(tenantId, "/charges/").concat(document), method: "GET", query: query, secure: true, format: "json" }, params));
|
|
418
|
+
},
|
|
419
|
+
/**
|
|
420
|
+
* No description
|
|
421
|
+
*
|
|
422
|
+
* @tags [Public] Tenant Charges
|
|
423
|
+
* @name PayCharge
|
|
424
|
+
* @request POST:/public/tenants/{tenantId}/charges/{document}/{chargeId}/pay
|
|
425
|
+
* @secure
|
|
426
|
+
* @response `200` `PublicFullChargeEntityDto`
|
|
427
|
+
*/
|
|
428
|
+
payCharge: function (tenantId, document, chargeId, data, params) {
|
|
429
|
+
if (params === void 0) { params = {}; }
|
|
430
|
+
return _this.request(__assign({ path: "/public/tenants/".concat(tenantId, "/charges/").concat(document, "/").concat(chargeId, "/pay"), method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params));
|
|
431
|
+
},
|
|
432
|
+
};
|
|
433
|
+
_this.auth = {
|
|
434
|
+
/**
|
|
435
|
+
* No description
|
|
436
|
+
*
|
|
437
|
+
* @tags Authentication
|
|
438
|
+
* @name Logout
|
|
439
|
+
* @request POST:/auth/logout
|
|
440
|
+
* @secure
|
|
441
|
+
* @response `204` `void`
|
|
442
|
+
*/
|
|
443
|
+
logout: function (params) {
|
|
444
|
+
if (params === void 0) { params = {}; }
|
|
445
|
+
return _this.request(__assign({ path: "/auth/logout", method: "POST", secure: true }, params));
|
|
446
|
+
},
|
|
447
|
+
/**
|
|
448
|
+
* No description
|
|
449
|
+
*
|
|
450
|
+
* @tags Authentication
|
|
451
|
+
* @name RequestPasswordReset
|
|
452
|
+
* @request POST:/auth/request-password-reset
|
|
453
|
+
* @secure
|
|
454
|
+
* @response `204` `void`
|
|
455
|
+
*/
|
|
456
|
+
requestPasswordReset: function (data, params) {
|
|
457
|
+
if (params === void 0) { params = {}; }
|
|
458
|
+
return _this.request(__assign({ path: "/auth/request-password-reset", method: "POST", body: data, secure: true, type: ContentType.Json }, params));
|
|
459
|
+
},
|
|
460
|
+
/**
|
|
461
|
+
* No description
|
|
462
|
+
*
|
|
463
|
+
* @tags Authentication
|
|
464
|
+
* @name ResetPassword
|
|
465
|
+
* @request PATCH:/auth/reset-password
|
|
466
|
+
* @secure
|
|
467
|
+
* @response `200` `SigninResponseDto`
|
|
468
|
+
*/
|
|
469
|
+
resetPassword: function (data, params) {
|
|
470
|
+
if (params === void 0) { params = {}; }
|
|
471
|
+
return _this.request(__assign({ path: "/auth/reset-password", method: "PATCH", body: data, secure: true, type: ContentType.Json, format: "json" }, params));
|
|
472
|
+
},
|
|
473
|
+
/**
|
|
474
|
+
* No description
|
|
475
|
+
*
|
|
476
|
+
* @tags Authentication
|
|
477
|
+
* @name SignIn
|
|
478
|
+
* @request POST:/auth/signin
|
|
479
|
+
* @secure
|
|
480
|
+
* @response `200` `SigninResponseDto`
|
|
481
|
+
*/
|
|
482
|
+
signIn: function (data, params) {
|
|
483
|
+
if (params === void 0) { params = {}; }
|
|
484
|
+
return _this.request(__assign({ path: "/auth/signin", method: "POST", body: data, secure: true, type: ContentType.Json, format: "json" }, params));
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
return _this;
|
|
488
|
+
}
|
|
489
|
+
return Api;
|
|
490
|
+
}(HttpClient));
|
|
491
|
+
exports.Api = Api;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MoraSDK = void 0;
|
|
18
|
+
var sdk_1 = require("./sdk");
|
|
19
|
+
Object.defineProperty(exports, "MoraSDK", { enumerable: true, get: function () { return sdk_1.MoraSDK; } });
|
|
20
|
+
__exportStar(require("./api/api"), exports);
|
|
21
|
+
__exportStar(require("./interfaces"), exports);
|