@mlhub/models-ts-sdk 0.1.1 → 0.3.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/.openapi-generator/FILES +4 -1
- package/README.md +2 -2
- package/dist/apis/ArtifactsApi.d.ts +2 -2
- package/dist/apis/ArtifactsApi.js +3 -3
- package/dist/apis/ModelsApi.d.ts +17 -11
- package/dist/apis/ModelsApi.js +27 -20
- package/dist/models/AssociateModelMetadataBody.d.ts +33 -0
- package/dist/models/{AssociateModelMetadata.js → AssociateModelMetadataBody.js} +7 -7
- package/dist/models/Canonical.d.ts +76 -0
- package/dist/models/Canonical.js +58 -0
- package/dist/models/CreateModelMetadataBody.d.ts +245 -0
- package/dist/models/CreateModelMetadataBody.js +114 -0
- package/dist/models/DiscoveryCriteria.d.ts +0 -6
- package/dist/models/DiscoveryCriteria.js +0 -2
- package/dist/models/Locator.d.ts +27 -0
- package/dist/models/Locator.js +40 -0
- package/dist/models/ModelMetadata.d.ts +13 -1
- package/dist/models/ModelMetadata.js +4 -0
- package/dist/models/index.d.ts +4 -1
- package/dist/models/index.js +4 -1
- package/package.json +1 -1
- package/src/apis/ArtifactsApi.ts +7 -7
- package/src/apis/ModelsApi.ts +34 -31
- package/src/models/{AssociateModelMetadata.ts → AssociateModelMetadataBody.ts} +8 -8
- package/src/models/Canonical.ts +131 -0
- package/src/models/CreateModelMetadataBody.ts +360 -0
- package/src/models/DiscoveryCriteria.ts +0 -8
- package/src/models/Locator.ts +56 -0
- package/src/models/ModelMetadata.ts +20 -0
- package/src/models/index.ts +4 -1
- package/dist/models/AssociateModelMetadata.d.ts +0 -33
package/src/apis/ModelsApi.ts
CHANGED
|
@@ -18,6 +18,9 @@ import {
|
|
|
18
18
|
BadRequestResponse,
|
|
19
19
|
BadRequestResponseFromJSON,
|
|
20
20
|
BadRequestResponseToJSON,
|
|
21
|
+
CreateModelMetadataBody,
|
|
22
|
+
CreateModelMetadataBodyFromJSON,
|
|
23
|
+
CreateModelMetadataBodyToJSON,
|
|
21
24
|
CreateModelMetadataResponse,
|
|
22
25
|
CreateModelMetadataResponseFromJSON,
|
|
23
26
|
CreateModelMetadataResponseToJSON,
|
|
@@ -39,9 +42,6 @@ import {
|
|
|
39
42
|
ListModelsResponse,
|
|
40
43
|
ListModelsResponseFromJSON,
|
|
41
44
|
ListModelsResponseToJSON,
|
|
42
|
-
ModelMetadata,
|
|
43
|
-
ModelMetadataFromJSON,
|
|
44
|
-
ModelMetadataToJSON,
|
|
45
45
|
NotFoundResponse,
|
|
46
46
|
NotFoundResponseFromJSON,
|
|
47
47
|
NotFoundResponseToJSON,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
} from '../models';
|
|
52
52
|
|
|
53
53
|
export interface CreateModelMetadataRequest {
|
|
54
|
-
|
|
54
|
+
createModelMetadataBody: CreateModelMetadataBody;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export interface DiscoverModelsRequest {
|
|
@@ -61,9 +61,10 @@ export interface DiscoverModelsRequest {
|
|
|
61
61
|
includeCount?: boolean;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export interface
|
|
65
|
-
author: string;
|
|
64
|
+
export interface GetModelByAuthorAndNameRequest {
|
|
66
65
|
name: string;
|
|
66
|
+
author: string;
|
|
67
|
+
scope?: GetModelByAuthorAndNameScopeEnum;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
export interface IngestCanonicalModelRequest {
|
|
@@ -72,10 +73,6 @@ export interface IngestCanonicalModelRequest {
|
|
|
72
73
|
ingestArtifactRequest: IngestArtifactRequest;
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
export interface ListModelsRequest {
|
|
76
|
-
modelMetadata: ModelMetadata;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
76
|
export interface ListModelsByAuthorRequest {
|
|
80
77
|
author: string;
|
|
81
78
|
}
|
|
@@ -89,8 +86,8 @@ export class ModelsApi extends runtime.BaseAPI {
|
|
|
89
86
|
* Create a model metadata
|
|
90
87
|
*/
|
|
91
88
|
async createModelMetadataRaw(requestParameters: CreateModelMetadataRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<CreateModelMetadataResponse>> {
|
|
92
|
-
if (requestParameters.
|
|
93
|
-
throw new runtime.RequiredError('
|
|
89
|
+
if (requestParameters.createModelMetadataBody === null || requestParameters.createModelMetadataBody === undefined) {
|
|
90
|
+
throw new runtime.RequiredError('createModelMetadataBody','Required parameter requestParameters.createModelMetadataBody was null or undefined when calling createModelMetadata.');
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
const queryParameters: any = {};
|
|
@@ -104,7 +101,7 @@ export class ModelsApi extends runtime.BaseAPI {
|
|
|
104
101
|
method: 'POST',
|
|
105
102
|
headers: headerParameters,
|
|
106
103
|
query: queryParameters,
|
|
107
|
-
body:
|
|
104
|
+
body: CreateModelMetadataBodyToJSON(requestParameters.createModelMetadataBody),
|
|
108
105
|
}, initOverrides);
|
|
109
106
|
|
|
110
107
|
return new runtime.JSONApiResponse(response, (jsonValue) => CreateModelMetadataResponseFromJSON(jsonValue));
|
|
@@ -166,21 +163,25 @@ export class ModelsApi extends runtime.BaseAPI {
|
|
|
166
163
|
/**
|
|
167
164
|
* Get model by the author and name
|
|
168
165
|
*/
|
|
169
|
-
async
|
|
170
|
-
if (requestParameters.
|
|
171
|
-
throw new runtime.RequiredError('
|
|
166
|
+
async getModelByAuthorAndNameRaw(requestParameters: GetModelByAuthorAndNameRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<GetModelResponse>> {
|
|
167
|
+
if (requestParameters.name === null || requestParameters.name === undefined) {
|
|
168
|
+
throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getModelByAuthorAndName.');
|
|
172
169
|
}
|
|
173
170
|
|
|
174
|
-
if (requestParameters.
|
|
175
|
-
throw new runtime.RequiredError('
|
|
171
|
+
if (requestParameters.author === null || requestParameters.author === undefined) {
|
|
172
|
+
throw new runtime.RequiredError('author','Required parameter requestParameters.author was null or undefined when calling getModelByAuthorAndName.');
|
|
176
173
|
}
|
|
177
174
|
|
|
178
175
|
const queryParameters: any = {};
|
|
179
176
|
|
|
177
|
+
if (requestParameters.scope !== undefined) {
|
|
178
|
+
queryParameters['scope'] = requestParameters.scope;
|
|
179
|
+
}
|
|
180
|
+
|
|
180
181
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
181
182
|
|
|
182
183
|
const response = await this.request({
|
|
183
|
-
path: `/models-api/models/{author}/{name}`.replace(`{${"
|
|
184
|
+
path: `/models-api/models/{author}/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))).replace(`{${"author"}}`, encodeURIComponent(String(requestParameters.author))),
|
|
184
185
|
method: 'GET',
|
|
185
186
|
headers: headerParameters,
|
|
186
187
|
query: queryParameters,
|
|
@@ -192,8 +193,8 @@ export class ModelsApi extends runtime.BaseAPI {
|
|
|
192
193
|
/**
|
|
193
194
|
* Get model by the author and name
|
|
194
195
|
*/
|
|
195
|
-
async
|
|
196
|
-
const response = await this.
|
|
196
|
+
async getModelByAuthorAndName(requestParameters: GetModelByAuthorAndNameRequest, initOverrides?: RequestInit): Promise<GetModelResponse> {
|
|
197
|
+
const response = await this.getModelByAuthorAndNameRaw(requestParameters, initOverrides);
|
|
197
198
|
return await response.value();
|
|
198
199
|
}
|
|
199
200
|
|
|
@@ -241,23 +242,16 @@ export class ModelsApi extends runtime.BaseAPI {
|
|
|
241
242
|
/**
|
|
242
243
|
* List all models
|
|
243
244
|
*/
|
|
244
|
-
async listModelsRaw(
|
|
245
|
-
if (requestParameters.modelMetadata === null || requestParameters.modelMetadata === undefined) {
|
|
246
|
-
throw new runtime.RequiredError('modelMetadata','Required parameter requestParameters.modelMetadata was null or undefined when calling listModels.');
|
|
247
|
-
}
|
|
248
|
-
|
|
245
|
+
async listModelsRaw(initOverrides?: RequestInit): Promise<runtime.ApiResponse<ListModelsResponse>> {
|
|
249
246
|
const queryParameters: any = {};
|
|
250
247
|
|
|
251
248
|
const headerParameters: runtime.HTTPHeaders = {};
|
|
252
249
|
|
|
253
|
-
headerParameters['Content-Type'] = 'application/json';
|
|
254
|
-
|
|
255
250
|
const response = await this.request({
|
|
256
251
|
path: `/models-api/models`,
|
|
257
252
|
method: 'GET',
|
|
258
253
|
headers: headerParameters,
|
|
259
254
|
query: queryParameters,
|
|
260
|
-
body: ModelMetadataToJSON(requestParameters.modelMetadata),
|
|
261
255
|
}, initOverrides);
|
|
262
256
|
|
|
263
257
|
return new runtime.JSONApiResponse(response, (jsonValue) => ListModelsResponseFromJSON(jsonValue));
|
|
@@ -266,8 +260,8 @@ export class ModelsApi extends runtime.BaseAPI {
|
|
|
266
260
|
/**
|
|
267
261
|
* List all models
|
|
268
262
|
*/
|
|
269
|
-
async listModels(
|
|
270
|
-
const response = await this.listModelsRaw(
|
|
263
|
+
async listModels(initOverrides?: RequestInit): Promise<ListModelsResponse> {
|
|
264
|
+
const response = await this.listModelsRaw(initOverrides);
|
|
271
265
|
return await response.value();
|
|
272
266
|
}
|
|
273
267
|
|
|
@@ -302,3 +296,12 @@ export class ModelsApi extends runtime.BaseAPI {
|
|
|
302
296
|
}
|
|
303
297
|
|
|
304
298
|
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @export
|
|
302
|
+
* @enum {string}
|
|
303
|
+
*/
|
|
304
|
+
export enum GetModelByAuthorAndNameScopeEnum {
|
|
305
|
+
Tenant = 'tenant',
|
|
306
|
+
Global = 'global'
|
|
307
|
+
}
|
|
@@ -16,28 +16,28 @@ import { exists, mapValues } from '../runtime';
|
|
|
16
16
|
/**
|
|
17
17
|
*
|
|
18
18
|
* @export
|
|
19
|
-
* @interface
|
|
19
|
+
* @interface AssociateModelMetadataBody
|
|
20
20
|
*/
|
|
21
|
-
export interface
|
|
21
|
+
export interface AssociateModelMetadataBody {
|
|
22
22
|
/**
|
|
23
23
|
*
|
|
24
24
|
* @type {string}
|
|
25
|
-
* @memberof
|
|
25
|
+
* @memberof AssociateModelMetadataBody
|
|
26
26
|
*/
|
|
27
27
|
author: string;
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
30
|
* @type {string}
|
|
31
|
-
* @memberof
|
|
31
|
+
* @memberof AssociateModelMetadataBody
|
|
32
32
|
*/
|
|
33
33
|
name: string;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
export function
|
|
37
|
-
return
|
|
36
|
+
export function AssociateModelMetadataBodyFromJSON(json: any): AssociateModelMetadataBody {
|
|
37
|
+
return AssociateModelMetadataBodyFromJSONTyped(json, false);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
export function
|
|
40
|
+
export function AssociateModelMetadataBodyFromJSONTyped(json: any, ignoreDiscriminator: boolean): AssociateModelMetadataBody {
|
|
41
41
|
if ((json === undefined) || (json === null)) {
|
|
42
42
|
return json;
|
|
43
43
|
}
|
|
@@ -48,7 +48,7 @@ export function AssociateModelMetadataFromJSONTyped(json: any, ignoreDiscriminat
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export function
|
|
51
|
+
export function AssociateModelMetadataBodyToJSON(value?: AssociateModelMetadataBody | null): any {
|
|
52
52
|
if (value === undefined) {
|
|
53
53
|
return undefined;
|
|
54
54
|
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* MLHub Models API
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { exists, mapValues } from '../runtime';
|
|
16
|
+
import {
|
|
17
|
+
Locator,
|
|
18
|
+
LocatorFromJSON,
|
|
19
|
+
LocatorFromJSONTyped,
|
|
20
|
+
LocatorToJSON,
|
|
21
|
+
Platform,
|
|
22
|
+
PlatformFromJSON,
|
|
23
|
+
PlatformFromJSONTyped,
|
|
24
|
+
PlatformToJSON,
|
|
25
|
+
} from './';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @export
|
|
30
|
+
* @interface Canonical
|
|
31
|
+
*/
|
|
32
|
+
export interface Canonical {
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @type {string}
|
|
36
|
+
* @memberof Canonical
|
|
37
|
+
*/
|
|
38
|
+
author?: string | null;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @type {number}
|
|
42
|
+
* @memberof Canonical
|
|
43
|
+
*/
|
|
44
|
+
downloads?: number | null;
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
* @type {boolean}
|
|
48
|
+
* @memberof Canonical
|
|
49
|
+
*/
|
|
50
|
+
gated?: boolean | null;
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @type {number}
|
|
54
|
+
* @memberof Canonical
|
|
55
|
+
*/
|
|
56
|
+
likes?: number | null;
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @type {Locator}
|
|
60
|
+
* @memberof Canonical
|
|
61
|
+
*/
|
|
62
|
+
locator: Locator;
|
|
63
|
+
/**
|
|
64
|
+
*
|
|
65
|
+
* @type {string}
|
|
66
|
+
* @memberof Canonical
|
|
67
|
+
*/
|
|
68
|
+
model_id: string;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @type {Platform}
|
|
72
|
+
* @memberof Canonical
|
|
73
|
+
*/
|
|
74
|
+
platform: Platform;
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
* @type {boolean}
|
|
78
|
+
* @memberof Canonical
|
|
79
|
+
*/
|
|
80
|
+
_private?: boolean | null;
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @type {string}
|
|
84
|
+
* @memberof Canonical
|
|
85
|
+
*/
|
|
86
|
+
sha?: string | null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function CanonicalFromJSON(json: any): Canonical {
|
|
90
|
+
return CanonicalFromJSONTyped(json, false);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function CanonicalFromJSONTyped(json: any, ignoreDiscriminator: boolean): Canonical {
|
|
94
|
+
if ((json === undefined) || (json === null)) {
|
|
95
|
+
return json;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
|
|
99
|
+
'author': !exists(json, 'author') ? undefined : json['author'],
|
|
100
|
+
'downloads': !exists(json, 'downloads') ? undefined : json['downloads'],
|
|
101
|
+
'gated': !exists(json, 'gated') ? undefined : json['gated'],
|
|
102
|
+
'likes': !exists(json, 'likes') ? undefined : json['likes'],
|
|
103
|
+
'locator': LocatorFromJSON(json['locator']),
|
|
104
|
+
'model_id': json['model_id'],
|
|
105
|
+
'platform': PlatformFromJSON(json['platform']),
|
|
106
|
+
'_private': !exists(json, 'private') ? undefined : json['private'],
|
|
107
|
+
'sha': !exists(json, 'sha') ? undefined : json['sha'],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function CanonicalToJSON(value?: Canonical | null): any {
|
|
112
|
+
if (value === undefined) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
if (value === null) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
|
|
120
|
+
'author': value.author,
|
|
121
|
+
'downloads': value.downloads,
|
|
122
|
+
'gated': value.gated,
|
|
123
|
+
'likes': value.likes,
|
|
124
|
+
'locator': LocatorToJSON(value.locator),
|
|
125
|
+
'model_id': value.model_id,
|
|
126
|
+
'platform': PlatformToJSON(value.platform),
|
|
127
|
+
'private': value._private,
|
|
128
|
+
'sha': value.sha,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|