// Generated from openapi/openapi.json. Do not edit by hand. import type { PrivateContentNoticeAckResponse, PrivateContentNoticeAckRequest, CreditAdjustmentResponse, CreditAdjustmentRequest, AdminServiceHealthCheckRequest, BrowserSupportSuccess, BrowserSupportRequest, AccountDeletionResponse, AccountDeletionCompleteRequest, AdminLoginCompleteResponse, AdminLoginCompleteRequest, LoginCompleteResponse, LoginCompleteRequest, RegistrationCompleteResponse, RegistrationCompleteRequest, GenerationCreateResponse, AccountSettingsResponse, AdminDiagnosticsResponse, AdminOperationAuditResponse, AdminOverviewResponse, AdminServicesResponse, AdminServicesStorageResponse, AdminSessionResponse, CreditBalanceResponse, BootstrapResponse, GenerationTaskResponse, SseEvent, ModelConfig, ModelConfigurationResponse, CreditLedgerResponse, PrivateContentAccessAuditResponse, ProjectDetailResponse, UserSessionResponse, AdminGenerationListResponse, ProjectListResponse, RecentAssetListResponse, LogoutResponse, PrivateContentPromptResponse, ProjectPurgeResponse, RecentAssetRecordResponse, RecentAssetRecordRequest, AdminServiceRecoveryRequest, ProjectRenameResponse, ProjectRenameRequest, ModelConfigUpdateRequest, ProjectRestoreResponse, ReverseGeocodeResponse, ReverseGeocodeRequest, LatestExportSaveResponse, ProjectStateSaveResponse, ProjectEditableState, AccountDeletionSendResponse, RegistrationSendResponse, AdminLoginSendRequest, LoginSendRequest, RegistrationSendRequest, FailedEmptyTrashResponse, FailedEmptyTrashRequest, ProjectTrashResponse, AccountProfileUpdateResponse, AccountProfileUpdateRequest, AdminServiceLimitRequest } from "./types.gen.js"; export interface ClientOptions { baseUrl?: string; fetch?: typeof globalThis.fetch; headers?: HeadersInit; } export async function ackPrivateContentNotice(body: PrivateContentNoticeAckRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/private-content-notice/ack`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function adjustAdminUserCredits(body: CreditAdjustmentRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/users/{userId}/credit-adjustments`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function checkAdminServiceHealth(body: AdminServiceHealthCheckRequest, options: ClientOptions = {}): Promise<{ "available": boolean; "check_id": string; "checked_at": string; }> { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/services/{service_id}/health-check`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise<{ "available": boolean; "check_id": string; "checked_at": string; }>; } export async function checkBrowserSupport(body: BrowserSupportRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/support/check`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function completeAccountDeletion(body: AccountDeletionCompleteRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/account/deletion/complete`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function completeAdminLogin(body: AdminLoginCompleteRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin-auth/login/complete`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function completeLogin(body: LoginCompleteRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/auth/login/complete`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function completeRegistration(body: RegistrationCompleteRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/auth/register/complete`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function createGeneration(body: FormData, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); const response = await request(`${options.baseUrl ?? ""}/api/v1/generations`, { body: body, method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function downloadLatestExport(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}/latest-exports/{format}`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.blob() as Promise; } export async function downloadOriginalGeneration(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/private-assets/projects/{projectId}/images/{imageId}`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.blob() as Promise; } export async function getAccountSettings(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/account/settings`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getAdminDiagnostics(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/diagnostics`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getAdminOperationAudit(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/audit/operations`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getAdminOverview(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/overview`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getAdminServices(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/services`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getAdminServicesStorage(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/services-storage`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getAdminSession(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin-auth/session`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getAdminUserCredits(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/users/{userId}/credits`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getBootstrap(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/bootstrap`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getCurrentGeneration(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/generations/current`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export function getEvents(options: Pick = {}): string { return `${options.baseUrl ?? ""}/api/v1/events`; } export async function getGeneration(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/generations/{generationId}`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getModel(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/models/{model_id}`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getModels(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/models`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getMyCreditLedger(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/me/credit-ledger`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getMyCredits(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/me/credits`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getPrivateContentAccessAudit(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/audit/private-content`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getProject(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function getUserSession(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/auth/session`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function listAdminGenerations(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/generations`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function listProjects(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/projects`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function listRecentAssets(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/assets/recent`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function logoutUser(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/auth/logout`, { method: "POST", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function openAdminGenerationImage(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/private-content/generations/{generationId}/image`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.blob() as Promise; } export async function openAdminGenerationPrompt(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/private-content/generations/{generationId}/prompt`, { method: "GET", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function purgeProject(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}/purge`, { method: "POST", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function recordRecentAsset(body: RecentAssetRecordRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/assets/recent`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function recoverAdminService(body: AdminServiceRecoveryRequest, options: ClientOptions = {}): Promise<{ "status": "active"; }> { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/services/{service_id}/recover`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise<{ "status": "active"; }>; } export async function renameProject(body: ProjectRenameRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}`, { body: JSON.stringify(body), method: "PATCH", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function replaceModelConfiguration(body: ModelConfigUpdateRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/models/configuration`, { body: JSON.stringify(body), method: "PUT", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function restoreProject(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}/restore`, { method: "POST", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function reverseGeocodeLocation(body: ReverseGeocodeRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/location/reverse-geocode`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function saveLatestExport(body: FormData, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}/latest-exports/{format}`, { body: body, method: "PUT", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function saveProjectState(body: ProjectEditableState, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}/state`, { body: JSON.stringify(body), method: "PUT", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function sendAccountDeletionCode(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/account/deletion/send`, { method: "POST", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function sendAdminLoginCode(body: AdminLoginSendRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin-auth/login/send`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function sendLoginCode(body: LoginSendRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/auth/login/send`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function sendRegistrationCode(body: RegistrationSendRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/auth/register/send`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function trashFailedEmptyProjects(body: FailedEmptyTrashRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/failed-empty/trash`, { body: JSON.stringify(body), method: "POST", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function trashProject(options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const response = await request(`${options.baseUrl ?? ""}/api/v1/projects/{projectId}/trash`, { method: "POST", headers: options.headers ?? {} }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function updateAccountProfile(body: AccountProfileUpdateRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/account/settings/profile`, { body: JSON.stringify(body), method: "PUT", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; } export async function updateAdminServiceHardLimit(body: AdminServiceLimitRequest, options: ClientOptions = {}): Promise { const request = options.fetch ?? globalThis.fetch; const headers = new Headers(options.headers); headers.set("Content-Type", "application/json"); const response = await request(`${options.baseUrl ?? ""}/api/v1/admin/services/{service_id}/limits`, { body: JSON.stringify(body), method: "PATCH", headers }); if (!response.ok) throw new Error(`HTTP ${response.status}`); return response.json() as Promise; }