starta.apiclient 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/lib/factory.d.ts +4 -0
- package/lib/factory.js +8 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +7 -0
- package/lib/request.d.ts +3 -0
- package/lib/request.js +60 -0
- package/lib/services/_helpers.d.ts +1 -0
- package/lib/services/_helpers.js +26 -0
- package/lib/services/accounts.d.ts +61 -0
- package/lib/services/accounts.js +163 -0
- package/lib/services/emailConfirmations.d.ts +7 -0
- package/lib/services/emailConfirmations.js +24 -0
- package/lib/services/healthcheck.d.ts +6 -0
- package/lib/services/healthcheck.js +15 -0
- package/lib/services/index.d.ts +21 -0
- package/lib/services/index.js +73 -0
- package/lib/services/organizations/customers.d.ts +47 -0
- package/lib/services/organizations/customers.js +87 -0
- package/lib/services/organizations/dashboard.d.ts +11 -0
- package/lib/services/organizations/dashboard.js +28 -0
- package/lib/services/organizations/index.d.ts +74 -0
- package/lib/services/organizations/index.js +222 -0
- package/lib/services/organizations/integrations.d.ts +10 -0
- package/lib/services/organizations/integrations.js +17 -0
- package/lib/services/organizations/members.d.ts +6 -0
- package/lib/services/organizations/members.js +16 -0
- package/lib/services/organizations/orders.d.ts +45 -0
- package/lib/services/organizations/orders.js +74 -0
- package/lib/services/organizations/payments.d.ts +16 -0
- package/lib/services/organizations/payments.js +33 -0
- package/lib/services/organizations/public.d.ts +14 -0
- package/lib/services/organizations/public.js +41 -0
- package/lib/services/organizations/rooms.d.ts +17 -0
- package/lib/services/organizations/rooms.js +45 -0
- package/lib/services/organizations/seminars.d.ts +38 -0
- package/lib/services/organizations/seminars.js +67 -0
- package/lib/services/organizations/services.d.ts +22 -0
- package/lib/services/organizations/services.js +31 -0
- package/lib/services/passwordResets.d.ts +15 -0
- package/lib/services/passwordResets.js +25 -0
- package/lib/services/sessions.d.ts +17 -0
- package/lib/services/sessions.js +37 -0
- package/lib/services/system.d.ts +6 -0
- package/lib/services/system.js +20 -0
- package/lib/services/webhooks.d.ts +6 -0
- package/lib/services/webhooks.js +21 -0
- package/lib/types.d.ts +25 -0
- package/lib/types.js +2 -0
- package/package.json +26 -0
package/lib/factory.d.ts
ADDED
package/lib/factory.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var request_1 = require("./request");
|
|
4
|
+
var services_1 = require("./services");
|
|
5
|
+
exports.default = (function (apiUrl, middlewares) {
|
|
6
|
+
if (middlewares === void 0) { middlewares = {}; }
|
|
7
|
+
return new services_1.default((0, request_1.requestFactory)(apiUrl, middlewares));
|
|
8
|
+
});
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import factory from './factory';
|
|
2
|
+
import StartaApiClient from './services';
|
|
3
|
+
import { StartaRequest, StartaRequestConfig, StartaRequestData, StartaRequestMiddlewares, StartaResponse } from './types';
|
|
4
|
+
export default factory;
|
|
5
|
+
export { StartaApiClient, StartaRequest, StartaRequestConfig, StartaRequestData, StartaRequestMiddlewares, StartaResponse };
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StartaApiClient = void 0;
|
|
4
|
+
var factory_1 = require("./factory");
|
|
5
|
+
var services_1 = require("./services");
|
|
6
|
+
exports.StartaApiClient = services_1.default;
|
|
7
|
+
exports.default = factory_1.default;
|
package/lib/request.d.ts
ADDED
package/lib/request.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.requestFactory = void 0;
|
|
15
|
+
var axios_1 = require("axios");
|
|
16
|
+
function onSuccess(response) {
|
|
17
|
+
return {
|
|
18
|
+
httpResponse: response,
|
|
19
|
+
success: true,
|
|
20
|
+
data: response.data,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
var onErrorFactory = function (middlewares) { return function (error) {
|
|
24
|
+
var _a, _b, _c;
|
|
25
|
+
var result = {
|
|
26
|
+
httpResponse: error.response,
|
|
27
|
+
success: false,
|
|
28
|
+
data: (_a = error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
29
|
+
axiosError: error,
|
|
30
|
+
};
|
|
31
|
+
if ((middlewares === null || middlewares === void 0 ? void 0 : middlewares.onForbidden) && ((_b = result.httpResponse) === null || _b === void 0 ? void 0 : _b.status) === 403) {
|
|
32
|
+
middlewares === null || middlewares === void 0 ? void 0 : middlewares.onForbidden(result);
|
|
33
|
+
}
|
|
34
|
+
else if ((middlewares === null || middlewares === void 0 ? void 0 : middlewares.onUnauthorized) && ((_c = result.httpResponse) === null || _c === void 0 ? void 0 : _c.status) === 401) {
|
|
35
|
+
middlewares === null || middlewares === void 0 ? void 0 : middlewares.onUnauthorized(result);
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}; };
|
|
39
|
+
var requestFactory = function (baseURL, middlewares) {
|
|
40
|
+
return function (_a) {
|
|
41
|
+
var url = _a.url, method = _a.method, urlParams = _a.urlParams, body = _a.body, _b = _a.config, config = _b === void 0 ? {} : _b;
|
|
42
|
+
if (!config.headers) {
|
|
43
|
+
config.headers = {};
|
|
44
|
+
}
|
|
45
|
+
var cookie = (middlewares === null || middlewares === void 0 ? void 0 : middlewares.cookieFactory) && (middlewares === null || middlewares === void 0 ? void 0 : middlewares.cookieFactory());
|
|
46
|
+
if (cookie) {
|
|
47
|
+
config.headers.Cookie = cookie;
|
|
48
|
+
}
|
|
49
|
+
var requestConfig = __assign({ baseURL: config.rewriteBaseUrl ? config.rewriteBaseUrl(baseURL) : baseURL, method: method, params: urlParams, data: body, withCredentials: true }, config);
|
|
50
|
+
(middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger) && (middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger("Sending request to: ".concat(url, " with config:"), requestConfig));
|
|
51
|
+
return (0, axios_1.default)(url, requestConfig)
|
|
52
|
+
.then(onSuccess, onErrorFactory(middlewares))
|
|
53
|
+
.then(function (_a) {
|
|
54
|
+
var success = _a.success, data = _a.data, httpResponse = _a.httpResponse;
|
|
55
|
+
(middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger) && (middlewares === null || middlewares === void 0 ? void 0 : middlewares.logger('received result', { success: success, data: data }));
|
|
56
|
+
return { success: success, data: data, httpResponse: httpResponse };
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
exports.requestFactory = requestFactory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildQuery: (query: object, prefix?: string) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildQuery = void 0;
|
|
4
|
+
var buildQuery = function (query, prefix) {
|
|
5
|
+
if (prefix === void 0) { prefix = ''; }
|
|
6
|
+
var resultString = objectToQueryString(query, prefix);
|
|
7
|
+
if (resultString) {
|
|
8
|
+
return resultString.replace('&', '?');
|
|
9
|
+
}
|
|
10
|
+
return resultString;
|
|
11
|
+
};
|
|
12
|
+
exports.buildQuery = buildQuery;
|
|
13
|
+
var objectToQueryString = function (query, prefix) {
|
|
14
|
+
return Object.keys(query).reduce(function (result, key) {
|
|
15
|
+
var value = query[key];
|
|
16
|
+
if (value !== null && value !== undefined) {
|
|
17
|
+
if (typeof value === 'object') {
|
|
18
|
+
result += objectToQueryString(value, "".concat(prefix).concat(key, "."));
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
result += "&".concat(prefix).concat(key, "=").concat(encodeURIComponent(value));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}, '');
|
|
26
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { StartaRequest } from '../types';
|
|
2
|
+
export default class Accounts {
|
|
3
|
+
private _request;
|
|
4
|
+
constructor(request: StartaRequest);
|
|
5
|
+
update(login: string, { phone, firstName, lastName, timeZone }: {
|
|
6
|
+
phone: any;
|
|
7
|
+
firstName: any;
|
|
8
|
+
lastName: any;
|
|
9
|
+
timeZone: any;
|
|
10
|
+
}): Promise<import("../types").StartaResponse>;
|
|
11
|
+
getMainData(login: string): Promise<import("../types").StartaResponse>;
|
|
12
|
+
serviceProviders(login: string): Promise<import("../types").StartaResponse>;
|
|
13
|
+
createViaSocialNetwork({ email, login, socialNetworksKey, authMethod, acceptedTermsAndConditions }: {
|
|
14
|
+
email: any;
|
|
15
|
+
login: any;
|
|
16
|
+
socialNetworksKey: any;
|
|
17
|
+
authMethod?: string | undefined;
|
|
18
|
+
acceptedTermsAndConditions: any;
|
|
19
|
+
}): Promise<import("../types").StartaResponse>;
|
|
20
|
+
create({ email, login, password, passwordConfirm, firstName, lastName, key, phone, authMethod, recaptchaToken, acceptedTermsAndConditions, }: {
|
|
21
|
+
email: any;
|
|
22
|
+
login: any;
|
|
23
|
+
password: any;
|
|
24
|
+
passwordConfirm: any;
|
|
25
|
+
firstName: any;
|
|
26
|
+
lastName: any;
|
|
27
|
+
key: any;
|
|
28
|
+
phone: any;
|
|
29
|
+
authMethod?: string | undefined;
|
|
30
|
+
recaptchaToken: any;
|
|
31
|
+
acceptedTermsAndConditions: any;
|
|
32
|
+
}): Promise<import("../types").StartaResponse>;
|
|
33
|
+
changePassword(login: string, { currentPassword, newPassword }: {
|
|
34
|
+
currentPassword: any;
|
|
35
|
+
newPassword: any;
|
|
36
|
+
}): Promise<import("../types").StartaResponse>;
|
|
37
|
+
acceptTermsAndConditions(login: string, { acceptedTermsAndConditions }: {
|
|
38
|
+
acceptedTermsAndConditions: any;
|
|
39
|
+
}): Promise<import("../types").StartaResponse>;
|
|
40
|
+
changeAvatar(login: string, file: any): Promise<import("../types").StartaResponse>;
|
|
41
|
+
changeLanguage(login: string, language: any): Promise<import("../types").StartaResponse>;
|
|
42
|
+
addFile(login: string, fileFormData: FormData, { headers }?: {
|
|
43
|
+
headers?: any;
|
|
44
|
+
}): Promise<import("../types").StartaResponse>;
|
|
45
|
+
getFile(login: string, fileId: any): Promise<import("../types").StartaResponse>;
|
|
46
|
+
getAvatar(login: string, version: any): Promise<import("../types").StartaResponse>;
|
|
47
|
+
createKey(login: string): Promise<import("../types").StartaResponse>;
|
|
48
|
+
getKeys(login: string): Promise<import("../types").StartaResponse>;
|
|
49
|
+
getAllKeys(): Promise<import("../types").StartaResponse>;
|
|
50
|
+
getAddressSuggestions(login: string, term: any): Promise<import("../types").StartaResponse>;
|
|
51
|
+
orders(login: string, { from, to, status, product: { type, id, executor } }: {
|
|
52
|
+
from: any;
|
|
53
|
+
to: any;
|
|
54
|
+
status: any;
|
|
55
|
+
product?: {
|
|
56
|
+
type: undefined;
|
|
57
|
+
id: undefined;
|
|
58
|
+
executor: undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
}): Promise<import("../types").StartaResponse>;
|
|
61
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _helpers_1 = require("./_helpers");
|
|
4
|
+
var Accounts = /** @class */ (function () {
|
|
5
|
+
function Accounts(request) {
|
|
6
|
+
this._request = request;
|
|
7
|
+
}
|
|
8
|
+
Accounts.prototype.update = function (login, _a) {
|
|
9
|
+
var phone = _a.phone, firstName = _a.firstName, lastName = _a.lastName, timeZone = _a.timeZone;
|
|
10
|
+
return this._request({
|
|
11
|
+
url: "accounts/".concat(login),
|
|
12
|
+
method: 'PUT',
|
|
13
|
+
body: { phone: phone, firstName: firstName, lastName: lastName, timeZone: timeZone },
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
Accounts.prototype.getMainData = function (login) {
|
|
17
|
+
return this._request({
|
|
18
|
+
url: "accounts/".concat(login, "/mainData"),
|
|
19
|
+
method: 'GET',
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
Accounts.prototype.serviceProviders = function (login) {
|
|
23
|
+
return this._request({
|
|
24
|
+
url: "accounts/".concat(login, "/serviceProviders"),
|
|
25
|
+
method: 'GET',
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
Accounts.prototype.createViaSocialNetwork = function (_a) {
|
|
29
|
+
var email = _a.email, login = _a.login, socialNetworksKey = _a.socialNetworksKey, _b = _a.authMethod, authMethod = _b === void 0 ? 'cookie' : _b, acceptedTermsAndConditions = _a.acceptedTermsAndConditions;
|
|
30
|
+
return this._request({
|
|
31
|
+
url: "accounts/sn",
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: {
|
|
34
|
+
email: email,
|
|
35
|
+
login: login,
|
|
36
|
+
socialNetworksKey: socialNetworksKey,
|
|
37
|
+
authMethod: authMethod,
|
|
38
|
+
acceptedTermsAndConditions: acceptedTermsAndConditions,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
Accounts.prototype.create = function (_a) {
|
|
43
|
+
var email = _a.email, login = _a.login, password = _a.password, passwordConfirm = _a.passwordConfirm, firstName = _a.firstName, lastName = _a.lastName, key = _a.key, phone = _a.phone, _b = _a.authMethod, authMethod = _b === void 0 ? 'cookie' : _b, recaptchaToken = _a.recaptchaToken, acceptedTermsAndConditions = _a.acceptedTermsAndConditions;
|
|
44
|
+
return this._request({
|
|
45
|
+
url: "accounts",
|
|
46
|
+
method: 'POST',
|
|
47
|
+
body: {
|
|
48
|
+
email: email,
|
|
49
|
+
login: login,
|
|
50
|
+
password: password,
|
|
51
|
+
passwordConfirm: passwordConfirm,
|
|
52
|
+
firstName: firstName,
|
|
53
|
+
lastName: lastName,
|
|
54
|
+
key: key,
|
|
55
|
+
phone: phone,
|
|
56
|
+
authMethod: authMethod,
|
|
57
|
+
recaptchaToken: recaptchaToken,
|
|
58
|
+
acceptedTermsAndConditions: acceptedTermsAndConditions,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
Accounts.prototype.changePassword = function (login, _a) {
|
|
63
|
+
var currentPassword = _a.currentPassword, newPassword = _a.newPassword;
|
|
64
|
+
return this._request({
|
|
65
|
+
url: "accounts/".concat(login, "/password"),
|
|
66
|
+
method: 'PUT',
|
|
67
|
+
body: { currentPassword: currentPassword, newPassword: newPassword },
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
Accounts.prototype.acceptTermsAndConditions = function (login, _a) {
|
|
71
|
+
var acceptedTermsAndConditions = _a.acceptedTermsAndConditions;
|
|
72
|
+
return this._request({
|
|
73
|
+
url: "accounts/".concat(login, "/acceptedTermsAndConditions"),
|
|
74
|
+
method: 'PUT',
|
|
75
|
+
body: { acceptedTermsAndConditions: acceptedTermsAndConditions },
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
Accounts.prototype.changeAvatar = function (login, file) {
|
|
79
|
+
return this._request({
|
|
80
|
+
url: "accounts/".concat(login, "/avatar"),
|
|
81
|
+
method: 'PUT',
|
|
82
|
+
body: { file: file },
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
Accounts.prototype.changeLanguage = function (login, language) {
|
|
86
|
+
return this._request({
|
|
87
|
+
url: "accounts/".concat(login, "/language"),
|
|
88
|
+
method: 'PUT',
|
|
89
|
+
body: { language: language },
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
Accounts.prototype.addFile = function (login, fileFormData, _a) {
|
|
93
|
+
var _b = _a === void 0 ? {} : _a, headers = _b.headers;
|
|
94
|
+
return this._request({
|
|
95
|
+
url: "accounts/".concat(login, "/files"),
|
|
96
|
+
method: 'POST',
|
|
97
|
+
body: fileFormData,
|
|
98
|
+
config: {
|
|
99
|
+
headers: headers || {
|
|
100
|
+
'Content-Type': 'multipart/form-data',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
Accounts.prototype.getFile = function (login, fileId) {
|
|
106
|
+
return this._request({
|
|
107
|
+
url: "accounts/".concat(login, "/files/").concat(fileId),
|
|
108
|
+
method: 'GET',
|
|
109
|
+
config: {
|
|
110
|
+
responseType: 'stream',
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
Accounts.prototype.getAvatar = function (login, version) {
|
|
115
|
+
return this._request({
|
|
116
|
+
url: "accounts/".concat(login, "/avatar/?").concat(version),
|
|
117
|
+
method: 'GET',
|
|
118
|
+
config: {
|
|
119
|
+
responseType: 'stream',
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
Accounts.prototype.createKey = function (login) {
|
|
124
|
+
return this._request({
|
|
125
|
+
url: "accounts/".concat(login, "/keys"),
|
|
126
|
+
method: 'POST',
|
|
127
|
+
body: {},
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
Accounts.prototype.getKeys = function (login) {
|
|
131
|
+
return this._request({
|
|
132
|
+
url: "accounts/".concat(login, "/keys"),
|
|
133
|
+
method: 'GET',
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
Accounts.prototype.getAllKeys = function () {
|
|
137
|
+
return this._request({
|
|
138
|
+
url: "keys",
|
|
139
|
+
method: 'GET',
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
Accounts.prototype.getAddressSuggestions = function (login, term) {
|
|
143
|
+
return this._request({
|
|
144
|
+
url: "accounts/".concat(login, "/address/suggestions?term=").concat(term),
|
|
145
|
+
method: 'GET',
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
Accounts.prototype.orders = function (login, _a) {
|
|
149
|
+
var from = _a.from, to = _a.to, status = _a.status, _b = _a.product, _c = _b === void 0 ? { type: undefined, id: undefined, executor: undefined } : _b, type = _c.type, id = _c.id, executor = _c.executor;
|
|
150
|
+
return this._request({
|
|
151
|
+
url: "accounts/".concat(login, "/orders").concat((0, _helpers_1.buildQuery)({
|
|
152
|
+
from: from,
|
|
153
|
+
to: to,
|
|
154
|
+
status: status,
|
|
155
|
+
product: { type: type, id: id, executor: executor },
|
|
156
|
+
})),
|
|
157
|
+
method: 'GET',
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
return Accounts;
|
|
161
|
+
}());
|
|
162
|
+
exports.default = Accounts;
|
|
163
|
+
;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StartaRequest } from '../types';
|
|
2
|
+
export default class EmailConfirmations {
|
|
3
|
+
private _request;
|
|
4
|
+
constructor(request: StartaRequest);
|
|
5
|
+
confirm(confirmEmailToken: any): Promise<import("../types").StartaResponse>;
|
|
6
|
+
create(): Promise<import("../types").StartaResponse>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var EmailConfirmations = /** @class */ (function () {
|
|
4
|
+
function EmailConfirmations(request) {
|
|
5
|
+
this._request = request;
|
|
6
|
+
}
|
|
7
|
+
EmailConfirmations.prototype.confirm = function (confirmEmailToken) {
|
|
8
|
+
return this._request({
|
|
9
|
+
url: "emailConfirmations/".concat(confirmEmailToken),
|
|
10
|
+
method: 'PUT',
|
|
11
|
+
body: {},
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
EmailConfirmations.prototype.create = function () {
|
|
15
|
+
return this._request({
|
|
16
|
+
url: "emailConfirmations",
|
|
17
|
+
method: 'POST',
|
|
18
|
+
body: {},
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
return EmailConfirmations;
|
|
22
|
+
}());
|
|
23
|
+
exports.default = EmailConfirmations;
|
|
24
|
+
;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Healthcheck = /** @class */ (function () {
|
|
4
|
+
function Healthcheck(request) {
|
|
5
|
+
this._request = request;
|
|
6
|
+
}
|
|
7
|
+
Healthcheck.prototype.get = function () {
|
|
8
|
+
return this._request({
|
|
9
|
+
url: "healthcheck",
|
|
10
|
+
method: 'GET',
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
return Healthcheck;
|
|
14
|
+
}());
|
|
15
|
+
exports.default = Healthcheck;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StartaRequest } from '../types';
|
|
2
|
+
import Sessions from './sessions';
|
|
3
|
+
import Accounts from './accounts';
|
|
4
|
+
import Organizations from './organizations';
|
|
5
|
+
import Healthcheck from './healthcheck';
|
|
6
|
+
import PasswordResets from './passwordResets';
|
|
7
|
+
import EmailConfirmations from './emailConfirmations';
|
|
8
|
+
import System from './system';
|
|
9
|
+
import Webhooks from './webhooks';
|
|
10
|
+
export default class StartaApiClient {
|
|
11
|
+
private _request;
|
|
12
|
+
constructor(request: StartaRequest);
|
|
13
|
+
get sessions(): Sessions;
|
|
14
|
+
get accounts(): Accounts;
|
|
15
|
+
get organizations(): Organizations;
|
|
16
|
+
get passwordResets(): PasswordResets;
|
|
17
|
+
get webhooks(): Webhooks;
|
|
18
|
+
get system(): System;
|
|
19
|
+
get emailConfirmations(): EmailConfirmations;
|
|
20
|
+
get healthcheck(): Healthcheck;
|
|
21
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var sessions_1 = require("./sessions");
|
|
4
|
+
var accounts_1 = require("./accounts");
|
|
5
|
+
var organizations_1 = require("./organizations");
|
|
6
|
+
var healthcheck_1 = require("./healthcheck");
|
|
7
|
+
var passwordResets_1 = require("./passwordResets");
|
|
8
|
+
var emailConfirmations_1 = require("./emailConfirmations");
|
|
9
|
+
var system_1 = require("./system");
|
|
10
|
+
var webhooks_1 = require("./webhooks");
|
|
11
|
+
var StartaApiClient = /** @class */ (function () {
|
|
12
|
+
function StartaApiClient(request) {
|
|
13
|
+
this._request = request;
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(StartaApiClient.prototype, "sessions", {
|
|
16
|
+
get: function () {
|
|
17
|
+
return new sessions_1.default(this._request);
|
|
18
|
+
},
|
|
19
|
+
enumerable: false,
|
|
20
|
+
configurable: true
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(StartaApiClient.prototype, "accounts", {
|
|
23
|
+
get: function () {
|
|
24
|
+
return new accounts_1.default(this._request);
|
|
25
|
+
},
|
|
26
|
+
enumerable: false,
|
|
27
|
+
configurable: true
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(StartaApiClient.prototype, "organizations", {
|
|
30
|
+
get: function () {
|
|
31
|
+
return new organizations_1.default(this._request);
|
|
32
|
+
},
|
|
33
|
+
enumerable: false,
|
|
34
|
+
configurable: true
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(StartaApiClient.prototype, "passwordResets", {
|
|
37
|
+
get: function () {
|
|
38
|
+
return new passwordResets_1.default(this._request);
|
|
39
|
+
},
|
|
40
|
+
enumerable: false,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(StartaApiClient.prototype, "webhooks", {
|
|
44
|
+
get: function () {
|
|
45
|
+
return new webhooks_1.default(this._request);
|
|
46
|
+
},
|
|
47
|
+
enumerable: false,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(StartaApiClient.prototype, "system", {
|
|
51
|
+
get: function () {
|
|
52
|
+
return new system_1.default(this._request);
|
|
53
|
+
},
|
|
54
|
+
enumerable: false,
|
|
55
|
+
configurable: true
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(StartaApiClient.prototype, "emailConfirmations", {
|
|
58
|
+
get: function () {
|
|
59
|
+
return new emailConfirmations_1.default(this._request);
|
|
60
|
+
},
|
|
61
|
+
enumerable: false,
|
|
62
|
+
configurable: true
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(StartaApiClient.prototype, "healthcheck", {
|
|
65
|
+
get: function () {
|
|
66
|
+
return new healthcheck_1.default(this._request);
|
|
67
|
+
},
|
|
68
|
+
enumerable: false,
|
|
69
|
+
configurable: true
|
|
70
|
+
});
|
|
71
|
+
return StartaApiClient;
|
|
72
|
+
}());
|
|
73
|
+
exports.default = StartaApiClient;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { StartaRequest } from '../../types';
|
|
2
|
+
export default class Accounts {
|
|
3
|
+
private _request;
|
|
4
|
+
constructor(request: StartaRequest);
|
|
5
|
+
index(organizationLogin: any, { phone, email }?: {
|
|
6
|
+
phone?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
}): Promise<import("../../types").StartaResponse>;
|
|
9
|
+
get(organizationLogin: any, customerId: any): Promise<import("../../types").StartaResponse>;
|
|
10
|
+
orders(organizationLogin: any, customerId: any): Promise<import("../../types").StartaResponse>;
|
|
11
|
+
add(organizationLogin: any, { login, type, email, phone, firstName, lastName, countryIso2, region, province, zip, city, addressLine1, addressLine2, dateOfBirth, comment, language, }: {
|
|
12
|
+
login: any;
|
|
13
|
+
type?: string | undefined;
|
|
14
|
+
email: any;
|
|
15
|
+
phone: any;
|
|
16
|
+
firstName: any;
|
|
17
|
+
lastName: any;
|
|
18
|
+
countryIso2: any;
|
|
19
|
+
region: any;
|
|
20
|
+
province: any;
|
|
21
|
+
zip: any;
|
|
22
|
+
city: any;
|
|
23
|
+
addressLine1: any;
|
|
24
|
+
addressLine2: any;
|
|
25
|
+
dateOfBirth: any;
|
|
26
|
+
comment: any;
|
|
27
|
+
language: any;
|
|
28
|
+
}): Promise<import("../../types").StartaResponse>;
|
|
29
|
+
update(organizationLogin: any, customerId: any, { type, email, phone, firstName, lastName, countryIso2, region, province, zip, city, addressLine1, addressLine2, dateOfBirth, comment, language, }: {
|
|
30
|
+
type?: string | undefined;
|
|
31
|
+
email: any;
|
|
32
|
+
phone: any;
|
|
33
|
+
firstName: any;
|
|
34
|
+
lastName: any;
|
|
35
|
+
countryIso2: any;
|
|
36
|
+
region: any;
|
|
37
|
+
province: any;
|
|
38
|
+
zip: any;
|
|
39
|
+
city: any;
|
|
40
|
+
addressLine1: any;
|
|
41
|
+
addressLine2: any;
|
|
42
|
+
dateOfBirth: any;
|
|
43
|
+
comment: any;
|
|
44
|
+
language: any;
|
|
45
|
+
}): Promise<import("../../types").StartaResponse>;
|
|
46
|
+
delete(organizationLogin: any, customerId: any): Promise<import("../../types").StartaResponse>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _helpers_1 = require("../_helpers");
|
|
4
|
+
var Accounts = /** @class */ (function () {
|
|
5
|
+
function Accounts(request) {
|
|
6
|
+
this._request = request;
|
|
7
|
+
}
|
|
8
|
+
Accounts.prototype.index = function (organizationLogin, _a) {
|
|
9
|
+
var _b = _a === void 0 ? {} : _a, phone = _b.phone, email = _b.email;
|
|
10
|
+
return this._request({
|
|
11
|
+
url: "accounts/".concat(organizationLogin, "/customers").concat((0, _helpers_1.buildQuery)({
|
|
12
|
+
phone: phone,
|
|
13
|
+
email: email,
|
|
14
|
+
})),
|
|
15
|
+
method: 'GET',
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
Accounts.prototype.get = function (organizationLogin, customerId) {
|
|
19
|
+
return this._request({
|
|
20
|
+
url: "accounts/".concat(organizationLogin, "/customers/").concat(customerId),
|
|
21
|
+
method: 'GET',
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
Accounts.prototype.orders = function (organizationLogin, customerId) {
|
|
25
|
+
return this._request({
|
|
26
|
+
url: "accounts/".concat(organizationLogin, "/customers/").concat(customerId, "/orders"),
|
|
27
|
+
method: 'GET',
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Accounts.prototype.add = function (organizationLogin, _a) {
|
|
31
|
+
var login = _a.login, _b = _a.type, type = _b === void 0 ? 'client' : _b, email = _a.email, phone = _a.phone, firstName = _a.firstName, lastName = _a.lastName, countryIso2 = _a.countryIso2, region = _a.region, province = _a.province, zip = _a.zip, city = _a.city, addressLine1 = _a.addressLine1, addressLine2 = _a.addressLine2, dateOfBirth = _a.dateOfBirth, comment = _a.comment, language = _a.language;
|
|
32
|
+
return this._request({
|
|
33
|
+
url: "accounts/".concat(organizationLogin, "/customers"),
|
|
34
|
+
method: 'POST',
|
|
35
|
+
body: {
|
|
36
|
+
login: login,
|
|
37
|
+
type: type,
|
|
38
|
+
email: email,
|
|
39
|
+
phone: phone,
|
|
40
|
+
firstName: firstName,
|
|
41
|
+
lastName: lastName,
|
|
42
|
+
countryIso2: countryIso2,
|
|
43
|
+
region: region,
|
|
44
|
+
province: province,
|
|
45
|
+
zip: zip,
|
|
46
|
+
city: city,
|
|
47
|
+
addressLine1: addressLine1,
|
|
48
|
+
addressLine2: addressLine2,
|
|
49
|
+
dateOfBirth: dateOfBirth,
|
|
50
|
+
comment: comment,
|
|
51
|
+
language: language,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
Accounts.prototype.update = function (organizationLogin, customerId, _a) {
|
|
56
|
+
var _b = _a.type, type = _b === void 0 ? 'client' : _b, email = _a.email, phone = _a.phone, firstName = _a.firstName, lastName = _a.lastName, countryIso2 = _a.countryIso2, region = _a.region, province = _a.province, zip = _a.zip, city = _a.city, addressLine1 = _a.addressLine1, addressLine2 = _a.addressLine2, dateOfBirth = _a.dateOfBirth, comment = _a.comment, language = _a.language;
|
|
57
|
+
return this._request({
|
|
58
|
+
url: "accounts/".concat(organizationLogin, "/customers/").concat(customerId),
|
|
59
|
+
method: 'PUT',
|
|
60
|
+
body: {
|
|
61
|
+
type: type,
|
|
62
|
+
email: email,
|
|
63
|
+
phone: phone,
|
|
64
|
+
firstName: firstName,
|
|
65
|
+
lastName: lastName,
|
|
66
|
+
countryIso2: countryIso2,
|
|
67
|
+
region: region,
|
|
68
|
+
province: province,
|
|
69
|
+
zip: zip,
|
|
70
|
+
city: city,
|
|
71
|
+
addressLine1: addressLine1,
|
|
72
|
+
addressLine2: addressLine2,
|
|
73
|
+
dateOfBirth: dateOfBirth,
|
|
74
|
+
comment: comment,
|
|
75
|
+
language: language,
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
Accounts.prototype.delete = function (organizationLogin, customerId) {
|
|
80
|
+
return this._request({
|
|
81
|
+
url: "accounts/".concat(organizationLogin, "/customers/").concat(customerId),
|
|
82
|
+
method: 'DELETE',
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
return Accounts;
|
|
86
|
+
}());
|
|
87
|
+
exports.default = Accounts;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StartaRequest } from '../../types';
|
|
2
|
+
export default class Accounts {
|
|
3
|
+
private _request;
|
|
4
|
+
constructor(request: StartaRequest);
|
|
5
|
+
ordersStats(organizationLogin: any, { period, customFrom, customTo }: {
|
|
6
|
+
period: any;
|
|
7
|
+
customFrom: any;
|
|
8
|
+
customTo: any;
|
|
9
|
+
}): Promise<import("../../types").StartaResponse>;
|
|
10
|
+
orders(organizationLogin: any): Promise<import("../../types").StartaResponse>;
|
|
11
|
+
}
|