minikai 1.0.2 → 1.2.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.
@@ -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.2",
47
- "User-Agent": "minikai/1.0.2",
46
+ "X-Fern-SDK-Version": "1.2.0",
47
+ "User-Agent": "minikai/1.2.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);
@@ -226,6 +226,24 @@ export declare class RecordsClient {
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
  *
@@ -72,7 +72,7 @@ class RecordsClient {
72
72
  __getRecords(request, requestOptions) {
73
73
  return __awaiter(this, void 0, void 0, function* () {
74
74
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
75
- const { miniId, recordIds, externalUris, recordId, beforeCursor, afterCursor, limitBefore, limitAfter, labels, states, startDate, endDate, createdBy, updatedBy, sortDescending, } = request;
75
+ const { miniId, recordIds, externalUris, recordId, beforeCursor, afterCursor, limitBefore, limitAfter, labels, states, startDate, endDate, createdBy, updatedBy, sortDescending, includeTotalCount, } = request;
76
76
  const _queryParams = {
77
77
  miniId,
78
78
  recordIds,
@@ -89,6 +89,7 @@ class RecordsClient {
89
89
  createdBy,
90
90
  updatedBy,
91
91
  sortDescending,
92
+ includeTotalCount,
92
93
  };
93
94
  const _authRequest = yield this._options.authProvider.getAuthRequest();
94
95
  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);
@@ -875,6 +876,70 @@ class RecordsClient {
875
876
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/v1/Records/batch/attachments");
876
877
  });
877
878
  }
879
+ /**
880
+ * 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.
881
+ *
882
+ * @param {Minikai.BatchUpdateAttachmentsRequest} request
883
+ * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
884
+ *
885
+ * @throws {@link Minikai.BadRequestError}
886
+ * @throws {@link Minikai.UnprocessableEntityError}
887
+ *
888
+ * @example
889
+ * import { createReadStream } from "fs";
890
+ * await client.records.batchUpdateAttachments({
891
+ * files: [fs.createReadStream("/path/to/your/file")],
892
+ * items: "items"
893
+ * })
894
+ */
895
+ batchUpdateAttachments(request, requestOptions) {
896
+ return core.HttpResponsePromise.fromPromise(this.__batchUpdateAttachments(request, requestOptions));
897
+ }
898
+ __batchUpdateAttachments(request, requestOptions) {
899
+ return __awaiter(this, void 0, void 0, function* () {
900
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
901
+ const _body = yield core.newFormData();
902
+ for (const _file of request.files) {
903
+ yield _body.appendFile("files", _file);
904
+ }
905
+ _body.append("items", request.items);
906
+ const _maybeEncodedRequest = yield _body.getRequest();
907
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
908
+ 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);
909
+ const _response = yield core.fetcher({
910
+ 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"),
911
+ method: "PUT",
912
+ headers: _headers,
913
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
914
+ requestType: "file",
915
+ duplex: _maybeEncodedRequest.duplex,
916
+ body: _maybeEncodedRequest.body,
917
+ 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,
918
+ 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,
919
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
920
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
921
+ logging: this._options.logging,
922
+ });
923
+ if (_response.ok) {
924
+ return { data: _response.body, rawResponse: _response.rawResponse };
925
+ }
926
+ if (_response.error.reason === "status-code") {
927
+ switch (_response.error.statusCode) {
928
+ case 400:
929
+ throw new Minikai.BadRequestError(_response.error.body, _response.rawResponse);
930
+ case 422:
931
+ throw new Minikai.UnprocessableEntityError(_response.error.body, _response.rawResponse);
932
+ default:
933
+ throw new errors.MinikaiError({
934
+ statusCode: _response.error.statusCode,
935
+ body: _response.error.body,
936
+ rawResponse: _response.rawResponse,
937
+ });
938
+ }
939
+ }
940
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/api/v1/Records/batch/attachments");
941
+ });
942
+ }
878
943
  /**
879
944
  * @deprecated
880
945
  *
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -21,4 +21,5 @@ export interface GetRecordsRequest {
21
21
  createdBy?: string | string[];
22
22
  updatedBy?: string | string[];
23
23
  sortDescending?: boolean;
24
+ includeTotalCount?: boolean;
24
25
  }
@@ -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";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.2";
1
+ export declare const SDK_VERSION = "1.2.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.0.2";
4
+ exports.SDK_VERSION = "1.2.0";
@@ -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.2",
10
- "User-Agent": "minikai/1.0.2",
9
+ "X-Fern-SDK-Version": "1.2.0",
10
+ "User-Agent": "minikai/1.2.0",
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);
@@ -226,6 +226,24 @@ export declare class RecordsClient {
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
  *
@@ -36,7 +36,7 @@ export class RecordsClient {
36
36
  __getRecords(request, requestOptions) {
37
37
  return __awaiter(this, void 0, void 0, function* () {
38
38
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
39
- const { miniId, recordIds, externalUris, recordId, beforeCursor, afterCursor, limitBefore, limitAfter, labels, states, startDate, endDate, createdBy, updatedBy, sortDescending, } = request;
39
+ const { miniId, recordIds, externalUris, recordId, beforeCursor, afterCursor, limitBefore, limitAfter, labels, states, startDate, endDate, createdBy, updatedBy, sortDescending, includeTotalCount, } = request;
40
40
  const _queryParams = {
41
41
  miniId,
42
42
  recordIds,
@@ -53,6 +53,7 @@ export class RecordsClient {
53
53
  createdBy,
54
54
  updatedBy,
55
55
  sortDescending,
56
+ includeTotalCount,
56
57
  };
57
58
  const _authRequest = yield this._options.authProvider.getAuthRequest();
58
59
  const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
@@ -839,6 +840,70 @@ export class RecordsClient {
839
840
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/api/v1/Records/batch/attachments");
840
841
  });
841
842
  }
843
+ /**
844
+ * 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.
845
+ *
846
+ * @param {Minikai.BatchUpdateAttachmentsRequest} request
847
+ * @param {RecordsClient.RequestOptions} requestOptions - Request-specific configuration.
848
+ *
849
+ * @throws {@link Minikai.BadRequestError}
850
+ * @throws {@link Minikai.UnprocessableEntityError}
851
+ *
852
+ * @example
853
+ * import { createReadStream } from "fs";
854
+ * await client.records.batchUpdateAttachments({
855
+ * files: [fs.createReadStream("/path/to/your/file")],
856
+ * items: "items"
857
+ * })
858
+ */
859
+ batchUpdateAttachments(request, requestOptions) {
860
+ return core.HttpResponsePromise.fromPromise(this.__batchUpdateAttachments(request, requestOptions));
861
+ }
862
+ __batchUpdateAttachments(request, requestOptions) {
863
+ return __awaiter(this, void 0, void 0, function* () {
864
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
865
+ const _body = yield core.newFormData();
866
+ for (const _file of request.files) {
867
+ yield _body.appendFile("files", _file);
868
+ }
869
+ _body.append("items", request.items);
870
+ const _maybeEncodedRequest = yield _body.getRequest();
871
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
872
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, _maybeEncodedRequest.headers)), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
873
+ const _response = yield core.fetcher({
874
+ 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"),
875
+ method: "PUT",
876
+ headers: _headers,
877
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
878
+ requestType: "file",
879
+ duplex: _maybeEncodedRequest.duplex,
880
+ body: _maybeEncodedRequest.body,
881
+ 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,
882
+ 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,
883
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
884
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
885
+ logging: this._options.logging,
886
+ });
887
+ if (_response.ok) {
888
+ return { data: _response.body, rawResponse: _response.rawResponse };
889
+ }
890
+ if (_response.error.reason === "status-code") {
891
+ switch (_response.error.statusCode) {
892
+ case 400:
893
+ throw new Minikai.BadRequestError(_response.error.body, _response.rawResponse);
894
+ case 422:
895
+ throw new Minikai.UnprocessableEntityError(_response.error.body, _response.rawResponse);
896
+ default:
897
+ throw new errors.MinikaiError({
898
+ statusCode: _response.error.statusCode,
899
+ body: _response.error.body,
900
+ rawResponse: _response.rawResponse,
901
+ });
902
+ }
903
+ }
904
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/api/v1/Records/batch/attachments");
905
+ });
906
+ }
842
907
  /**
843
908
  * @deprecated
844
909
  *
@@ -0,0 +1,12 @@
1
+ import type * as core from "../../../../../core/index.mjs";
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
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -21,4 +21,5 @@ export interface GetRecordsRequest {
21
21
  createdBy?: string | string[];
22
22
  updatedBy?: string | string[];
23
23
  sortDescending?: boolean;
24
+ includeTotalCount?: boolean;
24
25
  }
@@ -1,5 +1,6 @@
1
1
  export type { AddAttachmentsRequest } from "./AddAttachmentsRequest.mjs";
2
2
  export type { BatchAddAttachmentsRequest } from "./BatchAddAttachmentsRequest.mjs";
3
+ export type { BatchUpdateAttachmentsRequest } from "./BatchUpdateAttachmentsRequest.mjs";
3
4
  export type { BatchUploadRecordsRequest } from "./BatchUploadRecordsRequest.mjs";
4
5
  export type { CreateDraftRecordCommand } from "./CreateDraftRecordCommand.mjs";
5
6
  export type { CreateRecordCommand } from "./CreateRecordCommand.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.2";
1
+ export declare const SDK_VERSION = "1.2.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "1.0.2";
1
+ export const SDK_VERSION = "1.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minikai",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
package/reference.md CHANGED
@@ -2174,6 +2174,72 @@ await client.records.batchAddAttachments({
2174
2174
  </dl>
2175
2175
 
2176
2176
 
2177
+ </dd>
2178
+ </dl>
2179
+ </details>
2180
+
2181
+ <details><summary><code>client.records.<a href="/src/api/resources/records/client/Client.ts">batchUpdateAttachments</a>({ ...params }) -> Minikai.BatchAttachmentResult</code></summary>
2182
+ <dl>
2183
+ <dd>
2184
+
2185
+ #### 📝 Description
2186
+
2187
+ <dl>
2188
+ <dd>
2189
+
2190
+ <dl>
2191
+ <dd>
2192
+
2193
+ 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.
2194
+ </dd>
2195
+ </dl>
2196
+ </dd>
2197
+ </dl>
2198
+
2199
+ #### 🔌 Usage
2200
+
2201
+ <dl>
2202
+ <dd>
2203
+
2204
+ <dl>
2205
+ <dd>
2206
+
2207
+ ```typescript
2208
+ await client.records.batchUpdateAttachments({
2209
+ files: [fs.createReadStream("/path/to/your/file")],
2210
+ items: "items"
2211
+ });
2212
+
2213
+ ```
2214
+ </dd>
2215
+ </dl>
2216
+ </dd>
2217
+ </dl>
2218
+
2219
+ #### ⚙️ Parameters
2220
+
2221
+ <dl>
2222
+ <dd>
2223
+
2224
+ <dl>
2225
+ <dd>
2226
+
2227
+ **request:** `Minikai.BatchUpdateAttachmentsRequest`
2228
+
2229
+ </dd>
2230
+ </dl>
2231
+
2232
+ <dl>
2233
+ <dd>
2234
+
2235
+ **requestOptions:** `RecordsClient.RequestOptions`
2236
+
2237
+ </dd>
2238
+ </dl>
2239
+ </dd>
2240
+ </dl>
2241
+
2242
+
2177
2243
  </dd>
2178
2244
  </dl>
2179
2245
  </details>