minikai 1.0.1 → 1.1.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 +45 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/minis/client/Client.d.ts +18 -1
- package/dist/cjs/api/resources/minis/client/Client.js +59 -2
- package/dist/cjs/api/resources/minis/client/requests/UpdateMiniLabelsCommand.d.ts +10 -0
- package/dist/cjs/api/resources/minis/client/requests/UploadMiniProfilePictureRequest.d.ts +3 -3
- package/dist/cjs/api/resources/minis/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/records/client/Client.d.ts +24 -6
- package/dist/cjs/api/resources/records/client/Client.js +86 -15
- package/dist/cjs/api/resources/records/client/requests/AddAttachmentsRequest.d.ts +3 -3
- package/dist/cjs/api/resources/records/client/requests/BatchAddAttachmentsRequest.d.ts +3 -3
- package/dist/cjs/api/resources/records/client/requests/BatchUpdateAttachmentsRequest.d.ts +12 -0
- package/dist/cjs/api/resources/records/client/requests/BatchUploadRecordsRequest.d.ts +4 -3
- package/dist/cjs/api/resources/records/client/requests/UpdateAttachmentsRequest.d.ts +3 -3
- package/dist/cjs/api/resources/records/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/types/BatchUploadResult.d.ts +1 -0
- package/dist/cjs/api/types/BatchUpsertResult.d.ts +1 -0
- package/dist/cjs/api/types/DuplicateUpsertItemOfBatchUploadRecordItemDto.d.ts +10 -0
- package/dist/cjs/api/types/DuplicateUpsertItemOfBatchUploadRecordItemDto.js +3 -0
- package/dist/cjs/api/types/DuplicateUpsertItemOfUpsertRecordDto.d.ts +10 -0
- package/dist/cjs/api/types/DuplicateUpsertItemOfUpsertRecordDto.js +3 -0
- package/dist/cjs/api/types/ExistingDuplicateRecordMatch.d.ts +5 -0
- package/dist/cjs/api/types/ExistingDuplicateRecordMatch.js +3 -0
- package/dist/cjs/api/types/UpsertRecordsByExternalUriCommand.d.ts +1 -0
- package/dist/cjs/api/types/index.d.ts +3 -2
- package/dist/cjs/api/types/index.js +3 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/minis/client/Client.d.mts +18 -1
- package/dist/esm/api/resources/minis/client/Client.mjs +59 -2
- package/dist/esm/api/resources/minis/client/requests/UpdateMiniLabelsCommand.d.mts +10 -0
- package/dist/esm/api/resources/minis/client/requests/UploadMiniProfilePictureRequest.d.mts +3 -3
- package/dist/esm/api/resources/minis/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/records/client/Client.d.mts +24 -6
- package/dist/esm/api/resources/records/client/Client.mjs +86 -15
- package/dist/esm/api/resources/records/client/requests/AddAttachmentsRequest.d.mts +3 -3
- package/dist/esm/api/resources/records/client/requests/BatchAddAttachmentsRequest.d.mts +3 -3
- package/dist/esm/api/resources/records/client/requests/BatchUpdateAttachmentsRequest.d.mts +12 -0
- package/dist/esm/api/resources/records/client/requests/BatchUploadRecordsRequest.d.mts +4 -3
- package/dist/esm/api/resources/records/client/requests/UpdateAttachmentsRequest.d.mts +3 -3
- package/dist/esm/api/resources/records/client/requests/index.d.mts +1 -0
- package/dist/esm/api/types/BatchUploadResult.d.mts +1 -0
- package/dist/esm/api/types/BatchUpsertResult.d.mts +1 -0
- package/dist/esm/api/types/DuplicateUpsertItemOfBatchUploadRecordItemDto.d.mts +10 -0
- package/dist/esm/api/types/DuplicateUpsertItemOfBatchUploadRecordItemDto.mjs +2 -0
- package/dist/esm/api/types/DuplicateUpsertItemOfUpsertRecordDto.d.mts +10 -0
- package/dist/esm/api/types/DuplicateUpsertItemOfUpsertRecordDto.mjs +2 -0
- package/dist/esm/api/types/ExistingDuplicateRecordMatch.d.mts +5 -0
- package/dist/esm/api/types/ExistingDuplicateRecordMatch.mjs +2 -0
- package/dist/esm/api/types/UpsertRecordsByExternalUriCommand.d.mts +1 -0
- package/dist/esm/api/types/index.d.mts +3 -2
- package/dist/esm/api/types/index.mjs +3 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +146 -7
- package/dist/cjs/api/types/IFormFile.d.ts +0 -1
- package/dist/cjs/api/types/IFormFileCollection.d.ts +0 -2
- package/dist/esm/api/types/IFormFile.d.mts +0 -1
- package/dist/esm/api/types/IFormFileCollection.d.mts +0 -2
- /package/dist/cjs/api/{types/IFormFile.js → resources/minis/client/requests/UpdateMiniLabelsCommand.js} +0 -0
- /package/dist/cjs/api/{types/IFormFileCollection.js → resources/records/client/requests/BatchUpdateAttachmentsRequest.js} +0 -0
- /package/dist/esm/api/{types/IFormFile.mjs → resources/minis/client/requests/UpdateMiniLabelsCommand.mjs} +0 -0
- /package/dist/esm/api/{types/IFormFileCollection.mjs → resources/records/client/requests/BatchUpdateAttachmentsRequest.mjs} +0 -0
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@ The Minikai TypeScript library provides convenient access to the Minikai APIs fr
|
|
|
13
13
|
- [Environments](#environments)
|
|
14
14
|
- [Request and Response Types](#request-and-response-types)
|
|
15
15
|
- [Exception Handling](#exception-handling)
|
|
16
|
+
- [File Uploads](#file-uploads)
|
|
16
17
|
- [Advanced](#advanced)
|
|
17
18
|
- [Subpackage Exports](#subpackage-exports)
|
|
18
19
|
- [Additional Headers](#additional-headers)
|
|
@@ -95,6 +96,50 @@ try {
|
|
|
95
96
|
}
|
|
96
97
|
```
|
|
97
98
|
|
|
99
|
+
## File Uploads
|
|
100
|
+
|
|
101
|
+
You can upload files using the client:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { createReadStream } from "fs";
|
|
105
|
+
import * as fs from "fs";
|
|
106
|
+
import { MinikaiClient } from "minikai";
|
|
107
|
+
|
|
108
|
+
const client = new MinikaiClient({ token: "YOUR_TOKEN" });
|
|
109
|
+
await client.minis.uploadMiniProfilePicture("id", {
|
|
110
|
+
file: fs.createReadStream("/path/to/your/file")
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
The client accepts a variety of types for file upload parameters:
|
|
114
|
+
* Stream types: `fs.ReadStream`, `stream.Readable`, and `ReadableStream`
|
|
115
|
+
* Buffered types: `Buffer`, `Blob`, `File`, `ArrayBuffer`, `ArrayBufferView`, and `Uint8Array`
|
|
116
|
+
|
|
117
|
+
### Metadata
|
|
118
|
+
|
|
119
|
+
You can configure metadata when uploading a file:
|
|
120
|
+
```typescript
|
|
121
|
+
const file: Uploadable.WithMetadata = {
|
|
122
|
+
data: createReadStream("path/to/file"),
|
|
123
|
+
filename: "my-file", // optional
|
|
124
|
+
contentType: "audio/mpeg", // optional
|
|
125
|
+
contentLength: 1949, // optional
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Alternatively, you can upload a file directly from a file path:
|
|
130
|
+
```typescript
|
|
131
|
+
const file : Uploadable.FromPath = {
|
|
132
|
+
path: "path/to/file",
|
|
133
|
+
filename: "my-file", // optional
|
|
134
|
+
contentType: "audio/mpeg", // optional
|
|
135
|
+
contentLength: 1949, // optional
|
|
136
|
+
};
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The metadata is used to set the `Content-Length`, `Content-Type`, and `Content-Disposition` headers. If not provided, the client will attempt to determine them automatically.
|
|
140
|
+
For example, `fs.ReadStream` has a `path` property which the SDK uses to retrieve the file size from the filesystem without loading it into memory.
|
|
141
|
+
|
|
142
|
+
|
|
98
143
|
## Advanced
|
|
99
144
|
|
|
100
145
|
### Subpackage Exports
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "minikai",
|
|
46
|
-
"X-Fern-SDK-Version": "1.0
|
|
47
|
-
"User-Agent": "minikai/1.0
|
|
46
|
+
"X-Fern-SDK-Version": "1.1.0",
|
|
47
|
+
"User-Agent": "minikai/1.1.0",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -141,6 +141,23 @@ export declare class MinisClient {
|
|
|
141
141
|
*/
|
|
142
142
|
patchMini(id: string, request?: Minikai.PatchMiniCommand, requestOptions?: MinisClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
143
143
|
private __patchMini;
|
|
144
|
+
/**
|
|
145
|
+
* Replace a Mini's labels.
|
|
146
|
+
*
|
|
147
|
+
* @param {string} id - Either the Minikai-assigned Guid for this resource (e.g. `abc12345-1234-1234-1234-123456789abc`) or the resource's `externalUri`, URL-encoded (e.g. `https%3A%2F%2Fpartner.example.com%2Fpatients%2F48291`). Responses always return the canonical Guid in the `id` field.
|
|
148
|
+
* @param {Minikai.UpdateMiniLabelsCommand} request
|
|
149
|
+
* @param {MinisClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
150
|
+
*
|
|
151
|
+
* @throws {@link Minikai.BadRequestError}
|
|
152
|
+
* @throws {@link Minikai.NotFoundError}
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* await client.minis.updateMiniLabels("id", {
|
|
156
|
+
* labels: ["labels"]
|
|
157
|
+
* })
|
|
158
|
+
*/
|
|
159
|
+
updateMiniLabels(id: string, request: Minikai.UpdateMiniLabelsCommand, requestOptions?: MinisClient.RequestOptions): core.HttpResponsePromise<void>;
|
|
160
|
+
private __updateMiniLabels;
|
|
144
161
|
/**
|
|
145
162
|
* List a Mini's version history.
|
|
146
163
|
*
|
|
@@ -182,7 +199,7 @@ export declare class MinisClient {
|
|
|
182
199
|
* @example
|
|
183
200
|
* import { createReadStream } from "fs";
|
|
184
201
|
* await client.minis.uploadMiniProfilePicture("id", {
|
|
185
|
-
* file: "file"
|
|
202
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
186
203
|
* })
|
|
187
204
|
*/
|
|
188
205
|
uploadMiniProfilePicture(id: string, request: Minikai.UploadMiniProfilePictureRequest, requestOptions?: MinisClient.RequestOptions): core.HttpResponsePromise<string>;
|
|
@@ -534,6 +534,63 @@ class MinisClient {
|
|
|
534
534
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/api/v1/Minis/{id}");
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
|
+
/**
|
|
538
|
+
* Replace a Mini's labels.
|
|
539
|
+
*
|
|
540
|
+
* @param {string} id - Either the Minikai-assigned Guid for this resource (e.g. `abc12345-1234-1234-1234-123456789abc`) or the resource's `externalUri`, URL-encoded (e.g. `https%3A%2F%2Fpartner.example.com%2Fpatients%2F48291`). Responses always return the canonical Guid in the `id` field.
|
|
541
|
+
* @param {Minikai.UpdateMiniLabelsCommand} request
|
|
542
|
+
* @param {MinisClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
543
|
+
*
|
|
544
|
+
* @throws {@link Minikai.BadRequestError}
|
|
545
|
+
* @throws {@link Minikai.NotFoundError}
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* await client.minis.updateMiniLabels("id", {
|
|
549
|
+
* labels: ["labels"]
|
|
550
|
+
* })
|
|
551
|
+
*/
|
|
552
|
+
updateMiniLabels(id, request, requestOptions) {
|
|
553
|
+
return core.HttpResponsePromise.fromPromise(this.__updateMiniLabels(id, request, requestOptions));
|
|
554
|
+
}
|
|
555
|
+
__updateMiniLabels(id, request, requestOptions) {
|
|
556
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
557
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
558
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
559
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
560
|
+
const _response = yield core.fetcher({
|
|
561
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MinikaiEnvironment.Default, `api/v1/Minis/${core.url.encodePathParam(id)}/labels`),
|
|
562
|
+
method: "PUT",
|
|
563
|
+
headers: _headers,
|
|
564
|
+
contentType: "application/json",
|
|
565
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
566
|
+
requestType: "json",
|
|
567
|
+
body: request,
|
|
568
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
569
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
570
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
571
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
572
|
+
logging: this._options.logging,
|
|
573
|
+
});
|
|
574
|
+
if (_response.ok) {
|
|
575
|
+
return { data: undefined, rawResponse: _response.rawResponse };
|
|
576
|
+
}
|
|
577
|
+
if (_response.error.reason === "status-code") {
|
|
578
|
+
switch (_response.error.statusCode) {
|
|
579
|
+
case 400:
|
|
580
|
+
throw new Minikai.BadRequestError(_response.error.body, _response.rawResponse);
|
|
581
|
+
case 404:
|
|
582
|
+
throw new Minikai.NotFoundError(_response.error.body, _response.rawResponse);
|
|
583
|
+
default:
|
|
584
|
+
throw new errors.MinikaiError({
|
|
585
|
+
statusCode: _response.error.statusCode,
|
|
586
|
+
body: _response.error.body,
|
|
587
|
+
rawResponse: _response.rawResponse,
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/api/v1/Minis/{id}/labels");
|
|
592
|
+
});
|
|
593
|
+
}
|
|
537
594
|
/**
|
|
538
595
|
* List a Mini's version history.
|
|
539
596
|
*
|
|
@@ -657,7 +714,7 @@ class MinisClient {
|
|
|
657
714
|
* @example
|
|
658
715
|
* import { createReadStream } from "fs";
|
|
659
716
|
* await client.minis.uploadMiniProfilePicture("id", {
|
|
660
|
-
* file: "file"
|
|
717
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
661
718
|
* })
|
|
662
719
|
*/
|
|
663
720
|
uploadMiniProfilePicture(id, request, requestOptions) {
|
|
@@ -667,7 +724,7 @@ class MinisClient {
|
|
|
667
724
|
return __awaiter(this, void 0, void 0, function* () {
|
|
668
725
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
669
726
|
const _body = yield core.newFormData();
|
|
670
|
-
_body.
|
|
727
|
+
yield _body.appendFile("file", request.file);
|
|
671
728
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
672
729
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
673
730
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type * as
|
|
1
|
+
import type * as core from "../../../../../core/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* file: "file"
|
|
5
|
+
* file: fs.createReadStream("/path/to/your/file")
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface UploadMiniProfilePictureRequest {
|
|
9
|
-
file:
|
|
9
|
+
file: core.file.Uploadable;
|
|
10
10
|
}
|
|
@@ -5,5 +5,6 @@ export type { GetMiniVersionsRequest } from "./GetMiniVersionsRequest.js";
|
|
|
5
5
|
export type { PatchMiniCommand } from "./PatchMiniCommand.js";
|
|
6
6
|
export type { SearchMinisFullTextQuery } from "./SearchMinisFullTextQuery.js";
|
|
7
7
|
export type { UpdateMiniCommand } from "./UpdateMiniCommand.js";
|
|
8
|
+
export type { UpdateMiniLabelsCommand } from "./UpdateMiniLabelsCommand.js";
|
|
8
9
|
export type { UploadMiniProfilePictureRequest } from "./UploadMiniProfilePictureRequest.js";
|
|
9
10
|
export type { UpsertExternalMiniCommand } from "./UpsertExternalMiniCommand.js";
|
|
@@ -190,7 +190,7 @@ export declare class RecordsClient {
|
|
|
190
190
|
submitDraftRecord(recordId: string, request: Minikai.SubmitDraftRecordRequest, requestOptions?: RecordsClient.RequestOptions): core.HttpResponsePromise<string>;
|
|
191
191
|
private __submitDraftRecord;
|
|
192
192
|
/**
|
|
193
|
-
* Create or update many Records in one request.
|
|
193
|
+
* Create or update many Records in one request. By default, create-only items with the same normalized title and exact eventDate as an existing accessible Record in the same Mini, or an earlier create-only item in the same request, are skipped and returned in Duplicates. Set allowDuplicates to true to skip duplicate detection.
|
|
194
194
|
*
|
|
195
195
|
* @param {Minikai.UpsertRecordsByExternalUriCommand} request
|
|
196
196
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -220,16 +220,34 @@ export declare class RecordsClient {
|
|
|
220
220
|
* @example
|
|
221
221
|
* import { createReadStream } from "fs";
|
|
222
222
|
* await client.records.batchAddAttachments({
|
|
223
|
-
* files: ["
|
|
223
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
224
224
|
* items: "items"
|
|
225
225
|
* })
|
|
226
226
|
*/
|
|
227
227
|
batchAddAttachments(request: Minikai.BatchAddAttachmentsRequest, requestOptions?: RecordsClient.RequestOptions): core.HttpResponsePromise<Minikai.BatchAttachmentResult>;
|
|
228
228
|
private __batchAddAttachments;
|
|
229
|
+
/**
|
|
230
|
+
* Replace the attachments on many Records in one request. Each Record's attachments are overwritten with the files supplied for it, reusing files whose name and checksum already match and removing the rest.
|
|
231
|
+
*
|
|
232
|
+
* @param {Minikai.BatchUpdateAttachmentsRequest} request
|
|
233
|
+
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
234
|
+
*
|
|
235
|
+
* @throws {@link Minikai.BadRequestError}
|
|
236
|
+
* @throws {@link Minikai.UnprocessableEntityError}
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* import { createReadStream } from "fs";
|
|
240
|
+
* await client.records.batchUpdateAttachments({
|
|
241
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
242
|
+
* items: "items"
|
|
243
|
+
* })
|
|
244
|
+
*/
|
|
245
|
+
batchUpdateAttachments(request: Minikai.BatchUpdateAttachmentsRequest, requestOptions?: RecordsClient.RequestOptions): core.HttpResponsePromise<Minikai.BatchAttachmentResult>;
|
|
246
|
+
private __batchUpdateAttachments;
|
|
229
247
|
/**
|
|
230
248
|
* @deprecated
|
|
231
249
|
*
|
|
232
|
-
* Deprecated. Create Records with attachments in one request. Use POST /Records/batch followed by POST /Records/batch/attachments instead.
|
|
250
|
+
* Deprecated. Create Records with attachments in one request. By default, create-only items with the same normalized title and exact eventDate as an existing accessible Record in the same Mini, or an earlier create-only item in the same request, are skipped and returned in Duplicates. Set allowDuplicates to true to skip duplicate detection. Use POST /Records/batch followed by POST /Records/batch/attachments instead.
|
|
233
251
|
*
|
|
234
252
|
* @param {Minikai.BatchUploadRecordsRequest} request
|
|
235
253
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -240,7 +258,7 @@ export declare class RecordsClient {
|
|
|
240
258
|
* @example
|
|
241
259
|
* import { createReadStream } from "fs";
|
|
242
260
|
* await client.records.batchUploadRecords({
|
|
243
|
-
* files: ["
|
|
261
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
244
262
|
* items: "items"
|
|
245
263
|
* })
|
|
246
264
|
*/
|
|
@@ -296,7 +314,7 @@ export declare class RecordsClient {
|
|
|
296
314
|
* @example
|
|
297
315
|
* import { createReadStream } from "fs";
|
|
298
316
|
* await client.records.addAttachments("recordId", {
|
|
299
|
-
* files: ["
|
|
317
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
300
318
|
* })
|
|
301
319
|
*/
|
|
302
320
|
addAttachments(recordId: string, request: Minikai.AddAttachmentsRequest, requestOptions?: RecordsClient.RequestOptions): core.HttpResponsePromise<string[]>;
|
|
@@ -314,7 +332,7 @@ export declare class RecordsClient {
|
|
|
314
332
|
* @example
|
|
315
333
|
* import { createReadStream } from "fs";
|
|
316
334
|
* await client.records.updateAttachments("recordId", {
|
|
317
|
-
* files: ["
|
|
335
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
318
336
|
* })
|
|
319
337
|
*/
|
|
320
338
|
updateAttachments(recordId: string, request: Minikai.UpdateAttachmentsRequest, requestOptions?: RecordsClient.RequestOptions): core.HttpResponsePromise<string[]>;
|
|
@@ -753,7 +753,7 @@ class RecordsClient {
|
|
|
753
753
|
});
|
|
754
754
|
}
|
|
755
755
|
/**
|
|
756
|
-
* Create or update many Records in one request.
|
|
756
|
+
* Create or update many Records in one request. By default, create-only items with the same normalized title and exact eventDate as an existing accessible Record in the same Mini, or an earlier create-only item in the same request, are skipped and returned in Duplicates. Set allowDuplicates to true to skip duplicate detection.
|
|
757
757
|
*
|
|
758
758
|
* @param {Minikai.UpsertRecordsByExternalUriCommand} request
|
|
759
759
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -823,7 +823,7 @@ class RecordsClient {
|
|
|
823
823
|
* @example
|
|
824
824
|
* import { createReadStream } from "fs";
|
|
825
825
|
* await client.records.batchAddAttachments({
|
|
826
|
-
* files: ["
|
|
826
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
827
827
|
* items: "items"
|
|
828
828
|
* })
|
|
829
829
|
*/
|
|
@@ -834,8 +834,8 @@ class RecordsClient {
|
|
|
834
834
|
return __awaiter(this, void 0, void 0, function* () {
|
|
835
835
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
836
836
|
const _body = yield core.newFormData();
|
|
837
|
-
for (const
|
|
838
|
-
_body.
|
|
837
|
+
for (const _file of request.files) {
|
|
838
|
+
yield _body.appendFile("files", _file);
|
|
839
839
|
}
|
|
840
840
|
_body.append("items", request.items);
|
|
841
841
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
@@ -875,10 +875,74 @@ class RecordsClient {
|
|
|
875
875
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/Records/batch/attachments");
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
|
+
/**
|
|
879
|
+
* Replace the attachments on many Records in one request. Each Record's attachments are overwritten with the files supplied for it, reusing files whose name and checksum already match and removing the rest.
|
|
880
|
+
*
|
|
881
|
+
* @param {Minikai.BatchUpdateAttachmentsRequest} request
|
|
882
|
+
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
883
|
+
*
|
|
884
|
+
* @throws {@link Minikai.BadRequestError}
|
|
885
|
+
* @throws {@link Minikai.UnprocessableEntityError}
|
|
886
|
+
*
|
|
887
|
+
* @example
|
|
888
|
+
* import { createReadStream } from "fs";
|
|
889
|
+
* await client.records.batchUpdateAttachments({
|
|
890
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
891
|
+
* items: "items"
|
|
892
|
+
* })
|
|
893
|
+
*/
|
|
894
|
+
batchUpdateAttachments(request, requestOptions) {
|
|
895
|
+
return core.HttpResponsePromise.fromPromise(this.__batchUpdateAttachments(request, requestOptions));
|
|
896
|
+
}
|
|
897
|
+
__batchUpdateAttachments(request, requestOptions) {
|
|
898
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
899
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
900
|
+
const _body = yield core.newFormData();
|
|
901
|
+
for (const _file of request.files) {
|
|
902
|
+
yield _body.appendFile("files", _file);
|
|
903
|
+
}
|
|
904
|
+
_body.append("items", request.items);
|
|
905
|
+
const _maybeEncodedRequest = yield _body.getRequest();
|
|
906
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
907
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
908
|
+
const _response = yield core.fetcher({
|
|
909
|
+
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MinikaiEnvironment.Default, "api/v1/Records/batch/attachments"),
|
|
910
|
+
method: "PUT",
|
|
911
|
+
headers: _headers,
|
|
912
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
913
|
+
requestType: "file",
|
|
914
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
915
|
+
body: _maybeEncodedRequest.body,
|
|
916
|
+
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
917
|
+
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
918
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
919
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
920
|
+
logging: this._options.logging,
|
|
921
|
+
});
|
|
922
|
+
if (_response.ok) {
|
|
923
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
924
|
+
}
|
|
925
|
+
if (_response.error.reason === "status-code") {
|
|
926
|
+
switch (_response.error.statusCode) {
|
|
927
|
+
case 400:
|
|
928
|
+
throw new Minikai.BadRequestError(_response.error.body, _response.rawResponse);
|
|
929
|
+
case 422:
|
|
930
|
+
throw new Minikai.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
931
|
+
default:
|
|
932
|
+
throw new errors.MinikaiError({
|
|
933
|
+
statusCode: _response.error.statusCode,
|
|
934
|
+
body: _response.error.body,
|
|
935
|
+
rawResponse: _response.rawResponse,
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/api/v1/Records/batch/attachments");
|
|
940
|
+
});
|
|
941
|
+
}
|
|
878
942
|
/**
|
|
879
943
|
* @deprecated
|
|
880
944
|
*
|
|
881
|
-
* Deprecated. Create Records with attachments in one request. Use POST /Records/batch followed by POST /Records/batch/attachments instead.
|
|
945
|
+
* Deprecated. Create Records with attachments in one request. By default, create-only items with the same normalized title and exact eventDate as an existing accessible Record in the same Mini, or an earlier create-only item in the same request, are skipped and returned in Duplicates. Set allowDuplicates to true to skip duplicate detection. Use POST /Records/batch followed by POST /Records/batch/attachments instead.
|
|
882
946
|
*
|
|
883
947
|
* @param {Minikai.BatchUploadRecordsRequest} request
|
|
884
948
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -889,7 +953,7 @@ class RecordsClient {
|
|
|
889
953
|
* @example
|
|
890
954
|
* import { createReadStream } from "fs";
|
|
891
955
|
* await client.records.batchUploadRecords({
|
|
892
|
-
* files: ["
|
|
956
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
893
957
|
* items: "items"
|
|
894
958
|
* })
|
|
895
959
|
*/
|
|
@@ -899,9 +963,12 @@ class RecordsClient {
|
|
|
899
963
|
__batchUploadRecords(request, requestOptions) {
|
|
900
964
|
return __awaiter(this, void 0, void 0, function* () {
|
|
901
965
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
966
|
+
const _queryParams = {
|
|
967
|
+
allowDuplicates: request.allowDuplicates,
|
|
968
|
+
};
|
|
902
969
|
const _body = yield core.newFormData();
|
|
903
|
-
for (const
|
|
904
|
-
_body.
|
|
970
|
+
for (const _file of request.files) {
|
|
971
|
+
yield _body.appendFile("files", _file);
|
|
905
972
|
}
|
|
906
973
|
_body.append("items", request.items);
|
|
907
974
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
@@ -911,7 +978,11 @@ class RecordsClient {
|
|
|
911
978
|
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.MinikaiEnvironment.Default, "api/v1/Records/batch/upload"),
|
|
912
979
|
method: "POST",
|
|
913
980
|
headers: _headers,
|
|
914
|
-
queryString: core.url
|
|
981
|
+
queryString: core.url
|
|
982
|
+
.queryBuilder()
|
|
983
|
+
.addMany(_queryParams)
|
|
984
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
985
|
+
.build(),
|
|
915
986
|
requestType: "file",
|
|
916
987
|
duplex: _maybeEncodedRequest.duplex,
|
|
917
988
|
body: _maybeEncodedRequest.body,
|
|
@@ -1074,7 +1145,7 @@ class RecordsClient {
|
|
|
1074
1145
|
* @example
|
|
1075
1146
|
* import { createReadStream } from "fs";
|
|
1076
1147
|
* await client.records.addAttachments("recordId", {
|
|
1077
|
-
* files: ["
|
|
1148
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
1078
1149
|
* })
|
|
1079
1150
|
*/
|
|
1080
1151
|
addAttachments(recordId, request, requestOptions) {
|
|
@@ -1084,8 +1155,8 @@ class RecordsClient {
|
|
|
1084
1155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1085
1156
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1086
1157
|
const _body = yield core.newFormData();
|
|
1087
|
-
for (const
|
|
1088
|
-
_body.
|
|
1158
|
+
for (const _file of request.files) {
|
|
1159
|
+
yield _body.appendFile("files", _file);
|
|
1089
1160
|
}
|
|
1090
1161
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
1091
1162
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -1137,7 +1208,7 @@ class RecordsClient {
|
|
|
1137
1208
|
* @example
|
|
1138
1209
|
* import { createReadStream } from "fs";
|
|
1139
1210
|
* await client.records.updateAttachments("recordId", {
|
|
1140
|
-
* files: ["
|
|
1211
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
1141
1212
|
* })
|
|
1142
1213
|
*/
|
|
1143
1214
|
updateAttachments(recordId, request, requestOptions) {
|
|
@@ -1147,8 +1218,8 @@ class RecordsClient {
|
|
|
1147
1218
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1148
1219
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1149
1220
|
const _body = yield core.newFormData();
|
|
1150
|
-
for (const
|
|
1151
|
-
_body.
|
|
1221
|
+
for (const _file of request.files) {
|
|
1222
|
+
yield _body.appendFile("files", _file);
|
|
1152
1223
|
}
|
|
1153
1224
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
1154
1225
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type * as
|
|
1
|
+
import type * as core from "../../../../../core/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* files: ["
|
|
5
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface AddAttachmentsRequest {
|
|
9
|
-
files:
|
|
9
|
+
files: core.file.Uploadable[];
|
|
10
10
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type * as
|
|
1
|
+
import type * as core from "../../../../../core/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* files: ["
|
|
5
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
6
6
|
* items: "items"
|
|
7
7
|
* }
|
|
8
8
|
*/
|
|
9
9
|
export interface BatchAddAttachmentsRequest {
|
|
10
|
-
files:
|
|
10
|
+
files: core.file.Uploadable[];
|
|
11
11
|
items: string;
|
|
12
12
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as core from "../../../../../core/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
6
|
+
* items: "items"
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface BatchUpdateAttachmentsRequest {
|
|
10
|
+
files: core.file.Uploadable[];
|
|
11
|
+
items: string;
|
|
12
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type * as
|
|
1
|
+
import type * as core from "../../../../../core/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* files: ["
|
|
5
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
6
6
|
* items: "items"
|
|
7
7
|
* }
|
|
8
8
|
*/
|
|
9
9
|
export interface BatchUploadRecordsRequest {
|
|
10
|
-
|
|
10
|
+
allowDuplicates?: boolean;
|
|
11
|
+
files: core.file.Uploadable[];
|
|
11
12
|
items: string;
|
|
12
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type * as
|
|
1
|
+
import type * as core from "../../../../../core/index.js";
|
|
2
2
|
/**
|
|
3
3
|
* @example
|
|
4
4
|
* {
|
|
5
|
-
* files: ["
|
|
5
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
6
6
|
* }
|
|
7
7
|
*/
|
|
8
8
|
export interface UpdateAttachmentsRequest {
|
|
9
|
-
files:
|
|
9
|
+
files: core.file.Uploadable[];
|
|
10
10
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { AddAttachmentsRequest } from "./AddAttachmentsRequest.js";
|
|
2
2
|
export type { BatchAddAttachmentsRequest } from "./BatchAddAttachmentsRequest.js";
|
|
3
|
+
export type { BatchUpdateAttachmentsRequest } from "./BatchUpdateAttachmentsRequest.js";
|
|
3
4
|
export type { BatchUploadRecordsRequest } from "./BatchUploadRecordsRequest.js";
|
|
4
5
|
export type { CreateDraftRecordCommand } from "./CreateDraftRecordCommand.js";
|
|
5
6
|
export type { CreateRecordCommand } from "./CreateRecordCommand.js";
|
|
@@ -2,6 +2,7 @@ import type * as Minikai from "../index.js";
|
|
|
2
2
|
export interface BatchUploadResult {
|
|
3
3
|
successfulIds?: Record<string, string> | undefined;
|
|
4
4
|
failed?: Minikai.FailedUploadItem[] | undefined;
|
|
5
|
+
duplicates?: Minikai.DuplicateUpsertItemOfBatchUploadRecordItemDto[] | undefined;
|
|
5
6
|
successCount?: unknown | undefined;
|
|
6
7
|
failureCount?: unknown | undefined;
|
|
7
8
|
}
|
|
@@ -2,6 +2,7 @@ import type * as Minikai from "../index.js";
|
|
|
2
2
|
export interface BatchUpsertResult {
|
|
3
3
|
successfulIds?: Record<string, string> | undefined;
|
|
4
4
|
failed?: Minikai.FailedUpsertItem[] | undefined;
|
|
5
|
+
duplicates?: Minikai.DuplicateUpsertItemOfUpsertRecordDto[] | undefined;
|
|
5
6
|
successCount?: unknown | undefined;
|
|
6
7
|
failureCount?: unknown | undefined;
|
|
7
8
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Minikai from "../index.js";
|
|
2
|
+
export interface DuplicateUpsertItemOfBatchUploadRecordItemDto {
|
|
3
|
+
index?: unknown | undefined;
|
|
4
|
+
item: DuplicateUpsertItemOfBatchUploadRecordItemDto.Item;
|
|
5
|
+
existingMatches?: Minikai.ExistingDuplicateRecordMatch[] | undefined;
|
|
6
|
+
intraBatchDuplicateOf?: unknown[] | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace DuplicateUpsertItemOfBatchUploadRecordItemDto {
|
|
9
|
+
type Item = unknown | null | Minikai.BatchUploadRecordItemDto;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as Minikai from "../index.js";
|
|
2
|
+
export interface DuplicateUpsertItemOfUpsertRecordDto {
|
|
3
|
+
index?: unknown | undefined;
|
|
4
|
+
item: DuplicateUpsertItemOfUpsertRecordDto.Item;
|
|
5
|
+
existingMatches?: Minikai.ExistingDuplicateRecordMatch[] | undefined;
|
|
6
|
+
intraBatchDuplicateOf?: unknown[] | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace DuplicateUpsertItemOfUpsertRecordDto {
|
|
9
|
+
type Item = unknown | null | Minikai.UpsertRecordDto;
|
|
10
|
+
}
|