@hautechai/sdk 0.2.4 → 0.2.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/autogenerated/api.d.ts +475 -469
- package/dist/autogenerated/api.js +392 -392
- package/dist/sdk/api.js +3 -2
- package/dist/sdk/collections/index.d.ts +8 -5
- package/dist/sdk/collections/index.js +2 -2
- package/dist/sdk/errors/index.d.ts +3 -0
- package/dist/sdk/errors/index.js +6 -0
- package/dist/sdk/index.d.ts +164 -75
- package/dist/sdk/index.js +2 -0
- package/dist/sdk/listeners/index.js +5 -5
- package/dist/sdk/operations/index.d.ts +9 -6
- package/dist/sdk/pipelines/index.d.ts +102 -62
- package/dist/sdk/pipelines/index.js +10 -1
- package/dist/sdk/poses/index.d.ts +13 -0
- package/dist/sdk/poses/index.js +21 -0
- package/dist/sdk/stacks/index.d.ts +7 -4
- package/dist/sdk/stacks/index.js +1 -1
- package/dist/sdk/utils/index.d.ts +5 -0
- package/package.json +1 -1
- package/scripts/generate.sh +1 -1
- package/dist/sdk/exceptions/index.d.ts +0 -3
- package/dist/sdk/exceptions/index.js +0 -6
package/dist/sdk/api.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HautechError } from './errors';
|
|
1
2
|
export const getBaseUrl = (options) => options.endpoint ?? 'https://api.hautech.ai';
|
|
2
3
|
export const getAPI = async (API, options) => {
|
|
3
4
|
const config = {
|
|
@@ -15,13 +16,13 @@ export const useAutogeneratedAPI = (baseProps) => {
|
|
|
15
16
|
if (props.returnUndefinedOn404 && response.status === 404)
|
|
16
17
|
return undefined;
|
|
17
18
|
if (response.status < 200 || response.status >= 300)
|
|
18
|
-
throw new
|
|
19
|
+
throw new HautechError(`API call failed with status code ${response.status}`);
|
|
19
20
|
return props.transform ? props.transform(response.data) : response.data;
|
|
20
21
|
}
|
|
21
22
|
catch (error) {
|
|
22
23
|
if (props.returnUndefinedOn404 && error?.response?.status === 404)
|
|
23
24
|
return undefined;
|
|
24
|
-
throw error;
|
|
25
|
+
throw new HautechError(error.message, { cause: error });
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
const callWithReturningUndefinedOn404 = async (props) => call({ ...props, returnUndefinedOn404: true });
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { SDKOptions, ListProps, ListResponse } from '../../types';
|
|
2
2
|
import { CollectionEntity, CollectionsControllerListItemsV1KindEnum, ResourceEntity } from '../../autogenerated';
|
|
3
|
+
import { CollectionsMetadata } from '../index';
|
|
4
|
+
import { AddMetadata } from '../utils';
|
|
5
|
+
type CollectionEntityWithMetadata = AddMetadata<CollectionEntity, CollectionsMetadata>;
|
|
3
6
|
declare const collections: (options: SDKOptions) => {
|
|
4
7
|
create: (props?: {
|
|
5
|
-
metadata?:
|
|
6
|
-
}) => Promise<
|
|
8
|
+
metadata?: CollectionsMetadata;
|
|
9
|
+
}) => Promise<CollectionEntityWithMetadata>;
|
|
7
10
|
get: (props: {
|
|
8
11
|
id: string;
|
|
9
|
-
}) => Promise<
|
|
12
|
+
}) => Promise<CollectionEntityWithMetadata | undefined>;
|
|
10
13
|
items: {
|
|
11
14
|
add: (props: {
|
|
12
15
|
collectionId: string;
|
|
@@ -21,10 +24,10 @@ declare const collections: (options: SDKOptions) => {
|
|
|
21
24
|
itemIds: string[];
|
|
22
25
|
}) => Promise<void>;
|
|
23
26
|
};
|
|
24
|
-
list: (props?: ListProps) => Promise<ListResponse<
|
|
27
|
+
list: (props?: ListProps) => Promise<ListResponse<CollectionEntityWithMetadata>>;
|
|
25
28
|
updateMetadata: (props: {
|
|
26
29
|
id: string;
|
|
27
|
-
metadata?:
|
|
30
|
+
metadata?: Partial<CollectionsMetadata>;
|
|
28
31
|
}) => Promise<void>;
|
|
29
32
|
};
|
|
30
33
|
export default collections;
|
|
@@ -22,12 +22,12 @@ const collections = (options) => {
|
|
|
22
22
|
run: (methods) => methods.collectionsControllerRemoveItemsV1(props.collectionId, { itemIds: props.itemIds }),
|
|
23
23
|
}),
|
|
24
24
|
},
|
|
25
|
-
list:
|
|
25
|
+
list: (props = {}) => api.call({
|
|
26
26
|
run: (methods) => methods.collectionsControllerListCollectionsV1(props.orderBy, props.limit, props.cursor),
|
|
27
27
|
transform: transformToListResponse,
|
|
28
28
|
}),
|
|
29
29
|
updateMetadata: async (props) => api.call({
|
|
30
|
-
run: (methods) => methods.collectionsControllerUpdateMetadataV1(props.id, { overwrite: props.metadata }),
|
|
30
|
+
run: (methods) => methods.collectionsControllerUpdateMetadataV1(props.id, { overwrite: props.metadata ?? {} }),
|
|
31
31
|
}),
|
|
32
32
|
};
|
|
33
33
|
};
|