import ApiGroup, { ApiConfig } from '../ApiGroup'; import { AvailableModel, EstimateRequest, ImageUrlParams, ProjectParams, SizePreset, SupportedModel } from './types'; import Project from './Project'; import { ProjectApiEvents } from './types/events'; import { RawProject } from './types/RawProject'; import { SupernetType } from '../ApiClient/WebSocketClient/types'; declare class ProjectsApi extends ApiGroup { private _availableModels; private projects; private _supportedModels; get availableModels(): AvailableModel[]; constructor(config: ApiConfig); private handleChangeNetwork; private handleSwarmModels; private handleJobState; private handleJobProgress; private handleJobResult; private handleJobError; private handleProjectEvent; private handleJobEvent; private handleServerDisconnected; /** * Wait for available models to be received from the network. Useful for scripts that need to * run after the models are loaded. * @param timeout - timeout in milliseconds until the promise is rejected */ waitForModels(timeout?: number): Promise; /** * Send new project request to the network. Returns project instance which can be used to track * progress and get resulting images. * @param data */ create(data: ProjectParams): Promise; /** * Get project by id, this API returns project data from the server only if the project is * completed or failed. If the project is still processing, it will throw 404 error. * @internal * @param projectId */ get(projectId: string): Promise; /** * Cancel project by id. This will cancel all jobs in the project and mark project as canceled. * Client may still receive job events for the canceled jobs as it takes some time, but they will * be ignored * @param projectId **/ cancel(projectId: string): Promise; private uploadGuideImage; /** * Estimate project cost */ estimateCost({ network, model, imageCount, stepCount, previewCount, cnEnabled, startingImageStrength, width, height, sizePreset }: EstimateRequest): Promise<{ token: string; usd: string; }>; /** * Get upload URL for image * @internal * @param params */ uploadUrl(params: ImageUrlParams): Promise; /** * Get download URL for image * @internal * @param params */ downloadUrl(params: ImageUrlParams): Promise; getSupportedModels(forceRefresh?: boolean): Promise; /** * Get supported size presets for the model and network. Size presets are cached for 10 minutes. * * @example * ```ts * const presets = await client.projects.getSizePresets('fast', 'flux1-schnell-fp8'); * console.log(presets); * ``` * * @param network - 'fast' or 'relaxed' * @param modelId - model id (e.g. 'flux1-schnell-fp8') * @param forceRefresh - force refresh cache * @returns {Promise<{ * label: string; * id: string; * width: number; * height: number; * ratio: string; * aspect: string; * }[]>} */ getSizePresets(network: SupernetType, modelId: string, forceRefresh?: boolean): Promise; /** * Get available models and their worker counts. Normally, you would get list once you connect * to the server, but you can also call this method to get the list of available models manually. * @param network */ getAvailableModels(network: SupernetType): Promise; } export default ProjectsApi;