starta.apiclient 1.37.1669 → 1.37.1702
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/request.js +6 -0
- package/lib/services/accounts.d.ts +4 -2
- package/lib/services/accounts.js +4 -2
- package/lib/services/organizations/index.d.ts +2 -0
- package/lib/services/organizations/index.js +8 -0
- package/lib/services/organizations/worklogs.d.ts +12 -0
- package/lib/services/organizations/worklogs.js +17 -0
- package/lib/types.d.ts +2 -1
- package/package.json +1 -1
package/lib/request.js
CHANGED
|
@@ -30,6 +30,12 @@ var requestFactory = function (baseURL, middlewares) {
|
|
|
30
30
|
if (authHeaderToken) {
|
|
31
31
|
config.headers.Authorization = authHeaderToken;
|
|
32
32
|
}
|
|
33
|
+
if (middlewares.headers) {
|
|
34
|
+
var headers_1 = middlewares.headers();
|
|
35
|
+
Object.keys(headers_1).map(function (h) {
|
|
36
|
+
config.headers[h] = headers_1[h];
|
|
37
|
+
});
|
|
38
|
+
}
|
|
33
39
|
var requestConfig = __assign({ baseURL: config.rewriteBaseUrl ? config.rewriteBaseUrl(baseURL) : baseURL, method: method, params: urlParams, data: body, withCredentials: true }, config);
|
|
34
40
|
(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));
|
|
35
41
|
return (0, axios_1.default)(url, requestConfig)
|
|
@@ -30,15 +30,16 @@ export default class Accounts {
|
|
|
30
30
|
serviceProviders(login: string): Promise<import("../types").StartaResponse>;
|
|
31
31
|
addServiceProvider(login: string, organizationLogin: string): Promise<import("../types").StartaResponse>;
|
|
32
32
|
removeServiceProvider(login: string, organizationLogin: string): Promise<import("../types").StartaResponse>;
|
|
33
|
-
createViaSocialNetwork({ email, login, socialNetworksKey, authMethod, acceptedTermsAndConditions, referralId }: {
|
|
33
|
+
createViaSocialNetwork({ email, login, socialNetworksKey, authMethod, acceptedTermsAndConditions, referralId, platform }: {
|
|
34
34
|
email: any;
|
|
35
35
|
login: any;
|
|
36
36
|
socialNetworksKey: any;
|
|
37
37
|
authMethod: 'cookie' | 'header';
|
|
38
38
|
acceptedTermsAndConditions: any;
|
|
39
39
|
referralId?: any;
|
|
40
|
+
platform?: 'web' | 'ios' | 'android';
|
|
40
41
|
}): Promise<import("../types").StartaResponse>;
|
|
41
|
-
create({ email, login, password, passwordConfirm, firstName, lastName, phone, authMethod, recaptchaToken, acceptedTermsAndConditions, referralId, }: {
|
|
42
|
+
create({ email, login, password, passwordConfirm, firstName, lastName, phone, authMethod, recaptchaToken, acceptedTermsAndConditions, referralId, platform }: {
|
|
42
43
|
email: any;
|
|
43
44
|
login: any;
|
|
44
45
|
password: any;
|
|
@@ -50,6 +51,7 @@ export default class Accounts {
|
|
|
50
51
|
recaptchaToken: any;
|
|
51
52
|
acceptedTermsAndConditions: any;
|
|
52
53
|
referralId?: any;
|
|
54
|
+
platform?: 'web' | 'ios' | 'android';
|
|
53
55
|
}): Promise<import("../types").StartaResponse>;
|
|
54
56
|
changePassword(login: string, { currentPassword, newPassword }: {
|
|
55
57
|
currentPassword: any;
|
package/lib/services/accounts.js
CHANGED
|
@@ -65,7 +65,7 @@ var Accounts = /** @class */ (function () {
|
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
67
|
Accounts.prototype.createViaSocialNetwork = function (_a) {
|
|
68
|
-
var email = _a.email, login = _a.login, socialNetworksKey = _a.socialNetworksKey, _b = _a.authMethod, authMethod = _b === void 0 ? 'cookie' : _b, acceptedTermsAndConditions = _a.acceptedTermsAndConditions, referralId = _a.referralId;
|
|
68
|
+
var email = _a.email, login = _a.login, socialNetworksKey = _a.socialNetworksKey, _b = _a.authMethod, authMethod = _b === void 0 ? 'cookie' : _b, acceptedTermsAndConditions = _a.acceptedTermsAndConditions, referralId = _a.referralId, platform = _a.platform;
|
|
69
69
|
return this._requestRunner.performRequest({
|
|
70
70
|
url: "accounts/sn",
|
|
71
71
|
method: 'POST',
|
|
@@ -76,11 +76,12 @@ var Accounts = /** @class */ (function () {
|
|
|
76
76
|
authMethod: authMethod,
|
|
77
77
|
acceptedTermsAndConditions: acceptedTermsAndConditions,
|
|
78
78
|
referralId: referralId,
|
|
79
|
+
platform: platform,
|
|
79
80
|
},
|
|
80
81
|
});
|
|
81
82
|
};
|
|
82
83
|
Accounts.prototype.create = function (_a) {
|
|
83
|
-
var email = _a.email, login = _a.login, password = _a.password, passwordConfirm = _a.passwordConfirm, firstName = _a.firstName, lastName = _a.lastName, phone = _a.phone, _b = _a.authMethod, authMethod = _b === void 0 ? 'cookie' : _b, recaptchaToken = _a.recaptchaToken, acceptedTermsAndConditions = _a.acceptedTermsAndConditions, referralId = _a.referralId;
|
|
84
|
+
var email = _a.email, login = _a.login, password = _a.password, passwordConfirm = _a.passwordConfirm, firstName = _a.firstName, lastName = _a.lastName, phone = _a.phone, _b = _a.authMethod, authMethod = _b === void 0 ? 'cookie' : _b, recaptchaToken = _a.recaptchaToken, acceptedTermsAndConditions = _a.acceptedTermsAndConditions, referralId = _a.referralId, platform = _a.platform;
|
|
84
85
|
return this._requestRunner.performRequest({
|
|
85
86
|
url: "accounts",
|
|
86
87
|
method: 'POST',
|
|
@@ -96,6 +97,7 @@ var Accounts = /** @class */ (function () {
|
|
|
96
97
|
recaptchaToken: recaptchaToken,
|
|
97
98
|
acceptedTermsAndConditions: acceptedTermsAndConditions,
|
|
98
99
|
referralId: referralId,
|
|
100
|
+
platform: platform,
|
|
99
101
|
},
|
|
100
102
|
});
|
|
101
103
|
};
|
|
@@ -10,6 +10,7 @@ import Dashboard from './dashboard';
|
|
|
10
10
|
import Public from './public';
|
|
11
11
|
import Integrations from './integrations';
|
|
12
12
|
import Schedules from './schedules';
|
|
13
|
+
import Worklogs from './worklogs';
|
|
13
14
|
export default class Organizations {
|
|
14
15
|
private _requestRunner;
|
|
15
16
|
constructor(requestRunner: StartaRequestRunner);
|
|
@@ -80,4 +81,5 @@ export default class Organizations {
|
|
|
80
81
|
get dashboard(): Dashboard;
|
|
81
82
|
get integrations(): Integrations;
|
|
82
83
|
get schedules(): Schedules;
|
|
84
|
+
get worklogs(): Worklogs;
|
|
83
85
|
}
|
|
@@ -11,6 +11,7 @@ var dashboard_1 = require("./dashboard");
|
|
|
11
11
|
var public_1 = require("./public");
|
|
12
12
|
var integrations_1 = require("./integrations");
|
|
13
13
|
var schedules_1 = require("./schedules");
|
|
14
|
+
var worklogs_1 = require("./worklogs");
|
|
14
15
|
var _helpers_1 = require("../_helpers");
|
|
15
16
|
var Organizations = /** @class */ (function () {
|
|
16
17
|
function Organizations(requestRunner) {
|
|
@@ -243,6 +244,13 @@ var Organizations = /** @class */ (function () {
|
|
|
243
244
|
enumerable: false,
|
|
244
245
|
configurable: true
|
|
245
246
|
});
|
|
247
|
+
Object.defineProperty(Organizations.prototype, "worklogs", {
|
|
248
|
+
get: function () {
|
|
249
|
+
return new worklogs_1.default(this._requestRunner);
|
|
250
|
+
},
|
|
251
|
+
enumerable: false,
|
|
252
|
+
configurable: true
|
|
253
|
+
});
|
|
246
254
|
return Organizations;
|
|
247
255
|
}());
|
|
248
256
|
exports.default = Organizations;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StartaRequestRunner } from '../../types';
|
|
2
|
+
export default class Worklogs {
|
|
3
|
+
private _requestRunner;
|
|
4
|
+
constructor(requestRunner: StartaRequestRunner);
|
|
5
|
+
add(organizationLogin: any, { memberLogin, worklogName, start, end, type }: {
|
|
6
|
+
memberLogin?: string;
|
|
7
|
+
worklogName?: string;
|
|
8
|
+
start: Date;
|
|
9
|
+
end: Date;
|
|
10
|
+
type: 'holiday' | 'vacation';
|
|
11
|
+
}): Promise<import("../../types").StartaResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Worklogs = /** @class */ (function () {
|
|
4
|
+
function Worklogs(requestRunner) {
|
|
5
|
+
this._requestRunner = requestRunner;
|
|
6
|
+
}
|
|
7
|
+
Worklogs.prototype.add = function (organizationLogin, _a) {
|
|
8
|
+
var memberLogin = _a.memberLogin, worklogName = _a.worklogName, start = _a.start, end = _a.end, type = _a.type;
|
|
9
|
+
return this._requestRunner.performRequest({
|
|
10
|
+
url: "accounts/".concat(organizationLogin, "/worklogs"),
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: { memberLogin: memberLogin, worklogName: worklogName, start: start, end: end, type: type },
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
return Worklogs;
|
|
16
|
+
}());
|
|
17
|
+
exports.default = Worklogs;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosRequestConfig, Method, AxiosResponse, AxiosError } from 'axios';
|
|
1
|
+
import { AxiosRequestConfig, Method, AxiosResponse, AxiosError, AxiosRequestHeaders } from 'axios';
|
|
2
2
|
export interface StartaRequestRunner {
|
|
3
3
|
performRequest: (requestData: StartaRequestData) => Promise<StartaResponse>;
|
|
4
4
|
setAuthHeaderToken: (token: string) => void;
|
|
@@ -29,6 +29,7 @@ export declare type StartaRequestMiddlewares = {
|
|
|
29
29
|
onUnauthorized?: (response: StartaResponse) => void;
|
|
30
30
|
logger?: (...args: any[]) => void;
|
|
31
31
|
cookieFactory?: () => string | null;
|
|
32
|
+
headers?: () => AxiosRequestHeaders;
|
|
32
33
|
};
|
|
33
34
|
export declare type Interval = {
|
|
34
35
|
from: string;
|