diff --git a/invokeai/frontend/web/src/services/api/index.ts b/invokeai/frontend/web/src/services/api/index.ts index ada9153de5..0b97a97fb7 100644 --- a/invokeai/frontend/web/src/services/api/index.ts +++ b/invokeai/frontend/web/src/services/api/index.ts @@ -29,11 +29,14 @@ export type { GraphInvocation } from './models/GraphInvocation'; export type { GraphInvocationOutput } from './models/GraphInvocationOutput'; export type { HTTPValidationError } from './models/HTTPValidationError'; export type { ImageCategory } from './models/ImageCategory'; +export type { ImageDTO } from './models/ImageDTO'; export type { ImageField } from './models/ImageField'; +export type { ImageMetadata } from './models/ImageMetadata'; export type { ImageOutput } from './models/ImageOutput'; export type { ImageToImageInvocation } from './models/ImageToImageInvocation'; export type { ImageToLatentsInvocation } from './models/ImageToLatentsInvocation'; export type { ImageType } from './models/ImageType'; +export type { ImageUrlsDTO } from './models/ImageUrlsDTO'; export type { InfillColorInvocation } from './models/InfillColorInvocation'; export type { InfillPatchMatchInvocation } from './models/InfillPatchMatchInvocation'; export type { InfillTileInvocation } from './models/InfillTileInvocation'; @@ -56,6 +59,7 @@ export type { MultiplyInvocation } from './models/MultiplyInvocation'; export type { NoiseInvocation } from './models/NoiseInvocation'; export type { NoiseOutput } from './models/NoiseOutput'; export type { PaginatedResults_GraphExecutionState_ } from './models/PaginatedResults_GraphExecutionState_'; +export type { PaginatedResults_ImageDTO_ } from './models/PaginatedResults_ImageDTO_'; export type { ParamIntInvocation } from './models/ParamIntInvocation'; export type { PasteImageInvocation } from './models/PasteImageInvocation'; export type { PromptOutput } from './models/PromptOutput'; @@ -73,8 +77,6 @@ export type { UpscaleInvocation } from './models/UpscaleInvocation'; export type { VaeRepo } from './models/VaeRepo'; export type { ValidationError } from './models/ValidationError'; -export { FilesService } from './services/FilesService'; export { ImagesService } from './services/ImagesService'; export { ModelsService } from './services/ModelsService'; -export { RecordsService } from './services/RecordsService'; export { SessionsService } from './services/SessionsService'; diff --git a/invokeai/frontend/web/src/services/api/models/ImageDTO.ts b/invokeai/frontend/web/src/services/api/models/ImageDTO.ts new file mode 100644 index 0000000000..311a4a30a6 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ImageDTO.ts @@ -0,0 +1,50 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageCategory } from './ImageCategory'; +import type { ImageMetadata } from './ImageMetadata'; +import type { ImageType } from './ImageType'; + +/** + * Deserialized image record with URLs. + */ +export type ImageDTO = { + /** + * The name of the image. + */ + image_name: string; + /** + * The type of the image. + */ + image_type: ImageType; + /** + * The URL of the image. + */ + image_url: string; + /** + * The thumbnail URL of the image. + */ + thumbnail_url: string; + /** + * The category of the image. + */ + image_category: ImageCategory; + /** + * The created timestamp of the image. + */ + created_at: string; + /** + * The session ID. + */ + session_id?: string; + /** + * The node ID. + */ + node_id?: string; + /** + * The image's metadata. + */ + metadata?: ImageMetadata; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ImageMetadata.ts b/invokeai/frontend/web/src/services/api/models/ImageMetadata.ts new file mode 100644 index 0000000000..023d75fc56 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ImageMetadata.ts @@ -0,0 +1,68 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Core generation metadata for an image/tensor generated in InvokeAI. + * + * Also includes any metadata from the image's PNG tEXt chunks. + * + * Generated by traversing the execution graph, collecting the parameters of the nearest ancestors of a given node. + * + * Full metadata may be accessed by querying for the session in the `graph_executions` table. + */ +export type ImageMetadata = { + /** + * The positive conditioning. + */ + positive_conditioning?: string; + /** + * The negative conditioning. + */ + negative_conditioning?: string; + /** + * Width of the image/tensor in pixels. + */ + width?: number; + /** + * Height of the image/tensor in pixels. + */ + height?: number; + /** + * The seed used for noise generation. + */ + seed?: number; + /** + * The classifier-free guidance scale. + */ + cfg_scale?: number; + /** + * The number of steps used for inference. + */ + steps?: number; + /** + * The scheduler used for inference. + */ + scheduler?: string; + /** + * The model used for inference. + */ + model?: string; + /** + * The strength used for image-to-image/tensor-to-tensor. + */ + strength?: number; + /** + * The ID of the initial image. + */ + image?: string; + /** + * The ID of the initial tensor. + */ + tensor?: string; + /** + * Extra metadata, extracted from the PNG tEXt chunk. + */ + extra?: string; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/ImageUrlsDTO.ts b/invokeai/frontend/web/src/services/api/models/ImageUrlsDTO.ts new file mode 100644 index 0000000000..ea77c8af21 --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/ImageUrlsDTO.ts @@ -0,0 +1,28 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageType } from './ImageType'; + +/** + * The URLs for an image and its thumbnaill + */ +export type ImageUrlsDTO = { + /** + * The name of the image. + */ + image_name: string; + /** + * The type of the image. + */ + image_type: ImageType; + /** + * The URL of the image. + */ + image_url: string; + /** + * The thumbnail URL of the image. + */ + thumbnail_url: string; +}; + diff --git a/invokeai/frontend/web/src/services/api/models/PaginatedResults_ImageDTO_.ts b/invokeai/frontend/web/src/services/api/models/PaginatedResults_ImageDTO_.ts new file mode 100644 index 0000000000..5d2bdae5ab --- /dev/null +++ b/invokeai/frontend/web/src/services/api/models/PaginatedResults_ImageDTO_.ts @@ -0,0 +1,32 @@ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ImageDTO } from './ImageDTO'; + +/** + * Paginated results + */ +export type PaginatedResults_ImageDTO_ = { + /** + * Items + */ + items: Array; + /** + * Current Page + */ + page: number; + /** + * Total number of pages + */ + pages: number; + /** + * Number of items per page + */ + per_page: number; + /** + * Total number of items in result + */ + total: number; +}; + diff --git a/invokeai/frontend/web/src/services/api/services/FilesService.ts b/invokeai/frontend/web/src/services/api/services/FilesService.ts deleted file mode 100644 index 0a4d3b3a1f..0000000000 --- a/invokeai/frontend/web/src/services/api/services/FilesService.ts +++ /dev/null @@ -1,76 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ImageType } from '../models/ImageType'; - -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class FilesService { - - /** - * Get Image - * Gets an image - * @returns any Successful Response - * @throws ApiError - */ - public static getImage({ - imageType, - imageName, - }: { - /** - * The type of the image to get - */ - imageType: ImageType, - /** - * The id of the image to get - */ - imageName: string, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v1/files/images/{image_type}/{image_name}', - path: { - 'image_type': imageType, - 'image_name': imageName, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - - /** - * Get Thumbnail - * Gets a thumbnail - * @returns any Successful Response - * @throws ApiError - */ - public static getThumbnail({ - imageType, - imageName, - }: { - /** - * The type of the image whose thumbnail to get - */ - imageType: ImageType, - /** - * The id of the image whose thumbnail to get - */ - imageName: string, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v1/files/images/{image_type}/{image_name}/thumbnail', - path: { - 'image_type': imageType, - 'image_name': imageName, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - -} diff --git a/invokeai/frontend/web/src/services/api/services/ImagesService.ts b/invokeai/frontend/web/src/services/api/services/ImagesService.ts index 3af7d5b53e..7d567adc24 100644 --- a/invokeai/frontend/web/src/services/api/services/ImagesService.ts +++ b/invokeai/frontend/web/src/services/api/services/ImagesService.ts @@ -3,7 +3,10 @@ /* eslint-disable */ import type { Body_upload_image } from '../models/Body_upload_image'; import type { ImageCategory } from '../models/ImageCategory'; +import type { ImageDTO } from '../models/ImageDTO'; import type { ImageType } from '../models/ImageType'; +import type { ImageUrlsDTO } from '../models/ImageUrlsDTO'; +import type { PaginatedResults_ImageDTO_ } from '../models/PaginatedResults_ImageDTO_'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; @@ -11,106 +14,10 @@ import { request as __request } from '../core/request'; export class ImagesService { - /** - * Get Image - * Gets an image - * @returns any Successful Response - * @throws ApiError - */ - public static getImage({ - imageType, - imageName, - }: { - /** - * The type of the image to get - */ - imageType: ImageType, - /** - * The id of the image to get - */ - imageName: string, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v1/files/images/{image_type}/{image_name}', - path: { - 'image_type': imageType, - 'image_name': imageName, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - - /** - * Get Thumbnail - * Gets a thumbnail - * @returns any Successful Response - * @throws ApiError - */ - public static getThumbnail({ - imageType, - imageName, - }: { - /** - * The type of the image whose thumbnail to get - */ - imageType: ImageType, - /** - * The id of the image whose thumbnail to get - */ - imageName: string, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v1/files/images/{image_type}/{image_name}/thumbnail', - path: { - 'image_type': imageType, - 'image_name': imageName, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - - /** - * Get Image Record - * Gets an image record by id - * @returns any Successful Response - * @throws ApiError - */ - public static getImageRecord({ - imageType, - imageName, - }: { - /** - * The type of the image record to get - */ - imageType: ImageType, - /** - * The id of the image record to get - */ - imageName: string, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v1/images/records/{image_type}/{image_name}', - path: { - 'image_type': imageType, - 'image_name': imageName, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - /** * List Image Records * Gets a list of image records by type and category - * @returns any Successful Response + * @returns PaginatedResults_ImageDTO_ Successful Response * @throws ApiError */ public static listImageRecords({ @@ -135,10 +42,10 @@ export class ImagesService { * The number of image records per page */ perPage?: number, - }): CancelablePromise { + }): CancelablePromise { return __request(OpenAPI, { method: 'GET', - url: '/api/v1/images/records/', + url: '/api/v1/images/', query: { 'image_type': imageType, 'image_category': imageCategory, @@ -211,4 +118,132 @@ export class ImagesService { }); } + /** + * Get Image Record + * Gets an image record by id + * @returns ImageDTO Successful Response + * @throws ApiError + */ + public static getImageRecord({ + imageType, + imageName, + }: { + /** + * The type of the image record to get + */ + imageType: ImageType, + /** + * The id of the image record to get + */ + imageName: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v1/images/{image_type}/{image_name}/record', + path: { + 'image_type': imageType, + 'image_name': imageName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + + /** + * Get Image + * Gets an image + * @returns any Successful Response + * @throws ApiError + */ + public static getImage({ + imageType, + imageName, + }: { + /** + * The type of the image to get + */ + imageType: ImageType, + /** + * The id of the image to get + */ + imageName: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v1/images/{image_type}/{image_name}/image', + path: { + 'image_type': imageType, + 'image_name': imageName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + + /** + * Get Thumbnail + * Gets a thumbnail + * @returns any Successful Response + * @throws ApiError + */ + public static getThumbnail({ + imageType, + imageName, + }: { + /** + * The type of the image whose thumbnail to get + */ + imageType: ImageType, + /** + * The id of the image whose thumbnail to get + */ + imageName: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v1/images/{image_type}/{image_name}/thumbnail', + path: { + 'image_type': imageType, + 'image_name': imageName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + + /** + * Get Image Urls + * Gets an image and thumbnail URL + * @returns ImageUrlsDTO Successful Response + * @throws ApiError + */ + public static getImageUrls({ + imageType, + imageName, + }: { + /** + * The type of the image whose URL to get + */ + imageType: ImageType, + /** + * The id of the image whose URL to get + */ + imageName: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/api/v1/images/{image_type}/{image_name}/urls', + path: { + 'image_type': imageType, + 'image_name': imageName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + } diff --git a/invokeai/frontend/web/src/services/api/services/RecordsService.ts b/invokeai/frontend/web/src/services/api/services/RecordsService.ts deleted file mode 100644 index 4079f60ab5..0000000000 --- a/invokeai/frontend/web/src/services/api/services/RecordsService.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -import type { ImageCategory } from '../models/ImageCategory'; -import type { ImageType } from '../models/ImageType'; - -import type { CancelablePromise } from '../core/CancelablePromise'; -import { OpenAPI } from '../core/OpenAPI'; -import { request as __request } from '../core/request'; - -export class RecordsService { - - /** - * Get Image Record - * Gets an image record by id - * @returns any Successful Response - * @throws ApiError - */ - public static getImageRecord({ - imageType, - imageName, - }: { - /** - * The type of the image record to get - */ - imageType: ImageType, - /** - * The id of the image record to get - */ - imageName: string, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v1/images/records/{image_type}/{image_name}', - path: { - 'image_type': imageType, - 'image_name': imageName, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - - /** - * List Image Records - * Gets a list of image records by type and category - * @returns any Successful Response - * @throws ApiError - */ - public static listImageRecords({ - imageType, - imageCategory, - page, - perPage = 10, - }: { - /** - * The type of image records to get - */ - imageType: ImageType, - /** - * The kind of image records to get - */ - imageCategory: ImageCategory, - /** - * The page of image records to get - */ - page?: number, - /** - * The number of image records per page - */ - perPage?: number, - }): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v1/images/records/', - query: { - 'image_type': imageType, - 'image_category': imageCategory, - 'page': page, - 'per_page': perPage, - }, - errors: { - 422: `Validation Error`, - }, - }); - } - -}