minikai 1.0.1 → 1.0.2
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 +6 -6
- package/dist/cjs/api/resources/records/client/Client.js +22 -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/BatchUploadRecordsRequest.d.ts +4 -3
- package/dist/cjs/api/resources/records/client/requests/UpdateAttachmentsRequest.d.ts +3 -3
- 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/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 +6 -6
- package/dist/esm/api/resources/records/client/Client.mjs +22 -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/BatchUploadRecordsRequest.d.mts +4 -3
- package/dist/esm/api/resources/records/client/requests/UpdateAttachmentsRequest.d.mts +3 -3
- 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/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 +80 -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 → DuplicateUpsertItemOfBatchUploadRecordItemDto.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 → DuplicateUpsertItemOfBatchUploadRecordItemDto.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.0.2",
|
|
47
|
+
"User-Agent": "minikai/1.0.2",
|
|
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,7 +220,7 @@ 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
|
*/
|
|
@@ -229,7 +229,7 @@ export declare class RecordsClient {
|
|
|
229
229
|
/**
|
|
230
230
|
* @deprecated
|
|
231
231
|
*
|
|
232
|
-
* Deprecated. Create Records with attachments in one request. Use POST /Records/batch followed by POST /Records/batch/attachments instead.
|
|
232
|
+
* 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
233
|
*
|
|
234
234
|
* @param {Minikai.BatchUploadRecordsRequest} request
|
|
235
235
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -240,7 +240,7 @@ export declare class RecordsClient {
|
|
|
240
240
|
* @example
|
|
241
241
|
* import { createReadStream } from "fs";
|
|
242
242
|
* await client.records.batchUploadRecords({
|
|
243
|
-
* files: ["
|
|
243
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
244
244
|
* items: "items"
|
|
245
245
|
* })
|
|
246
246
|
*/
|
|
@@ -296,7 +296,7 @@ export declare class RecordsClient {
|
|
|
296
296
|
* @example
|
|
297
297
|
* import { createReadStream } from "fs";
|
|
298
298
|
* await client.records.addAttachments("recordId", {
|
|
299
|
-
* files: ["
|
|
299
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
300
300
|
* })
|
|
301
301
|
*/
|
|
302
302
|
addAttachments(recordId: string, request: Minikai.AddAttachmentsRequest, requestOptions?: RecordsClient.RequestOptions): core.HttpResponsePromise<string[]>;
|
|
@@ -314,7 +314,7 @@ export declare class RecordsClient {
|
|
|
314
314
|
* @example
|
|
315
315
|
* import { createReadStream } from "fs";
|
|
316
316
|
* await client.records.updateAttachments("recordId", {
|
|
317
|
-
* files: ["
|
|
317
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
318
318
|
* })
|
|
319
319
|
*/
|
|
320
320
|
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();
|
|
@@ -878,7 +878,7 @@ class RecordsClient {
|
|
|
878
878
|
/**
|
|
879
879
|
* @deprecated
|
|
880
880
|
*
|
|
881
|
-
* Deprecated. Create Records with attachments in one request. Use POST /Records/batch followed by POST /Records/batch/attachments instead.
|
|
881
|
+
* 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
882
|
*
|
|
883
883
|
* @param {Minikai.BatchUploadRecordsRequest} request
|
|
884
884
|
* @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -889,7 +889,7 @@ class RecordsClient {
|
|
|
889
889
|
* @example
|
|
890
890
|
* import { createReadStream } from "fs";
|
|
891
891
|
* await client.records.batchUploadRecords({
|
|
892
|
-
* files: ["
|
|
892
|
+
* files: [fs.createReadStream("/path/to/your/file")],
|
|
893
893
|
* items: "items"
|
|
894
894
|
* })
|
|
895
895
|
*/
|
|
@@ -899,9 +899,12 @@ class RecordsClient {
|
|
|
899
899
|
__batchUploadRecords(request, requestOptions) {
|
|
900
900
|
return __awaiter(this, void 0, void 0, function* () {
|
|
901
901
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
902
|
+
const _queryParams = {
|
|
903
|
+
allowDuplicates: request.allowDuplicates,
|
|
904
|
+
};
|
|
902
905
|
const _body = yield core.newFormData();
|
|
903
|
-
for (const
|
|
904
|
-
_body.
|
|
906
|
+
for (const _file of request.files) {
|
|
907
|
+
yield _body.appendFile("files", _file);
|
|
905
908
|
}
|
|
906
909
|
_body.append("items", request.items);
|
|
907
910
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
@@ -911,7 +914,11 @@ class RecordsClient {
|
|
|
911
914
|
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
915
|
method: "POST",
|
|
913
916
|
headers: _headers,
|
|
914
|
-
queryString: core.url
|
|
917
|
+
queryString: core.url
|
|
918
|
+
.queryBuilder()
|
|
919
|
+
.addMany(_queryParams)
|
|
920
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
921
|
+
.build(),
|
|
915
922
|
requestType: "file",
|
|
916
923
|
duplex: _maybeEncodedRequest.duplex,
|
|
917
924
|
body: _maybeEncodedRequest.body,
|
|
@@ -1074,7 +1081,7 @@ class RecordsClient {
|
|
|
1074
1081
|
* @example
|
|
1075
1082
|
* import { createReadStream } from "fs";
|
|
1076
1083
|
* await client.records.addAttachments("recordId", {
|
|
1077
|
-
* files: ["
|
|
1084
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
1078
1085
|
* })
|
|
1079
1086
|
*/
|
|
1080
1087
|
addAttachments(recordId, request, requestOptions) {
|
|
@@ -1084,8 +1091,8 @@ class RecordsClient {
|
|
|
1084
1091
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1085
1092
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1086
1093
|
const _body = yield core.newFormData();
|
|
1087
|
-
for (const
|
|
1088
|
-
_body.
|
|
1094
|
+
for (const _file of request.files) {
|
|
1095
|
+
yield _body.appendFile("files", _file);
|
|
1089
1096
|
}
|
|
1090
1097
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
1091
1098
|
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
@@ -1137,7 +1144,7 @@ class RecordsClient {
|
|
|
1137
1144
|
* @example
|
|
1138
1145
|
* import { createReadStream } from "fs";
|
|
1139
1146
|
* await client.records.updateAttachments("recordId", {
|
|
1140
|
-
* files: ["
|
|
1147
|
+
* files: [fs.createReadStream("/path/to/your/file")]
|
|
1141
1148
|
* })
|
|
1142
1149
|
*/
|
|
1143
1150
|
updateAttachments(recordId, request, requestOptions) {
|
|
@@ -1147,8 +1154,8 @@ class RecordsClient {
|
|
|
1147
1154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1148
1155
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1149
1156
|
const _body = yield core.newFormData();
|
|
1150
|
-
for (const
|
|
1151
|
-
_body.
|
|
1157
|
+
for (const _file of request.files) {
|
|
1158
|
+
yield _body.appendFile("files", _file);
|
|
1152
1159
|
}
|
|
1153
1160
|
const _maybeEncodedRequest = yield _body.getRequest();
|
|
1154
1161
|
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
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
+
}
|
|
@@ -6,14 +6,15 @@ export * from "./BatchUpsertResult.js";
|
|
|
6
6
|
export * from "./CursorPaginatedListOfMiniVersionDto.js";
|
|
7
7
|
export * from "./CursorPaginatedListOfRecordDto.js";
|
|
8
8
|
export * from "./CursorPaginatedListOfRecordVersionDto.js";
|
|
9
|
+
export * from "./DuplicateUpsertItemOfBatchUploadRecordItemDto.js";
|
|
10
|
+
export * from "./DuplicateUpsertItemOfUpsertRecordDto.js";
|
|
11
|
+
export * from "./ExistingDuplicateRecordMatch.js";
|
|
9
12
|
export * from "./FailedAttachmentItem.js";
|
|
10
13
|
export * from "./FailedUploadItem.js";
|
|
11
14
|
export * from "./FailedUpsertItem.js";
|
|
12
15
|
export * from "./HttpValidationProblemDetails.js";
|
|
13
16
|
export * from "./Identity.js";
|
|
14
17
|
export * from "./IdentityKind.js";
|
|
15
|
-
export * from "./IFormFile.js";
|
|
16
|
-
export * from "./IFormFileCollection.js";
|
|
17
18
|
export * from "./LabelDto.js";
|
|
18
19
|
export * from "./LabelGroupDto.js";
|
|
19
20
|
export * from "./LabelResourceType.js";
|
|
@@ -22,14 +22,15 @@ __exportStar(require("./BatchUpsertResult.js"), exports);
|
|
|
22
22
|
__exportStar(require("./CursorPaginatedListOfMiniVersionDto.js"), exports);
|
|
23
23
|
__exportStar(require("./CursorPaginatedListOfRecordDto.js"), exports);
|
|
24
24
|
__exportStar(require("./CursorPaginatedListOfRecordVersionDto.js"), exports);
|
|
25
|
+
__exportStar(require("./DuplicateUpsertItemOfBatchUploadRecordItemDto.js"), exports);
|
|
26
|
+
__exportStar(require("./DuplicateUpsertItemOfUpsertRecordDto.js"), exports);
|
|
27
|
+
__exportStar(require("./ExistingDuplicateRecordMatch.js"), exports);
|
|
25
28
|
__exportStar(require("./FailedAttachmentItem.js"), exports);
|
|
26
29
|
__exportStar(require("./FailedUploadItem.js"), exports);
|
|
27
30
|
__exportStar(require("./FailedUpsertItem.js"), exports);
|
|
28
31
|
__exportStar(require("./HttpValidationProblemDetails.js"), exports);
|
|
29
32
|
__exportStar(require("./Identity.js"), exports);
|
|
30
33
|
__exportStar(require("./IdentityKind.js"), exports);
|
|
31
|
-
__exportStar(require("./IFormFile.js"), exports);
|
|
32
|
-
__exportStar(require("./IFormFileCollection.js"), exports);
|
|
33
34
|
__exportStar(require("./LabelDto.js"), exports);
|
|
34
35
|
__exportStar(require("./LabelGroupDto.js"), exports);
|
|
35
36
|
__exportStar(require("./LabelResourceType.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.0.
|
|
1
|
+
export declare const SDK_VERSION = "1.0.2";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "minikai",
|
|
9
|
-
"X-Fern-SDK-Version": "1.0.
|
|
10
|
-
"User-Agent": "minikai/1.0.
|
|
9
|
+
"X-Fern-SDK-Version": "1.0.2",
|
|
10
|
+
"User-Agent": "minikai/1.0.2",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, 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>;
|