@tillhub/javascript-sdk 4.93.0 → 4.95.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/CHANGELOG.md +18 -0
- package/dist/types/v0/documents.d.ts +30 -5
- package/dist/v0/documents.js +77 -1
- package/dist/v0/documents.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
# [4.95.0](https://github.com/tillhub/tillhub-sdk-javascript/compare/v4.94.0...v4.95.0) (2023-10-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **documents:** add download method ([9d3471e](https://github.com/tillhub/tillhub-sdk-javascript/commit/9d3471eac556a40ac183cd367949695ac30238ca))
|
|
7
|
+
|
|
8
|
+
# [4.94.0](https://github.com/tillhub/tillhub-sdk-javascript/compare/v4.93.0...v4.94.0) (2023-10-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **documents:** add send method ([c4361dc](https://github.com/tillhub/tillhub-sdk-javascript/commit/c4361dc0fd992894ca3cb4fe2339f28827701444))
|
|
14
|
+
* **documents:** add tests ([f1f6392](https://github.com/tillhub/tillhub-sdk-javascript/commit/f1f63925749efcd6f5c3f057e8b4a7f0c0dcaf2f))
|
|
15
|
+
* **documents:** fix unit tests ([74f28e2](https://github.com/tillhub/tillhub-sdk-javascript/commit/74f28e2e793897ce5114060326ec342bc7022824))
|
|
16
|
+
* **documents:** update response ([6f3c411](https://github.com/tillhub/tillhub-sdk-javascript/commit/6f3c4113c0556a7fa0d4deac3bd2947dc7e52347))
|
|
17
|
+
* **documents:** update response ([b6194ef](https://github.com/tillhub/tillhub-sdk-javascript/commit/b6194ef676bbcf10a5b15d5e2950e160bc93862c))
|
|
18
|
+
|
|
1
19
|
# [4.93.0](https://github.com/tillhub/tillhub-sdk-javascript/compare/v4.92.0...v4.93.0) (2023-09-28)
|
|
2
20
|
|
|
3
21
|
|
|
@@ -12,13 +12,26 @@ export interface DocumentsMultipleResponse {
|
|
|
12
12
|
next?: () => Promise<DocumentsMultipleResponse>;
|
|
13
13
|
}
|
|
14
14
|
export interface Document {
|
|
15
|
-
id: string;
|
|
16
15
|
createdAt?: string;
|
|
17
|
-
|
|
16
|
+
documentNumber: string;
|
|
18
17
|
documentType: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
id: string;
|
|
19
|
+
updatedAt?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface DocumentsSendQuery {
|
|
22
|
+
partnerName: string;
|
|
23
|
+
recipients: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface DocumentsSendResponse {
|
|
26
|
+
data: {
|
|
27
|
+
success: true;
|
|
28
|
+
};
|
|
29
|
+
msg: string;
|
|
30
|
+
}
|
|
31
|
+
export interface DocumentsDownloadResponse {
|
|
32
|
+
data?: string;
|
|
33
|
+
contentType?: string;
|
|
34
|
+
filename?: string;
|
|
22
35
|
}
|
|
23
36
|
export declare class Documents extends ThBaseHandler {
|
|
24
37
|
static baseEndpoint: string;
|
|
@@ -29,6 +42,8 @@ export declare class Documents extends ThBaseHandler {
|
|
|
29
42
|
constructor(options: DocumentsOptions, http: Client);
|
|
30
43
|
getAll(query?: Record<string, unknown>): Promise<DocumentsMultipleResponse>;
|
|
31
44
|
meta(query?: Record<string, unknown>): Promise<DocumentsMultipleResponse>;
|
|
45
|
+
send(documentId: string, sendQuery: DocumentsSendQuery): Promise<DocumentsSendResponse>;
|
|
46
|
+
download(documentId: string): Promise<DocumentsDownloadResponse>;
|
|
32
47
|
}
|
|
33
48
|
export declare class DocumentsGetFailed extends BaseError {
|
|
34
49
|
message: string;
|
|
@@ -40,3 +55,13 @@ export declare class DocumentsMetaFailed extends BaseError {
|
|
|
40
55
|
name: string;
|
|
41
56
|
constructor(message?: string, properties?: Record<string, unknown>);
|
|
42
57
|
}
|
|
58
|
+
export declare class DocumentsSendFailed extends BaseError {
|
|
59
|
+
message: string;
|
|
60
|
+
name: string;
|
|
61
|
+
constructor(message?: string, properties?: Record<string, unknown>);
|
|
62
|
+
}
|
|
63
|
+
export declare class DocumentsDownloadFailed extends BaseError {
|
|
64
|
+
message: string;
|
|
65
|
+
name: string;
|
|
66
|
+
constructor(message?: string, properties?: Record<string, unknown>);
|
|
67
|
+
}
|
package/dist/v0/documents.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DocumentsMetaFailed = exports.DocumentsGetFailed = exports.Documents = void 0;
|
|
3
|
+
exports.DocumentsDownloadFailed = exports.DocumentsSendFailed = exports.DocumentsMetaFailed = exports.DocumentsGetFailed = exports.Documents = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var errors_1 = require("../errors");
|
|
6
6
|
var uri_helper_1 = require("../uri-helper");
|
|
@@ -87,6 +87,56 @@ var Documents = (function (_super) {
|
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
};
|
|
90
|
+
Documents.prototype.send = function (documentId, sendQuery) {
|
|
91
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
92
|
+
var base, uri, response, error_3;
|
|
93
|
+
return tslib_1.__generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
_a.trys.push([0, 2, , 3]);
|
|
97
|
+
base = this.uriHelper.generateBaseUri("/" + documentId + "/send");
|
|
98
|
+
uri = this.uriHelper.generateUriWithQuery(base);
|
|
99
|
+
return [4, this.http.getClient().post(uri, sendQuery)];
|
|
100
|
+
case 1:
|
|
101
|
+
response = _a.sent();
|
|
102
|
+
return [2, {
|
|
103
|
+
data: response.data.results[0],
|
|
104
|
+
msg: response.data.msg
|
|
105
|
+
}];
|
|
106
|
+
case 2:
|
|
107
|
+
error_3 = _a.sent();
|
|
108
|
+
throw new DocumentsSendFailed(error_3.message);
|
|
109
|
+
case 3: return [2];
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
Documents.prototype.download = function (documentId) {
|
|
115
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
116
|
+
var base, uri, response, pdfObj, error_4;
|
|
117
|
+
return tslib_1.__generator(this, function (_a) {
|
|
118
|
+
switch (_a.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
_a.trys.push([0, 2, , 3]);
|
|
121
|
+
base = this.uriHelper.generateBaseUri("/" + documentId + "/download");
|
|
122
|
+
uri = this.uriHelper.generateUriWithQuery(base);
|
|
123
|
+
return [4, this.http.getClient().get(uri)];
|
|
124
|
+
case 1:
|
|
125
|
+
response = _a.sent();
|
|
126
|
+
pdfObj = response.data.results[0];
|
|
127
|
+
return [2, {
|
|
128
|
+
data: pdfObj.base64Content,
|
|
129
|
+
contentType: pdfObj.contentType,
|
|
130
|
+
filename: pdfObj.fileName
|
|
131
|
+
}];
|
|
132
|
+
case 2:
|
|
133
|
+
error_4 = _a.sent();
|
|
134
|
+
throw new DocumentsDownloadFailed(error_4.message);
|
|
135
|
+
case 3: return [2];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
90
140
|
Documents.baseEndpoint = '/api/v0/documents';
|
|
91
141
|
return Documents;
|
|
92
142
|
}(base_1.ThBaseHandler));
|
|
@@ -117,4 +167,30 @@ var DocumentsMetaFailed = (function (_super) {
|
|
|
117
167
|
return DocumentsMetaFailed;
|
|
118
168
|
}(errors_1.BaseError));
|
|
119
169
|
exports.DocumentsMetaFailed = DocumentsMetaFailed;
|
|
170
|
+
var DocumentsSendFailed = (function (_super) {
|
|
171
|
+
tslib_1.__extends(DocumentsSendFailed, _super);
|
|
172
|
+
function DocumentsSendFailed(message, properties) {
|
|
173
|
+
if (message === void 0) { message = 'Could not send email'; }
|
|
174
|
+
var _this = _super.call(this, message, properties) || this;
|
|
175
|
+
_this.message = message;
|
|
176
|
+
_this.name = 'DocumentsSendFailed';
|
|
177
|
+
Object.setPrototypeOf(_this, DocumentsSendFailed.prototype);
|
|
178
|
+
return _this;
|
|
179
|
+
}
|
|
180
|
+
return DocumentsSendFailed;
|
|
181
|
+
}(errors_1.BaseError));
|
|
182
|
+
exports.DocumentsSendFailed = DocumentsSendFailed;
|
|
183
|
+
var DocumentsDownloadFailed = (function (_super) {
|
|
184
|
+
tslib_1.__extends(DocumentsDownloadFailed, _super);
|
|
185
|
+
function DocumentsDownloadFailed(message, properties) {
|
|
186
|
+
if (message === void 0) { message = 'Could not download file'; }
|
|
187
|
+
var _this = _super.call(this, message, properties) || this;
|
|
188
|
+
_this.message = message;
|
|
189
|
+
_this.name = 'DocumentsDownloadFailed';
|
|
190
|
+
Object.setPrototypeOf(_this, DocumentsDownloadFailed.prototype);
|
|
191
|
+
return _this;
|
|
192
|
+
}
|
|
193
|
+
return DocumentsDownloadFailed;
|
|
194
|
+
}(errors_1.BaseError));
|
|
195
|
+
exports.DocumentsDownloadFailed = DocumentsDownloadFailed;
|
|
120
196
|
//# sourceMappingURL=documents.js.map
|
package/dist/v0/documents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/v0/documents.ts"],"names":[],"mappings":";;;;AACA,oCAAqC;AACrC,4CAAyC;AACzC,gCAAuC;
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/v0/documents.ts"],"names":[],"mappings":";;;;AACA,oCAAqC;AACrC,4CAAyC;AACzC,gCAAuC;AAqCvC;IAA+B,qCAAa;IAO1C,mBAAa,OAAyB,EAAE,IAAY;;QAApD,YACE,kBAAM,IAAI,EAAE;YACV,QAAQ,EAAE,SAAS,CAAC,YAAY;YAChC,IAAI,QAAE,OAAO,CAAC,IAAI,mCAAI,yBAAyB;SAChD,CAAC,SAOH;QANC,KAAI,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