From 8b1cbec66a8350f910d4e736f249655dce1f1a8e Mon Sep 17 00:00:00 2001 From: alberto Date: Sat, 28 Nov 2026 09:24:39 -0600 Subject: [PATCH] Client for model bundle export and import --- openapi.json | 150 +++++++++++++++++++++++ src/app/api/fn/models/export-models.ts | 36 ++++++ src/app/api/fn/models/import-models.ts | 41 +++++++ src/app/api/functions.ts | 4 + src/app/api/models.ts | 1 + src/app/api/models/body-import-models.ts | 6 + 6 files changed, 238 insertions(+) create mode 100644 src/app/api/fn/models/export-models.ts create mode 100644 src/app/api/fn/models/import-models.ts create mode 100644 src/app/api/models/body-import-models.ts diff --git a/openapi.json b/openapi.json index a61df2d..87f1c6f 100644 --- a/openapi.json +++ b/openapi.json @@ -111,6 +111,20 @@ "title": "Body_add_clinical_validation", "type": "object" }, + "Body_import_models": { + "properties": { + "file": { + "contentMediaType": "application/octet-stream", + "title": "File", + "type": "string" + } + }, + "required": [ + "file" + ], + "title": "Body_import_models", + "type": "object" + }, "Body_upload": { "properties": { "file": { @@ -2881,6 +2895,142 @@ ] } }, + "/models/{domain}/export": { + "get": { + "operationId": "export_models", + "parameters": [ + { + "in": "path", + "name": "domain", + "required": true, + "schema": { + "$ref": "#/components/schemas/Domain" + } + }, + { + "in": "query", + "name": "names", + "required": false, + "schema": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Names" + } + }, + { + "in": "query", + "name": "versions", + "required": false, + "schema": { + "default": "champion", + "enum": [ + "champion", + "latest", + "all" + ], + "title": "Versions", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/zip": {} + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Export Models", + "tags": [ + "models" + ] + } + }, + "/models/{domain}/import": { + "post": { + "operationId": "import_models", + "parameters": [ + { + "in": "path", + "name": "domain", + "required": true, + "schema": { + "$ref": "#/components/schemas/Domain" + } + }, + { + "in": "query", + "name": "sha256", + "required": true, + "schema": { + "pattern": "^[0-9a-fA-F]{64}$", + "title": "Sha256", + "type": "string" + } + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/Body_import_models" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "additionalProperties": { + "type": "string" + }, + "title": "Response Import Models", + "type": "object" + } + } + }, + "description": "Successful Response" + }, + "422": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/HTTPValidationError" + } + } + }, + "description": "Validation Error" + } + }, + "summary": "Import Models", + "tags": [ + "models" + ] + } + }, "/models/{domain}/score": { "post": { "description": "Starts a risk batch from each model's champion; follow it at /runs.", diff --git a/src/app/api/fn/models/export-models.ts b/src/app/api/fn/models/export-models.ts new file mode 100644 index 0000000..8c68ed2 --- /dev/null +++ b/src/app/api/fn/models/export-models.ts @@ -0,0 +1,36 @@ +/* eslint-disable */ +/* Code generated by ng-openapi-gen DO NOT EDIT. */ + +import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { StrictHttpResponse } from '../../strict-http-response'; +import { RequestBuilder } from '../../request-builder'; + +import { Domain } from '../../models/domain'; + +export interface ExportModels$Params { + domain: Domain; + names?: (Array | null); + versions?: 'champion' | 'latest' | 'all'; +} + +export function exportModels(http: HttpClient, rootUrl: string, params: ExportModels$Params, context?: HttpContext): Observable> { + const rb = new RequestBuilder(rootUrl, exportModels.PATH, 'get'); + if (params) { + rb.path('domain', params.domain, {}); + rb.query('names', params.names, {}); + rb.query('versions', params.versions, {}); + } + + return http.request( + rb.build({ responseType: 'blob', accept: 'application/zip', context }) + ).pipe( + filter((r: any): r is HttpResponse => r instanceof HttpResponse), + map((r: HttpResponse) => { + return r as StrictHttpResponse; + }) + ); +} + +exportModels.PATH = '/models/{domain}/export'; diff --git a/src/app/api/fn/models/import-models.ts b/src/app/api/fn/models/import-models.ts new file mode 100644 index 0000000..e5f3aee --- /dev/null +++ b/src/app/api/fn/models/import-models.ts @@ -0,0 +1,41 @@ +/* eslint-disable */ +/* Code generated by ng-openapi-gen DO NOT EDIT. */ + +import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { filter, map } from 'rxjs/operators'; +import { StrictHttpResponse } from '../../strict-http-response'; +import { RequestBuilder } from '../../request-builder'; + +import { BodyImportModels } from '../../models/body-import-models'; +import { Domain } from '../../models/domain'; + +export interface ImportModels$Params { + domain: Domain; + sha256: string; + body: BodyImportModels +} + +export function importModels(http: HttpClient, rootUrl: string, params: ImportModels$Params, context?: HttpContext): Observable> { + const rb = new RequestBuilder(rootUrl, importModels.PATH, 'post'); + if (params) { + rb.path('domain', params.domain, {}); + rb.query('sha256', params.sha256, {}); + rb.body(params.body, 'multipart/form-data'); + } + + return http.request( + rb.build({ responseType: 'json', accept: 'application/json', context }) + ).pipe( + filter((r: any): r is HttpResponse => r instanceof HttpResponse), + map((r: HttpResponse) => { + return r as StrictHttpResponse<{ + [key: string]: string; + }>; + }) + ); +} + +importModels.PATH = '/models/{domain}/import'; diff --git a/src/app/api/functions.ts b/src/app/api/functions.ts index 6012282..e409a3f 100644 --- a/src/app/api/functions.ts +++ b/src/app/api/functions.ts @@ -37,6 +37,10 @@ export type { Models$Params as Models$Params } from './fn/models/models'; export { models as models } from './fn/models/models'; export type { Analyze$Params as Analyze$Params } from './fn/models/analyze'; export { analyze as analyze } from './fn/models/analyze'; +export type { ExportModels$Params as ExportModels$Params } from './fn/models/export-models'; +export { exportModels as exportModels } from './fn/models/export-models'; +export type { ImportModels$Params as ImportModels$Params } from './fn/models/import-models'; +export { importModels as importModels } from './fn/models/import-models'; export type { Score$Params as Score$Params } from './fn/models/score'; export { score as score } from './fn/models/score'; export type { Train$Params as Train$Params } from './fn/models/train'; diff --git a/src/app/api/models.ts b/src/app/api/models.ts index d9513dc..d36a34f 100644 --- a/src/app/api/models.ts +++ b/src/app/api/models.ts @@ -5,6 +5,7 @@ export type { Analysis } from './models/analysis'; export type { Analyze } from './models/analyze'; export type { AnalyzeRequest } from './models/analyze-request'; export type { BodyAddClinicalValidation } from './models/body-add-clinical-validation'; +export type { BodyImportModels } from './models/body-import-models'; export type { BodyUpload } from './models/body-upload'; export type { Cancel } from './models/cancel'; export type { Condition } from './models/condition'; diff --git a/src/app/api/models/body-import-models.ts b/src/app/api/models/body-import-models.ts new file mode 100644 index 0000000..cd13fed --- /dev/null +++ b/src/app/api/models/body-import-models.ts @@ -0,0 +1,6 @@ +/* eslint-disable */ +/* Code generated by ng-openapi-gen DO NOT EDIT. */ + +export interface BodyImportModels { + file: string; +}