diff --git a/packages_generated/qaas/src/v1alpha1/api.gen.ts b/packages_generated/qaas/src/v1alpha1/api.gen.ts index 13f63c598..cac7929b4 100644 --- a/packages_generated/qaas/src/v1alpha1/api.gen.ts +++ b/packages_generated/qaas/src/v1alpha1/api.gen.ts @@ -18,6 +18,7 @@ import { } from './content.gen' import { marshalCreateJobRequest, + marshalCreateModelRequest, marshalCreateProcessRequest, marshalCreateSessionRequest, marshalUpdateBookingRequest, @@ -32,11 +33,13 @@ import { unmarshalListBookingsResponse, unmarshalListJobResultsResponse, unmarshalListJobsResponse, + unmarshalListModelsResponse, unmarshalListPlatformsResponse, unmarshalListProcessesResponse, unmarshalListProcessResultsResponse, unmarshalListSessionACLsResponse, unmarshalListSessionsResponse, + unmarshalModel, unmarshalPlatform, unmarshalProcess, unmarshalSession, @@ -47,6 +50,7 @@ import type { CancelJobRequest, CancelProcessRequest, CreateJobRequest, + CreateModelRequest, CreateProcessRequest, CreateSessionRequest, DeleteJobRequest, @@ -56,6 +60,7 @@ import type { GetBookingRequest, GetJobCircuitRequest, GetJobRequest, + GetModelRequest, GetPlatformRequest, GetProcessRequest, GetSessionRequest, @@ -69,6 +74,8 @@ import type { ListJobResultsResponse, ListJobsRequest, ListJobsResponse, + ListModelsRequest, + ListModelsResponse, ListPlatformsRequest, ListPlatformsResponse, ListProcessesRequest, @@ -79,6 +86,7 @@ import type { ListSessionACLsResponse, ListSessionsRequest, ListSessionsResponse, + Model, Platform, Process, Session, @@ -784,4 +792,68 @@ export class API extends ParentAPI { }, unmarshalBooking, ) + + /** + * Create a new model. Create and register a new model that can be executed through next jobs. A model can also be assigned to a Session. + * + * @param request - The request {@link CreateModelRequest} + * @returns A Promise of Model + */ + createModel = (request: Readonly = {}) => + this.client.fetch( + { + body: JSON.stringify( + marshalCreateModelRequest(request, this.client.settings), + ), + headers: jsonContentHeaders, + method: 'POST', + path: `/qaas/v1alpha1/models`, + }, + unmarshalModel, + ) + + /** + * Get model information. Retrieve information about of the provided **model ID**. + * + * @param request - The request {@link GetModelRequest} + * @returns A Promise of Model + */ + getModel = (request: Readonly) => + this.client.fetch( + { + method: 'GET', + path: `/qaas/v1alpha1/models/${validatePathParam('modelId', request.modelId)}`, + }, + unmarshalModel, + ) + + protected pageOfListModels = (request: Readonly = {}) => + this.client.fetch( + { + method: 'GET', + path: `/qaas/v1alpha1/models`, + urlParams: urlParams( + ['order_by', request.orderBy], + ['page', request.page], + [ + 'page_size', + request.pageSize ?? this.client.settings.defaultPageSize, + ], + [ + 'project_id', + request.projectId ?? this.client.settings.defaultProjectId, + ], + ), + }, + unmarshalListModelsResponse, + ) + + /** + * List all models attached to the **project ID**. Retrieve information about all models of the provided **project ID**. + * + * @param request - The request {@link ListModelsRequest} + * @returns A Promise of ListModelsResponse + */ + listModels = (request: Readonly = {}) => + enrichForPagination('models', this.pageOfListModels, request) } diff --git a/packages_generated/qaas/src/v1alpha1/index.gen.ts b/packages_generated/qaas/src/v1alpha1/index.gen.ts index b1b7edd99..9936b8875 100644 --- a/packages_generated/qaas/src/v1alpha1/index.gen.ts +++ b/packages_generated/qaas/src/v1alpha1/index.gen.ts @@ -11,6 +11,7 @@ export type { CancelJobRequest, CancelProcessRequest, CreateJobRequest, + CreateModelRequest, CreateProcessRequest, CreateSessionRequest, CreateSessionRequestBookingDemand, @@ -21,6 +22,7 @@ export type { GetBookingRequest, GetJobCircuitRequest, GetJobRequest, + GetModelRequest, GetPlatformRequest, GetProcessRequest, GetSessionRequest, @@ -40,6 +42,9 @@ export type { ListJobsRequest, ListJobsRequestOrderBy, ListJobsResponse, + ListModelsRequest, + ListModelsRequestOrderBy, + ListModelsResponse, ListPlatformsRequest, ListPlatformsRequestOrderBy, ListPlatformsResponse, @@ -55,6 +60,7 @@ export type { ListSessionsRequest, ListSessionsRequestOrderBy, ListSessionsResponse, + Model, Platform, PlatformAvailability, PlatformBookingRequirement, diff --git a/packages_generated/qaas/src/v1alpha1/marshalling.gen.ts b/packages_generated/qaas/src/v1alpha1/marshalling.gen.ts index 9e1dfe70c..bc56981de 100644 --- a/packages_generated/qaas/src/v1alpha1/marshalling.gen.ts +++ b/packages_generated/qaas/src/v1alpha1/marshalling.gen.ts @@ -13,6 +13,7 @@ import type { Application, Booking, CreateJobRequest, + CreateModelRequest, CreateProcessRequest, CreateSessionRequest, CreateSessionRequestBookingDemand, @@ -23,11 +24,13 @@ import type { ListBookingsResponse, ListJobResultsResponse, ListJobsResponse, + ListModelsResponse, ListPlatformsResponse, ListProcessesResponse, ListProcessResultsResponse, ListSessionACLsResponse, ListSessionsResponse, + Model, Platform, PlatformBookingRequirement, PlatformHardware, @@ -99,7 +102,9 @@ export const unmarshalJob = (data: unknown): Job => { createdAt: unmarshalDate(data.created_at), id: data.id, jobDuration: data.job_duration, + modelId: data.model_id, name: data.name, + parameters: data.parameters, progressMessage: data.progress_message, resultDistribution: data.result_distribution, sessionId: data.session_id, @@ -110,6 +115,21 @@ export const unmarshalJob = (data: unknown): Job => { } as Job } +export const unmarshalModel = (data: unknown): Model => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'Model' failed as data isn't a dictionary.`, + ) + } + + return { + createdAt: unmarshalDate(data.created_at), + id: data.id, + projectId: data.project_id, + url: data.url, + } as Model +} + const unmarshalPlatformBookingRequirement = ( data: unknown, ): PlatformBookingRequirement => { @@ -226,6 +246,7 @@ export const unmarshalSession = (data: unknown): Session => { id: data.id, maxDuration: data.max_duration, maxIdleDuration: data.max_idle_duration, + modelId: data.model_id, name: data.name, originId: data.origin_id, originType: data.origin_type, @@ -317,6 +338,21 @@ export const unmarshalListJobsResponse = (data: unknown): ListJobsResponse => { } as ListJobsResponse } +export const unmarshalListModelsResponse = ( + data: unknown, +): ListModelsResponse => { + if (!isJSONObject(data)) { + throw new TypeError( + `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`, + ) + } + + return { + models: unmarshalArrayOfObject(data.models, unmarshalModel), + totalCount: data.total_count, + } as ListModelsResponse +} + export const unmarshalListPlatformsResponse = ( data: unknown, ): ListPlatformsResponse => { @@ -425,11 +461,21 @@ export const marshalCreateJobRequest = ( ): Record => ({ circuit: marshalJobCircuit(request.circuit, defaults), max_duration: request.maxDuration, + model_id: request.modelId, name: request.name, + parameters: request.parameters, session_id: request.sessionId, tags: request.tags, }) +export const marshalCreateModelRequest = ( + request: CreateModelRequest, + defaults: DefaultValues, +): Record => ({ + payload: request.payload, + project_id: request.projectId ?? defaults.defaultProjectId, +}) + export const marshalCreateProcessRequest = ( request: CreateProcessRequest, defaults: DefaultValues, @@ -465,6 +511,7 @@ export const marshalCreateSessionRequest = ( deduplication_id: request.deduplicationId, max_duration: request.maxDuration, max_idle_duration: request.maxIdleDuration, + model_id: request.modelId, name: request.name, platform_id: request.platformId, project_id: request.projectId ?? defaults.defaultProjectId, diff --git a/packages_generated/qaas/src/v1alpha1/types.gen.ts b/packages_generated/qaas/src/v1alpha1/types.gen.ts index fb97fe36e..5a4fd64f7 100644 --- a/packages_generated/qaas/src/v1alpha1/types.gen.ts +++ b/packages_generated/qaas/src/v1alpha1/types.gen.ts @@ -48,6 +48,8 @@ export type ListJobsRequestOrderBy = | 'session_name_asc' | 'session_name_desc' +export type ListModelsRequestOrderBy = 'created_at_desc' | 'created_at_asc' + export type ListPlatformsRequestOrderBy = | 'name_asc' | 'name_desc' @@ -320,6 +322,33 @@ export interface Job { * Result of the job, if the job is finished. */ resultDistribution?: string + /** + * Computation model ID executed by the job. + */ + modelId?: string + /** + * Execution parameters for this job. + */ + parameters?: string +} + +export interface Model { + /** + * Unique ID of the model. + */ + id: string + /** + * Time at which the model was created. + */ + createdAt?: Date + /** + * Storage URL of the model. + */ + url?: string + /** + * Project ID in which the model has been created. + */ + projectId: string } export interface Platform { @@ -560,6 +589,10 @@ export interface Session { * An optional booking unique ID of an attached booking. */ bookingId?: string + /** + * Default computation model ID to be executed by job assigned to this session. + */ + modelId?: string } export type CancelJobRequest = { @@ -597,6 +630,25 @@ export type CreateJobRequest = { * Maximum duration of the job. */ maxDuration?: string + /** + * Computation model ID to be executed by the job. + */ + modelId?: string + /** + * Execution parameters for this job. + */ + parameters?: string +} + +export type CreateModelRequest = { + /** + * Project ID to attach this model. + */ + projectId?: string + /** + * The serialized model data. + */ + payload?: string } export type CreateProcessRequest = { @@ -659,6 +711,10 @@ export type CreateSessionRequest = { * A booking demand to schedule the session, only applicable if the platform is bookable. */ bookingDemand?: CreateSessionRequestBookingDemand + /** + * Default computation model ID to be executed by job assigned to this session. + */ + modelId?: string } export type DeleteJobRequest = { @@ -710,6 +766,13 @@ export type GetJobRequest = { jobId: string } +export type GetModelRequest = { + /** + * Unique ID of the model. + */ + modelId: string +} + export type GetPlatformRequest = { /** * Unique ID of the platform. @@ -871,6 +934,36 @@ export interface ListJobsResponse { jobs: Job[] } +export type ListModelsRequest = { + /** + * List models belonging to this project ID. + */ + projectId?: string + /** + * Page number. + */ + page?: number + /** + * Maximum number of results to return per page. + */ + pageSize?: number + /** + * Sort order of the returned results. + */ + orderBy?: ListModelsRequestOrderBy +} + +export interface ListModelsResponse { + /** + * Total number of models. + */ + totalCount: number + /** + * List of models. + */ + models: Model[] +} + export type ListPlatformsRequest = { /** * List platforms with this provider name.