@hautechai/sdk 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk/api.js CHANGED
@@ -12,12 +12,19 @@ export const useAutogeneratedAPI = (baseProps) => {
12
12
  };
13
13
  const call = async (props) => {
14
14
  const api = await getAPI();
15
- const response = await props.run(api);
16
- if (props.returnUndefinedOn404 && response.status === 404)
17
- return undefined;
18
- if (response.status < 200 || response.status >= 300)
19
- throw new Error(response.statusText);
20
- return props.transform ? props.transform(response.data) : response.data;
15
+ try {
16
+ const response = await props.run(api);
17
+ if (props.returnUndefinedOn404 && response.status === 404)
18
+ return undefined;
19
+ if (response.status < 200 || response.status >= 300)
20
+ throw new Error(response.statusText);
21
+ return props.transform ? props.transform(response.data) : response.data;
22
+ }
23
+ catch (error) {
24
+ if (props.returnUndefinedOn404 && error?.response?.status === 404)
25
+ return undefined;
26
+ throw error;
27
+ }
21
28
  };
22
29
  const callWithReturningUndefinedOn404 = async (props) => call({ ...props, returnUndefinedOn404: true });
23
30
  return {
@@ -1,4 +1,5 @@
1
1
  import { SDKOptions, ListProps } from '../../types';
2
+ import { CollectionsControllerListItemsV1KindEnum } from '../../autogenerated';
2
3
  declare const collections: (options: SDKOptions) => {
3
4
  create: (props?: {
4
5
  metadata?: any;
@@ -13,6 +14,7 @@ declare const collections: (options: SDKOptions) => {
13
14
  }) => Promise<void>;
14
15
  list: (props: {
15
16
  collectionId: string;
17
+ kind?: CollectionsControllerListItemsV1KindEnum;
16
18
  } & ListProps) => Promise<import("../../autogenerated").ListCollectionItemsDto>;
17
19
  remove: (props: {
18
20
  collectionId: string;
@@ -14,7 +14,7 @@ const collections = (options) => {
14
14
  run: (methods) => methods.collectionsControllerAddItemsV1(props.collectionId, { itemIds: props.itemIds }),
15
15
  }),
16
16
  list: async (props) => api.call({
17
- run: (methods) => methods.collectionsControllerListItemsV1(props.collectionId, props.cursor, props.orderBy, props.limit),
17
+ run: (methods) => methods.collectionsControllerListItemsV1(props.collectionId, props.cursor, props.orderBy, props.limit, props.kind),
18
18
  }),
19
19
  remove: async (props) => api.call({
20
20
  run: (methods) => methods.collectionsControllerRemoveItemsV1(props.collectionId, { itemIds: props.itemIds }),
@@ -35,6 +35,7 @@ export declare const createSDK: (options: SDKOptions) => {
35
35
  }) => Promise<void>;
36
36
  list: (props: {
37
37
  collectionId: string;
38
+ kind?: import("../autogenerated").CollectionsControllerListItemsV1KindEnum;
38
39
  } & import("../types").ListProps) => Promise<import("../autogenerated").ListCollectionItemsDto>;
39
40
  remove: (props: {
40
41
  collectionId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hautechai/sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "license": "MIT",
5
5
  "keywords": [],
6
6
  "repository": {