/* eslint-disable */ /* * Generated by tools/generate_api_client.py from openapi/v2.json. * Do not edit this file directly. Run `npm --prefix frontend run api:generate`. */ export interface Components { schemas: { AuditList: { items : Array; next_cursor : string | null }; AuditSummary: { action : string; created_at : string; details : Record; id : string; outcome : string; request_id : string; resource_id : string | null; resource_type : string }; AuthenticatedUser: { id : string; username : string }; BackupDeletePreview: { backup_id : string; destructive_action : string; eligible : boolean; reason : string | null }; BackupList: { items : Array }; BackupSummary: { created_at : string; execution_id : string; id : string; integrity : string; logical_bytes : number; manifest_id : string; pinned : boolean; stored_bytes : number; tombstoned_at : string | null }; EmailSettingsInput: { host : string; max_attempts?: number; password : string; port?: number; rate_limit_per_minute?: number; sender : string; username : string }; ExecutionList: { items : Array }; ExecutionSummary: { attempt : number; id : string; progress : Record; reason_code : string | null; revision : number; state : string }; HTTPValidationError: { detail?: Array }; JobInput: { allow_empty?: boolean; enabled?: boolean; exclusions?: Array; name : string; repository_id : string; requested_mode?: string; retention?: Record; source_id : string }; JobList: { items : Array }; JobSummary: { enabled : boolean; id : string; name : string; repository_id : string; requested_mode : string; schedule : Components['schemas']["ScheduleSummary"] | null; source_id : string; state : string }; LocalSourceInput: { kind : string; name : string; public_config : Record }; LoginInput: { password : string; username : string }; NotificationAttemptList: { items : Array }; NotificationAttemptSummary: { completed_at : string | null; diagnostic : string | null; number : number; outcome : string; response_class : string | null; started_at : string }; NotificationDeliveryList: { items : Array }; NotificationDeliverySummary: { attempt_count : number; due_at : string; event_id : string; id : string; response_class : string | null; response_summary : string | null; state : string; subscription_id : string; terminal_reason : string | null }; NotificationSubscriptionInput: { channel : "webhook" | "email"; destination : Record; event_filters : Array; rate_limit_per_minute?: number; signing_secret?: string | null }; NotificationSubscriptionList: { items : Array }; NotificationSubscriptionPatch: { destination?: Record | null; event_filters?: Array | null; rate_limit_per_minute?: number | null; state?: "active" | "disabled" | "archived" | null }; NotificationSubscriptionSummary: { channel : string; created_at : string; destination : Record; event_filters : Array; id : string; rate_limit_per_minute : number; revision : number; state : string; updated_at : string }; RecoveryStatus: { encrypted_repository_count : number; recovery_mode : string; runbook : string }; RepositoryInput: { compression?: string; encryption?: string; name : string; relative_path : string }; RepositoryList: { items : Array }; RepositoryPatch: { compression?: string | null; encryption?: string | null }; RepositorySummary: { compression : string; encryption : string; format_version : number; id : string; name : string; state : string }; RestoreInput: { destination : string; dry_run?: boolean; overwrite_policy?: string; selection?: Array }; SSHSourceInput: { kind : string; name : string; private_key_secret_id : string; public_config : Components['schemas']["SSHSourcePublicConfig"] }; SSHSourcePublicConfig: { host_key : string; hostname : string; port : number; root : string; username : string }; ScheduleInput: { cron : string; enabled?: boolean; misfire_grace_seconds?: number; timezone : string }; ScheduleSummary: { cron : string; enabled : boolean; id : string; last_enqueue_outcome : string | null; next_nominal_at : string | null; timezone : string }; SecretInput: { purpose : string; value : string }; SessionUser: { id : string; state : string; username : string }; SetupInput: { bootstrap_secret?: string | null; password : string; username : string }; SigningKeyRotateInput: { overlap_seconds?: number; secret : string }; SourceList: { items : Array }; SourceSummary: { id : string; kind : string; name : string; public_config : Record; state : string }; TokenInput: { expires_at?: string | null; scopes : Array }; UserPatch: { state : string }; ValidationError: { ctx?: Record; input?: unknown; loc : Array; msg : string; type : string }; }; } export type CreateSecretParams = { body : Components['schemas']["SecretInput"] }; export type GetUserParams = { path: { user_id: string } }; export type PatchUserParams = { path: { user_id: string }; body : Components['schemas']["UserPatch"] }; export type ListAuditParams = { query?: { limit?: number; cursor?: string | null } }; export type LoginParams = { body : Components['schemas']["LoginInput"] }; export type CreateTokenParams = { body : Components['schemas']["TokenInput"] }; export type RevokeTokenParams = { path: { token_id: string } }; export type GetBackupParams = { path: { backup_id: string } }; export type BackupDeletePreviewParams = { path: { backup_id: string } }; export type CreateRestoreParams = { path: { backup_id: string }; body : Components['schemas']["RestoreInput"] }; export type VerifyBackupParams = { path: { backup_id: string } }; export type GetExecutionParams = { path: { execution_id: string } }; export type CancelExecutionParams = { path: { execution_id: string } }; export type ExecutionEventsParams = { path: { execution_id: string } }; export type RetryExecutionParams = { path: { execution_id: string } }; export type CreateJobParams = { body : Components['schemas']["JobInput"] }; export type EnqueueExecutionParams = { path: { job_id: string } }; export type DeleteScheduleParams = { path: { job_id: string } }; export type GetScheduleParams = { path: { job_id: string } }; export type PatchScheduleParams = { path: { job_id: string }; body : Components['schemas']["ScheduleInput"] }; export type CreateScheduleParams = { path: { job_id: string }; body : Components['schemas']["ScheduleInput"] }; export type ListNotificationDeliveriesParams = { query?: { limit?: number } }; export type ListNotificationAttemptsParams = { path: { delivery_id: string } }; export type RetryNotificationDeliveryParams = { path: { delivery_id: string } }; export type PutNotificationEmailSettingsParams = { body : Components['schemas']["EmailSettingsInput"] }; export type CreateNotificationSubscriptionParams = { body : Components['schemas']["NotificationSubscriptionInput"] }; export type GetNotificationSubscriptionParams = { path: { subscription_id: string } }; export type PatchNotificationSubscriptionParams = { path: { subscription_id: string }; body : Components['schemas']["NotificationSubscriptionPatch"] }; export type RotateNotificationSigningKeyParams = { path: { subscription_id: string }; body : Components['schemas']["SigningKeyRotateInput"] }; export type TestNotificationSubscriptionParams = { path: { subscription_id: string } }; export type CreateRepositoryParams = { body : Components['schemas']["RepositoryInput"] }; export type GetRepositoryParams = { path: { repository_id: string } }; export type PatchRepositoryParams = { path: { repository_id: string }; body : Components['schemas']["RepositoryPatch"] }; export type InspectRepositoryEndpointParams = { path: { repository_id: string } }; export type GetRestoreParams = { path: { restore_id: string } }; export type SetupParams = { body : Components['schemas']["SetupInput"] }; export type CreateSourceParams = { body : Components['schemas']["LocalSourceInput"] | Components['schemas']["SSHSourceInput"] }; export type ArchiveSourceParams = { path: { source_id: string } }; export type ProbeSourceParams = { path: { source_id: string } }; export type RequestOptions = Omit; export type Problem = { type: string; title: string; status: number; detail: string; instance: string; code: string; }; export class ApiError extends Error { readonly status: number; readonly problem?: Problem; constructor(status: number, problem?: Problem) { super(problem?.detail ?? `Request failed with status ${status}.`); this.name = "ApiError"; this.status = status; this.problem = problem; } } export function isApiError(error: unknown): error is ApiError { return error instanceof ApiError; } function appendQuery(search: URLSearchParams, query: Record | undefined): void { if (!query) return; for (const [key, value] of Object.entries(query)) { if (value === undefined || value === null) continue; for (const item of Array.isArray(value) ? value : [value]) search.append(key, String(item)); } } async function request( url: URL, method: string, options: RequestOptions, body?: unknown, ): Promise { const headers = new Headers(options.headers); if (body !== undefined && !headers.has("Content-Type")) { headers.set("Content-Type", "application/json"); } const response = await fetch(url, { ...options, method, headers, credentials: options.credentials ?? "same-origin", body: body === undefined ? undefined : JSON.stringify(body), }); if (response.status === 204) return undefined as T; const contentType = response.headers.get("content-type") ?? ""; const isJson = contentType.includes("application/json") || contentType.includes("application/problem+json"); const payload: unknown = isJson ? await response.json() : undefined; if (!response.ok) throw new ApiError(response.status, payload as Problem | undefined); return payload as T; } export class BackupToolClient { constructor(readonly baseUrl = window.location.origin) {} async listSecrets(options: RequestOptions = {}): Promise>> { const url = new URL("/api/v2/admin/secrets", this.baseUrl); return request>>( url, "GET", options ); } async createSecret(params: CreateSecretParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/admin/secrets", this.baseUrl); return request>( url, "POST", options, params.body ); } async getUser(params: GetUserParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/admin/users/{user_id}".replace("{user_id}", encodeURIComponent(String(params.path.user_id))), this.baseUrl); return request>( url, "GET", options ); } async patchUser(params: PatchUserParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/admin/users/{user_id}".replace("{user_id}", encodeURIComponent(String(params.path.user_id))), this.baseUrl); return request>( url, "PATCH", options, params.body ); } async listAudit(params: ListAuditParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/audit", this.baseUrl); appendQuery(url.searchParams, params.query); return request( url, "GET", options ); } async login(params: LoginParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/auth/login", this.baseUrl); return request( url, "POST", options, params.body ); } async logout(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/auth/logout", this.baseUrl); return request( url, "POST", options ); } async getSession(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/auth/session", this.baseUrl); return request( url, "GET", options ); } async createToken(params: CreateTokenParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/auth/tokens", this.baseUrl); return request( url, "POST", options, params.body ); } async revokeToken(params: RevokeTokenParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/auth/tokens/{token_id}".replace("{token_id}", encodeURIComponent(String(params.path.token_id))), this.baseUrl); return request( url, "DELETE", options ); } async listBackups(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/backups", this.baseUrl); return request( url, "GET", options ); } async getBackup(params: GetBackupParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/backups/{backup_id}".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl); return request( url, "GET", options ); } async backupDeletePreview(params: BackupDeletePreviewParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/backups/{backup_id}/delete-preview".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl); return request( url, "GET", options ); } async createRestore(params: CreateRestoreParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/backups/{backup_id}/restores".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl); return request>( url, "POST", options, params.body ); } async verifyBackup(params: VerifyBackupParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/backups/{backup_id}/verify".replace("{backup_id}", encodeURIComponent(String(params.path.backup_id))), this.baseUrl); return request( url, "POST", options ); } async listExecutions(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/executions", this.baseUrl); return request( url, "GET", options ); } async getExecution(params: GetExecutionParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/executions/{execution_id}".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl); return request( url, "GET", options ); } async cancelExecution(params: CancelExecutionParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/executions/{execution_id}/cancel".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl); return request>( url, "POST", options ); } /** EventSource transport; intentionally not a JSON fetch Promise. */ executionEventsUrl(params: ExecutionEventsParams): URL { const url = new URL("/api/v2/executions/{execution_id}/events".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl); return url; } async retryExecution(params: RetryExecutionParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/executions/{execution_id}/retry".replace("{execution_id}", encodeURIComponent(String(params.path.execution_id))), this.baseUrl); return request>( url, "POST", options ); } async listJobs(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/jobs", this.baseUrl); return request( url, "GET", options ); } async createJob(params: CreateJobParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/jobs", this.baseUrl); return request>( url, "POST", options, params.body ); } async enqueueExecution(params: EnqueueExecutionParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/jobs/{job_id}/executions".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl); return request>( url, "POST", options ); } async deleteSchedule(params: DeleteScheduleParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl); return request( url, "DELETE", options ); } async getSchedule(params: GetScheduleParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl); return request>( url, "GET", options ); } async patchSchedule(params: PatchScheduleParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl); return request>( url, "PATCH", options, params.body ); } async createSchedule(params: CreateScheduleParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/jobs/{job_id}/schedule".replace("{job_id}", encodeURIComponent(String(params.path.job_id))), this.baseUrl); return request>( url, "POST", options, params.body ); } async listNotificationDeliveries(params: ListNotificationDeliveriesParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/notifications/deliveries", this.baseUrl); appendQuery(url.searchParams, params.query); return request( url, "GET", options ); } async listNotificationAttempts(params: ListNotificationAttemptsParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/notifications/deliveries/{delivery_id}/attempts".replace("{delivery_id}", encodeURIComponent(String(params.path.delivery_id))), this.baseUrl); return request( url, "GET", options ); } async retryNotificationDelivery(params: RetryNotificationDeliveryParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/deliveries/{delivery_id}/retry".replace("{delivery_id}", encodeURIComponent(String(params.path.delivery_id))), this.baseUrl); return request>( url, "POST", options ); } async getNotificationEmailSettings(options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/email-settings", this.baseUrl); return request>( url, "GET", options ); } async putNotificationEmailSettings(params: PutNotificationEmailSettingsParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/email-settings", this.baseUrl); return request>( url, "PUT", options, params.body ); } async notificationCatalog(options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/event-catalog", this.baseUrl); return request>( url, "GET", options ); } async listNotificationSubscriptions(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/notifications/subscriptions", this.baseUrl); return request( url, "GET", options ); } async createNotificationSubscription(params: CreateNotificationSubscriptionParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/subscriptions", this.baseUrl); return request>( url, "POST", options, params.body ); } async getNotificationSubscription(params: GetNotificationSubscriptionParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl); return request>( url, "GET", options ); } async patchNotificationSubscription(params: PatchNotificationSubscriptionParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl); return request>( url, "PATCH", options, params.body ); } async rotateNotificationSigningKey(params: RotateNotificationSigningKeyParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}/signing-keys/rotate".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl); return request>( url, "POST", options, params.body ); } async testNotificationSubscription(params: TestNotificationSubscriptionParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/notifications/subscriptions/{subscription_id}/test".replace("{subscription_id}", encodeURIComponent(String(params.path.subscription_id))), this.baseUrl); return request>( url, "POST", options ); } async listRepositories(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/repositories", this.baseUrl); return request( url, "GET", options ); } async createRepository(params: CreateRepositoryParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/repositories", this.baseUrl); return request>( url, "POST", options, params.body ); } async getRepository(params: GetRepositoryParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/repositories/{repository_id}".replace("{repository_id}", encodeURIComponent(String(params.path.repository_id))), this.baseUrl); return request>( url, "GET", options ); } async patchRepository(params: PatchRepositoryParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/repositories/{repository_id}".replace("{repository_id}", encodeURIComponent(String(params.path.repository_id))), this.baseUrl); return request( url, "PATCH", options, params.body ); } async inspectRepositoryEndpoint(params: InspectRepositoryEndpointParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/repositories/{repository_id}/inspection".replace("{repository_id}", encodeURIComponent(String(params.path.repository_id))), this.baseUrl); return request>( url, "GET", options ); } async getRestore(params: GetRestoreParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/restores/{restore_id}".replace("{restore_id}", encodeURIComponent(String(params.path.restore_id))), this.baseUrl); return request>( url, "GET", options ); } async recoveryStatus(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/security/recovery/status", this.baseUrl); return request( url, "GET", options ); } async setup(params: SetupParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/setup", this.baseUrl); return request( url, "POST", options, params.body ); } async listSources(options: RequestOptions = {}): Promise { const url = new URL("/api/v2/sources", this.baseUrl); return request( url, "GET", options ); } async createSource(params: CreateSourceParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/sources", this.baseUrl); return request>( url, "POST", options, params.body ); } async archiveSource(params: ArchiveSourceParams, options: RequestOptions = {}): Promise { const url = new URL("/api/v2/sources/{source_id}".replace("{source_id}", encodeURIComponent(String(params.path.source_id))), this.baseUrl); return request( url, "DELETE", options ); } async probeSource(params: ProbeSourceParams, options: RequestOptions = {}): Promise> { const url = new URL("/api/v2/sources/{source_id}/probe".replace("{source_id}", encodeURIComponent(String(params.path.source_id))), this.baseUrl); return request>( url, "POST", options ); } async livez(options: RequestOptions = {}): Promise> { const url = new URL("/livez", this.baseUrl); return request>( url, "GET", options ); } async readyz(options: RequestOptions = {}): Promise> { const url = new URL("/readyz", this.baseUrl); return request>( url, "GET", options ); } }