From af4e942b96f8752156868ca2332b47eea987e9b7 Mon Sep 17 00:00:00 2001 From: xnought Date: Sat, 2 Dec 2023 15:20:19 -0800 Subject: [PATCH] sh run.sh gen_api --- frontend/src/openapi/models/EditBody.ts | 3 + .../src/openapi/models/HTTPValidationError.ts | 1 + frontend/src/openapi/models/ProteinEntry.ts | 2 + frontend/src/openapi/models/UploadBody.ts | 2 + .../src/openapi/models/ValidationError.ts | 1 + .../src/openapi/services/DefaultService.ts | 94 +++++++++++++++---- 6 files changed, 83 insertions(+), 20 deletions(-) diff --git a/frontend/src/openapi/models/EditBody.ts b/frontend/src/openapi/models/EditBody.ts index 00705931..b0bf7ae9 100644 --- a/frontend/src/openapi/models/EditBody.ts +++ b/frontend/src/openapi/models/EditBody.ts @@ -6,6 +6,9 @@ export type EditBody = { oldName: string; newName: string; + oldSpeciesName: string; + newSpeciesName: string; newContent?: (string | null); newRefs?: (string | null); }; + diff --git a/frontend/src/openapi/models/HTTPValidationError.ts b/frontend/src/openapi/models/HTTPValidationError.ts index e218a9f3..c0bcc87c 100644 --- a/frontend/src/openapi/models/HTTPValidationError.ts +++ b/frontend/src/openapi/models/HTTPValidationError.ts @@ -8,3 +8,4 @@ import type { ValidationError } from './ValidationError'; export type HTTPValidationError = { detail?: Array; }; + diff --git a/frontend/src/openapi/models/ProteinEntry.ts b/frontend/src/openapi/models/ProteinEntry.ts index b2e3f3df..95c53a8b 100644 --- a/frontend/src/openapi/models/ProteinEntry.ts +++ b/frontend/src/openapi/models/ProteinEntry.ts @@ -7,6 +7,8 @@ export type ProteinEntry = { name: string; length: number; mass: number; + speciesName: string; content?: (string | null); refs?: (string | null); }; + diff --git a/frontend/src/openapi/models/UploadBody.ts b/frontend/src/openapi/models/UploadBody.ts index 93574852..2619843c 100644 --- a/frontend/src/openapi/models/UploadBody.ts +++ b/frontend/src/openapi/models/UploadBody.ts @@ -5,7 +5,9 @@ export type UploadBody = { name: string; + speciesName: string; content: string; refs: string; pdbFileStr: string; }; + diff --git a/frontend/src/openapi/models/ValidationError.ts b/frontend/src/openapi/models/ValidationError.ts index 0a3e90e9..18997ec7 100644 --- a/frontend/src/openapi/models/ValidationError.ts +++ b/frontend/src/openapi/models/ValidationError.ts @@ -8,3 +8,4 @@ export type ValidationError = { msg: string; type: string; }; + diff --git a/frontend/src/openapi/services/DefaultService.ts b/frontend/src/openapi/services/DefaultService.ts index b2f66a1a..9e3950f7 100644 --- a/frontend/src/openapi/services/DefaultService.ts +++ b/frontend/src/openapi/services/DefaultService.ts @@ -13,10 +13,52 @@ import { request as __request } from '../core/request'; export class DefaultService { + /** + * Get Pdb File + * @param proteinName + * @returns any Successful Response + * @throws ApiError + */ + public static getPdbFile( + proteinName: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/pdb/{protein_name}', + path: { + 'protein_name': proteinName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + + /** + * Get Fasta File + * @param proteinName + * @returns any Successful Response + * @throws ApiError + */ + public static getFastaFile( + proteinName: string, + ): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/fasta/{protein_name}', + path: { + 'protein_name': proteinName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** * Get All Entries * Gets all protein entries from the database - * Returns: list[ProteinEntry] if found | None if not found + * Returns: list[ProteinEntry] if found | None if not found * @returns any Successful Response * @throws ApiError */ @@ -30,19 +72,19 @@ export class DefaultService { /** * Search Entries * Gets a list of protein entries by a search string - * Returns: list[ProteinEntry] if found | None if not found - * @param query + * Returns: list[ProteinEntry] if found | None if not found + * @param proteinName * @returns any Successful Response * @throws ApiError */ public static searchEntries( -query: string, -): CancelablePromise<(Array | null)> { + proteinName: string, + ): CancelablePromise<(Array | null)> { return __request(OpenAPI, { method: 'GET', - url: '/search-entries/{query}', + url: '/search-entries/{protein_name}', path: { - 'query': query, + 'protein_name': proteinName, }, errors: { 422: `Validation Error`, @@ -53,14 +95,14 @@ query: string, /** * Get Protein Entry * Get a single protein entry by its id - * Returns: ProteinEntry if found | None if not found - * @param proteinName + * Returns: ProteinEntry if found | None if not found + * @param proteinName * @returns any Successful Response * @throws ApiError */ public static getProteinEntry( -proteinName: string, -): CancelablePromise<(ProteinEntry | null)> { + proteinName: string, + ): CancelablePromise<(ProteinEntry | null)> { return __request(OpenAPI, { method: 'GET', url: '/protein-entry/{protein_name}', @@ -75,13 +117,13 @@ proteinName: string, /** * Delete Protein Entry - * @param proteinName + * @param proteinName * @returns any Successful Response * @throws ApiError */ public static deleteProteinEntry( -proteinName: string, -): CancelablePromise { + proteinName: string, + ): CancelablePromise { return __request(OpenAPI, { method: 'DELETE', url: '/protein-entry/{protein_name}', @@ -96,13 +138,13 @@ proteinName: string, /** * Upload Protein Entry - * @param requestBody + * @param requestBody * @returns any Successful Response * @throws ApiError */ public static uploadProteinEntry( -requestBody: UploadBody, -): CancelablePromise<(UploadError | null)> { + requestBody: UploadBody, + ): CancelablePromise<(UploadError | null)> { return __request(OpenAPI, { method: 'POST', url: '/protein-upload', @@ -116,13 +158,13 @@ requestBody: UploadBody, /** * Edit Protein Entry - * @param requestBody + * @param requestBody * @returns any Successful Response * @throws ApiError */ public static editProteinEntry( -requestBody: EditBody, -): CancelablePromise<(UploadError | null)> { + requestBody: EditBody, + ): CancelablePromise<(UploadError | null)> { return __request(OpenAPI, { method: 'PUT', url: '/protein-edit', @@ -134,4 +176,16 @@ requestBody: EditBody, }); } + /** + * Get All Species + * @returns any Successful Response + * @throws ApiError + */ + public static getAllSpecies(): CancelablePromise<(Array | null)> { + return __request(OpenAPI, { + method: 'GET', + url: '/all-species', + }); + } + }