@doist/todoist-api-typescript 2.0.1 → 2.0.3
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/dist/TodoistApi.js +2 -2
- package/dist/restClient.d.ts +2 -1
- package/dist/restClient.js +19 -2
- package/dist/types/requests.d.ts +1 -1
- package/package.json +2 -2
package/dist/TodoistApi.js
CHANGED
|
@@ -238,7 +238,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
238
238
|
switch (_a.label) {
|
|
239
239
|
case 0:
|
|
240
240
|
runtypes_1.String.check(id);
|
|
241
|
-
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, requestId)];
|
|
241
|
+
return [4 /*yield*/, (0, restClient_1.request)('DELETE', this.restApiBase, generatePath(endpoints_1.ENDPOINT_REST_PROJECTS, id), this.authToken, undefined, requestId)];
|
|
242
242
|
case 1:
|
|
243
243
|
response = _a.sent();
|
|
244
244
|
return [2 /*return*/, (0, restClient_1.isSuccess)(response)];
|
|
@@ -266,7 +266,7 @@ var TodoistApi = /** @class */ (function () {
|
|
|
266
266
|
var response;
|
|
267
267
|
return __generator(this, function (_a) {
|
|
268
268
|
switch (_a.label) {
|
|
269
|
-
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, endpoints_1.ENDPOINT_REST_SECTIONS, this.authToken, projectId
|
|
269
|
+
case 0: return [4 /*yield*/, (0, restClient_1.request)('GET', this.restApiBase, endpoints_1.ENDPOINT_REST_SECTIONS, this.authToken, projectId ? { projectId: projectId } : undefined)];
|
|
270
270
|
case 1:
|
|
271
271
|
response = _a.sent();
|
|
272
272
|
return [2 /*return*/, (0, validators_1.validateSectionArray)(response.data)];
|
package/dist/restClient.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { HttpMethod } from './types/http';
|
|
3
|
+
export declare function paramsSerializer(params: Record<string, unknown>): string;
|
|
3
4
|
export declare function isSuccess(response: AxiosResponse): boolean;
|
|
4
|
-
export declare function request<T>(httpMethod: HttpMethod, baseUri: string, relativePath: string, apiToken?: string, payload?:
|
|
5
|
+
export declare function request<T>(httpMethod: HttpMethod, baseUri: string, relativePath: string, apiToken?: string, payload?: Record<string, unknown>, requestId?: string): Promise<AxiosResponse<T>>;
|
package/dist/restClient.js
CHANGED
|
@@ -50,12 +50,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.request = exports.isSuccess = void 0;
|
|
53
|
+
exports.request = exports.isSuccess = exports.paramsSerializer = void 0;
|
|
54
54
|
var axios_1 = __importDefault(require("axios"));
|
|
55
55
|
var axios_case_converter_1 = __importDefault(require("axios-case-converter"));
|
|
56
56
|
var errors_1 = require("./types/errors");
|
|
57
57
|
var uuid_1 = require("uuid");
|
|
58
58
|
var axios_retry_1 = __importDefault(require("axios-retry"));
|
|
59
|
+
function paramsSerializer(params) {
|
|
60
|
+
var qs = new URLSearchParams();
|
|
61
|
+
Object.keys(params).forEach(function (key) {
|
|
62
|
+
var value = params[key];
|
|
63
|
+
if (Array.isArray(value)) {
|
|
64
|
+
qs.append(key, value.join(','));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
qs.append(key, String(value));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
return qs.toString();
|
|
71
|
+
}
|
|
72
|
+
exports.paramsSerializer = paramsSerializer;
|
|
59
73
|
var defaultHeaders = {
|
|
60
74
|
'Content-Type': 'application/json',
|
|
61
75
|
};
|
|
@@ -121,7 +135,10 @@ function request(httpMethod, baseUri, relativePath, apiToken, payload, requestId
|
|
|
121
135
|
case 'DELETE': return [3 /*break*/, 6];
|
|
122
136
|
}
|
|
123
137
|
return [3 /*break*/, 8];
|
|
124
|
-
case 2: return [4 /*yield*/, axiosClient.get(relativePath, {
|
|
138
|
+
case 2: return [4 /*yield*/, axiosClient.get(relativePath, {
|
|
139
|
+
params: payload,
|
|
140
|
+
paramsSerializer: paramsSerializer,
|
|
141
|
+
})];
|
|
125
142
|
case 3: return [2 /*return*/, _b.sent()];
|
|
126
143
|
case 4: return [4 /*yield*/, axiosClient.post(relativePath, payload)];
|
|
127
144
|
case 5: return [2 /*return*/, _b.sent()];
|
package/dist/types/requests.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doist/todoist-api-typescript",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A typescript wrapper for the Todoist REST API.",
|
|
5
5
|
"author": "Doist developers",
|
|
6
6
|
"repository": "git@github.com:doist/todoist-api-typescript.git",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"rimraf": "3.0.2",
|
|
53
53
|
"ts-jest": "28.0.8",
|
|
54
54
|
"ts-node": "10.9.1",
|
|
55
|
-
"typescript": "4.8.
|
|
55
|
+
"typescript": "4.8.3"
|
|
56
56
|
},
|
|
57
57
|
"prettier": "@doist/prettier-config",
|
|
58
58
|
"husky": {
|