From e60eed253513bbc41f9c61fee48c702f597084ed Mon Sep 17 00:00:00 2001 From: Raj Dave Date: Tue, 13 Jan 2026 23:46:15 +0300 Subject: [PATCH] add ability to edit bandwidth limits for existing repositories --- .../api-client/@tanstack/react-query.gen.ts | 1946 ++--- app/client/api-client/client.gen.ts | 17 +- app/client/api-client/client/client.gen.ts | 514 +- app/client/api-client/client/index.ts | 42 +- app/client/api-client/client/types.gen.ts | 358 +- app/client/api-client/client/utils.gen.ts | 505 +- app/client/api-client/core/auth.gen.ts | 56 +- .../api-client/core/bodySerializer.gen.ts | 132 +- app/client/api-client/core/params.gen.ts | 272 +- .../api-client/core/pathSerializer.gen.ts | 274 +- .../api-client/core/queryKeySerializer.gen.ts | 176 +- .../api-client/core/serverSentEvents.gen.ts | 444 +- app/client/api-client/core/types.gen.ts | 200 +- app/client/api-client/core/utils.gen.ts | 220 +- app/client/api-client/index.ts | 4 +- app/client/api-client/sdk.gen.ts | 822 +- app/client/api-client/types.gen.ts | 6740 +++++++++-------- app/client/modules/repositories/tabs/info.tsx | 152 +- .../modules/repositories/repositories.dto.ts | 10 + .../repositories/repositories.service.ts | 38 +- 20 files changed, 6186 insertions(+), 6736 deletions(-) diff --git a/app/client/api-client/@tanstack/react-query.gen.ts b/app/client/api-client/@tanstack/react-query.gen.ts index 8f40258f..67e5dda2 100644 --- a/app/client/api-client/@tanstack/react-query.gen.ts +++ b/app/client/api-client/@tanstack/react-query.gen.ts @@ -1,1551 +1,911 @@ // This file is auto-generated by @hey-api/openapi-ts -import { - type DefaultError, - queryOptions, - type UseMutationOptions, -} from "@tanstack/react-query"; +import { type DefaultError, queryOptions, type UseMutationOptions } from '@tanstack/react-query'; -import { client } from "../client.gen"; -import { - browseFilesystem, - createBackupSchedule, - createNotificationDestination, - createRepository, - createVolume, - deleteBackupSchedule, - deleteNotificationDestination, - deleteRepository, - deleteSnapshot, - deleteSnapshots, - deleteVolume, - doctorRepository, - downloadResticPassword, - getBackupSchedule, - getBackupScheduleForVolume, - getMirrorCompatibility, - getNotificationDestination, - getRepository, - getScheduleMirrors, - getScheduleNotifications, - getSnapshotDetails, - getStatus, - getSystemInfo, - getUpdates, - getVolume, - healthCheckVolume, - listBackupSchedules, - listFiles, - listNotificationDestinations, - listRcloneRemotes, - listRepositories, - listSnapshotFiles, - listSnapshots, - listVolumes, - mountVolume, - type Options, - reorderBackupSchedules, - restoreSnapshot, - runBackupNow, - runForget, - stopBackup, - tagSnapshots, - testConnection, - testNotificationDestination, - unmountVolume, - updateBackupSchedule, - updateNotificationDestination, - updateRepository, - updateScheduleMirrors, - updateScheduleNotifications, - updateVolume, -} from "../sdk.gen"; -import type { - BrowseFilesystemData, - BrowseFilesystemResponse, - CreateBackupScheduleData, - CreateBackupScheduleResponse, - CreateNotificationDestinationData, - CreateNotificationDestinationResponse, - CreateRepositoryData, - CreateRepositoryResponse, - CreateVolumeData, - CreateVolumeResponse, - DeleteBackupScheduleData, - DeleteBackupScheduleResponse, - DeleteNotificationDestinationData, - DeleteNotificationDestinationResponse, - DeleteRepositoryData, - DeleteRepositoryResponse, - DeleteSnapshotData, - DeleteSnapshotResponse, - DeleteSnapshotsData, - DeleteSnapshotsResponse, - DeleteVolumeData, - DeleteVolumeResponse, - DoctorRepositoryData, - DoctorRepositoryResponse, - DownloadResticPasswordData, - DownloadResticPasswordResponse, - GetBackupScheduleData, - GetBackupScheduleForVolumeData, - GetBackupScheduleForVolumeResponse, - GetBackupScheduleResponse, - GetMirrorCompatibilityData, - GetMirrorCompatibilityResponse, - GetNotificationDestinationData, - GetNotificationDestinationResponse, - GetRepositoryData, - GetRepositoryResponse, - GetScheduleMirrorsData, - GetScheduleMirrorsResponse, - GetScheduleNotificationsData, - GetScheduleNotificationsResponse, - GetSnapshotDetailsData, - GetSnapshotDetailsResponse, - GetStatusData, - GetStatusResponse, - GetSystemInfoData, - GetSystemInfoResponse, - GetUpdatesData, - GetUpdatesResponse, - GetVolumeData, - GetVolumeResponse, - HealthCheckVolumeData, - HealthCheckVolumeResponse, - ListBackupSchedulesData, - ListBackupSchedulesResponse, - ListFilesData, - ListFilesResponse, - ListNotificationDestinationsData, - ListNotificationDestinationsResponse, - ListRcloneRemotesData, - ListRcloneRemotesResponse, - ListRepositoriesData, - ListRepositoriesResponse, - ListSnapshotFilesData, - ListSnapshotFilesResponse, - ListSnapshotsData, - ListSnapshotsResponse, - ListVolumesData, - ListVolumesResponse, - MountVolumeData, - MountVolumeResponse, - ReorderBackupSchedulesData, - ReorderBackupSchedulesResponse, - RestoreSnapshotData, - RestoreSnapshotResponse, - RunBackupNowData, - RunBackupNowResponse, - RunForgetData, - RunForgetResponse, - StopBackupData, - StopBackupResponse, - TagSnapshotsData, - TagSnapshotsResponse, - TestConnectionData, - TestConnectionResponse, - TestNotificationDestinationData, - TestNotificationDestinationResponse, - UnmountVolumeData, - UnmountVolumeResponse, - UpdateBackupScheduleData, - UpdateBackupScheduleResponse, - UpdateNotificationDestinationData, - UpdateNotificationDestinationResponse, - UpdateRepositoryData, - UpdateRepositoryResponse, - UpdateScheduleMirrorsData, - UpdateScheduleMirrorsResponse, - UpdateScheduleNotificationsData, - UpdateScheduleNotificationsResponse, - UpdateVolumeData, - UpdateVolumeResponse, -} from "../types.gen"; +import { client } from '../client.gen'; +import { browseFilesystem, createBackupSchedule, createNotificationDestination, createRepository, createVolume, deleteBackupSchedule, deleteNotificationDestination, deleteRepository, deleteSnapshot, deleteSnapshots, deleteVolume, doctorRepository, downloadResticPassword, getBackupSchedule, getBackupScheduleForVolume, getMirrorCompatibility, getNotificationDestination, getRepository, getScheduleMirrors, getScheduleNotifications, getSnapshotDetails, getStatus, getSystemInfo, getUpdates, getVolume, healthCheckVolume, listBackupSchedules, listFiles, listNotificationDestinations, listRcloneRemotes, listRepositories, listSnapshotFiles, listSnapshots, listVolumes, mountVolume, type Options, reorderBackupSchedules, restoreSnapshot, runBackupNow, runForget, stopBackup, tagSnapshots, testConnection, testNotificationDestination, unmountVolume, updateBackupSchedule, updateNotificationDestination, updateRepository, updateScheduleMirrors, updateScheduleNotifications, updateVolume } from '../sdk.gen'; +import type { BrowseFilesystemData, BrowseFilesystemResponse, CreateBackupScheduleData, CreateBackupScheduleResponse, CreateNotificationDestinationData, CreateNotificationDestinationResponse, CreateRepositoryData, CreateRepositoryResponse, CreateVolumeData, CreateVolumeResponse, DeleteBackupScheduleData, DeleteBackupScheduleResponse, DeleteNotificationDestinationData, DeleteNotificationDestinationResponse, DeleteRepositoryData, DeleteRepositoryResponse, DeleteSnapshotData, DeleteSnapshotResponse, DeleteSnapshotsData, DeleteSnapshotsResponse, DeleteVolumeData, DeleteVolumeResponse, DoctorRepositoryData, DoctorRepositoryResponse, DownloadResticPasswordData, DownloadResticPasswordResponse, GetBackupScheduleData, GetBackupScheduleForVolumeData, GetBackupScheduleForVolumeResponse, GetBackupScheduleResponse, GetMirrorCompatibilityData, GetMirrorCompatibilityResponse, GetNotificationDestinationData, GetNotificationDestinationResponse, GetRepositoryData, GetRepositoryResponse, GetScheduleMirrorsData, GetScheduleMirrorsResponse, GetScheduleNotificationsData, GetScheduleNotificationsResponse, GetSnapshotDetailsData, GetSnapshotDetailsResponse, GetStatusData, GetStatusResponse, GetSystemInfoData, GetSystemInfoResponse, GetUpdatesData, GetUpdatesResponse, GetVolumeData, GetVolumeResponse, HealthCheckVolumeData, HealthCheckVolumeResponse, ListBackupSchedulesData, ListBackupSchedulesResponse, ListFilesData, ListFilesResponse, ListNotificationDestinationsData, ListNotificationDestinationsResponse, ListRcloneRemotesData, ListRcloneRemotesResponse, ListRepositoriesData, ListRepositoriesResponse, ListSnapshotFilesData, ListSnapshotFilesResponse, ListSnapshotsData, ListSnapshotsResponse, ListVolumesData, ListVolumesResponse, MountVolumeData, MountVolumeResponse, ReorderBackupSchedulesData, ReorderBackupSchedulesResponse, RestoreSnapshotData, RestoreSnapshotResponse, RunBackupNowData, RunBackupNowResponse, RunForgetData, RunForgetResponse, StopBackupData, StopBackupResponse, TagSnapshotsData, TagSnapshotsResponse, TestConnectionData, TestConnectionResponse, TestNotificationDestinationData, TestNotificationDestinationResponse, UnmountVolumeData, UnmountVolumeResponse, UpdateBackupScheduleData, UpdateBackupScheduleResponse, UpdateNotificationDestinationData, UpdateNotificationDestinationResponse, UpdateRepositoryData, UpdateRepositoryResponse, UpdateScheduleMirrorsData, UpdateScheduleMirrorsResponse, UpdateScheduleNotificationsData, UpdateScheduleNotificationsResponse, UpdateVolumeData, UpdateVolumeResponse } from '../types.gen'; export type QueryKey = [ - Pick & { - _id: string; - _infinite?: boolean; - tags?: ReadonlyArray; - }, + Pick & { + _id: string; + _infinite?: boolean; + tags?: ReadonlyArray; + } ]; -const createQueryKey = ( - id: string, - options?: TOptions, - infinite?: boolean, - tags?: ReadonlyArray, -): [QueryKey[0]] => { - const params: QueryKey[0] = { - _id: id, - baseUrl: - options?.baseUrl || (options?.client ?? client).getConfig().baseUrl, - } as QueryKey[0]; - if (infinite) { - params._infinite = infinite; - } - if (tags) { - params.tags = tags; - } - if (options?.body) { - params.body = options.body; - } - if (options?.headers) { - params.headers = options.headers; - } - if (options?.path) { - params.path = options.path; - } - if (options?.query) { - params.query = options.query; - } - return [params]; +const createQueryKey = (id: string, options?: TOptions, infinite?: boolean, tags?: ReadonlyArray): [ + QueryKey[0] +] => { + const params: QueryKey[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl } as QueryKey[0]; + if (infinite) { + params._infinite = infinite; + } + if (tags) { + params.tags = tags; + } + if (options?.body) { + params.body = options.body; + } + if (options?.headers) { + params.headers = options.headers; + } + if (options?.path) { + params.path = options.path; + } + if (options?.query) { + params.query = options.query; + } + return [params]; }; -export const getStatusQueryKey = (options?: Options) => - createQueryKey("getStatus", options); +export const getStatusQueryKey = (options?: Options) => createQueryKey('getStatus', options); /** * Get authentication system status */ -export const getStatusOptions = (options?: Options) => - queryOptions< - GetStatusResponse, - DefaultError, - GetStatusResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getStatus({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getStatusQueryKey(options), - }); +export const getStatusOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getStatus({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getStatusQueryKey(options) +}); -export const listVolumesQueryKey = (options?: Options) => - createQueryKey("listVolumes", options); +export const listVolumesQueryKey = (options?: Options) => createQueryKey('listVolumes', options); /** * List all volumes */ -export const listVolumesOptions = (options?: Options) => - queryOptions< - ListVolumesResponse, - DefaultError, - ListVolumesResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listVolumes({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listVolumesQueryKey(options), - }); +export const listVolumesOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listVolumes({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listVolumesQueryKey(options) +}); /** * Create a new volume */ -export const createVolumeMutation = ( - options?: Partial>, -): UseMutationOptions< - CreateVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - CreateVolumeResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await createVolume({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const createVolumeMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await createVolume({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Test connection to backend */ -export const testConnectionMutation = ( - options?: Partial>, -): UseMutationOptions< - TestConnectionResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - TestConnectionResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await testConnection({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const testConnectionMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await testConnection({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Delete a volume */ -export const deleteVolumeMutation = ( - options?: Partial>, -): UseMutationOptions< - DeleteVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteVolumeResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await deleteVolume({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const deleteVolumeMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await deleteVolume({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getVolumeQueryKey = (options: Options) => - createQueryKey("getVolume", options); +export const getVolumeQueryKey = (options: Options) => createQueryKey('getVolume', options); /** * Get a volume by name */ -export const getVolumeOptions = (options: Options) => - queryOptions< - GetVolumeResponse, - DefaultError, - GetVolumeResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getVolume({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getVolumeQueryKey(options), - }); +export const getVolumeOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getVolume({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getVolumeQueryKey(options) +}); /** * Update a volume's configuration */ -export const updateVolumeMutation = ( - options?: Partial>, -): UseMutationOptions< - UpdateVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateVolumeResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await updateVolume({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const updateVolumeMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await updateVolume({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Mount a volume */ -export const mountVolumeMutation = ( - options?: Partial>, -): UseMutationOptions< - MountVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - MountVolumeResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await mountVolume({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const mountVolumeMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await mountVolume({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Unmount a volume */ -export const unmountVolumeMutation = ( - options?: Partial>, -): UseMutationOptions< - UnmountVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UnmountVolumeResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await unmountVolume({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const unmountVolumeMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await unmountVolume({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Perform a health check on a volume */ -export const healthCheckVolumeMutation = ( - options?: Partial>, -): UseMutationOptions< - HealthCheckVolumeResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - HealthCheckVolumeResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await healthCheckVolume({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const healthCheckVolumeMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await healthCheckVolume({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const listFilesQueryKey = (options: Options) => - createQueryKey("listFiles", options); +export const listFilesQueryKey = (options: Options) => createQueryKey('listFiles', options); /** * List files in a volume directory */ -export const listFilesOptions = (options: Options) => - queryOptions< - ListFilesResponse, - DefaultError, - ListFilesResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listFiles({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listFilesQueryKey(options), - }); +export const listFilesOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listFiles({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listFilesQueryKey(options) +}); -export const browseFilesystemQueryKey = ( - options?: Options, -) => createQueryKey("browseFilesystem", options); +export const browseFilesystemQueryKey = (options?: Options) => createQueryKey('browseFilesystem', options); /** * Browse directories on the host filesystem */ -export const browseFilesystemOptions = ( - options?: Options, -) => - queryOptions< - BrowseFilesystemResponse, - DefaultError, - BrowseFilesystemResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await browseFilesystem({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: browseFilesystemQueryKey(options), - }); +export const browseFilesystemOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await browseFilesystem({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: browseFilesystemQueryKey(options) +}); -export const listRepositoriesQueryKey = ( - options?: Options, -) => createQueryKey("listRepositories", options); +export const listRepositoriesQueryKey = (options?: Options) => createQueryKey('listRepositories', options); /** * List all repositories */ -export const listRepositoriesOptions = ( - options?: Options, -) => - queryOptions< - ListRepositoriesResponse, - DefaultError, - ListRepositoriesResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listRepositories({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listRepositoriesQueryKey(options), - }); +export const listRepositoriesOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listRepositories({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listRepositoriesQueryKey(options) +}); /** * Create a new restic repository */ -export const createRepositoryMutation = ( - options?: Partial>, -): UseMutationOptions< - CreateRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - CreateRepositoryResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await createRepository({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const createRepositoryMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await createRepository({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const listRcloneRemotesQueryKey = ( - options?: Options, -) => createQueryKey("listRcloneRemotes", options); +export const listRcloneRemotesQueryKey = (options?: Options) => createQueryKey('listRcloneRemotes', options); /** * List all configured rclone remotes on the host system */ -export const listRcloneRemotesOptions = ( - options?: Options, -) => - queryOptions< - ListRcloneRemotesResponse, - DefaultError, - ListRcloneRemotesResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listRcloneRemotes({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listRcloneRemotesQueryKey(options), - }); +export const listRcloneRemotesOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listRcloneRemotes({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listRcloneRemotesQueryKey(options) +}); /** * Delete a repository */ -export const deleteRepositoryMutation = ( - options?: Partial>, -): UseMutationOptions< - DeleteRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteRepositoryResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await deleteRepository({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const deleteRepositoryMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await deleteRepository({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getRepositoryQueryKey = (options: Options) => - createQueryKey("getRepository", options); +export const getRepositoryQueryKey = (options: Options) => createQueryKey('getRepository', options); /** * Get a single repository by ID */ -export const getRepositoryOptions = (options: Options) => - queryOptions< - GetRepositoryResponse, - DefaultError, - GetRepositoryResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getRepository({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getRepositoryQueryKey(options), - }); +export const getRepositoryOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getRepository({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getRepositoryQueryKey(options) +}); /** * Update a repository's name or settings */ -export const updateRepositoryMutation = ( - options?: Partial>, -): UseMutationOptions< - UpdateRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateRepositoryResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await updateRepository({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const updateRepositoryMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await updateRepository({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Delete multiple snapshots from a repository */ -export const deleteSnapshotsMutation = ( - options?: Partial>, -): UseMutationOptions< - DeleteSnapshotsResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteSnapshotsResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await deleteSnapshots({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const deleteSnapshotsMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await deleteSnapshots({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const listSnapshotsQueryKey = (options: Options) => - createQueryKey("listSnapshots", options); +export const listSnapshotsQueryKey = (options: Options) => createQueryKey('listSnapshots', options); /** * List all snapshots in a repository */ -export const listSnapshotsOptions = (options: Options) => - queryOptions< - ListSnapshotsResponse, - DefaultError, - ListSnapshotsResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listSnapshots({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listSnapshotsQueryKey(options), - }); +export const listSnapshotsOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listSnapshots({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listSnapshotsQueryKey(options) +}); /** * Delete a specific snapshot from a repository */ -export const deleteSnapshotMutation = ( - options?: Partial>, -): UseMutationOptions< - DeleteSnapshotResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteSnapshotResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await deleteSnapshot({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const deleteSnapshotMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await deleteSnapshot({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getSnapshotDetailsQueryKey = ( - options: Options, -) => createQueryKey("getSnapshotDetails", options); +export const getSnapshotDetailsQueryKey = (options: Options) => createQueryKey('getSnapshotDetails', options); /** * Get details of a specific snapshot */ -export const getSnapshotDetailsOptions = ( - options: Options, -) => - queryOptions< - GetSnapshotDetailsResponse, - DefaultError, - GetSnapshotDetailsResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getSnapshotDetails({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getSnapshotDetailsQueryKey(options), - }); +export const getSnapshotDetailsOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getSnapshotDetails({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getSnapshotDetailsQueryKey(options) +}); -export const listSnapshotFilesQueryKey = ( - options: Options, -) => createQueryKey("listSnapshotFiles", options); +export const listSnapshotFilesQueryKey = (options: Options) => createQueryKey('listSnapshotFiles', options); /** * List files and directories in a snapshot */ -export const listSnapshotFilesOptions = ( - options: Options, -) => - queryOptions< - ListSnapshotFilesResponse, - DefaultError, - ListSnapshotFilesResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listSnapshotFiles({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listSnapshotFilesQueryKey(options), - }); +export const listSnapshotFilesOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listSnapshotFiles({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listSnapshotFilesQueryKey(options) +}); /** * Restore a snapshot to a target path on the filesystem */ -export const restoreSnapshotMutation = ( - options?: Partial>, -): UseMutationOptions< - RestoreSnapshotResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - RestoreSnapshotResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await restoreSnapshot({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const restoreSnapshotMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await restoreSnapshot({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Run doctor operations on a repository to fix common issues (unlock, check, repair index). Use this when the repository is locked or has errors. */ -export const doctorRepositoryMutation = ( - options?: Partial>, -): UseMutationOptions< - DoctorRepositoryResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DoctorRepositoryResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await doctorRepository({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const doctorRepositoryMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await doctorRepository({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Tag multiple snapshots in a repository */ -export const tagSnapshotsMutation = ( - options?: Partial>, -): UseMutationOptions< - TagSnapshotsResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - TagSnapshotsResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await tagSnapshots({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const tagSnapshotsMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await tagSnapshots({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const listBackupSchedulesQueryKey = ( - options?: Options, -) => createQueryKey("listBackupSchedules", options); +export const listBackupSchedulesQueryKey = (options?: Options) => createQueryKey('listBackupSchedules', options); /** * List all backup schedules */ -export const listBackupSchedulesOptions = ( - options?: Options, -) => - queryOptions< - ListBackupSchedulesResponse, - DefaultError, - ListBackupSchedulesResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listBackupSchedules({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listBackupSchedulesQueryKey(options), - }); +export const listBackupSchedulesOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listBackupSchedules({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listBackupSchedulesQueryKey(options) +}); /** * Create a new backup schedule for a volume */ -export const createBackupScheduleMutation = ( - options?: Partial>, -): UseMutationOptions< - CreateBackupScheduleResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - CreateBackupScheduleResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await createBackupSchedule({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const createBackupScheduleMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await createBackupSchedule({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Delete a backup schedule */ -export const deleteBackupScheduleMutation = ( - options?: Partial>, -): UseMutationOptions< - DeleteBackupScheduleResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteBackupScheduleResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await deleteBackupSchedule({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const deleteBackupScheduleMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await deleteBackupSchedule({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getBackupScheduleQueryKey = ( - options: Options, -) => createQueryKey("getBackupSchedule", options); +export const getBackupScheduleQueryKey = (options: Options) => createQueryKey('getBackupSchedule', options); /** * Get a backup schedule by ID */ -export const getBackupScheduleOptions = ( - options: Options, -) => - queryOptions< - GetBackupScheduleResponse, - DefaultError, - GetBackupScheduleResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getBackupSchedule({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getBackupScheduleQueryKey(options), - }); +export const getBackupScheduleOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getBackupSchedule({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getBackupScheduleQueryKey(options) +}); /** * Update a backup schedule */ -export const updateBackupScheduleMutation = ( - options?: Partial>, -): UseMutationOptions< - UpdateBackupScheduleResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateBackupScheduleResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await updateBackupSchedule({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const updateBackupScheduleMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await updateBackupSchedule({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getBackupScheduleForVolumeQueryKey = ( - options: Options, -) => createQueryKey("getBackupScheduleForVolume", options); +export const getBackupScheduleForVolumeQueryKey = (options: Options) => createQueryKey('getBackupScheduleForVolume', options); /** * Get a backup schedule for a specific volume */ -export const getBackupScheduleForVolumeOptions = ( - options: Options, -) => - queryOptions< - GetBackupScheduleForVolumeResponse, - DefaultError, - GetBackupScheduleForVolumeResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getBackupScheduleForVolume({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getBackupScheduleForVolumeQueryKey(options), - }); +export const getBackupScheduleForVolumeOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getBackupScheduleForVolume({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getBackupScheduleForVolumeQueryKey(options) +}); /** * Trigger a backup immediately for a schedule */ -export const runBackupNowMutation = ( - options?: Partial>, -): UseMutationOptions< - RunBackupNowResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - RunBackupNowResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await runBackupNow({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const runBackupNowMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await runBackupNow({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Stop a backup that is currently in progress */ -export const stopBackupMutation = ( - options?: Partial>, -): UseMutationOptions< - StopBackupResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - StopBackupResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await stopBackup({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const stopBackupMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await stopBackup({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Manually apply retention policy to clean up old snapshots */ -export const runForgetMutation = ( - options?: Partial>, -): UseMutationOptions< - RunForgetResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - RunForgetResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await runForget({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const runForgetMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await runForget({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getScheduleNotificationsQueryKey = ( - options: Options, -) => createQueryKey("getScheduleNotifications", options); +export const getScheduleNotificationsQueryKey = (options: Options) => createQueryKey('getScheduleNotifications', options); /** * Get notification assignments for a backup schedule */ -export const getScheduleNotificationsOptions = ( - options: Options, -) => - queryOptions< - GetScheduleNotificationsResponse, - DefaultError, - GetScheduleNotificationsResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getScheduleNotifications({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getScheduleNotificationsQueryKey(options), - }); +export const getScheduleNotificationsOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getScheduleNotifications({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getScheduleNotificationsQueryKey(options) +}); /** * Update notification assignments for a backup schedule */ -export const updateScheduleNotificationsMutation = ( - options?: Partial>, -): UseMutationOptions< - UpdateScheduleNotificationsResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateScheduleNotificationsResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await updateScheduleNotifications({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const updateScheduleNotificationsMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await updateScheduleNotifications({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getScheduleMirrorsQueryKey = ( - options: Options, -) => createQueryKey("getScheduleMirrors", options); +export const getScheduleMirrorsQueryKey = (options: Options) => createQueryKey('getScheduleMirrors', options); /** * Get mirror repository assignments for a backup schedule */ -export const getScheduleMirrorsOptions = ( - options: Options, -) => - queryOptions< - GetScheduleMirrorsResponse, - DefaultError, - GetScheduleMirrorsResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getScheduleMirrors({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getScheduleMirrorsQueryKey(options), - }); +export const getScheduleMirrorsOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getScheduleMirrors({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getScheduleMirrorsQueryKey(options) +}); /** * Update mirror repository assignments for a backup schedule */ -export const updateScheduleMirrorsMutation = ( - options?: Partial>, -): UseMutationOptions< - UpdateScheduleMirrorsResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateScheduleMirrorsResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await updateScheduleMirrors({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const updateScheduleMirrorsMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await updateScheduleMirrors({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getMirrorCompatibilityQueryKey = ( - options: Options, -) => createQueryKey("getMirrorCompatibility", options); +export const getMirrorCompatibilityQueryKey = (options: Options) => createQueryKey('getMirrorCompatibility', options); /** * Get mirror compatibility info for all repositories relative to a backup schedule's primary repository */ -export const getMirrorCompatibilityOptions = ( - options: Options, -) => - queryOptions< - GetMirrorCompatibilityResponse, - DefaultError, - GetMirrorCompatibilityResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getMirrorCompatibility({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getMirrorCompatibilityQueryKey(options), - }); +export const getMirrorCompatibilityOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getMirrorCompatibility({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getMirrorCompatibilityQueryKey(options) +}); /** * Reorder backup schedules by providing an array of schedule IDs in the desired order */ -export const reorderBackupSchedulesMutation = ( - options?: Partial>, -): UseMutationOptions< - ReorderBackupSchedulesResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - ReorderBackupSchedulesResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await reorderBackupSchedules({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const reorderBackupSchedulesMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await reorderBackupSchedules({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const listNotificationDestinationsQueryKey = ( - options?: Options, -) => createQueryKey("listNotificationDestinations", options); +export const listNotificationDestinationsQueryKey = (options?: Options) => createQueryKey('listNotificationDestinations', options); /** * List all notification destinations */ -export const listNotificationDestinationsOptions = ( - options?: Options, -) => - queryOptions< - ListNotificationDestinationsResponse, - DefaultError, - ListNotificationDestinationsResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await listNotificationDestinations({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: listNotificationDestinationsQueryKey(options), - }); +export const listNotificationDestinationsOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await listNotificationDestinations({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: listNotificationDestinationsQueryKey(options) +}); /** * Create a new notification destination */ -export const createNotificationDestinationMutation = ( - options?: Partial>, -): UseMutationOptions< - CreateNotificationDestinationResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - CreateNotificationDestinationResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await createNotificationDestination({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const createNotificationDestinationMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await createNotificationDestination({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Delete a notification destination */ -export const deleteNotificationDestinationMutation = ( - options?: Partial>, -): UseMutationOptions< - DeleteNotificationDestinationResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DeleteNotificationDestinationResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await deleteNotificationDestination({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const deleteNotificationDestinationMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await deleteNotificationDestination({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getNotificationDestinationQueryKey = ( - options: Options, -) => createQueryKey("getNotificationDestination", options); +export const getNotificationDestinationQueryKey = (options: Options) => createQueryKey('getNotificationDestination', options); /** * Get a notification destination by ID */ -export const getNotificationDestinationOptions = ( - options: Options, -) => - queryOptions< - GetNotificationDestinationResponse, - DefaultError, - GetNotificationDestinationResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getNotificationDestination({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getNotificationDestinationQueryKey(options), - }); +export const getNotificationDestinationOptions = (options: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getNotificationDestination({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getNotificationDestinationQueryKey(options) +}); /** * Update a notification destination */ -export const updateNotificationDestinationMutation = ( - options?: Partial>, -): UseMutationOptions< - UpdateNotificationDestinationResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - UpdateNotificationDestinationResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await updateNotificationDestination({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const updateNotificationDestinationMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await updateNotificationDestination({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; /** * Test a notification destination by sending a test message */ -export const testNotificationDestinationMutation = ( - options?: Partial>, -): UseMutationOptions< - TestNotificationDestinationResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - TestNotificationDestinationResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await testNotificationDestination({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const testNotificationDestinationMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await testNotificationDestination({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; -export const getSystemInfoQueryKey = (options?: Options) => - createQueryKey("getSystemInfo", options); +export const getSystemInfoQueryKey = (options?: Options) => createQueryKey('getSystemInfo', options); /** * Get system information including available capabilities */ -export const getSystemInfoOptions = (options?: Options) => - queryOptions< - GetSystemInfoResponse, - DefaultError, - GetSystemInfoResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getSystemInfo({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getSystemInfoQueryKey(options), - }); +export const getSystemInfoOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getSystemInfo({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getSystemInfoQueryKey(options) +}); -export const getUpdatesQueryKey = (options?: Options) => - createQueryKey("getUpdates", options); +export const getUpdatesQueryKey = (options?: Options) => createQueryKey('getUpdates', options); /** * Check for application updates from GitHub */ -export const getUpdatesOptions = (options?: Options) => - queryOptions< - GetUpdatesResponse, - DefaultError, - GetUpdatesResponse, - ReturnType - >({ - queryFn: async ({ queryKey, signal }) => { - const { data } = await getUpdates({ - ...options, - ...queryKey[0], - signal, - throwOnError: true, - }); - return data; - }, - queryKey: getUpdatesQueryKey(options), - }); +export const getUpdatesOptions = (options?: Options) => queryOptions>({ + queryFn: async ({ queryKey, signal }) => { + const { data } = await getUpdates({ + ...options, + ...queryKey[0], + signal, + throwOnError: true + }); + return data; + }, + queryKey: getUpdatesQueryKey(options) +}); /** * Download the Restic password file for backup recovery. Requires password re-authentication. */ -export const downloadResticPasswordMutation = ( - options?: Partial>, -): UseMutationOptions< - DownloadResticPasswordResponse, - DefaultError, - Options -> => { - const mutationOptions: UseMutationOptions< - DownloadResticPasswordResponse, - DefaultError, - Options - > = { - mutationFn: async (fnOptions) => { - const { data } = await downloadResticPassword({ - ...options, - ...fnOptions, - throwOnError: true, - }); - return data; - }, - }; - return mutationOptions; +export const downloadResticPasswordMutation = (options?: Partial>): UseMutationOptions> => { + const mutationOptions: UseMutationOptions> = { + mutationFn: async (fnOptions) => { + const { data } = await downloadResticPassword({ + ...options, + ...fnOptions, + throwOnError: true + }); + return data; + } + }; + return mutationOptions; }; diff --git a/app/client/api-client/client.gen.ts b/app/client/api-client/client.gen.ts index 92f3451a..a31c7b49 100644 --- a/app/client/api-client/client.gen.ts +++ b/app/client/api-client/client.gen.ts @@ -1,12 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import { - type ClientOptions, - type Config, - createClient, - createConfig, -} from "./client"; -import type { ClientOptions as ClientOptions2 } from "./types.gen"; +import { type ClientOptions, type Config, createClient, createConfig } from './client'; +import type { ClientOptions as ClientOptions2 } from './types.gen'; /** * The `createClientConfig()` function will be called on client initialization @@ -16,10 +11,6 @@ import type { ClientOptions as ClientOptions2 } from "./types.gen"; * `setConfig()`. This is useful for example if you're using Next.js * to ensure your client always has the correct values. */ -export type CreateClientConfig = ( - override?: Config, -) => Config & T>; +export type CreateClientConfig = (override?: Config) => Config & T>; -export const client = createClient( - createConfig({ baseUrl: "http://localhost:4096" }), -); +export const client = createClient(createConfig({ baseUrl: 'http://localhost:4096' })); diff --git a/app/client/api-client/client/client.gen.ts b/app/client/api-client/client/client.gen.ts index a8a478dc..bf75e621 100644 --- a/app/client/api-client/client/client.gen.ts +++ b/app/client/api-client/client/client.gen.ts @@ -1,301 +1,305 @@ // This file is auto-generated by @hey-api/openapi-ts -import { createSseClient } from "../core/serverSentEvents.gen"; -import type { HttpMethod } from "../core/types.gen"; -import { getValidRequestBody } from "../core/utils.gen"; +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { - Client, - Config, - RequestOptions, - ResolvedRequestOptions, -} from "./types.gen"; + Client, + Config, + RequestOptions, + ResolvedRequestOptions, +} from './types.gen'; import { - buildUrl, - createConfig, - createInterceptors, - getParseAs, - mergeConfigs, - mergeHeaders, - setAuthParams, -} from "./utils.gen"; + buildUrl, + createConfig, + createInterceptors, + getParseAs, + mergeConfigs, + mergeHeaders, + setAuthParams, +} from './utils.gen'; -type ReqInit = Omit & { - body?: any; - headers: ReturnType; +type ReqInit = Omit & { + body?: any; + headers: ReturnType; }; export const createClient = (config: Config = {}): Client => { - let _config = mergeConfigs(createConfig(), config); + let _config = mergeConfigs(createConfig(), config); - const getConfig = (): Config => ({ ..._config }); + const getConfig = (): Config => ({ ..._config }); - const setConfig = (config: Config): Config => { - _config = mergeConfigs(_config, config); - return getConfig(); - }; + const setConfig = (config: Config): Config => { + _config = mergeConfigs(_config, config); + return getConfig(); + }; - const interceptors = createInterceptors< - Request, - Response, - unknown, - ResolvedRequestOptions - >(); + const interceptors = createInterceptors< + Request, + Response, + unknown, + ResolvedRequestOptions + >(); - const beforeRequest = async (options: RequestOptions) => { - const opts = { - ..._config, - ...options, - fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, - headers: mergeHeaders(_config.headers, options.headers), - serializedBody: undefined, - }; + const beforeRequest = async (options: RequestOptions) => { + const opts = { + ..._config, + ...options, + fetch: options.fetch ?? _config.fetch ?? globalThis.fetch, + headers: mergeHeaders(_config.headers, options.headers), + serializedBody: undefined, + }; - if (opts.security) { - await setAuthParams({ - ...opts, - security: opts.security, - }); - } + if (opts.security) { + await setAuthParams({ + ...opts, + security: opts.security, + }); + } - if (opts.requestValidator) { - await opts.requestValidator(opts); - } + if (opts.requestValidator) { + await opts.requestValidator(opts); + } - if (opts.body !== undefined && opts.bodySerializer) { - opts.serializedBody = opts.bodySerializer(opts.body); - } + if (opts.body !== undefined && opts.bodySerializer) { + opts.serializedBody = opts.bodySerializer(opts.body); + } - // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.serializedBody === "") { - opts.headers.delete("Content-Type"); - } + // remove Content-Type header if body is empty to avoid sending invalid requests + if (opts.body === undefined || opts.serializedBody === '') { + opts.headers.delete('Content-Type'); + } - const url = buildUrl(opts); + const url = buildUrl(opts); - return { opts, url }; - }; + return { opts, url }; + }; - const request: Client["request"] = async (options) => { - // @ts-expect-error - const { opts, url } = await beforeRequest(options); - const requestInit: ReqInit = { - redirect: "follow", - ...opts, - body: getValidRequestBody(opts), - }; + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, url } = await beforeRequest(options); + const requestInit: ReqInit = { + redirect: 'follow', + ...opts, + body: getValidRequestBody(opts), + }; - let request = new Request(url, requestInit); + let request = new Request(url, requestInit); - for (const fn of interceptors.request.fns) { - if (fn) { - request = await fn(request, opts); - } - } + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } - // fetch must be assigned here, otherwise it would throw the error: - // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation - const _fetch = opts.fetch!; - let response: Response; + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = opts.fetch!; + let response: Response; - try { - response = await _fetch(request); - } catch (error) { - // Handle fetch exceptions (AbortError, network errors, etc.) - let finalError = error; + try { + response = await _fetch(request); + } catch (error) { + // Handle fetch exceptions (AbortError, network errors, etc.) + let finalError = error; - for (const fn of interceptors.error.fns) { - if (fn) { - finalError = (await fn( - error, - undefined as any, - request, - opts, - )) as unknown; - } - } + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn( + error, + undefined as any, + request, + opts, + )) as unknown; + } + } - finalError = finalError || ({} as unknown); + finalError = finalError || ({} as unknown); - if (opts.throwOnError) { - throw finalError; - } + if (opts.throwOnError) { + throw finalError; + } - // Return error response - return opts.responseStyle === "data" - ? undefined - : { - error: finalError, - request, - response: undefined as any, - }; - } + // Return error response + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + request, + response: undefined as any, + }; + } - for (const fn of interceptors.response.fns) { - if (fn) { - response = await fn(response, request, opts); - } - } + for (const fn of interceptors.response.fns) { + if (fn) { + response = await fn(response, request, opts); + } + } - const result = { - request, - response, - }; + const result = { + request, + response, + }; - if (response.ok) { - const parseAs = - (opts.parseAs === "auto" - ? getParseAs(response.headers.get("Content-Type")) - : opts.parseAs) ?? "json"; + if (response.ok) { + const parseAs = + (opts.parseAs === 'auto' + ? getParseAs(response.headers.get('Content-Type')) + : opts.parseAs) ?? 'json'; - if ( - response.status === 204 || - response.headers.get("Content-Length") === "0" - ) { - let emptyData: any; - switch (parseAs) { - case "arrayBuffer": - case "blob": - case "text": - emptyData = await response[parseAs](); - break; - case "formData": - emptyData = new FormData(); - break; - case "stream": - emptyData = response.body; - break; - case "json": - default: - emptyData = {}; - break; - } - return opts.responseStyle === "data" - ? emptyData - : { - data: emptyData, - ...result, - }; - } + if ( + response.status === 204 || + response.headers.get('Content-Length') === '0' + ) { + let emptyData: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'text': + emptyData = await response[parseAs](); + break; + case 'formData': + emptyData = new FormData(); + break; + case 'stream': + emptyData = response.body; + break; + case 'json': + default: + emptyData = {}; + break; + } + return opts.responseStyle === 'data' + ? emptyData + : { + data: emptyData, + ...result, + }; + } - let data: any; - switch (parseAs) { - case "arrayBuffer": - case "blob": - case "formData": - case "json": - case "text": - data = await response[parseAs](); - break; - case "stream": - return opts.responseStyle === "data" - ? response.body - : { - data: response.body, - ...result, - }; - } + let data: any; + switch (parseAs) { + case 'arrayBuffer': + case 'blob': + case 'formData': + case 'json': + case 'text': + data = await response[parseAs](); + break; + case 'stream': + return opts.responseStyle === 'data' + ? response.body + : { + data: response.body, + ...result, + }; + } - if (parseAs === "json") { - if (opts.responseValidator) { - await opts.responseValidator(data); - } + if (parseAs === 'json') { + if (opts.responseValidator) { + await opts.responseValidator(data); + } - if (opts.responseTransformer) { - data = await opts.responseTransformer(data); - } - } + if (opts.responseTransformer) { + data = await opts.responseTransformer(data); + } + } - return opts.responseStyle === "data" - ? data - : { - data, - ...result, - }; - } + return opts.responseStyle === 'data' + ? data + : { + data, + ...result, + }; + } - const textError = await response.text(); - let jsonError: unknown; + const textError = await response.text(); + let jsonError: unknown; - try { - jsonError = JSON.parse(textError); - } catch { - // noop - } + try { + jsonError = JSON.parse(textError); + } catch { + // noop + } - const error = jsonError ?? textError; - let finalError = error; + const error = jsonError ?? textError; + let finalError = error; - for (const fn of interceptors.error.fns) { - if (fn) { - finalError = (await fn(error, response, request, opts)) as string; - } - } + for (const fn of interceptors.error.fns) { + if (fn) { + finalError = (await fn(error, response, request, opts)) as string; + } + } - finalError = finalError || ({} as string); + finalError = finalError || ({} as string); - if (opts.throwOnError) { - throw finalError; - } + if (opts.throwOnError) { + throw finalError; + } - // TODO: we probably want to return error and improve types - return opts.responseStyle === "data" - ? undefined - : { - error: finalError, - ...result, - }; - }; + // TODO: we probably want to return error and improve types + return opts.responseStyle === 'data' + ? undefined + : { + error: finalError, + ...result, + }; + }; - const makeMethodFn = - (method: Uppercase) => (options: RequestOptions) => - request({ ...options, method }); + const makeMethodFn = + (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); - const makeSseFn = - (method: Uppercase) => async (options: RequestOptions) => { - const { opts, url } = await beforeRequest(options); - return createSseClient({ - ...opts, - body: opts.body as BodyInit | null | undefined, - headers: opts.headers as unknown as Record, - method, - onRequest: async (url, init) => { - let request = new Request(url, init); - for (const fn of interceptors.request.fns) { - if (fn) { - request = await fn(request, opts); - } - } - return request; - }, - url, - }); - }; + const makeSseFn = + (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + onRequest: async (url, init) => { + let request = new Request(url, init); + for (const fn of interceptors.request.fns) { + if (fn) { + request = await fn(request, opts); + } + } + return request; + }, + serializedBody: getValidRequestBody(opts) as + | BodyInit + | null + | undefined, + url, + }); + }; - return { - buildUrl, - connect: makeMethodFn("CONNECT"), - delete: makeMethodFn("DELETE"), - get: makeMethodFn("GET"), - getConfig, - head: makeMethodFn("HEAD"), - interceptors, - options: makeMethodFn("OPTIONS"), - patch: makeMethodFn("PATCH"), - post: makeMethodFn("POST"), - put: makeMethodFn("PUT"), - request, - setConfig, - sse: { - connect: makeSseFn("CONNECT"), - delete: makeSseFn("DELETE"), - get: makeSseFn("GET"), - head: makeSseFn("HEAD"), - options: makeSseFn("OPTIONS"), - patch: makeSseFn("PATCH"), - post: makeSseFn("POST"), - put: makeSseFn("PUT"), - trace: makeSseFn("TRACE"), - }, - trace: makeMethodFn("TRACE"), - } as Client; + return { + buildUrl, + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), + getConfig, + head: makeMethodFn('HEAD'), + interceptors, + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), + request, + setConfig, + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; }; diff --git a/app/client/api-client/client/index.ts b/app/client/api-client/client/index.ts index 99ab72d0..b295edec 100644 --- a/app/client/api-client/client/index.ts +++ b/app/client/api-client/client/index.ts @@ -1,25 +1,25 @@ // This file is auto-generated by @hey-api/openapi-ts -export type { Auth } from "../core/auth.gen"; -export type { QuerySerializerOptions } from "../core/bodySerializer.gen"; +export type { Auth } from '../core/auth.gen'; +export type { QuerySerializerOptions } from '../core/bodySerializer.gen'; export { - formDataBodySerializer, - jsonBodySerializer, - urlSearchParamsBodySerializer, -} from "../core/bodySerializer.gen"; -export { buildClientParams } from "../core/params.gen"; -export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen"; -export { createClient } from "./client.gen"; + formDataBodySerializer, + jsonBodySerializer, + urlSearchParamsBodySerializer, +} from '../core/bodySerializer.gen'; +export { buildClientParams } from '../core/params.gen'; +export { serializeQueryKeyValue } from '../core/queryKeySerializer.gen'; +export { createClient } from './client.gen'; export type { - Client, - ClientOptions, - Config, - CreateClientConfig, - Options, - RequestOptions, - RequestResult, - ResolvedRequestOptions, - ResponseStyle, - TDataShape, -} from "./types.gen"; -export { createConfig, mergeHeaders } from "./utils.gen"; + Client, + ClientOptions, + Config, + CreateClientConfig, + Options, + RequestOptions, + RequestResult, + ResolvedRequestOptions, + ResponseStyle, + TDataShape, +} from './types.gen'; +export { createConfig, mergeHeaders } from './utils.gen'; diff --git a/app/client/api-client/client/types.gen.ts b/app/client/api-client/client/types.gen.ts index 68310f36..b4a499cc 100644 --- a/app/client/api-client/client/types.gen.ts +++ b/app/client/api-client/client/types.gen.ts @@ -1,210 +1,210 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Auth } from "../core/auth.gen"; +import type { Auth } from '../core/auth.gen'; import type { - ServerSentEventsOptions, - ServerSentEventsResult, -} from "../core/serverSentEvents.gen"; + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; import type { - Client as CoreClient, - Config as CoreConfig, -} from "../core/types.gen"; -import type { Middleware } from "./utils.gen"; + Client as CoreClient, + Config as CoreConfig, +} from '../core/types.gen'; +import type { Middleware } from './utils.gen'; -export type ResponseStyle = "data" | "fields"; +export type ResponseStyle = 'data' | 'fields'; export interface Config - extends Omit, - CoreConfig { - /** - * Base URL for all requests made by this client. - */ - baseUrl?: T["baseUrl"]; - /** - * Fetch API implementation. You can use this option to provide a custom - * fetch instance. - * - * @default globalThis.fetch - */ - fetch?: typeof fetch; - /** - * Please don't use the Fetch client for Next.js applications. The `next` - * options won't have any effect. - * - * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. - */ - next?: never; - /** - * Return the response data parsed in a specified format. By default, `auto` - * will infer the appropriate method from the `Content-Type` response header. - * You can override this behavior with any of the {@link Body} methods. - * Select `stream` if you don't want to parse response data at all. - * - * @default 'auto' - */ - parseAs?: - | "arrayBuffer" - | "auto" - | "blob" - | "formData" - | "json" - | "stream" - | "text"; - /** - * Should we return only data or multiple fields (data, error, response, etc.)? - * - * @default 'fields' - */ - responseStyle?: ResponseStyle; - /** - * Throw an error instead of returning it in the response? - * - * @default false - */ - throwOnError?: T["throwOnError"]; + extends Omit, + CoreConfig { + /** + * Base URL for all requests made by this client. + */ + baseUrl?: T['baseUrl']; + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Please don't use the Fetch client for Next.js applications. The `next` + * options won't have any effect. + * + * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead. + */ + next?: never; + /** + * Return the response data parsed in a specified format. By default, `auto` + * will infer the appropriate method from the `Content-Type` response header. + * You can override this behavior with any of the {@link Body} methods. + * Select `stream` if you don't want to parse response data at all. + * + * @default 'auto' + */ + parseAs?: + | 'arrayBuffer' + | 'auto' + | 'blob' + | 'formData' + | 'json' + | 'stream' + | 'text'; + /** + * Should we return only data or multiple fields (data, error, response, etc.)? + * + * @default 'fields' + */ + responseStyle?: ResponseStyle; + /** + * Throw an error instead of returning it in the response? + * + * @default false + */ + throwOnError?: T['throwOnError']; } export interface RequestOptions< - TData = unknown, - TResponseStyle extends ResponseStyle = "fields", - ThrowOnError extends boolean = boolean, - Url extends string = string, + TData = unknown, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, > extends Config<{ - responseStyle: TResponseStyle; - throwOnError: ThrowOnError; - }>, - Pick< - ServerSentEventsOptions, - | "onSseError" - | "onSseEvent" - | "sseDefaultRetryDelay" - | "sseMaxRetryAttempts" - | "sseMaxRetryDelay" - > { - /** - * Any body that you want to add to your request. - * - * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} - */ - body?: unknown; - path?: Record; - query?: Record; - /** - * Security mechanism(s) to use for the request. - */ - security?: ReadonlyArray; - url: Url; + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { + /** + * Any body that you want to add to your request. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#body} + */ + body?: unknown; + path?: Record; + query?: Record; + /** + * Security mechanism(s) to use for the request. + */ + security?: ReadonlyArray; + url: Url; } export interface ResolvedRequestOptions< - TResponseStyle extends ResponseStyle = "fields", - ThrowOnError extends boolean = boolean, - Url extends string = string, + TResponseStyle extends ResponseStyle = 'fields', + ThrowOnError extends boolean = boolean, + Url extends string = string, > extends RequestOptions { - serializedBody?: string; + serializedBody?: string; } export type RequestResult< - TData = unknown, - TError = unknown, - ThrowOnError extends boolean = boolean, - TResponseStyle extends ResponseStyle = "fields", + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = boolean, + TResponseStyle extends ResponseStyle = 'fields', > = ThrowOnError extends true - ? Promise< - TResponseStyle extends "data" - ? TData extends Record - ? TData[keyof TData] - : TData - : { - data: TData extends Record - ? TData[keyof TData] - : TData; - request: Request; - response: Response; - } - > - : Promise< - TResponseStyle extends "data" - ? - | (TData extends Record - ? TData[keyof TData] - : TData) - | undefined - : ( - | { - data: TData extends Record - ? TData[keyof TData] - : TData; - error: undefined; - } - | { - data: undefined; - error: TError extends Record - ? TError[keyof TError] - : TError; - } - ) & { - request: Request; - response: Response; - } - >; + ? Promise< + TResponseStyle extends 'data' + ? TData extends Record + ? TData[keyof TData] + : TData + : { + data: TData extends Record + ? TData[keyof TData] + : TData; + request: Request; + response: Response; + } + > + : Promise< + TResponseStyle extends 'data' + ? + | (TData extends Record + ? TData[keyof TData] + : TData) + | undefined + : ( + | { + data: TData extends Record + ? TData[keyof TData] + : TData; + error: undefined; + } + | { + data: undefined; + error: TError extends Record + ? TError[keyof TError] + : TError; + } + ) & { + request: Request; + response: Response; + } + >; export interface ClientOptions { - baseUrl?: string; - responseStyle?: ResponseStyle; - throwOnError?: boolean; + baseUrl?: string; + responseStyle?: ResponseStyle; + throwOnError?: boolean; } type MethodFn = < - TData = unknown, - TError = unknown, - ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = "fields", + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, "method">, + options: Omit, 'method'>, ) => RequestResult; type SseFn = < - TData = unknown, - TError = unknown, - ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = "fields", + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, "method">, + options: Omit, 'method'>, ) => Promise>; type RequestFn = < - TData = unknown, - TError = unknown, - ThrowOnError extends boolean = false, - TResponseStyle extends ResponseStyle = "fields", + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, "method"> & - Pick< - Required>, - "method" - >, + options: Omit, 'method'> & + Pick< + Required>, + 'method' + >, ) => RequestResult; type BuildUrlFn = < - TData extends { - body?: unknown; - path?: Record; - query?: Record; - url: string; - }, + TData extends { + body?: unknown; + path?: Record; + query?: Record; + url: string; + }, >( - options: TData & Options, + options: TData & Options, ) => string; export type Client = CoreClient< - RequestFn, - Config, - MethodFn, - BuildUrlFn, - SseFn + RequestFn, + Config, + MethodFn, + BuildUrlFn, + SseFn > & { - interceptors: Middleware; + interceptors: Middleware; }; /** @@ -216,26 +216,26 @@ export type Client = CoreClient< * to ensure your client always has the correct values. */ export type CreateClientConfig = ( - override?: Config, + override?: Config, ) => Config & T>; export interface TDataShape { - body?: unknown; - headers?: unknown; - path?: unknown; - query?: unknown; - url: string; + body?: unknown; + headers?: unknown; + path?: unknown; + query?: unknown; + url: string; } type OmitKeys = Pick>; export type Options< - TData extends TDataShape = TDataShape, - ThrowOnError extends boolean = boolean, - TResponse = unknown, - TResponseStyle extends ResponseStyle = "fields", + TData extends TDataShape = TDataShape, + ThrowOnError extends boolean = boolean, + TResponse = unknown, + TResponseStyle extends ResponseStyle = 'fields', > = OmitKeys< - RequestOptions, - "body" | "path" | "query" | "url" + RequestOptions, + 'body' | 'path' | 'query' | 'url' > & - ([TData] extends [never] ? unknown : Omit); + ([TData] extends [never] ? unknown : Omit); diff --git a/app/client/api-client/client/utils.gen.ts b/app/client/api-client/client/utils.gen.ts index 82b63a89..4c48a9ee 100644 --- a/app/client/api-client/client/utils.gen.ts +++ b/app/client/api-client/client/utils.gen.ts @@ -1,337 +1,332 @@ // This file is auto-generated by @hey-api/openapi-ts -import { getAuthToken } from "../core/auth.gen"; -import type { QuerySerializerOptions } from "../core/bodySerializer.gen"; -import { jsonBodySerializer } from "../core/bodySerializer.gen"; +import { getAuthToken } from '../core/auth.gen'; +import type { QuerySerializerOptions } from '../core/bodySerializer.gen'; +import { jsonBodySerializer } from '../core/bodySerializer.gen'; import { - serializeArrayParam, - serializeObjectParam, - serializePrimitiveParam, -} from "../core/pathSerializer.gen"; -import { getUrl } from "../core/utils.gen"; -import type { - Client, - ClientOptions, - Config, - RequestOptions, -} from "./types.gen"; + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from '../core/pathSerializer.gen'; +import { getUrl } from '../core/utils.gen'; +import type { Client, ClientOptions, Config, RequestOptions } from './types.gen'; export const createQuerySerializer = ({ - parameters = {}, - ...args + parameters = {}, + ...args }: QuerySerializerOptions = {}) => { - const querySerializer = (queryParams: T) => { - const search: string[] = []; - if (queryParams && typeof queryParams === "object") { - for (const name in queryParams) { - const value = queryParams[name]; + const querySerializer = (queryParams: T) => { + const search: string[] = []; + if (queryParams && typeof queryParams === 'object') { + for (const name in queryParams) { + const value = queryParams[name]; - if (value === undefined || value === null) { - continue; - } + if (value === undefined || value === null) { + continue; + } - const options = parameters[name] || args; + const options = parameters[name] || args; - if (Array.isArray(value)) { - const serializedArray = serializeArrayParam({ - allowReserved: options.allowReserved, - explode: true, - name, - style: "form", - value, - ...options.array, - }); - if (serializedArray) search.push(serializedArray); - } else if (typeof value === "object") { - const serializedObject = serializeObjectParam({ - allowReserved: options.allowReserved, - explode: true, - name, - style: "deepObject", - value: value as Record, - ...options.object, - }); - if (serializedObject) search.push(serializedObject); - } else { - const serializedPrimitive = serializePrimitiveParam({ - allowReserved: options.allowReserved, - name, - value: value as string, - }); - if (serializedPrimitive) search.push(serializedPrimitive); - } - } - } - return search.join("&"); - }; - return querySerializer; + if (Array.isArray(value)) { + const serializedArray = serializeArrayParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'form', + value, + ...options.array, + }); + if (serializedArray) search.push(serializedArray); + } else if (typeof value === 'object') { + const serializedObject = serializeObjectParam({ + allowReserved: options.allowReserved, + explode: true, + name, + style: 'deepObject', + value: value as Record, + ...options.object, + }); + if (serializedObject) search.push(serializedObject); + } else { + const serializedPrimitive = serializePrimitiveParam({ + allowReserved: options.allowReserved, + name, + value: value as string, + }); + if (serializedPrimitive) search.push(serializedPrimitive); + } + } + } + return search.join('&'); + }; + return querySerializer; }; /** * Infers parseAs value from provided Content-Type header. */ export const getParseAs = ( - contentType: string | null, -): Exclude => { - if (!contentType) { - // If no Content-Type header is provided, the best we can do is return the raw response body, - // which is effectively the same as the 'stream' option. - return "stream"; - } + contentType: string | null, +): Exclude => { + if (!contentType) { + // If no Content-Type header is provided, the best we can do is return the raw response body, + // which is effectively the same as the 'stream' option. + return 'stream'; + } - const cleanContent = contentType.split(";")[0]?.trim(); + const cleanContent = contentType.split(';')[0]?.trim(); - if (!cleanContent) { - return; - } + if (!cleanContent) { + return; + } - if ( - cleanContent.startsWith("application/json") || - cleanContent.endsWith("+json") - ) { - return "json"; - } + if ( + cleanContent.startsWith('application/json') || + cleanContent.endsWith('+json') + ) { + return 'json'; + } - if (cleanContent === "multipart/form-data") { - return "formData"; - } + if (cleanContent === 'multipart/form-data') { + return 'formData'; + } - if ( - ["application/", "audio/", "image/", "video/"].some((type) => - cleanContent.startsWith(type), - ) - ) { - return "blob"; - } + if ( + ['application/', 'audio/', 'image/', 'video/'].some((type) => + cleanContent.startsWith(type), + ) + ) { + return 'blob'; + } - if (cleanContent.startsWith("text/")) { - return "text"; - } + if (cleanContent.startsWith('text/')) { + return 'text'; + } - return; + return; }; const checkForExistence = ( - options: Pick & { - headers: Headers; - }, - name?: string, + options: Pick & { + headers: Headers; + }, + name?: string, ): boolean => { - if (!name) { - return false; - } - if ( - options.headers.has(name) || - options.query?.[name] || - options.headers.get("Cookie")?.includes(`${name}=`) - ) { - return true; - } - return false; + if (!name) { + return false; + } + if ( + options.headers.has(name) || + options.query?.[name] || + options.headers.get('Cookie')?.includes(`${name}=`) + ) { + return true; + } + return false; }; export const setAuthParams = async ({ - security, - ...options -}: Pick, "security"> & - Pick & { - headers: Headers; - }) => { - for (const auth of security) { - if (checkForExistence(options, auth.name)) { - continue; - } + security, + ...options +}: Pick, 'security'> & + Pick & { + headers: Headers; + }) => { + for (const auth of security) { + if (checkForExistence(options, auth.name)) { + continue; + } - const token = await getAuthToken(auth, options.auth); + const token = await getAuthToken(auth, options.auth); - if (!token) { - continue; - } + if (!token) { + continue; + } - const name = auth.name ?? "Authorization"; + const name = auth.name ?? 'Authorization'; - switch (auth.in) { - case "query": - if (!options.query) { - options.query = {}; - } - options.query[name] = token; - break; - case "cookie": - options.headers.append("Cookie", `${name}=${token}`); - break; - case "header": - default: - options.headers.set(name, token); - break; - } - } + switch (auth.in) { + case 'query': + if (!options.query) { + options.query = {}; + } + options.query[name] = token; + break; + case 'cookie': + options.headers.append('Cookie', `${name}=${token}`); + break; + case 'header': + default: + options.headers.set(name, token); + break; + } + } }; -export const buildUrl: Client["buildUrl"] = (options) => - getUrl({ - baseUrl: options.baseUrl as string, - path: options.path, - query: options.query, - querySerializer: - typeof options.querySerializer === "function" - ? options.querySerializer - : createQuerySerializer(options.querySerializer), - url: options.url, - }); +export const buildUrl: Client['buildUrl'] = (options) => + getUrl({ + baseUrl: options.baseUrl as string, + path: options.path, + query: options.query, + querySerializer: + typeof options.querySerializer === 'function' + ? options.querySerializer + : createQuerySerializer(options.querySerializer), + url: options.url, + }); export const mergeConfigs = (a: Config, b: Config): Config => { - const config = { ...a, ...b }; - if (config.baseUrl?.endsWith("/")) { - config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); - } - config.headers = mergeHeaders(a.headers, b.headers); - return config; + const config = { ...a, ...b }; + if (config.baseUrl?.endsWith('/')) { + config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1); + } + config.headers = mergeHeaders(a.headers, b.headers); + return config; }; const headersEntries = (headers: Headers): Array<[string, string]> => { - const entries: Array<[string, string]> = []; - headers.forEach((value, key) => { - entries.push([key, value]); - }); - return entries; + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; }; export const mergeHeaders = ( - ...headers: Array["headers"] | undefined> + ...headers: Array['headers'] | undefined> ): Headers => { - const mergedHeaders = new Headers(); - for (const header of headers) { - if (!header) { - continue; - } + const mergedHeaders = new Headers(); + for (const header of headers) { + if (!header) { + continue; + } - const iterator = - header instanceof Headers - ? headersEntries(header) - : Object.entries(header); + const iterator = + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); - for (const [key, value] of iterator) { - if (value === null) { - mergedHeaders.delete(key); - } else if (Array.isArray(value)) { - for (const v of value) { - mergedHeaders.append(key, v as string); - } - } else if (value !== undefined) { - // assume object headers are meant to be JSON stringified, i.e. their - // content value in OpenAPI specification is 'application/json' - mergedHeaders.set( - key, - typeof value === "object" ? JSON.stringify(value) : (value as string), - ); - } - } - } - return mergedHeaders; + for (const [key, value] of iterator) { + if (value === null) { + mergedHeaders.delete(key); + } else if (Array.isArray(value)) { + for (const v of value) { + mergedHeaders.append(key, v as string); + } + } else if (value !== undefined) { + // assume object headers are meant to be JSON stringified, i.e. their + // content value in OpenAPI specification is 'application/json' + mergedHeaders.set( + key, + typeof value === 'object' ? JSON.stringify(value) : (value as string), + ); + } + } + } + return mergedHeaders; }; type ErrInterceptor = ( - error: Err, - response: Res, - request: Req, - options: Options, + error: Err, + response: Res, + request: Req, + options: Options, ) => Err | Promise; type ReqInterceptor = ( - request: Req, - options: Options, + request: Req, + options: Options, ) => Req | Promise; type ResInterceptor = ( - response: Res, - request: Req, - options: Options, + response: Res, + request: Req, + options: Options, ) => Res | Promise; class Interceptors { - fns: Array = []; + fns: Array = []; - clear(): void { - this.fns = []; - } + clear(): void { + this.fns = []; + } - eject(id: number | Interceptor): void { - const index = this.getInterceptorIndex(id); - if (this.fns[index]) { - this.fns[index] = null; - } - } + eject(id: number | Interceptor): void { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = null; + } + } - exists(id: number | Interceptor): boolean { - const index = this.getInterceptorIndex(id); - return Boolean(this.fns[index]); - } + exists(id: number | Interceptor): boolean { + const index = this.getInterceptorIndex(id); + return Boolean(this.fns[index]); + } - getInterceptorIndex(id: number | Interceptor): number { - if (typeof id === "number") { - return this.fns[id] ? id : -1; - } - return this.fns.indexOf(id); - } + getInterceptorIndex(id: number | Interceptor): number { + if (typeof id === 'number') { + return this.fns[id] ? id : -1; + } + return this.fns.indexOf(id); + } - update( - id: number | Interceptor, - fn: Interceptor, - ): number | Interceptor | false { - const index = this.getInterceptorIndex(id); - if (this.fns[index]) { - this.fns[index] = fn; - return id; - } - return false; - } + update( + id: number | Interceptor, + fn: Interceptor, + ): number | Interceptor | false { + const index = this.getInterceptorIndex(id); + if (this.fns[index]) { + this.fns[index] = fn; + return id; + } + return false; + } - use(fn: Interceptor): number { - this.fns.push(fn); - return this.fns.length - 1; - } + use(fn: Interceptor): number { + this.fns.push(fn); + return this.fns.length - 1; + } } export interface Middleware { - error: Interceptors>; - request: Interceptors>; - response: Interceptors>; + error: Interceptors>; + request: Interceptors>; + response: Interceptors>; } export const createInterceptors = (): Middleware< - Req, - Res, - Err, - Options + Req, + Res, + Err, + Options > => ({ - error: new Interceptors>(), - request: new Interceptors>(), - response: new Interceptors>(), + error: new Interceptors>(), + request: new Interceptors>(), + response: new Interceptors>(), }); const defaultQuerySerializer = createQuerySerializer({ - allowReserved: false, - array: { - explode: true, - style: "form", - }, - object: { - explode: true, - style: "deepObject", - }, + allowReserved: false, + array: { + explode: true, + style: 'form', + }, + object: { + explode: true, + style: 'deepObject', + }, }); const defaultHeaders = { - "Content-Type": "application/json", + 'Content-Type': 'application/json', }; export const createConfig = ( - override: Config & T> = {}, + override: Config & T> = {}, ): Config & T> => ({ - ...jsonBodySerializer, - headers: defaultHeaders, - parseAs: "auto", - querySerializer: defaultQuerySerializer, - ...override, + ...jsonBodySerializer, + headers: defaultHeaders, + parseAs: 'auto', + querySerializer: defaultQuerySerializer, + ...override, }); diff --git a/app/client/api-client/core/auth.gen.ts b/app/client/api-client/core/auth.gen.ts index 48eb5109..f8a73266 100644 --- a/app/client/api-client/core/auth.gen.ts +++ b/app/client/api-client/core/auth.gen.ts @@ -3,40 +3,40 @@ export type AuthToken = string | undefined; export interface Auth { - /** - * Which part of the request do we use to send the auth? - * - * @default 'header' - */ - in?: "header" | "query" | "cookie"; - /** - * Header or query parameter name. - * - * @default 'Authorization' - */ - name?: string; - scheme?: "basic" | "bearer"; - type: "apiKey" | "http"; + /** + * Which part of the request do we use to send the auth? + * + * @default 'header' + */ + in?: 'header' | 'query' | 'cookie'; + /** + * Header or query parameter name. + * + * @default 'Authorization' + */ + name?: string; + scheme?: 'basic' | 'bearer'; + type: 'apiKey' | 'http'; } export const getAuthToken = async ( - auth: Auth, - callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, + auth: Auth, + callback: ((auth: Auth) => Promise | AuthToken) | AuthToken, ): Promise => { - const token = - typeof callback === "function" ? await callback(auth) : callback; + const token = + typeof callback === 'function' ? await callback(auth) : callback; - if (!token) { - return; - } + if (!token) { + return; + } - if (auth.scheme === "bearer") { - return `Bearer ${token}`; - } + if (auth.scheme === 'bearer') { + return `Bearer ${token}`; + } - if (auth.scheme === "basic") { - return `Basic ${btoa(token)}`; - } + if (auth.scheme === 'basic') { + return `Basic ${btoa(token)}`; + } - return token; + return token; }; diff --git a/app/client/api-client/core/bodySerializer.gen.ts b/app/client/api-client/core/bodySerializer.gen.ts index 80771d70..552b50f7 100644 --- a/app/client/api-client/core/bodySerializer.gen.ts +++ b/app/client/api-client/core/bodySerializer.gen.ts @@ -1,100 +1,100 @@ // This file is auto-generated by @hey-api/openapi-ts import type { - ArrayStyle, - ObjectStyle, - SerializerOptions, -} from "./pathSerializer.gen"; + ArrayStyle, + ObjectStyle, + SerializerOptions, +} from './pathSerializer.gen'; export type QuerySerializer = (query: Record) => string; export type BodySerializer = (body: any) => any; type QuerySerializerOptionsObject = { - allowReserved?: boolean; - array?: Partial>; - object?: Partial>; + allowReserved?: boolean; + array?: Partial>; + object?: Partial>; }; export type QuerySerializerOptions = QuerySerializerOptionsObject & { - /** - * Per-parameter serialization overrides. When provided, these settings - * override the global array/object settings for specific parameter names. - */ - parameters?: Record; + /** + * Per-parameter serialization overrides. When provided, these settings + * override the global array/object settings for specific parameter names. + */ + parameters?: Record; }; const serializeFormDataPair = ( - data: FormData, - key: string, - value: unknown, + data: FormData, + key: string, + value: unknown, ): void => { - if (typeof value === "string" || value instanceof Blob) { - data.append(key, value); - } else if (value instanceof Date) { - data.append(key, value.toISOString()); - } else { - data.append(key, JSON.stringify(value)); - } + if (typeof value === 'string' || value instanceof Blob) { + data.append(key, value); + } else if (value instanceof Date) { + data.append(key, value.toISOString()); + } else { + data.append(key, JSON.stringify(value)); + } }; const serializeUrlSearchParamsPair = ( - data: URLSearchParams, - key: string, - value: unknown, + data: URLSearchParams, + key: string, + value: unknown, ): void => { - if (typeof value === "string") { - data.append(key, value); - } else { - data.append(key, JSON.stringify(value)); - } + if (typeof value === 'string') { + data.append(key, value); + } else { + data.append(key, JSON.stringify(value)); + } }; export const formDataBodySerializer = { - bodySerializer: | Array>>( - body: T, - ): FormData => { - const data = new FormData(); + bodySerializer: | Array>>( + body: T, + ): FormData => { + const data = new FormData(); - Object.entries(body).forEach(([key, value]) => { - if (value === undefined || value === null) { - return; - } - if (Array.isArray(value)) { - value.forEach((v) => serializeFormDataPair(data, key, v)); - } else { - serializeFormDataPair(data, key, value); - } - }); + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeFormDataPair(data, key, v)); + } else { + serializeFormDataPair(data, key, value); + } + }); - return data; - }, + return data; + }, }; export const jsonBodySerializer = { - bodySerializer: (body: T): string => - JSON.stringify(body, (_key, value) => - typeof value === "bigint" ? value.toString() : value, - ), + bodySerializer: (body: T): string => + JSON.stringify(body, (_key, value) => + typeof value === 'bigint' ? value.toString() : value, + ), }; export const urlSearchParamsBodySerializer = { - bodySerializer: | Array>>( - body: T, - ): string => { - const data = new URLSearchParams(); + bodySerializer: | Array>>( + body: T, + ): string => { + const data = new URLSearchParams(); - Object.entries(body).forEach(([key, value]) => { - if (value === undefined || value === null) { - return; - } - if (Array.isArray(value)) { - value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); - } else { - serializeUrlSearchParamsPair(data, key, value); - } - }); + Object.entries(body).forEach(([key, value]) => { + if (value === undefined || value === null) { + return; + } + if (Array.isArray(value)) { + value.forEach((v) => serializeUrlSearchParamsPair(data, key, v)); + } else { + serializeUrlSearchParamsPair(data, key, value); + } + }); - return data.toString(); - }, + return data.toString(); + }, }; diff --git a/app/client/api-client/core/params.gen.ts b/app/client/api-client/core/params.gen.ts index 8cfe5a59..602715c4 100644 --- a/app/client/api-client/core/params.gen.ts +++ b/app/client/api-client/core/params.gen.ts @@ -1,176 +1,176 @@ // This file is auto-generated by @hey-api/openapi-ts -type Slot = "body" | "headers" | "path" | "query"; +type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = - | { - in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ - key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ - map?: string; - } - | { - in: Extract; - /** - * Key isn't required for bodies. - */ - key?: string; - map?: string; - } - | { - /** - * Field name. This is the name we want the user to see and use. - */ - key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If `in` is omitted, `map` aliases `key` to the transport layer. - */ - map: Slot; - }; + | { + in: Exclude; + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If omitted, we use the same value as `key`. + */ + map?: string; + } + | { + in: Extract; + /** + * Key isn't required for bodies. + */ + key?: string; + map?: string; + } + | { + /** + * Field name. This is the name we want the user to see and use. + */ + key: string; + /** + * Field mapped name. This is the name we want to use in the request. + * If `in` is omitted, `map` aliases `key` to the transport layer. + */ + map: Slot; + }; export interface Fields { - allowExtra?: Partial>; - args?: ReadonlyArray; + allowExtra?: Partial>; + args?: ReadonlyArray; } export type FieldsConfig = ReadonlyArray; const extraPrefixesMap: Record = { - $body_: "body", - $headers_: "headers", - $path_: "path", - $query_: "query", + $body_: 'body', + $headers_: 'headers', + $path_: 'path', + $query_: 'query', }; const extraPrefixes = Object.entries(extraPrefixesMap); type KeyMap = Map< - string, - | { - in: Slot; - map?: string; - } - | { - in?: never; - map: Slot; - } + string, + | { + in: Slot; + map?: string; + } + | { + in?: never; + map: Slot; + } >; const buildKeyMap = (fields: FieldsConfig, map?: KeyMap): KeyMap => { - if (!map) { - map = new Map(); - } + if (!map) { + map = new Map(); + } - for (const config of fields) { - if ("in" in config) { - if (config.key) { - map.set(config.key, { - in: config.in, - map: config.map, - }); - } - } else if ("key" in config) { - map.set(config.key, { - map: config.map, - }); - } else if (config.args) { - buildKeyMap(config.args, map); - } - } + for (const config of fields) { + if ('in' in config) { + if (config.key) { + map.set(config.key, { + in: config.in, + map: config.map, + }); + } + } else if ('key' in config) { + map.set(config.key, { + map: config.map, + }); + } else if (config.args) { + buildKeyMap(config.args, map); + } + } - return map; + return map; }; interface Params { - body: unknown; - headers: Record; - path: Record; - query: Record; + body: unknown; + headers: Record; + path: Record; + query: Record; } const stripEmptySlots = (params: Params) => { - for (const [slot, value] of Object.entries(params)) { - if (value && typeof value === "object" && !Object.keys(value).length) { - delete params[slot as Slot]; - } - } + for (const [slot, value] of Object.entries(params)) { + if (value && typeof value === 'object' && !Object.keys(value).length) { + delete params[slot as Slot]; + } + } }; export const buildClientParams = ( - args: ReadonlyArray, - fields: FieldsConfig, + args: ReadonlyArray, + fields: FieldsConfig, ) => { - const params: Params = { - body: {}, - headers: {}, - path: {}, - query: {}, - }; + const params: Params = { + body: {}, + headers: {}, + path: {}, + query: {}, + }; - const map = buildKeyMap(fields); + const map = buildKeyMap(fields); - let config: FieldsConfig[number] | undefined; + let config: FieldsConfig[number] | undefined; - for (const [index, arg] of args.entries()) { - if (fields[index]) { - config = fields[index]; - } + for (const [index, arg] of args.entries()) { + if (fields[index]) { + config = fields[index]; + } - if (!config) { - continue; - } + if (!config) { + continue; + } - if ("in" in config) { - if (config.key) { - const field = map.get(config.key)!; - const name = field.map || config.key; - if (field.in) { - (params[field.in] as Record)[name] = arg; - } - } else { - params.body = arg; - } - } else { - for (const [key, value] of Object.entries(arg ?? {})) { - const field = map.get(key); + if ('in' in config) { + if (config.key) { + const field = map.get(config.key)!; + const name = field.map || config.key; + if (field.in) { + (params[field.in] as Record)[name] = arg; + } + } else { + params.body = arg; + } + } else { + for (const [key, value] of Object.entries(arg ?? {})) { + const field = map.get(key); - if (field) { - if (field.in) { - const name = field.map || key; - (params[field.in] as Record)[name] = value; - } else { - params[field.map] = value; - } - } else { - const extra = extraPrefixes.find(([prefix]) => - key.startsWith(prefix), - ); + if (field) { + if (field.in) { + const name = field.map || key; + (params[field.in] as Record)[name] = value; + } else { + params[field.map] = value; + } + } else { + const extra = extraPrefixes.find(([prefix]) => + key.startsWith(prefix), + ); - if (extra) { - const [prefix, slot] = extra; - (params[slot] as Record)[ - key.slice(prefix.length) - ] = value; - } else if ("allowExtra" in config && config.allowExtra) { - for (const [slot, allowed] of Object.entries(config.allowExtra)) { - if (allowed) { - (params[slot as Slot] as Record)[key] = value; - break; - } - } - } - } - } - } - } + if (extra) { + const [prefix, slot] = extra; + (params[slot] as Record)[ + key.slice(prefix.length) + ] = value; + } else if ('allowExtra' in config && config.allowExtra) { + for (const [slot, allowed] of Object.entries(config.allowExtra)) { + if (allowed) { + (params[slot as Slot] as Record)[key] = value; + break; + } + } + } + } + } + } + } - stripEmptySlots(params); + stripEmptySlots(params); - return params; + return params; }; diff --git a/app/client/api-client/core/pathSerializer.gen.ts b/app/client/api-client/core/pathSerializer.gen.ts index 2fe930d9..8d999310 100644 --- a/app/client/api-client/core/pathSerializer.gen.ts +++ b/app/client/api-client/core/pathSerializer.gen.ts @@ -1,181 +1,181 @@ // This file is auto-generated by @hey-api/openapi-ts interface SerializeOptions - extends SerializePrimitiveOptions, - SerializerOptions {} + extends SerializePrimitiveOptions, + SerializerOptions {} interface SerializePrimitiveOptions { - allowReserved?: boolean; - name: string; + allowReserved?: boolean; + name: string; } export interface SerializerOptions { - /** - * @default true - */ - explode: boolean; - style: T; + /** + * @default true + */ + explode: boolean; + style: T; } -export type ArrayStyle = "form" | "spaceDelimited" | "pipeDelimited"; +export type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited'; export type ArraySeparatorStyle = ArrayStyle | MatrixStyle; -type MatrixStyle = "label" | "matrix" | "simple"; -export type ObjectStyle = "form" | "deepObject"; +type MatrixStyle = 'label' | 'matrix' | 'simple'; +export type ObjectStyle = 'form' | 'deepObject'; type ObjectSeparatorStyle = ObjectStyle | MatrixStyle; interface SerializePrimitiveParam extends SerializePrimitiveOptions { - value: string; + value: string; } export const separatorArrayExplode = (style: ArraySeparatorStyle) => { - switch (style) { - case "label": - return "."; - case "matrix": - return ";"; - case "simple": - return ","; - default: - return "&"; - } + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } }; export const separatorArrayNoExplode = (style: ArraySeparatorStyle) => { - switch (style) { - case "form": - return ","; - case "pipeDelimited": - return "|"; - case "spaceDelimited": - return "%20"; - default: - return ","; - } + switch (style) { + case 'form': + return ','; + case 'pipeDelimited': + return '|'; + case 'spaceDelimited': + return '%20'; + default: + return ','; + } }; export const separatorObjectExplode = (style: ObjectSeparatorStyle) => { - switch (style) { - case "label": - return "."; - case "matrix": - return ";"; - case "simple": - return ","; - default: - return "&"; - } + switch (style) { + case 'label': + return '.'; + case 'matrix': + return ';'; + case 'simple': + return ','; + default: + return '&'; + } }; export const serializeArrayParam = ({ - allowReserved, - explode, - name, - style, - value, + allowReserved, + explode, + name, + style, + value, }: SerializeOptions & { - value: unknown[]; + value: unknown[]; }) => { - if (!explode) { - const joinedValues = ( - allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) - ).join(separatorArrayNoExplode(style)); - switch (style) { - case "label": - return `.${joinedValues}`; - case "matrix": - return `;${name}=${joinedValues}`; - case "simple": - return joinedValues; - default: - return `${name}=${joinedValues}`; - } - } + if (!explode) { + const joinedValues = ( + allowReserved ? value : value.map((v) => encodeURIComponent(v as string)) + ).join(separatorArrayNoExplode(style)); + switch (style) { + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + case 'simple': + return joinedValues; + default: + return `${name}=${joinedValues}`; + } + } - const separator = separatorArrayExplode(style); - const joinedValues = value - .map((v) => { - if (style === "label" || style === "simple") { - return allowReserved ? v : encodeURIComponent(v as string); - } + const separator = separatorArrayExplode(style); + const joinedValues = value + .map((v) => { + if (style === 'label' || style === 'simple') { + return allowReserved ? v : encodeURIComponent(v as string); + } - return serializePrimitiveParam({ - allowReserved, - name, - value: v as string, - }); - }) - .join(separator); - return style === "label" || style === "matrix" - ? separator + joinedValues - : joinedValues; + return serializePrimitiveParam({ + allowReserved, + name, + value: v as string, + }); + }) + .join(separator); + return style === 'label' || style === 'matrix' + ? separator + joinedValues + : joinedValues; }; export const serializePrimitiveParam = ({ - allowReserved, - name, - value, + allowReserved, + name, + value, }: SerializePrimitiveParam) => { - if (value === undefined || value === null) { - return ""; - } + if (value === undefined || value === null) { + return ''; + } - if (typeof value === "object") { - throw new Error( - "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.", - ); - } + if (typeof value === 'object') { + throw new Error( + 'Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.', + ); + } - return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; + return `${name}=${allowReserved ? value : encodeURIComponent(value)}`; }; export const serializeObjectParam = ({ - allowReserved, - explode, - name, - style, - value, - valueOnly, + allowReserved, + explode, + name, + style, + value, + valueOnly, }: SerializeOptions & { - value: Record | Date; - valueOnly?: boolean; + value: Record | Date; + valueOnly?: boolean; }) => { - if (value instanceof Date) { - return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; - } + if (value instanceof Date) { + return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`; + } - if (style !== "deepObject" && !explode) { - let values: string[] = []; - Object.entries(value).forEach(([key, v]) => { - values = [ - ...values, - key, - allowReserved ? (v as string) : encodeURIComponent(v as string), - ]; - }); - const joinedValues = values.join(","); - switch (style) { - case "form": - return `${name}=${joinedValues}`; - case "label": - return `.${joinedValues}`; - case "matrix": - return `;${name}=${joinedValues}`; - default: - return joinedValues; - } - } + if (style !== 'deepObject' && !explode) { + let values: string[] = []; + Object.entries(value).forEach(([key, v]) => { + values = [ + ...values, + key, + allowReserved ? (v as string) : encodeURIComponent(v as string), + ]; + }); + const joinedValues = values.join(','); + switch (style) { + case 'form': + return `${name}=${joinedValues}`; + case 'label': + return `.${joinedValues}`; + case 'matrix': + return `;${name}=${joinedValues}`; + default: + return joinedValues; + } + } - const separator = separatorObjectExplode(style); - const joinedValues = Object.entries(value) - .map(([key, v]) => - serializePrimitiveParam({ - allowReserved, - name: style === "deepObject" ? `${name}[${key}]` : key, - value: v as string, - }), - ) - .join(separator); - return style === "label" || style === "matrix" - ? separator + joinedValues - : joinedValues; + const separator = separatorObjectExplode(style); + const joinedValues = Object.entries(value) + .map(([key, v]) => + serializePrimitiveParam({ + allowReserved, + name: style === 'deepObject' ? `${name}[${key}]` : key, + value: v as string, + }), + ) + .join(separator); + return style === 'label' || style === 'matrix' + ? separator + joinedValues + : joinedValues; }; diff --git a/app/client/api-client/core/queryKeySerializer.gen.ts b/app/client/api-client/core/queryKeySerializer.gen.ts index 2e8e7aab..d3bb6839 100644 --- a/app/client/api-client/core/queryKeySerializer.gen.ts +++ b/app/client/api-client/core/queryKeySerializer.gen.ts @@ -4,133 +4,133 @@ * JSON-friendly union that mirrors what Pinia Colada can hash. */ export type JsonValue = - | null - | string - | number - | boolean - | JsonValue[] - | { [key: string]: JsonValue }; + | null + | string + | number + | boolean + | JsonValue[] + | { [key: string]: JsonValue }; /** * Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes. */ export const queryKeyJsonReplacer = (_key: string, value: unknown) => { - if ( - value === undefined || - typeof value === "function" || - typeof value === "symbol" - ) { - return undefined; - } - if (typeof value === "bigint") { - return value.toString(); - } - if (value instanceof Date) { - return value.toISOString(); - } - return value; + if ( + value === undefined || + typeof value === 'function' || + typeof value === 'symbol' + ) { + return undefined; + } + if (typeof value === 'bigint') { + return value.toString(); + } + if (value instanceof Date) { + return value.toISOString(); + } + return value; }; /** * Safely stringifies a value and parses it back into a JsonValue. */ export const stringifyToJsonValue = (input: unknown): JsonValue | undefined => { - try { - const json = JSON.stringify(input, queryKeyJsonReplacer); - if (json === undefined) { - return undefined; - } - return JSON.parse(json) as JsonValue; - } catch { - return undefined; - } + try { + const json = JSON.stringify(input, queryKeyJsonReplacer); + if (json === undefined) { + return undefined; + } + return JSON.parse(json) as JsonValue; + } catch { + return undefined; + } }; /** * Detects plain objects (including objects with a null prototype). */ const isPlainObject = (value: unknown): value is Record => { - if (value === null || typeof value !== "object") { - return false; - } - const prototype = Object.getPrototypeOf(value as object); - return prototype === Object.prototype || prototype === null; + if (value === null || typeof value !== 'object') { + return false; + } + const prototype = Object.getPrototypeOf(value as object); + return prototype === Object.prototype || prototype === null; }; /** * Turns URLSearchParams into a sorted JSON object for deterministic keys. */ const serializeSearchParams = (params: URLSearchParams): JsonValue => { - const entries = Array.from(params.entries()).sort(([a], [b]) => - a.localeCompare(b), - ); - const result: Record = {}; + const entries = Array.from(params.entries()).sort(([a], [b]) => + a.localeCompare(b), + ); + const result: Record = {}; - for (const [key, value] of entries) { - const existing = result[key]; - if (existing === undefined) { - result[key] = value; - continue; - } + for (const [key, value] of entries) { + const existing = result[key]; + if (existing === undefined) { + result[key] = value; + continue; + } - if (Array.isArray(existing)) { - (existing as string[]).push(value); - } else { - result[key] = [existing, value]; - } - } + if (Array.isArray(existing)) { + (existing as string[]).push(value); + } else { + result[key] = [existing, value]; + } + } - return result; + return result; }; /** * Normalizes any accepted value into a JSON-friendly shape for query keys. */ export const serializeQueryKeyValue = ( - value: unknown, + value: unknown, ): JsonValue | undefined => { - if (value === null) { - return null; - } + if (value === null) { + return null; + } - if ( - typeof value === "string" || - typeof value === "number" || - typeof value === "boolean" - ) { - return value; - } + if ( + typeof value === 'string' || + typeof value === 'number' || + typeof value === 'boolean' + ) { + return value; + } - if ( - value === undefined || - typeof value === "function" || - typeof value === "symbol" - ) { - return undefined; - } + if ( + value === undefined || + typeof value === 'function' || + typeof value === 'symbol' + ) { + return undefined; + } - if (typeof value === "bigint") { - return value.toString(); - } + if (typeof value === 'bigint') { + return value.toString(); + } - if (value instanceof Date) { - return value.toISOString(); - } + if (value instanceof Date) { + return value.toISOString(); + } - if (Array.isArray(value)) { - return stringifyToJsonValue(value); - } + if (Array.isArray(value)) { + return stringifyToJsonValue(value); + } - if ( - typeof URLSearchParams !== "undefined" && - value instanceof URLSearchParams - ) { - return serializeSearchParams(value); - } + if ( + typeof URLSearchParams !== 'undefined' && + value instanceof URLSearchParams + ) { + return serializeSearchParams(value); + } - if (isPlainObject(value)) { - return stringifyToJsonValue(value); - } + if (isPlainObject(value)) { + return stringifyToJsonValue(value); + } - return undefined; + return undefined; }; diff --git a/app/client/api-client/core/serverSentEvents.gen.ts b/app/client/api-client/core/serverSentEvents.gen.ts index 8dfe6a5c..343d25af 100644 --- a/app/client/api-client/core/serverSentEvents.gen.ts +++ b/app/client/api-client/core/serverSentEvents.gen.ts @@ -1,266 +1,266 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Config } from "./types.gen"; +import type { Config } from './types.gen'; export type ServerSentEventsOptions = Omit< - RequestInit, - "method" + RequestInit, + 'method' > & - Pick & { - /** - * Fetch API implementation. You can use this option to provide a custom - * fetch instance. - * - * @default globalThis.fetch - */ - fetch?: typeof fetch; - /** - * Implementing clients can call request interceptors inside this hook. - */ - onRequest?: (url: string, init: RequestInit) => Promise; - /** - * Callback invoked when a network or parsing error occurs during streaming. - * - * This option applies only if the endpoint returns a stream of events. - * - * @param error The error that occurred. - */ - onSseError?: (error: unknown) => void; - /** - * Callback invoked when an event is streamed from the server. - * - * This option applies only if the endpoint returns a stream of events. - * - * @param event Event streamed from the server. - * @returns Nothing (void). - */ - onSseEvent?: (event: StreamEvent) => void; - serializedBody?: RequestInit["body"]; - /** - * Default retry delay in milliseconds. - * - * This option applies only if the endpoint returns a stream of events. - * - * @default 3000 - */ - sseDefaultRetryDelay?: number; - /** - * Maximum number of retry attempts before giving up. - */ - sseMaxRetryAttempts?: number; - /** - * Maximum retry delay in milliseconds. - * - * Applies only when exponential backoff is used. - * - * This option applies only if the endpoint returns a stream of events. - * - * @default 30000 - */ - sseMaxRetryDelay?: number; - /** - * Optional sleep function for retry backoff. - * - * Defaults to using `setTimeout`. - */ - sseSleepFn?: (ms: number) => Promise; - url: string; - }; + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; export interface StreamEvent { - data: TData; - event?: string; - id?: string; - retry?: number; + data: TData; + event?: string; + id?: string; + retry?: number; } export type ServerSentEventsResult< - TData = unknown, - TReturn = void, - TNext = unknown, + TData = unknown, + TReturn = void, + TNext = unknown, > = { - stream: AsyncGenerator< - TData extends Record ? TData[keyof TData] : TData, - TReturn, - TNext - >; + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; }; export const createSseClient = ({ - onRequest, - onSseError, - onSseEvent, - responseTransformer, - responseValidator, - sseDefaultRetryDelay, - sseMaxRetryAttempts, - sseMaxRetryDelay, - sseSleepFn, - url, - ...options + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options }: ServerSentEventsOptions): ServerSentEventsResult => { - let lastEventId: string | undefined; + let lastEventId: string | undefined; - const sleep = - sseSleepFn ?? - ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + const sleep = + sseSleepFn ?? + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); - const createStream = async function* () { - let retryDelay: number = sseDefaultRetryDelay ?? 3000; - let attempt = 0; - const signal = options.signal ?? new AbortController().signal; + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; - while (true) { - if (signal.aborted) break; + while (true) { + if (signal.aborted) break; - attempt++; + attempt++; - const headers = - options.headers instanceof Headers - ? options.headers - : new Headers(options.headers as Record | undefined); + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); - if (lastEventId !== undefined) { - headers.set("Last-Event-ID", lastEventId); - } + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } - try { - const requestInit: RequestInit = { - redirect: "follow", - ...options, - body: options.serializedBody, - headers, - signal, - }; - let request = new Request(url, requestInit); - if (onRequest) { - request = await onRequest(url, requestInit); - } - // fetch must be assigned here, otherwise it would throw the error: - // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation - const _fetch = options.fetch ?? globalThis.fetch; - const response = await _fetch(request); + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); - if (!response.ok) - throw new Error( - `SSE failed: ${response.status} ${response.statusText}`, - ); + if (!response.ok) + throw new Error( + `SSE failed: ${response.status} ${response.statusText}`, + ); - if (!response.body) throw new Error("No body in SSE response"); + if (!response.body) throw new Error('No body in SSE response'); - const reader = response.body - .pipeThrough(new TextDecoderStream()) - .getReader(); + const reader = response.body + .pipeThrough(new TextDecoderStream()) + .getReader(); - let buffer = ""; + let buffer = ''; - const abortHandler = () => { - try { - reader.cancel(); - } catch { - // noop - } - }; + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; - signal.addEventListener("abort", abortHandler); + signal.addEventListener('abort', abortHandler); - try { - while (true) { - const { done, value } = await reader.read(); - if (done) break; - buffer += value; - // Normalize line endings: CRLF -> LF, then CR -> LF - buffer = buffer.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + // Normalize line endings: CRLF -> LF, then CR -> LF + buffer = buffer.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); - const chunks = buffer.split("\n\n"); - buffer = chunks.pop() ?? ""; + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; - for (const chunk of chunks) { - const lines = chunk.split("\n"); - const dataLines: Array = []; - let eventName: string | undefined; + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; - for (const line of lines) { - if (line.startsWith("data:")) { - dataLines.push(line.replace(/^data:\s*/, "")); - } else if (line.startsWith("event:")) { - eventName = line.replace(/^event:\s*/, ""); - } else if (line.startsWith("id:")) { - lastEventId = line.replace(/^id:\s*/, ""); - } else if (line.startsWith("retry:")) { - const parsed = Number.parseInt( - line.replace(/^retry:\s*/, ""), - 10, - ); - if (!Number.isNaN(parsed)) { - retryDelay = parsed; - } - } - } + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt( + line.replace(/^retry:\s*/, ''), + 10, + ); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } - let data: unknown; - let parsedJson = false; + let data: unknown; + let parsedJson = false; - if (dataLines.length) { - const rawData = dataLines.join("\n"); - try { - data = JSON.parse(rawData); - parsedJson = true; - } catch { - data = rawData; - } - } + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } - if (parsedJson) { - if (responseValidator) { - await responseValidator(data); - } + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } - if (responseTransformer) { - data = await responseTransformer(data); - } - } + if (responseTransformer) { + data = await responseTransformer(data); + } + } - onSseEvent?.({ - data, - event: eventName, - id: lastEventId, - retry: retryDelay, - }); + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); - if (dataLines.length) { - yield data as any; - } - } - } - } finally { - signal.removeEventListener("abort", abortHandler); - reader.releaseLock(); - } + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } - break; // exit loop on normal completion - } catch (error) { - // connection failed or aborted; retry after delay - onSseError?.(error); + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); - if ( - sseMaxRetryAttempts !== undefined && - attempt >= sseMaxRetryAttempts - ) { - break; // stop after firing error - } + if ( + sseMaxRetryAttempts !== undefined && + attempt >= sseMaxRetryAttempts + ) { + break; // stop after firing error + } - // exponential backoff: double retry each attempt, cap at 30s - const backoff = Math.min( - retryDelay * 2 ** (attempt - 1), - sseMaxRetryDelay ?? 30000, - ); - await sleep(backoff); - } - } - }; + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min( + retryDelay * 2 ** (attempt - 1), + sseMaxRetryDelay ?? 30000, + ); + await sleep(backoff); + } + } + }; - const stream = createStream(); + const stream = createStream(); - return { stream }; + return { stream }; }; diff --git a/app/client/api-client/core/types.gen.ts b/app/client/api-client/core/types.gen.ts index 8db8c934..643c070c 100644 --- a/app/client/api-client/core/types.gen.ts +++ b/app/client/api-client/core/types.gen.ts @@ -1,118 +1,118 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Auth, AuthToken } from "./auth.gen"; +import type { Auth, AuthToken } from './auth.gen'; import type { - BodySerializer, - QuerySerializer, - QuerySerializerOptions, -} from "./bodySerializer.gen"; + BodySerializer, + QuerySerializer, + QuerySerializerOptions, +} from './bodySerializer.gen'; export type HttpMethod = - | "connect" - | "delete" - | "get" - | "head" - | "options" - | "patch" - | "post" - | "put" - | "trace"; + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; export type Client< - RequestFn = never, - Config = unknown, - MethodFn = never, - BuildUrlFn = never, - SseFn = never, + RequestFn = never, + Config = unknown, + MethodFn = never, + BuildUrlFn = never, + SseFn = never, > = { - /** - * Returns the final request URL. - */ - buildUrl: BuildUrlFn; - getConfig: () => Config; - request: RequestFn; - setConfig: (config: Config) => Config; + /** + * Returns the final request URL. + */ + buildUrl: BuildUrlFn; + getConfig: () => Config; + request: RequestFn; + setConfig: (config: Config) => Config; } & { - [K in HttpMethod]: MethodFn; + [K in HttpMethod]: MethodFn; } & ([SseFn] extends [never] - ? { sse?: never } - : { sse: { [K in HttpMethod]: SseFn } }); + ? { sse?: never } + : { sse: { [K in HttpMethod]: SseFn } }); export interface Config { - /** - * Auth token or a function returning auth token. The resolved value will be - * added to the request payload as defined by its `security` array. - */ - auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; - /** - * A function for serializing request body parameter. By default, - * {@link JSON.stringify()} will be used. - */ - bodySerializer?: BodySerializer | null; - /** - * An object containing any HTTP headers that you want to pre-populate your - * `Headers` object with. - * - * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} - */ - headers?: - | RequestInit["headers"] - | Record< - string, - | string - | number - | boolean - | (string | number | boolean)[] - | null - | undefined - | unknown - >; - /** - * The request method. - * - * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} - */ - method?: Uppercase; - /** - * A function for serializing request query parameters. By default, arrays - * will be exploded in form style, objects will be exploded in deepObject - * style, and reserved characters are percent-encoded. - * - * This method will have no effect if the native `paramsSerializer()` Axios - * API function is used. - * - * {@link https://swagger.io/docs/specification/serialization/#query View examples} - */ - querySerializer?: QuerySerializer | QuerySerializerOptions; - /** - * A function validating request data. This is useful if you want to ensure - * the request conforms to the desired shape, so it can be safely sent to - * the server. - */ - requestValidator?: (data: unknown) => Promise; - /** - * A function transforming response data before it's returned. This is useful - * for post-processing data, e.g. converting ISO strings into Date objects. - */ - responseTransformer?: (data: unknown) => Promise; - /** - * A function validating response data. This is useful if you want to ensure - * the response conforms to the desired shape, so it can be safely passed to - * the transformers and returned to the user. - */ - responseValidator?: (data: unknown) => Promise; + /** + * Auth token or a function returning auth token. The resolved value will be + * added to the request payload as defined by its `security` array. + */ + auth?: ((auth: Auth) => Promise | AuthToken) | AuthToken; + /** + * A function for serializing request body parameter. By default, + * {@link JSON.stringify()} will be used. + */ + bodySerializer?: BodySerializer | null; + /** + * An object containing any HTTP headers that you want to pre-populate your + * `Headers` object with. + * + * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} + */ + headers?: + | RequestInit['headers'] + | Record< + string, + | string + | number + | boolean + | (string | number | boolean)[] + | null + | undefined + | unknown + >; + /** + * The request method. + * + * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} + */ + method?: Uppercase; + /** + * A function for serializing request query parameters. By default, arrays + * will be exploded in form style, objects will be exploded in deepObject + * style, and reserved characters are percent-encoded. + * + * This method will have no effect if the native `paramsSerializer()` Axios + * API function is used. + * + * {@link https://swagger.io/docs/specification/serialization/#query View examples} + */ + querySerializer?: QuerySerializer | QuerySerializerOptions; + /** + * A function validating request data. This is useful if you want to ensure + * the request conforms to the desired shape, so it can be safely sent to + * the server. + */ + requestValidator?: (data: unknown) => Promise; + /** + * A function transforming response data before it's returned. This is useful + * for post-processing data, e.g. converting ISO strings into Date objects. + */ + responseTransformer?: (data: unknown) => Promise; + /** + * A function validating response data. This is useful if you want to ensure + * the response conforms to the desired shape, so it can be safely passed to + * the transformers and returned to the user. + */ + responseValidator?: (data: unknown) => Promise; } type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; + ? true + : [T] extends [never | undefined] + ? [undefined] extends [T] + ? false + : true + : false; export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; + [K in keyof T as IsExactlyNeverOrNeverUndefined extends true + ? never + : K]: T[K]; }; diff --git a/app/client/api-client/core/utils.gen.ts b/app/client/api-client/core/utils.gen.ts index 999c4a36..0b5389d0 100644 --- a/app/client/api-client/core/utils.gen.ts +++ b/app/client/api-client/core/utils.gen.ts @@ -1,143 +1,143 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { BodySerializer, QuerySerializer } from "./bodySerializer.gen"; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { - type ArraySeparatorStyle, - serializeArrayParam, - serializeObjectParam, - serializePrimitiveParam, -} from "./pathSerializer.gen"; + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; export interface PathSerializer { - path: Record; - url: string; + path: Record; + url: string; } export const PATH_PARAM_RE = /\{[^{}]+\}/g; export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { - let url = _url; - const matches = _url.match(PATH_PARAM_RE); - if (matches) { - for (const match of matches) { - let explode = false; - let name = match.substring(1, match.length - 1); - let style: ArraySeparatorStyle = "simple"; + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; - if (name.endsWith("*")) { - explode = true; - name = name.substring(0, name.length - 1); - } + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } - if (name.startsWith(".")) { - name = name.substring(1); - style = "label"; - } else if (name.startsWith(";")) { - name = name.substring(1); - style = "matrix"; - } + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } - const value = path[name]; + const value = path[name]; - if (value === undefined || value === null) { - continue; - } + if (value === undefined || value === null) { + continue; + } - if (Array.isArray(value)) { - url = url.replace( - match, - serializeArrayParam({ explode, name, style, value }), - ); - continue; - } + if (Array.isArray(value)) { + url = url.replace( + match, + serializeArrayParam({ explode, name, style, value }), + ); + continue; + } - if (typeof value === "object") { - url = url.replace( - match, - serializeObjectParam({ - explode, - name, - style, - value: value as Record, - valueOnly: true, - }), - ); - continue; - } + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } - if (style === "matrix") { - url = url.replace( - match, - `;${serializePrimitiveParam({ - name, - value: value as string, - })}`, - ); - continue; - } + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } - const replaceValue = encodeURIComponent( - style === "label" ? `.${value as string}` : (value as string), - ); - url = url.replace(match, replaceValue); - } - } - return url; + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; }; export const getUrl = ({ - baseUrl, - path, - query, - querySerializer, - url: _url, + baseUrl, + path, + query, + querySerializer, + url: _url, }: { - baseUrl?: string; - path?: Record; - query?: Record; - querySerializer: QuerySerializer; - url: string; + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; }) => { - const pathUrl = _url.startsWith("/") ? _url : `/${_url}`; - let url = (baseUrl ?? "") + pathUrl; - if (path) { - url = defaultPathSerializer({ path, url }); - } - let search = query ? querySerializer(query) : ""; - if (search.startsWith("?")) { - search = search.substring(1); - } - if (search) { - url += `?${search}`; - } - return url; + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; }; export function getValidRequestBody(options: { - body?: unknown; - bodySerializer?: BodySerializer | null; - serializedBody?: unknown; + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; }) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody) { - if ("serializedBody" in options) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ""; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - // not all clients implement a serializedBody property (i.e. client-axios) - return options.body !== "" ? options.body : null; - } + // not all clients implement a serializedBody property (i.e. client-axios) + return options.body !== '' ? options.body : null; + } - // plain/text body - if (hasBody) { - return options.body; - } + // plain/text body + if (hasBody) { + return options.body; + } - // no body was provided - return undefined; + // no body was provided + return undefined; } diff --git a/app/client/api-client/index.ts b/app/client/api-client/index.ts index 7a716924..fbd8c01a 100644 --- a/app/client/api-client/index.ts +++ b/app/client/api-client/index.ts @@ -1,4 +1,4 @@ // This file is auto-generated by @hey-api/openapi-ts -export type * from "./types.gen"; -export * from "./sdk.gen"; +export { browseFilesystem, createBackupSchedule, createNotificationDestination, createRepository, createVolume, deleteBackupSchedule, deleteNotificationDestination, deleteRepository, deleteSnapshot, deleteSnapshots, deleteVolume, doctorRepository, downloadResticPassword, getBackupSchedule, getBackupScheduleForVolume, getMirrorCompatibility, getNotificationDestination, getRepository, getScheduleMirrors, getScheduleNotifications, getSnapshotDetails, getStatus, getSystemInfo, getUpdates, getVolume, healthCheckVolume, listBackupSchedules, listFiles, listNotificationDestinations, listRcloneRemotes, listRepositories, listSnapshotFiles, listSnapshots, listVolumes, mountVolume, type Options, reorderBackupSchedules, restoreSnapshot, runBackupNow, runForget, stopBackup, tagSnapshots, testConnection, testNotificationDestination, unmountVolume, updateBackupSchedule, updateNotificationDestination, updateRepository, updateScheduleMirrors, updateScheduleNotifications, updateVolume } from './sdk.gen'; +export type { BrowseFilesystemData, BrowseFilesystemResponse, BrowseFilesystemResponses, ClientOptions, CreateBackupScheduleData, CreateBackupScheduleResponse, CreateBackupScheduleResponses, CreateNotificationDestinationData, CreateNotificationDestinationResponse, CreateNotificationDestinationResponses, CreateRepositoryData, CreateRepositoryResponse, CreateRepositoryResponses, CreateVolumeData, CreateVolumeResponse, CreateVolumeResponses, DeleteBackupScheduleData, DeleteBackupScheduleResponse, DeleteBackupScheduleResponses, DeleteNotificationDestinationData, DeleteNotificationDestinationErrors, DeleteNotificationDestinationResponse, DeleteNotificationDestinationResponses, DeleteRepositoryData, DeleteRepositoryResponse, DeleteRepositoryResponses, DeleteSnapshotData, DeleteSnapshotResponse, DeleteSnapshotResponses, DeleteSnapshotsData, DeleteSnapshotsResponse, DeleteSnapshotsResponses, DeleteVolumeData, DeleteVolumeResponse, DeleteVolumeResponses, DoctorRepositoryData, DoctorRepositoryResponse, DoctorRepositoryResponses, DownloadResticPasswordData, DownloadResticPasswordResponse, DownloadResticPasswordResponses, GetBackupScheduleData, GetBackupScheduleForVolumeData, GetBackupScheduleForVolumeResponse, GetBackupScheduleForVolumeResponses, GetBackupScheduleResponse, GetBackupScheduleResponses, GetMirrorCompatibilityData, GetMirrorCompatibilityResponse, GetMirrorCompatibilityResponses, GetNotificationDestinationData, GetNotificationDestinationErrors, GetNotificationDestinationResponse, GetNotificationDestinationResponses, GetRepositoryData, GetRepositoryResponse, GetRepositoryResponses, GetScheduleMirrorsData, GetScheduleMirrorsResponse, GetScheduleMirrorsResponses, GetScheduleNotificationsData, GetScheduleNotificationsResponse, GetScheduleNotificationsResponses, GetSnapshotDetailsData, GetSnapshotDetailsResponse, GetSnapshotDetailsResponses, GetStatusData, GetStatusResponse, GetStatusResponses, GetSystemInfoData, GetSystemInfoResponse, GetSystemInfoResponses, GetUpdatesData, GetUpdatesResponse, GetUpdatesResponses, GetVolumeData, GetVolumeErrors, GetVolumeResponse, GetVolumeResponses, HealthCheckVolumeData, HealthCheckVolumeErrors, HealthCheckVolumeResponse, HealthCheckVolumeResponses, ListBackupSchedulesData, ListBackupSchedulesResponse, ListBackupSchedulesResponses, ListFilesData, ListFilesResponse, ListFilesResponses, ListNotificationDestinationsData, ListNotificationDestinationsResponse, ListNotificationDestinationsResponses, ListRcloneRemotesData, ListRcloneRemotesResponse, ListRcloneRemotesResponses, ListRepositoriesData, ListRepositoriesResponse, ListRepositoriesResponses, ListSnapshotFilesData, ListSnapshotFilesResponse, ListSnapshotFilesResponses, ListSnapshotsData, ListSnapshotsResponse, ListSnapshotsResponses, ListVolumesData, ListVolumesResponse, ListVolumesResponses, MountVolumeData, MountVolumeResponse, MountVolumeResponses, ReorderBackupSchedulesData, ReorderBackupSchedulesResponse, ReorderBackupSchedulesResponses, RestoreSnapshotData, RestoreSnapshotResponse, RestoreSnapshotResponses, RunBackupNowData, RunBackupNowResponse, RunBackupNowResponses, RunForgetData, RunForgetResponse, RunForgetResponses, StopBackupData, StopBackupErrors, StopBackupResponse, StopBackupResponses, TagSnapshotsData, TagSnapshotsResponse, TagSnapshotsResponses, TestConnectionData, TestConnectionResponse, TestConnectionResponses, TestNotificationDestinationData, TestNotificationDestinationErrors, TestNotificationDestinationResponse, TestNotificationDestinationResponses, UnmountVolumeData, UnmountVolumeResponse, UnmountVolumeResponses, UpdateBackupScheduleData, UpdateBackupScheduleResponse, UpdateBackupScheduleResponses, UpdateNotificationDestinationData, UpdateNotificationDestinationErrors, UpdateNotificationDestinationResponse, UpdateNotificationDestinationResponses, UpdateRepositoryData, UpdateRepositoryErrors, UpdateRepositoryResponse, UpdateRepositoryResponses, UpdateScheduleMirrorsData, UpdateScheduleMirrorsResponse, UpdateScheduleMirrorsResponses, UpdateScheduleNotificationsData, UpdateScheduleNotificationsResponse, UpdateScheduleNotificationsResponses, UpdateVolumeData, UpdateVolumeErrors, UpdateVolumeResponse, UpdateVolumeResponses } from './types.gen'; diff --git a/app/client/api-client/sdk.gen.ts b/app/client/api-client/sdk.gen.ts index 5d28a09c..1f582010 100644 --- a/app/client/api-client/sdk.gen.ts +++ b/app/client/api-client/sdk.gen.ts @@ -1,849 +1,381 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { Client, Options as Options2, TDataShape } from "./client"; -import { client } from "./client.gen"; -import type { - BrowseFilesystemData, - BrowseFilesystemResponses, - CreateBackupScheduleData, - CreateBackupScheduleResponses, - CreateNotificationDestinationData, - CreateNotificationDestinationResponses, - CreateRepositoryData, - CreateRepositoryResponses, - CreateVolumeData, - CreateVolumeResponses, - DeleteBackupScheduleData, - DeleteBackupScheduleResponses, - DeleteNotificationDestinationData, - DeleteNotificationDestinationErrors, - DeleteNotificationDestinationResponses, - DeleteRepositoryData, - DeleteRepositoryResponses, - DeleteSnapshotData, - DeleteSnapshotResponses, - DeleteSnapshotsData, - DeleteSnapshotsResponses, - DeleteVolumeData, - DeleteVolumeResponses, - DoctorRepositoryData, - DoctorRepositoryResponses, - DownloadResticPasswordData, - DownloadResticPasswordResponses, - GetBackupScheduleData, - GetBackupScheduleForVolumeData, - GetBackupScheduleForVolumeResponses, - GetBackupScheduleResponses, - GetMirrorCompatibilityData, - GetMirrorCompatibilityResponses, - GetNotificationDestinationData, - GetNotificationDestinationErrors, - GetNotificationDestinationResponses, - GetRepositoryData, - GetRepositoryResponses, - GetScheduleMirrorsData, - GetScheduleMirrorsResponses, - GetScheduleNotificationsData, - GetScheduleNotificationsResponses, - GetSnapshotDetailsData, - GetSnapshotDetailsResponses, - GetStatusData, - GetStatusResponses, - GetSystemInfoData, - GetSystemInfoResponses, - GetUpdatesData, - GetUpdatesResponses, - GetVolumeData, - GetVolumeErrors, - GetVolumeResponses, - HealthCheckVolumeData, - HealthCheckVolumeErrors, - HealthCheckVolumeResponses, - ListBackupSchedulesData, - ListBackupSchedulesResponses, - ListFilesData, - ListFilesResponses, - ListNotificationDestinationsData, - ListNotificationDestinationsResponses, - ListRcloneRemotesData, - ListRcloneRemotesResponses, - ListRepositoriesData, - ListRepositoriesResponses, - ListSnapshotFilesData, - ListSnapshotFilesResponses, - ListSnapshotsData, - ListSnapshotsResponses, - ListVolumesData, - ListVolumesResponses, - MountVolumeData, - MountVolumeResponses, - ReorderBackupSchedulesData, - ReorderBackupSchedulesResponses, - RestoreSnapshotData, - RestoreSnapshotResponses, - RunBackupNowData, - RunBackupNowResponses, - RunForgetData, - RunForgetResponses, - StopBackupData, - StopBackupErrors, - StopBackupResponses, - TagSnapshotsData, - TagSnapshotsResponses, - TestConnectionData, - TestConnectionResponses, - TestNotificationDestinationData, - TestNotificationDestinationErrors, - TestNotificationDestinationResponses, - UnmountVolumeData, - UnmountVolumeResponses, - UpdateBackupScheduleData, - UpdateBackupScheduleResponses, - UpdateNotificationDestinationData, - UpdateNotificationDestinationErrors, - UpdateNotificationDestinationResponses, - UpdateRepositoryData, - UpdateRepositoryErrors, - UpdateRepositoryResponses, - UpdateScheduleMirrorsData, - UpdateScheduleMirrorsResponses, - UpdateScheduleNotificationsData, - UpdateScheduleNotificationsResponses, - UpdateVolumeData, - UpdateVolumeErrors, - UpdateVolumeResponses, -} from "./types.gen"; +import type { Client, Options as Options2, TDataShape } from './client'; +import { client } from './client.gen'; +import type { BrowseFilesystemData, BrowseFilesystemResponses, CreateBackupScheduleData, CreateBackupScheduleResponses, CreateNotificationDestinationData, CreateNotificationDestinationResponses, CreateRepositoryData, CreateRepositoryResponses, CreateVolumeData, CreateVolumeResponses, DeleteBackupScheduleData, DeleteBackupScheduleResponses, DeleteNotificationDestinationData, DeleteNotificationDestinationErrors, DeleteNotificationDestinationResponses, DeleteRepositoryData, DeleteRepositoryResponses, DeleteSnapshotData, DeleteSnapshotResponses, DeleteSnapshotsData, DeleteSnapshotsResponses, DeleteVolumeData, DeleteVolumeResponses, DoctorRepositoryData, DoctorRepositoryResponses, DownloadResticPasswordData, DownloadResticPasswordResponses, GetBackupScheduleData, GetBackupScheduleForVolumeData, GetBackupScheduleForVolumeResponses, GetBackupScheduleResponses, GetMirrorCompatibilityData, GetMirrorCompatibilityResponses, GetNotificationDestinationData, GetNotificationDestinationErrors, GetNotificationDestinationResponses, GetRepositoryData, GetRepositoryResponses, GetScheduleMirrorsData, GetScheduleMirrorsResponses, GetScheduleNotificationsData, GetScheduleNotificationsResponses, GetSnapshotDetailsData, GetSnapshotDetailsResponses, GetStatusData, GetStatusResponses, GetSystemInfoData, GetSystemInfoResponses, GetUpdatesData, GetUpdatesResponses, GetVolumeData, GetVolumeErrors, GetVolumeResponses, HealthCheckVolumeData, HealthCheckVolumeErrors, HealthCheckVolumeResponses, ListBackupSchedulesData, ListBackupSchedulesResponses, ListFilesData, ListFilesResponses, ListNotificationDestinationsData, ListNotificationDestinationsResponses, ListRcloneRemotesData, ListRcloneRemotesResponses, ListRepositoriesData, ListRepositoriesResponses, ListSnapshotFilesData, ListSnapshotFilesResponses, ListSnapshotsData, ListSnapshotsResponses, ListVolumesData, ListVolumesResponses, MountVolumeData, MountVolumeResponses, ReorderBackupSchedulesData, ReorderBackupSchedulesResponses, RestoreSnapshotData, RestoreSnapshotResponses, RunBackupNowData, RunBackupNowResponses, RunForgetData, RunForgetResponses, StopBackupData, StopBackupErrors, StopBackupResponses, TagSnapshotsData, TagSnapshotsResponses, TestConnectionData, TestConnectionResponses, TestNotificationDestinationData, TestNotificationDestinationErrors, TestNotificationDestinationResponses, UnmountVolumeData, UnmountVolumeResponses, UpdateBackupScheduleData, UpdateBackupScheduleResponses, UpdateNotificationDestinationData, UpdateNotificationDestinationErrors, UpdateNotificationDestinationResponses, UpdateRepositoryData, UpdateRepositoryErrors, UpdateRepositoryResponses, UpdateScheduleMirrorsData, UpdateScheduleMirrorsResponses, UpdateScheduleNotificationsData, UpdateScheduleNotificationsResponses, UpdateVolumeData, UpdateVolumeErrors, UpdateVolumeResponses } from './types.gen'; -export type Options< - TData extends TDataShape = TDataShape, - ThrowOnError extends boolean = boolean, -> = Options2 & { - /** - * You can provide a client instance returned by `createClient()` instead of - * individual options. This might be also useful if you want to implement a - * custom client. - */ - client?: Client; - /** - * You can pass arbitrary values through the `meta` object. This can be - * used to access values that aren't defined as part of the SDK function. - */ - meta?: Record; +export type Options = Options2 & { + /** + * You can provide a client instance returned by `createClient()` instead of + * individual options. This might be also useful if you want to implement a + * custom client. + */ + client?: Client; + /** + * You can pass arbitrary values through the `meta` object. This can be + * used to access values that aren't defined as part of the SDK function. + */ + meta?: Record; }; /** * Get authentication system status */ -export const getStatus = ( - options?: Options, -) => - (options?.client ?? client).get({ - url: "/api/v1/auth/status", - ...options, - }); +export const getStatus = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/auth/status', ...options }); /** * List all volumes */ -export const listVolumes = ( - options?: Options, -) => - (options?.client ?? client).get({ - url: "/api/v1/volumes", - ...options, - }); +export const listVolumes = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/volumes', ...options }); /** * Create a new volume */ -export const createVolume = ( - options?: Options, -) => - (options?.client ?? client).post< - CreateVolumeResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/volumes", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); +export const createVolume = (options?: Options) => (options?.client ?? client).post({ + url: '/api/v1/volumes', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); /** * Test connection to backend */ -export const testConnection = ( - options?: Options, -) => - (options?.client ?? client).post< - TestConnectionResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/volumes/test-connection", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); +export const testConnection = (options?: Options) => (options?.client ?? client).post({ + url: '/api/v1/volumes/test-connection', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); /** * Delete a volume */ -export const deleteVolume = ( - options: Options, -) => - (options.client ?? client).delete< - DeleteVolumeResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/volumes/{name}", ...options }); +export const deleteVolume = (options: Options) => (options.client ?? client).delete({ url: '/api/v1/volumes/{name}', ...options }); /** * Get a volume by name */ -export const getVolume = ( - options: Options, -) => - (options.client ?? client).get< - GetVolumeResponses, - GetVolumeErrors, - ThrowOnError - >({ url: "/api/v1/volumes/{name}", ...options }); +export const getVolume = (options: Options) => (options.client ?? client).get({ url: '/api/v1/volumes/{name}', ...options }); /** * Update a volume's configuration */ -export const updateVolume = ( - options: Options, -) => - (options.client ?? client).put< - UpdateVolumeResponses, - UpdateVolumeErrors, - ThrowOnError - >({ - url: "/api/v1/volumes/{name}", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const updateVolume = (options: Options) => (options.client ?? client).put({ + url: '/api/v1/volumes/{name}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * Mount a volume */ -export const mountVolume = ( - options: Options, -) => - (options.client ?? client).post({ - url: "/api/v1/volumes/{name}/mount", - ...options, - }); +export const mountVolume = (options: Options) => (options.client ?? client).post({ url: '/api/v1/volumes/{name}/mount', ...options }); /** * Unmount a volume */ -export const unmountVolume = ( - options: Options, -) => - (options.client ?? client).post< - UnmountVolumeResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/volumes/{name}/unmount", ...options }); +export const unmountVolume = (options: Options) => (options.client ?? client).post({ url: '/api/v1/volumes/{name}/unmount', ...options }); /** * Perform a health check on a volume */ -export const healthCheckVolume = ( - options: Options, -) => - (options.client ?? client).post< - HealthCheckVolumeResponses, - HealthCheckVolumeErrors, - ThrowOnError - >({ url: "/api/v1/volumes/{name}/health-check", ...options }); +export const healthCheckVolume = (options: Options) => (options.client ?? client).post({ url: '/api/v1/volumes/{name}/health-check', ...options }); /** * List files in a volume directory */ -export const listFiles = ( - options: Options, -) => - (options.client ?? client).get({ - url: "/api/v1/volumes/{name}/files", - ...options, - }); +export const listFiles = (options: Options) => (options.client ?? client).get({ url: '/api/v1/volumes/{name}/files', ...options }); /** * Browse directories on the host filesystem */ -export const browseFilesystem = ( - options?: Options, -) => - (options?.client ?? client).get< - BrowseFilesystemResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/volumes/filesystem/browse", ...options }); +export const browseFilesystem = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/volumes/filesystem/browse', ...options }); /** * List all repositories */ -export const listRepositories = ( - options?: Options, -) => - (options?.client ?? client).get< - ListRepositoriesResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories", ...options }); +export const listRepositories = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/repositories', ...options }); /** * Create a new restic repository */ -export const createRepository = ( - options?: Options, -) => - (options?.client ?? client).post< - CreateRepositoryResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/repositories", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); +export const createRepository = (options?: Options) => (options?.client ?? client).post({ + url: '/api/v1/repositories', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); /** * List all configured rclone remotes on the host system */ -export const listRcloneRemotes = ( - options?: Options, -) => - (options?.client ?? client).get< - ListRcloneRemotesResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/rclone-remotes", ...options }); +export const listRcloneRemotes = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/repositories/rclone-remotes', ...options }); /** * Delete a repository */ -export const deleteRepository = ( - options: Options, -) => - (options.client ?? client).delete< - DeleteRepositoryResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}", ...options }); +export const deleteRepository = (options: Options) => (options.client ?? client).delete({ url: '/api/v1/repositories/{id}', ...options }); /** * Get a single repository by ID */ -export const getRepository = ( - options: Options, -) => - (options.client ?? client).get( - { url: "/api/v1/repositories/{id}", ...options }, - ); +export const getRepository = (options: Options) => (options.client ?? client).get({ url: '/api/v1/repositories/{id}', ...options }); /** * Update a repository's name or settings */ -export const updateRepository = ( - options: Options, -) => - (options.client ?? client).patch< - UpdateRepositoryResponses, - UpdateRepositoryErrors, - ThrowOnError - >({ - url: "/api/v1/repositories/{id}", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const updateRepository = (options: Options) => (options.client ?? client).patch({ + url: '/api/v1/repositories/{id}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * Delete multiple snapshots from a repository */ -export const deleteSnapshots = ( - options: Options, -) => - (options.client ?? client).delete< - DeleteSnapshotsResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/repositories/{id}/snapshots", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const deleteSnapshots = (options: Options) => (options.client ?? client).delete({ + url: '/api/v1/repositories/{id}/snapshots', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * List all snapshots in a repository */ -export const listSnapshots = ( - options: Options, -) => - (options.client ?? client).get( - { url: "/api/v1/repositories/{id}/snapshots", ...options }, - ); +export const listSnapshots = (options: Options) => (options.client ?? client).get({ url: '/api/v1/repositories/{id}/snapshots', ...options }); /** * Delete a specific snapshot from a repository */ -export const deleteSnapshot = ( - options: Options, -) => - (options.client ?? client).delete< - DeleteSnapshotResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", ...options }); +export const deleteSnapshot = (options: Options) => (options.client ?? client).delete({ url: '/api/v1/repositories/{id}/snapshots/{snapshotId}', ...options }); /** * Get details of a specific snapshot */ -export const getSnapshotDetails = ( - options: Options, -) => - (options.client ?? client).get< - GetSnapshotDetailsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", ...options }); +export const getSnapshotDetails = (options: Options) => (options.client ?? client).get({ url: '/api/v1/repositories/{id}/snapshots/{snapshotId}', ...options }); /** * List files and directories in a snapshot */ -export const listSnapshotFiles = ( - options: Options, -) => - (options.client ?? client).get< - ListSnapshotFilesResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/repositories/{id}/snapshots/{snapshotId}/files", - ...options, - }); +export const listSnapshotFiles = (options: Options) => (options.client ?? client).get({ url: '/api/v1/repositories/{id}/snapshots/{snapshotId}/files', ...options }); /** * Restore a snapshot to a target path on the filesystem */ -export const restoreSnapshot = ( - options: Options, -) => - (options.client ?? client).post< - RestoreSnapshotResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/repositories/{id}/restore", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const restoreSnapshot = (options: Options) => (options.client ?? client).post({ + url: '/api/v1/repositories/{id}/restore', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * Run doctor operations on a repository to fix common issues (unlock, check, repair index). Use this when the repository is locked or has errors. */ -export const doctorRepository = ( - options: Options, -) => - (options.client ?? client).post< - DoctorRepositoryResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/repositories/{id}/doctor", ...options }); +export const doctorRepository = (options: Options) => (options.client ?? client).post({ url: '/api/v1/repositories/{id}/doctor', ...options }); /** * Tag multiple snapshots in a repository */ -export const tagSnapshots = ( - options: Options, -) => - (options.client ?? client).post( - { - url: "/api/v1/repositories/{id}/snapshots/tag", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }, - ); +export const tagSnapshots = (options: Options) => (options.client ?? client).post({ + url: '/api/v1/repositories/{id}/snapshots/tag', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * List all backup schedules */ -export const listBackupSchedules = ( - options?: Options, -) => - (options?.client ?? client).get< - ListBackupSchedulesResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups", ...options }); +export const listBackupSchedules = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/backups', ...options }); /** * Create a new backup schedule for a volume */ -export const createBackupSchedule = ( - options?: Options, -) => - (options?.client ?? client).post< - CreateBackupScheduleResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/backups", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); +export const createBackupSchedule = (options?: Options) => (options?.client ?? client).post({ + url: '/api/v1/backups', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); /** * Delete a backup schedule */ -export const deleteBackupSchedule = ( - options: Options, -) => - (options.client ?? client).delete< - DeleteBackupScheduleResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}", ...options }); +export const deleteBackupSchedule = (options: Options) => (options.client ?? client).delete({ url: '/api/v1/backups/{scheduleId}', ...options }); /** * Get a backup schedule by ID */ -export const getBackupSchedule = ( - options: Options, -) => - (options.client ?? client).get< - GetBackupScheduleResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}", ...options }); +export const getBackupSchedule = (options: Options) => (options.client ?? client).get({ url: '/api/v1/backups/{scheduleId}', ...options }); /** * Update a backup schedule */ -export const updateBackupSchedule = ( - options: Options, -) => - (options.client ?? client).patch< - UpdateBackupScheduleResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/backups/{scheduleId}", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const updateBackupSchedule = (options: Options) => (options.client ?? client).patch({ + url: '/api/v1/backups/{scheduleId}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * Get a backup schedule for a specific volume */ -export const getBackupScheduleForVolume = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => - (options.client ?? client).get< - GetBackupScheduleForVolumeResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/volume/{volumeId}", ...options }); +export const getBackupScheduleForVolume = (options: Options) => (options.client ?? client).get({ url: '/api/v1/backups/volume/{volumeId}', ...options }); /** * Trigger a backup immediately for a schedule */ -export const runBackupNow = ( - options: Options, -) => - (options.client ?? client).post( - { url: "/api/v1/backups/{scheduleId}/run", ...options }, - ); +export const runBackupNow = (options: Options) => (options.client ?? client).post({ url: '/api/v1/backups/{scheduleId}/run', ...options }); /** * Stop a backup that is currently in progress */ -export const stopBackup = ( - options: Options, -) => - (options.client ?? client).post< - StopBackupResponses, - StopBackupErrors, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/stop", ...options }); +export const stopBackup = (options: Options) => (options.client ?? client).post({ url: '/api/v1/backups/{scheduleId}/stop', ...options }); /** * Manually apply retention policy to clean up old snapshots */ -export const runForget = ( - options: Options, -) => - (options.client ?? client).post({ - url: "/api/v1/backups/{scheduleId}/forget", - ...options, - }); +export const runForget = (options: Options) => (options.client ?? client).post({ url: '/api/v1/backups/{scheduleId}/forget', ...options }); /** * Get notification assignments for a backup schedule */ -export const getScheduleNotifications = ( - options: Options, -) => - (options.client ?? client).get< - GetScheduleNotificationsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/notifications", ...options }); +export const getScheduleNotifications = (options: Options) => (options.client ?? client).get({ url: '/api/v1/backups/{scheduleId}/notifications', ...options }); /** * Update notification assignments for a backup schedule */ -export const updateScheduleNotifications = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => - (options.client ?? client).put< - UpdateScheduleNotificationsResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/backups/{scheduleId}/notifications", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const updateScheduleNotifications = (options: Options) => (options.client ?? client).put({ + url: '/api/v1/backups/{scheduleId}/notifications', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * Get mirror repository assignments for a backup schedule */ -export const getScheduleMirrors = ( - options: Options, -) => - (options.client ?? client).get< - GetScheduleMirrorsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/mirrors", ...options }); +export const getScheduleMirrors = (options: Options) => (options.client ?? client).get({ url: '/api/v1/backups/{scheduleId}/mirrors', ...options }); /** * Update mirror repository assignments for a backup schedule */ -export const updateScheduleMirrors = ( - options: Options, -) => - (options.client ?? client).put< - UpdateScheduleMirrorsResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/backups/{scheduleId}/mirrors", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const updateScheduleMirrors = (options: Options) => (options.client ?? client).put({ + url: '/api/v1/backups/{scheduleId}/mirrors', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * Get mirror compatibility info for all repositories relative to a backup schedule's primary repository */ -export const getMirrorCompatibility = ( - options: Options, -) => - (options.client ?? client).get< - GetMirrorCompatibilityResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/backups/{scheduleId}/mirrors/compatibility", ...options }); +export const getMirrorCompatibility = (options: Options) => (options.client ?? client).get({ url: '/api/v1/backups/{scheduleId}/mirrors/compatibility', ...options }); /** * Reorder backup schedules by providing an array of schedule IDs in the desired order */ -export const reorderBackupSchedules = ( - options?: Options, -) => - (options?.client ?? client).post< - ReorderBackupSchedulesResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/backups/reorder", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); +export const reorderBackupSchedules = (options?: Options) => (options?.client ?? client).post({ + url: '/api/v1/backups/reorder', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); /** * List all notification destinations */ -export const listNotificationDestinations = < - ThrowOnError extends boolean = false, ->( - options?: Options, -) => - (options?.client ?? client).get< - ListNotificationDestinationsResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/notifications/destinations", ...options }); +export const listNotificationDestinations = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/notifications/destinations', ...options }); /** * Create a new notification destination */ -export const createNotificationDestination = < - ThrowOnError extends boolean = false, ->( - options?: Options, -) => - (options?.client ?? client).post< - CreateNotificationDestinationResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/notifications/destinations", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); +export const createNotificationDestination = (options?: Options) => (options?.client ?? client).post({ + url: '/api/v1/notifications/destinations', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); /** * Delete a notification destination */ -export const deleteNotificationDestination = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => - (options.client ?? client).delete< - DeleteNotificationDestinationResponses, - DeleteNotificationDestinationErrors, - ThrowOnError - >({ url: "/api/v1/notifications/destinations/{id}", ...options }); +export const deleteNotificationDestination = (options: Options) => (options.client ?? client).delete({ url: '/api/v1/notifications/destinations/{id}', ...options }); /** * Get a notification destination by ID */ -export const getNotificationDestination = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => - (options.client ?? client).get< - GetNotificationDestinationResponses, - GetNotificationDestinationErrors, - ThrowOnError - >({ url: "/api/v1/notifications/destinations/{id}", ...options }); +export const getNotificationDestination = (options: Options) => (options.client ?? client).get({ url: '/api/v1/notifications/destinations/{id}', ...options }); /** * Update a notification destination */ -export const updateNotificationDestination = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => - (options.client ?? client).patch< - UpdateNotificationDestinationResponses, - UpdateNotificationDestinationErrors, - ThrowOnError - >({ - url: "/api/v1/notifications/destinations/{id}", - ...options, - headers: { - "Content-Type": "application/json", - ...options.headers, - }, - }); +export const updateNotificationDestination = (options: Options) => (options.client ?? client).patch({ + url: '/api/v1/notifications/destinations/{id}', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options.headers + } +}); /** * Test a notification destination by sending a test message */ -export const testNotificationDestination = < - ThrowOnError extends boolean = false, ->( - options: Options, -) => - (options.client ?? client).post< - TestNotificationDestinationResponses, - TestNotificationDestinationErrors, - ThrowOnError - >({ url: "/api/v1/notifications/destinations/{id}/test", ...options }); +export const testNotificationDestination = (options: Options) => (options.client ?? client).post({ url: '/api/v1/notifications/destinations/{id}/test', ...options }); /** * Get system information including available capabilities */ -export const getSystemInfo = ( - options?: Options, -) => - (options?.client ?? client).get< - GetSystemInfoResponses, - unknown, - ThrowOnError - >({ url: "/api/v1/system/info", ...options }); +export const getSystemInfo = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/system/info', ...options }); /** * Check for application updates from GitHub */ -export const getUpdates = ( - options?: Options, -) => - (options?.client ?? client).get({ - url: "/api/v1/system/updates", - ...options, - }); +export const getUpdates = (options?: Options) => (options?.client ?? client).get({ url: '/api/v1/system/updates', ...options }); /** * Download the Restic password file for backup recovery. Requires password re-authentication. */ -export const downloadResticPassword = ( - options?: Options, -) => - (options?.client ?? client).post< - DownloadResticPasswordResponses, - unknown, - ThrowOnError - >({ - url: "/api/v1/system/restic-password", - ...options, - headers: { - "Content-Type": "application/json", - ...options?.headers, - }, - }); +export const downloadResticPassword = (options?: Options) => (options?.client ?? client).post({ + url: '/api/v1/system/restic-password', + ...options, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } +}); diff --git a/app/client/api-client/types.gen.ts b/app/client/api-client/types.gen.ts index 7230304f..7f3b4eb8 100644 --- a/app/client/api-client/types.gen.ts +++ b/app/client/api-client/types.gen.ts @@ -1,3563 +1,3951 @@ // This file is auto-generated by @hey-api/openapi-ts export type ClientOptions = { - baseUrl: "http://localhost:4096" | (string & {}); + baseUrl: 'http://localhost:4096' | (string & {}); }; export type GetStatusData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/auth/status"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/auth/status'; }; export type GetStatusResponses = { - /** - * Authentication system status - */ - 200: { - hasUsers: boolean; - }; + /** + * Authentication system status + */ + 200: { + hasUsers: boolean; + }; }; export type GetStatusResponse = GetStatusResponses[keyof GetStatusResponses]; export type ListVolumesData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/volumes"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/volumes'; }; export type ListVolumesResponses = { - /** - * A list of volumes - */ - 200: Array<{ - autoRemount: boolean; - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - shortId: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "rclone" | "sftp" | "smb" | "webdav"; - updatedAt: number; - }>; + /** + * A list of volumes + */ + 200: Array<{ + autoRemount: boolean; + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + shortId: string; + status: 'error' | 'mounted' | 'unmounted'; + type: 'directory' | 'nfs' | 'rclone' | 'sftp' | 'smb' | 'webdav'; + updatedAt: number; + }>; }; -export type ListVolumesResponse = - ListVolumesResponses[keyof ListVolumesResponses]; +export type ListVolumesResponse = ListVolumesResponses[keyof ListVolumesResponses]; export type CreateVolumeData = { - body?: { - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - name: string; - }; - path?: never; - query?: never; - url: "/api/v1/volumes"; + body?: { + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + name: string; + }; + path?: never; + query?: never; + url: '/api/v1/volumes'; }; export type CreateVolumeResponses = { - /** - * Volume created successfully - */ - 201: { - autoRemount: boolean; - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - shortId: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "rclone" | "sftp" | "smb" | "webdav"; - updatedAt: number; - }; + /** + * Volume created successfully + */ + 201: { + autoRemount: boolean; + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + shortId: string; + status: 'error' | 'mounted' | 'unmounted'; + type: 'directory' | 'nfs' | 'rclone' | 'sftp' | 'smb' | 'webdav'; + updatedAt: number; + }; }; -export type CreateVolumeResponse = - CreateVolumeResponses[keyof CreateVolumeResponses]; +export type CreateVolumeResponse = CreateVolumeResponses[keyof CreateVolumeResponses]; export type TestConnectionData = { - body?: { - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - }; - path?: never; - query?: never; - url: "/api/v1/volumes/test-connection"; + body?: { + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + }; + path?: never; + query?: never; + url: '/api/v1/volumes/test-connection'; }; export type TestConnectionResponses = { - /** - * Connection test result - */ - 200: { - message: string; - success: boolean; - }; + /** + * Connection test result + */ + 200: { + message: string; + success: boolean; + }; }; -export type TestConnectionResponse = - TestConnectionResponses[keyof TestConnectionResponses]; +export type TestConnectionResponse = TestConnectionResponses[keyof TestConnectionResponses]; export type DeleteVolumeData = { - body?: never; - path: { - name: string; - }; - query?: never; - url: "/api/v1/volumes/{name}"; + body?: never; + path: { + name: string; + }; + query?: never; + url: '/api/v1/volumes/{name}'; }; export type DeleteVolumeResponses = { - /** - * Volume deleted successfully - */ - 200: { - message: string; - }; + /** + * Volume deleted successfully + */ + 200: { + message: string; + }; }; -export type DeleteVolumeResponse = - DeleteVolumeResponses[keyof DeleteVolumeResponses]; +export type DeleteVolumeResponse = DeleteVolumeResponses[keyof DeleteVolumeResponses]; export type GetVolumeData = { - body?: never; - path: { - name: string; - }; - query?: never; - url: "/api/v1/volumes/{name}"; + body?: never; + path: { + name: string; + }; + query?: never; + url: '/api/v1/volumes/{name}'; }; export type GetVolumeErrors = { - /** - * Volume not found - */ - 404: unknown; + /** + * Volume not found + */ + 404: unknown; }; export type GetVolumeResponses = { - /** - * Volume details - */ - 200: { - statfs: { - free: number; - total: number; - used: number; - }; - volume: { - autoRemount: boolean; - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - shortId: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "rclone" | "sftp" | "smb" | "webdav"; - updatedAt: number; - }; - }; + /** + * Volume details + */ + 200: { + statfs: { + free: number; + total: number; + used: number; + }; + volume: { + autoRemount: boolean; + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + shortId: string; + status: 'error' | 'mounted' | 'unmounted'; + type: 'directory' | 'nfs' | 'rclone' | 'sftp' | 'smb' | 'webdav'; + updatedAt: number; + }; + }; }; export type GetVolumeResponse = GetVolumeResponses[keyof GetVolumeResponses]; export type UpdateVolumeData = { - body?: { - autoRemount?: boolean; - config?: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - name?: string; - }; - path: { - name: string; - }; - query?: never; - url: "/api/v1/volumes/{name}"; + body?: { + autoRemount?: boolean; + config?: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + name?: string; + }; + path: { + name: string; + }; + query?: never; + url: '/api/v1/volumes/{name}'; }; export type UpdateVolumeErrors = { - /** - * Volume not found - */ - 404: unknown; + /** + * Volume not found + */ + 404: unknown; }; export type UpdateVolumeResponses = { - /** - * Volume updated successfully - */ - 200: { - autoRemount: boolean; - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - shortId: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "rclone" | "sftp" | "smb" | "webdav"; - updatedAt: number; - }; + /** + * Volume updated successfully + */ + 200: { + autoRemount: boolean; + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + shortId: string; + status: 'error' | 'mounted' | 'unmounted'; + type: 'directory' | 'nfs' | 'rclone' | 'sftp' | 'smb' | 'webdav'; + updatedAt: number; + }; }; -export type UpdateVolumeResponse = - UpdateVolumeResponses[keyof UpdateVolumeResponses]; +export type UpdateVolumeResponse = UpdateVolumeResponses[keyof UpdateVolumeResponses]; export type MountVolumeData = { - body?: never; - path: { - name: string; - }; - query?: never; - url: "/api/v1/volumes/{name}/mount"; + body?: never; + path: { + name: string; + }; + query?: never; + url: '/api/v1/volumes/{name}/mount'; }; export type MountVolumeResponses = { - /** - * Volume mounted successfully - */ - 200: { - status: "error" | "mounted" | "unmounted"; - error?: string; - }; + /** + * Volume mounted successfully + */ + 200: { + status: 'error' | 'mounted' | 'unmounted'; + error?: string; + }; }; -export type MountVolumeResponse = - MountVolumeResponses[keyof MountVolumeResponses]; +export type MountVolumeResponse = MountVolumeResponses[keyof MountVolumeResponses]; export type UnmountVolumeData = { - body?: never; - path: { - name: string; - }; - query?: never; - url: "/api/v1/volumes/{name}/unmount"; + body?: never; + path: { + name: string; + }; + query?: never; + url: '/api/v1/volumes/{name}/unmount'; }; export type UnmountVolumeResponses = { - /** - * Volume unmounted successfully - */ - 200: { - status: "error" | "mounted" | "unmounted"; - error?: string; - }; + /** + * Volume unmounted successfully + */ + 200: { + status: 'error' | 'mounted' | 'unmounted'; + error?: string; + }; }; -export type UnmountVolumeResponse = - UnmountVolumeResponses[keyof UnmountVolumeResponses]; +export type UnmountVolumeResponse = UnmountVolumeResponses[keyof UnmountVolumeResponses]; export type HealthCheckVolumeData = { - body?: never; - path: { - name: string; - }; - query?: never; - url: "/api/v1/volumes/{name}/health-check"; + body?: never; + path: { + name: string; + }; + query?: never; + url: '/api/v1/volumes/{name}/health-check'; }; export type HealthCheckVolumeErrors = { - /** - * Volume not found - */ - 404: unknown; + /** + * Volume not found + */ + 404: unknown; }; export type HealthCheckVolumeResponses = { - /** - * Volume health check result - */ - 200: { - status: "error" | "mounted" | "unmounted"; - error?: string; - }; + /** + * Volume health check result + */ + 200: { + status: 'error' | 'mounted' | 'unmounted'; + error?: string; + }; }; -export type HealthCheckVolumeResponse = - HealthCheckVolumeResponses[keyof HealthCheckVolumeResponses]; +export type HealthCheckVolumeResponse = HealthCheckVolumeResponses[keyof HealthCheckVolumeResponses]; export type ListFilesData = { - body?: never; - path: { - name: string; - }; - query?: { - /** - * Subdirectory path to list (relative to volume root) - */ - path?: string; - }; - url: "/api/v1/volumes/{name}/files"; + body?: never; + path: { + name: string; + }; + query?: { + /** + * Subdirectory path to list (relative to volume root) + */ + path?: string; + }; + url: '/api/v1/volumes/{name}/files'; }; export type ListFilesResponses = { - /** - * List of files in the volume - */ - 200: { - files: Array<{ - name: string; - path: string; - type: "directory" | "file"; - modifiedAt?: number; - size?: number; - }>; - path: string; - }; + /** + * List of files in the volume + */ + 200: { + files: Array<{ + name: string; + path: string; + type: 'directory' | 'file'; + modifiedAt?: number; + size?: number; + }>; + path: string; + }; }; export type ListFilesResponse = ListFilesResponses[keyof ListFilesResponses]; export type BrowseFilesystemData = { - body?: never; - path?: never; - query?: { - /** - * Directory path to browse (absolute path, defaults to /) - */ - path?: string; - }; - url: "/api/v1/volumes/filesystem/browse"; + body?: never; + path?: never; + query?: { + /** + * Directory path to browse (absolute path, defaults to /) + */ + path?: string; + }; + url: '/api/v1/volumes/filesystem/browse'; }; export type BrowseFilesystemResponses = { - /** - * List of directories in the specified path - */ - 200: { - directories: Array<{ - name: string; - path: string; - type: "directory" | "file"; - modifiedAt?: number; - size?: number; - }>; - path: string; - }; + /** + * List of directories in the specified path + */ + 200: { + directories: Array<{ + name: string; + path: string; + type: 'directory' | 'file'; + modifiedAt?: number; + size?: number; + }>; + path: string; + }; }; -export type BrowseFilesystemResponse = - BrowseFilesystemResponses[keyof BrowseFilesystemResponses]; +export type BrowseFilesystemResponse = BrowseFilesystemResponses[keyof BrowseFilesystemResponses]; export type ListRepositoriesData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/repositories"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/repositories'; }; export type ListRepositoriesResponses = { - /** - * List of repositories - */ - 200: Array<{ - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: "azure" | "gcs" | "local" | "r2" | "rclone" | "rest" | "s3" | "sftp"; - updatedAt: number; - }>; + /** + * List of repositories + */ + 200: Array<{ + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }>; }; -export type ListRepositoriesResponse = - ListRepositoriesResponses[keyof ListRepositoriesResponses]; +export type ListRepositoriesResponse = ListRepositoriesResponses[keyof ListRepositoriesResponses]; export type CreateRepositoryData = { - body?: { - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - name: string; - compressionMode?: "auto" | "max" | "off"; - }; - path?: never; - query?: never; - url: "/api/v1/repositories"; + body?: { + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + name: string; + compressionMode?: 'auto' | 'max' | 'off'; + }; + path?: never; + query?: never; + url: '/api/v1/repositories'; }; export type CreateRepositoryResponses = { - /** - * Repository created successfully - */ - 201: { - message: string; - repository: { - id: string; - name: string; - shortId: string; - }; - }; + /** + * Repository created successfully + */ + 201: { + message: string; + repository: { + id: string; + name: string; + shortId: string; + }; + }; }; -export type CreateRepositoryResponse = - CreateRepositoryResponses[keyof CreateRepositoryResponses]; +export type CreateRepositoryResponse = CreateRepositoryResponses[keyof CreateRepositoryResponses]; export type ListRcloneRemotesData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/repositories/rclone-remotes"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/repositories/rclone-remotes'; }; export type ListRcloneRemotesResponses = { - /** - * List of rclone remotes - */ - 200: Array<{ - name: string; - type: string; - }>; + /** + * List of rclone remotes + */ + 200: Array<{ + name: string; + type: string; + }>; }; -export type ListRcloneRemotesResponse = - ListRcloneRemotesResponses[keyof ListRcloneRemotesResponses]; +export type ListRcloneRemotesResponse = ListRcloneRemotesResponses[keyof ListRcloneRemotesResponses]; export type DeleteRepositoryData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/api/v1/repositories/{id}"; + body?: never; + path: { + id: string; + }; + query?: never; + url: '/api/v1/repositories/{id}'; }; export type DeleteRepositoryResponses = { - /** - * Repository deleted successfully - */ - 200: { - message: string; - }; + /** + * Repository deleted successfully + */ + 200: { + message: string; + }; }; -export type DeleteRepositoryResponse = - DeleteRepositoryResponses[keyof DeleteRepositoryResponses]; +export type DeleteRepositoryResponse = DeleteRepositoryResponses[keyof DeleteRepositoryResponses]; export type GetRepositoryData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/api/v1/repositories/{id}"; + body?: never; + path: { + id: string; + }; + query?: never; + url: '/api/v1/repositories/{id}'; }; export type GetRepositoryResponses = { - /** - * Repository details - */ - 200: { - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: "azure" | "gcs" | "local" | "r2" | "rclone" | "rest" | "s3" | "sftp"; - updatedAt: number; - }; + /** + * Repository details + */ + 200: { + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }; }; -export type GetRepositoryResponse = - GetRepositoryResponses[keyof GetRepositoryResponses]; +export type GetRepositoryResponse = GetRepositoryResponses[keyof GetRepositoryResponses]; export type UpdateRepositoryData = { - body?: { - compressionMode?: "auto" | "max" | "off"; - name?: string; - }; - path: { - id: string; - }; - query?: never; - url: "/api/v1/repositories/{id}"; + body?: { + compressionMode?: 'auto' | 'max' | 'off'; + downloadLimit?: { + enabled: boolean; + unit: string; + value: number; + }; + name?: string; + uploadLimit?: { + enabled: boolean; + unit: string; + value: number; + }; + }; + path: { + id: string; + }; + query?: never; + url: '/api/v1/repositories/{id}'; }; export type UpdateRepositoryErrors = { - /** - * Repository not found - */ - 404: unknown; - /** - * Repository with this name already exists - */ - 409: unknown; + /** + * Repository not found + */ + 404: unknown; + /** + * Repository with this name already exists + */ + 409: unknown; }; export type UpdateRepositoryResponses = { - /** - * Repository updated successfully - */ - 200: { - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: "azure" | "gcs" | "local" | "r2" | "rclone" | "rest" | "s3" | "sftp"; - updatedAt: number; - }; + /** + * Repository updated successfully + */ + 200: { + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }; }; -export type UpdateRepositoryResponse = - UpdateRepositoryResponses[keyof UpdateRepositoryResponses]; +export type UpdateRepositoryResponse = UpdateRepositoryResponses[keyof UpdateRepositoryResponses]; export type DeleteSnapshotsData = { - body?: { - snapshotIds: Array; - }; - path: { - id: string; - }; - query?: never; - url: "/api/v1/repositories/{id}/snapshots"; + body?: { + snapshotIds: Array; + }; + path: { + id: string; + }; + query?: never; + url: '/api/v1/repositories/{id}/snapshots'; }; export type DeleteSnapshotsResponses = { - /** - * Snapshots deleted successfully - */ - 200: { - message: string; - }; + /** + * Snapshots deleted successfully + */ + 200: { + message: string; + }; }; -export type DeleteSnapshotsResponse = - DeleteSnapshotsResponses[keyof DeleteSnapshotsResponses]; +export type DeleteSnapshotsResponse = DeleteSnapshotsResponses[keyof DeleteSnapshotsResponses]; export type ListSnapshotsData = { - body?: never; - path: { - id: string; - }; - query?: { - backupId?: string; - }; - url: "/api/v1/repositories/{id}/snapshots"; + body?: never; + path: { + id: string; + }; + query?: { + backupId?: string; + }; + url: '/api/v1/repositories/{id}/snapshots'; }; export type ListSnapshotsResponses = { - /** - * List of snapshots - */ - 200: Array<{ - duration: number; - paths: Array; - short_id: string; - size: number; - tags: Array; - time: number; - }>; + /** + * List of snapshots + */ + 200: Array<{ + duration: number; + paths: Array; + short_id: string; + size: number; + tags: Array; + time: number; + }>; }; -export type ListSnapshotsResponse = - ListSnapshotsResponses[keyof ListSnapshotsResponses]; +export type ListSnapshotsResponse = ListSnapshotsResponses[keyof ListSnapshotsResponses]; export type DeleteSnapshotData = { - body?: never; - path: { - id: string; - snapshotId: string; - }; - query?: never; - url: "/api/v1/repositories/{id}/snapshots/{snapshotId}"; + body?: never; + path: { + id: string; + snapshotId: string; + }; + query?: never; + url: '/api/v1/repositories/{id}/snapshots/{snapshotId}'; }; export type DeleteSnapshotResponses = { - /** - * Snapshot deleted successfully - */ - 200: { - message: string; - }; + /** + * Snapshot deleted successfully + */ + 200: { + message: string; + }; }; -export type DeleteSnapshotResponse = - DeleteSnapshotResponses[keyof DeleteSnapshotResponses]; +export type DeleteSnapshotResponse = DeleteSnapshotResponses[keyof DeleteSnapshotResponses]; export type GetSnapshotDetailsData = { - body?: never; - path: { - id: string; - snapshotId: string; - }; - query?: never; - url: "/api/v1/repositories/{id}/snapshots/{snapshotId}"; + body?: never; + path: { + id: string; + snapshotId: string; + }; + query?: never; + url: '/api/v1/repositories/{id}/snapshots/{snapshotId}'; }; export type GetSnapshotDetailsResponses = { - /** - * Snapshot details - */ - 200: { - duration: number; - paths: Array; - short_id: string; - size: number; - tags: Array; - time: number; - }; + /** + * Snapshot details + */ + 200: { + duration: number; + paths: Array; + short_id: string; + size: number; + tags: Array; + time: number; + }; }; -export type GetSnapshotDetailsResponse = - GetSnapshotDetailsResponses[keyof GetSnapshotDetailsResponses]; +export type GetSnapshotDetailsResponse = GetSnapshotDetailsResponses[keyof GetSnapshotDetailsResponses]; export type ListSnapshotFilesData = { - body?: never; - path: { - id: string; - snapshotId: string; - }; - query?: { - path?: string; - }; - url: "/api/v1/repositories/{id}/snapshots/{snapshotId}/files"; + body?: never; + path: { + id: string; + snapshotId: string; + }; + query?: { + path?: string; + }; + url: '/api/v1/repositories/{id}/snapshots/{snapshotId}/files'; }; export type ListSnapshotFilesResponses = { - /** - * List of files and directories in the snapshot - */ - 200: { - files: Array<{ - name: string; - path: string; - type: string; - atime?: string; - ctime?: string; - gid?: number; - mode?: number; - mtime?: string; - size?: number; - uid?: number; - }>; - snapshot: { - hostname: string; - id: string; - paths: Array; - short_id: string; - time: string; - }; - }; + /** + * List of files and directories in the snapshot + */ + 200: { + files: Array<{ + name: string; + path: string; + type: string; + atime?: string; + ctime?: string; + gid?: number; + mode?: number; + mtime?: string; + size?: number; + uid?: number; + }>; + snapshot: { + hostname: string; + id: string; + paths: Array; + short_id: string; + time: string; + }; + }; }; -export type ListSnapshotFilesResponse = - ListSnapshotFilesResponses[keyof ListSnapshotFilesResponses]; +export type ListSnapshotFilesResponse = ListSnapshotFilesResponses[keyof ListSnapshotFilesResponses]; export type RestoreSnapshotData = { - body?: { - snapshotId: string; - delete?: boolean; - exclude?: Array; - excludeXattr?: Array; - include?: Array; - overwrite?: "always" | "if-changed" | "if-newer" | "never"; - targetPath?: string; - }; - path: { - id: string; - }; - query?: never; - url: "/api/v1/repositories/{id}/restore"; + body?: { + snapshotId: string; + delete?: boolean; + exclude?: Array; + excludeXattr?: Array; + include?: Array; + overwrite?: 'always' | 'if-changed' | 'if-newer' | 'never'; + targetPath?: string; + }; + path: { + id: string; + }; + query?: never; + url: '/api/v1/repositories/{id}/restore'; }; export type RestoreSnapshotResponses = { - /** - * Snapshot restored successfully - */ - 200: { - filesRestored: number; - filesSkipped: number; - message: string; - success: boolean; - }; + /** + * Snapshot restored successfully + */ + 200: { + filesRestored: number; + filesSkipped: number; + message: string; + success: boolean; + }; }; -export type RestoreSnapshotResponse = - RestoreSnapshotResponses[keyof RestoreSnapshotResponses]; +export type RestoreSnapshotResponse = RestoreSnapshotResponses[keyof RestoreSnapshotResponses]; export type DoctorRepositoryData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/api/v1/repositories/{id}/doctor"; + body?: never; + path: { + id: string; + }; + query?: never; + url: '/api/v1/repositories/{id}/doctor'; }; export type DoctorRepositoryResponses = { - /** - * Doctor operation completed - */ - 200: { - steps: Array<{ - error: string | null; - output: string | null; - step: string; - success: boolean; - }>; - success: boolean; - }; + /** + * Doctor operation completed + */ + 200: { + steps: Array<{ + error: string | null; + output: string | null; + step: string; + success: boolean; + }>; + success: boolean; + }; }; -export type DoctorRepositoryResponse = - DoctorRepositoryResponses[keyof DoctorRepositoryResponses]; +export type DoctorRepositoryResponse = DoctorRepositoryResponses[keyof DoctorRepositoryResponses]; export type TagSnapshotsData = { - body?: { - snapshotIds: Array; - add?: Array; - remove?: Array; - set?: Array; - }; - path: { - id: string; - }; - query?: never; - url: "/api/v1/repositories/{id}/snapshots/tag"; + body?: { + snapshotIds: Array; + add?: Array; + remove?: Array; + set?: Array; + }; + path: { + id: string; + }; + query?: never; + url: '/api/v1/repositories/{id}/snapshots/tag'; }; export type TagSnapshotsResponses = { - /** - * Snapshots tagged successfully - */ - 200: { - message: string; - }; + /** + * Snapshots tagged successfully + */ + 200: { + message: string; + }; }; -export type TagSnapshotsResponse = - TagSnapshotsResponses[keyof TagSnapshotsResponses]; +export type TagSnapshotsResponse = TagSnapshotsResponses[keyof TagSnapshotsResponses]; export type ListBackupSchedulesData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/backups"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/backups'; }; export type ListBackupSchedulesResponses = { - /** - * List of backup schedules - */ - 200: Array<{ - createdAt: number; - cronExpression: string; - enabled: boolean; - excludeIfPresent: Array | null; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "in_progress" | "success" | "warning" | null; - name: string; - nextBackupAt: number | null; - oneFileSystem: boolean; - repository: { - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: - | "azure" - | "gcs" - | "local" - | "r2" - | "rclone" - | "rest" - | "s3" - | "sftp"; - updatedAt: number; - }; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - shortId: string; - updatedAt: number; - volume: { - autoRemount: boolean; - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - shortId: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "rclone" | "sftp" | "smb" | "webdav"; - updatedAt: number; - }; - volumeId: number; - }>; + /** + * List of backup schedules + */ + 200: Array<{ + createdAt: number; + cronExpression: string; + enabled: boolean; + excludeIfPresent: Array | null; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: 'error' | 'in_progress' | 'success' | 'warning' | null; + name: string; + nextBackupAt: number | null; + oneFileSystem: boolean; + repository: { + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + shortId: string; + updatedAt: number; + volume: { + autoRemount: boolean; + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + shortId: string; + status: 'error' | 'mounted' | 'unmounted'; + type: 'directory' | 'nfs' | 'rclone' | 'sftp' | 'smb' | 'webdav'; + updatedAt: number; + }; + volumeId: number; + }>; }; -export type ListBackupSchedulesResponse = - ListBackupSchedulesResponses[keyof ListBackupSchedulesResponses]; +export type ListBackupSchedulesResponse = ListBackupSchedulesResponses[keyof ListBackupSchedulesResponses]; export type CreateBackupScheduleData = { - body?: { - cronExpression: string; - enabled: boolean; - name: string; - repositoryId: string; - volumeId: number; - excludeIfPresent?: Array; - excludePatterns?: Array; - includePatterns?: Array; - oneFileSystem?: boolean; - retentionPolicy?: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - }; - tags?: Array; - }; - path?: never; - query?: never; - url: "/api/v1/backups"; + body?: { + cronExpression: string; + enabled: boolean; + name: string; + repositoryId: string; + volumeId: number; + excludeIfPresent?: Array; + excludePatterns?: Array; + includePatterns?: Array; + oneFileSystem?: boolean; + retentionPolicy?: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + }; + tags?: Array; + }; + path?: never; + query?: never; + url: '/api/v1/backups'; }; export type CreateBackupScheduleResponses = { - /** - * Backup schedule created successfully - */ - 201: { - createdAt: number; - cronExpression: string; - enabled: boolean; - excludeIfPresent: Array | null; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "in_progress" | "success" | "warning" | null; - name: string; - nextBackupAt: number | null; - oneFileSystem: boolean; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - shortId: string; - updatedAt: number; - volumeId: number; - }; + /** + * Backup schedule created successfully + */ + 201: { + createdAt: number; + cronExpression: string; + enabled: boolean; + excludeIfPresent: Array | null; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: 'error' | 'in_progress' | 'success' | 'warning' | null; + name: string; + nextBackupAt: number | null; + oneFileSystem: boolean; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + shortId: string; + updatedAt: number; + volumeId: number; + }; }; -export type CreateBackupScheduleResponse = - CreateBackupScheduleResponses[keyof CreateBackupScheduleResponses]; +export type CreateBackupScheduleResponse = CreateBackupScheduleResponses[keyof CreateBackupScheduleResponses]; export type DeleteBackupScheduleData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}'; }; export type DeleteBackupScheduleResponses = { - /** - * Backup schedule deleted successfully - */ - 200: { - success: boolean; - }; + /** + * Backup schedule deleted successfully + */ + 200: { + success: boolean; + }; }; -export type DeleteBackupScheduleResponse = - DeleteBackupScheduleResponses[keyof DeleteBackupScheduleResponses]; +export type DeleteBackupScheduleResponse = DeleteBackupScheduleResponses[keyof DeleteBackupScheduleResponses]; export type GetBackupScheduleData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}'; }; export type GetBackupScheduleResponses = { - /** - * Backup schedule details - */ - 200: { - createdAt: number; - cronExpression: string; - enabled: boolean; - excludeIfPresent: Array | null; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "in_progress" | "success" | "warning" | null; - name: string; - nextBackupAt: number | null; - oneFileSystem: boolean; - repository: { - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: - | "azure" - | "gcs" - | "local" - | "r2" - | "rclone" - | "rest" - | "s3" - | "sftp"; - updatedAt: number; - }; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - shortId: string; - updatedAt: number; - volume: { - autoRemount: boolean; - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - shortId: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "rclone" | "sftp" | "smb" | "webdav"; - updatedAt: number; - }; - volumeId: number; - }; + /** + * Backup schedule details + */ + 200: { + createdAt: number; + cronExpression: string; + enabled: boolean; + excludeIfPresent: Array | null; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: 'error' | 'in_progress' | 'success' | 'warning' | null; + name: string; + nextBackupAt: number | null; + oneFileSystem: boolean; + repository: { + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + shortId: string; + updatedAt: number; + volume: { + autoRemount: boolean; + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + shortId: string; + status: 'error' | 'mounted' | 'unmounted'; + type: 'directory' | 'nfs' | 'rclone' | 'sftp' | 'smb' | 'webdav'; + updatedAt: number; + }; + volumeId: number; + }; }; -export type GetBackupScheduleResponse = - GetBackupScheduleResponses[keyof GetBackupScheduleResponses]; +export type GetBackupScheduleResponse = GetBackupScheduleResponses[keyof GetBackupScheduleResponses]; export type UpdateBackupScheduleData = { - body?: { - cronExpression: string; - repositoryId: string; - enabled?: boolean; - excludeIfPresent?: Array; - excludePatterns?: Array; - includePatterns?: Array; - name?: string; - oneFileSystem?: boolean; - retentionPolicy?: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - }; - tags?: Array; - }; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}"; + body?: { + cronExpression: string; + repositoryId: string; + enabled?: boolean; + excludeIfPresent?: Array; + excludePatterns?: Array; + includePatterns?: Array; + name?: string; + oneFileSystem?: boolean; + retentionPolicy?: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + }; + tags?: Array; + }; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}'; }; export type UpdateBackupScheduleResponses = { - /** - * Backup schedule updated successfully - */ - 200: { - createdAt: number; - cronExpression: string; - enabled: boolean; - excludeIfPresent: Array | null; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "in_progress" | "success" | "warning" | null; - name: string; - nextBackupAt: number | null; - oneFileSystem: boolean; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - shortId: string; - updatedAt: number; - volumeId: number; - }; + /** + * Backup schedule updated successfully + */ + 200: { + createdAt: number; + cronExpression: string; + enabled: boolean; + excludeIfPresent: Array | null; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: 'error' | 'in_progress' | 'success' | 'warning' | null; + name: string; + nextBackupAt: number | null; + oneFileSystem: boolean; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + shortId: string; + updatedAt: number; + volumeId: number; + }; }; -export type UpdateBackupScheduleResponse = - UpdateBackupScheduleResponses[keyof UpdateBackupScheduleResponses]; +export type UpdateBackupScheduleResponse = UpdateBackupScheduleResponses[keyof UpdateBackupScheduleResponses]; export type GetBackupScheduleForVolumeData = { - body?: never; - path: { - volumeId: string; - }; - query?: never; - url: "/api/v1/backups/volume/{volumeId}"; + body?: never; + path: { + volumeId: string; + }; + query?: never; + url: '/api/v1/backups/volume/{volumeId}'; }; export type GetBackupScheduleForVolumeResponses = { - /** - * Backup schedule details for the volume - */ - 200: { - createdAt: number; - cronExpression: string; - enabled: boolean; - excludeIfPresent: Array | null; - excludePatterns: Array | null; - id: number; - includePatterns: Array | null; - lastBackupAt: number | null; - lastBackupError: string | null; - lastBackupStatus: "error" | "in_progress" | "success" | "warning" | null; - name: string; - nextBackupAt: number | null; - oneFileSystem: boolean; - repository: { - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: - | "azure" - | "gcs" - | "local" - | "r2" - | "rclone" - | "rest" - | "s3" - | "sftp"; - updatedAt: number; - }; - repositoryId: string; - retentionPolicy: { - keepDaily?: number; - keepHourly?: number; - keepLast?: number; - keepMonthly?: number; - keepWeekly?: number; - keepWithinDuration?: string; - keepYearly?: number; - } | null; - shortId: string; - updatedAt: number; - volume: { - autoRemount: boolean; - config: - | { - backend: "directory"; - path: string; - readOnly?: false; - } - | { - backend: "nfs"; - exportPath: string; - server: string; - version: "3" | "4" | "4.1"; - port?: number; - readOnly?: boolean; - } - | { - backend: "rclone"; - path: string; - remote: string; - readOnly?: boolean; - } - | { - backend: "sftp"; - host: string; - path: string; - username: string; - port?: number; - skipHostKeyCheck?: boolean; - knownHosts?: string; - password?: string; - privateKey?: string; - readOnly?: boolean; - } - | { - backend: "smb"; - password: string; - server: string; - share: string; - username: string; - vers?: "1.0" | "2.0" | "2.1" | "3.0"; - port?: number; - domain?: string; - readOnly?: boolean; - } - | { - backend: "webdav"; - path: string; - server: string; - port?: number; - password?: string; - readOnly?: boolean; - ssl?: boolean; - username?: string; - }; - createdAt: number; - id: number; - lastError: string | null; - lastHealthCheck: number; - name: string; - shortId: string; - status: "error" | "mounted" | "unmounted"; - type: "directory" | "nfs" | "rclone" | "sftp" | "smb" | "webdav"; - updatedAt: number; - }; - volumeId: number; - } | null; + /** + * Backup schedule details for the volume + */ + 200: { + createdAt: number; + cronExpression: string; + enabled: boolean; + excludeIfPresent: Array | null; + excludePatterns: Array | null; + id: number; + includePatterns: Array | null; + lastBackupAt: number | null; + lastBackupError: string | null; + lastBackupStatus: 'error' | 'in_progress' | 'success' | 'warning' | null; + name: string; + nextBackupAt: number | null; + oneFileSystem: boolean; + repository: { + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }; + repositoryId: string; + retentionPolicy: { + keepDaily?: number; + keepHourly?: number; + keepLast?: number; + keepMonthly?: number; + keepWeekly?: number; + keepWithinDuration?: string; + keepYearly?: number; + } | null; + shortId: string; + updatedAt: number; + volume: { + autoRemount: boolean; + config: { + backend: 'directory'; + path: string; + readOnly?: false; + } | { + backend: 'nfs'; + exportPath: string; + server: string; + version: '3' | '4' | '4.1'; + port?: number; + readOnly?: boolean; + } | { + backend: 'rclone'; + path: string; + remote: string; + readOnly?: boolean; + } | { + backend: 'sftp'; + host: string; + path: string; + username: string; + port?: number; + skipHostKeyCheck?: boolean; + knownHosts?: string; + password?: string; + privateKey?: string; + readOnly?: boolean; + } | { + backend: 'smb'; + password: string; + server: string; + share: string; + username: string; + vers?: '1.0' | '2.0' | '2.1' | '3.0'; + port?: number; + domain?: string; + readOnly?: boolean; + } | { + backend: 'webdav'; + path: string; + server: string; + port?: number; + password?: string; + readOnly?: boolean; + ssl?: boolean; + username?: string; + }; + createdAt: number; + id: number; + lastError: string | null; + lastHealthCheck: number; + name: string; + shortId: string; + status: 'error' | 'mounted' | 'unmounted'; + type: 'directory' | 'nfs' | 'rclone' | 'sftp' | 'smb' | 'webdav'; + updatedAt: number; + }; + volumeId: number; + } | null; }; -export type GetBackupScheduleForVolumeResponse = - GetBackupScheduleForVolumeResponses[keyof GetBackupScheduleForVolumeResponses]; +export type GetBackupScheduleForVolumeResponse = GetBackupScheduleForVolumeResponses[keyof GetBackupScheduleForVolumeResponses]; export type RunBackupNowData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/run"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/run'; }; export type RunBackupNowResponses = { - /** - * Backup started successfully - */ - 200: { - success: boolean; - }; + /** + * Backup started successfully + */ + 200: { + success: boolean; + }; }; -export type RunBackupNowResponse = - RunBackupNowResponses[keyof RunBackupNowResponses]; +export type RunBackupNowResponse = RunBackupNowResponses[keyof RunBackupNowResponses]; export type StopBackupData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/stop"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/stop'; }; export type StopBackupErrors = { - /** - * No backup is currently running for this schedule - */ - 409: unknown; + /** + * No backup is currently running for this schedule + */ + 409: unknown; }; export type StopBackupResponses = { - /** - * Backup stopped successfully - */ - 200: { - success: boolean; - }; + /** + * Backup stopped successfully + */ + 200: { + success: boolean; + }; }; export type StopBackupResponse = StopBackupResponses[keyof StopBackupResponses]; export type RunForgetData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/forget"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/forget'; }; export type RunForgetResponses = { - /** - * Retention policy applied successfully - */ - 200: { - success: boolean; - }; + /** + * Retention policy applied successfully + */ + 200: { + success: boolean; + }; }; export type RunForgetResponse = RunForgetResponses[keyof RunForgetResponses]; export type GetScheduleNotificationsData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/notifications"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/notifications'; }; export type GetScheduleNotificationsResponses = { - /** - * List of notification assignments for the schedule - */ - 200: Array<{ - createdAt: number; - destination: { - config: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - createdAt: number; - enabled: boolean; - id: number; - name: string; - type: - | "custom" - | "discord" - | "email" - | "generic" - | "gotify" - | "ntfy" - | "pushover" - | "slack" - | "telegram"; - updatedAt: number; - }; - destinationId: number; - notifyOnFailure: boolean; - notifyOnStart: boolean; - notifyOnSuccess: boolean; - notifyOnWarning: boolean; - scheduleId: number; - }>; + /** + * List of notification assignments for the schedule + */ + 200: Array<{ + createdAt: number; + destination: { + config: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + createdAt: number; + enabled: boolean; + id: number; + name: string; + type: 'custom' | 'discord' | 'email' | 'generic' | 'gotify' | 'ntfy' | 'pushover' | 'slack' | 'telegram'; + updatedAt: number; + }; + destinationId: number; + notifyOnFailure: boolean; + notifyOnStart: boolean; + notifyOnSuccess: boolean; + notifyOnWarning: boolean; + scheduleId: number; + }>; }; -export type GetScheduleNotificationsResponse = - GetScheduleNotificationsResponses[keyof GetScheduleNotificationsResponses]; +export type GetScheduleNotificationsResponse = GetScheduleNotificationsResponses[keyof GetScheduleNotificationsResponses]; export type UpdateScheduleNotificationsData = { - body?: { - assignments: Array<{ - destinationId: number; - notifyOnFailure: boolean; - notifyOnStart: boolean; - notifyOnSuccess: boolean; - notifyOnWarning: boolean; - }>; - }; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/notifications"; + body?: { + assignments: Array<{ + destinationId: number; + notifyOnFailure: boolean; + notifyOnStart: boolean; + notifyOnSuccess: boolean; + notifyOnWarning: boolean; + }>; + }; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/notifications'; }; export type UpdateScheduleNotificationsResponses = { - /** - * Notification assignments updated successfully - */ - 200: Array<{ - createdAt: number; - destination: { - config: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - createdAt: number; - enabled: boolean; - id: number; - name: string; - type: - | "custom" - | "discord" - | "email" - | "generic" - | "gotify" - | "ntfy" - | "pushover" - | "slack" - | "telegram"; - updatedAt: number; - }; - destinationId: number; - notifyOnFailure: boolean; - notifyOnStart: boolean; - notifyOnSuccess: boolean; - notifyOnWarning: boolean; - scheduleId: number; - }>; + /** + * Notification assignments updated successfully + */ + 200: Array<{ + createdAt: number; + destination: { + config: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + createdAt: number; + enabled: boolean; + id: number; + name: string; + type: 'custom' | 'discord' | 'email' | 'generic' | 'gotify' | 'ntfy' | 'pushover' | 'slack' | 'telegram'; + updatedAt: number; + }; + destinationId: number; + notifyOnFailure: boolean; + notifyOnStart: boolean; + notifyOnSuccess: boolean; + notifyOnWarning: boolean; + scheduleId: number; + }>; }; -export type UpdateScheduleNotificationsResponse = - UpdateScheduleNotificationsResponses[keyof UpdateScheduleNotificationsResponses]; +export type UpdateScheduleNotificationsResponse = UpdateScheduleNotificationsResponses[keyof UpdateScheduleNotificationsResponses]; export type GetScheduleMirrorsData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/mirrors"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/mirrors'; }; export type GetScheduleMirrorsResponses = { - /** - * List of mirror repository assignments for the schedule - */ - 200: Array<{ - createdAt: number; - enabled: boolean; - lastCopyAt: number | null; - lastCopyError: string | null; - lastCopyStatus: "error" | "success" | null; - repository: { - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: - | "azure" - | "gcs" - | "local" - | "r2" - | "rclone" - | "rest" - | "s3" - | "sftp"; - updatedAt: number; - }; - repositoryId: string; - scheduleId: number; - }>; + /** + * List of mirror repository assignments for the schedule + */ + 200: Array<{ + createdAt: number; + enabled: boolean; + lastCopyAt: number | null; + lastCopyError: string | null; + lastCopyStatus: 'error' | 'success' | null; + repository: { + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }; + repositoryId: string; + scheduleId: number; + }>; }; -export type GetScheduleMirrorsResponse = - GetScheduleMirrorsResponses[keyof GetScheduleMirrorsResponses]; +export type GetScheduleMirrorsResponse = GetScheduleMirrorsResponses[keyof GetScheduleMirrorsResponses]; export type UpdateScheduleMirrorsData = { - body?: { - mirrors: Array<{ - enabled: boolean; - repositoryId: string; - }>; - }; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/mirrors"; + body?: { + mirrors: Array<{ + enabled: boolean; + repositoryId: string; + }>; + }; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/mirrors'; }; export type UpdateScheduleMirrorsResponses = { - /** - * Mirror assignments updated successfully - */ - 200: Array<{ - createdAt: number; - enabled: boolean; - lastCopyAt: number | null; - lastCopyError: string | null; - lastCopyStatus: "error" | "success" | null; - repository: { - compressionMode: "auto" | "max" | "off" | null; - config: - | { - accessKeyId: string; - backend: "r2"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accessKeyId: string; - backend: "s3"; - bucket: string; - endpoint: string; - secretAccessKey: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - accountKey: string; - accountName: string; - backend: "azure"; - container: string; - cacert?: string; - customPassword?: string; - endpointSuffix?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "gcs"; - bucket: string; - credentialsJson: string; - projectId: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "local"; - name: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - path?: string; - } - | { - backend: "rclone"; - path: string; - remote: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - } - | { - backend: "rest"; - url: string; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - password?: string; - path?: string; - username?: string; - } - | { - backend: "sftp"; - host: string; - path: string; - privateKey: string; - user: string; - port?: number; - skipHostKeyCheck?: boolean; - cacert?: string; - customPassword?: string; - insecureTls?: boolean; - isExistingRepository?: boolean; - knownHosts?: string; - }; - createdAt: number; - id: string; - lastChecked: number | null; - lastError: string | null; - name: string; - shortId: string; - status: "error" | "healthy" | "unknown" | null; - type: - | "azure" - | "gcs" - | "local" - | "r2" - | "rclone" - | "rest" - | "s3" - | "sftp"; - updatedAt: number; - }; - repositoryId: string; - scheduleId: number; - }>; + /** + * Mirror assignments updated successfully + */ + 200: Array<{ + createdAt: number; + enabled: boolean; + lastCopyAt: number | null; + lastCopyError: string | null; + lastCopyStatus: 'error' | 'success' | null; + repository: { + compressionMode: 'auto' | 'max' | 'off' | null; + config: { + accessKeyId: string; + backend: 'r2'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accessKeyId: string; + backend: 's3'; + bucket: string; + endpoint: string; + secretAccessKey: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + accountKey: string; + accountName: string; + backend: 'azure'; + container: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + endpointSuffix?: string; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'gcs'; + bucket: string; + credentialsJson: string; + projectId: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'local'; + name: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rclone'; + path: string; + remote: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + } | { + backend: 'rest'; + url: string; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + password?: string; + path?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + username?: string; + } | { + backend: 'sftp'; + host: string; + path: string; + privateKey: string; + user: string; + port?: number; + skipHostKeyCheck?: boolean; + cacert?: string; + customPassword?: string; + downloadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + insecureTls?: boolean; + isExistingRepository?: boolean; + knownHosts?: string; + uploadLimit?: { + unit?: 'Gbps' | 'Kbps' | 'Mbps'; + value?: number; + enabled?: boolean; + }; + }; + createdAt: number; + id: string; + lastChecked: number | null; + lastError: string | null; + name: string; + shortId: string; + status: 'error' | 'healthy' | 'unknown' | null; + type: 'azure' | 'gcs' | 'local' | 'r2' | 'rclone' | 'rest' | 's3' | 'sftp'; + updatedAt: number; + }; + repositoryId: string; + scheduleId: number; + }>; }; -export type UpdateScheduleMirrorsResponse = - UpdateScheduleMirrorsResponses[keyof UpdateScheduleMirrorsResponses]; +export type UpdateScheduleMirrorsResponse = UpdateScheduleMirrorsResponses[keyof UpdateScheduleMirrorsResponses]; export type GetMirrorCompatibilityData = { - body?: never; - path: { - scheduleId: string; - }; - query?: never; - url: "/api/v1/backups/{scheduleId}/mirrors/compatibility"; + body?: never; + path: { + scheduleId: string; + }; + query?: never; + url: '/api/v1/backups/{scheduleId}/mirrors/compatibility'; }; export type GetMirrorCompatibilityResponses = { - /** - * List of repositories with their mirror compatibility status - */ - 200: Array<{ - compatible: boolean; - reason: string | null; - repositoryId: string; - }>; + /** + * List of repositories with their mirror compatibility status + */ + 200: Array<{ + compatible: boolean; + reason: string | null; + repositoryId: string; + }>; }; -export type GetMirrorCompatibilityResponse = - GetMirrorCompatibilityResponses[keyof GetMirrorCompatibilityResponses]; +export type GetMirrorCompatibilityResponse = GetMirrorCompatibilityResponses[keyof GetMirrorCompatibilityResponses]; export type ReorderBackupSchedulesData = { - body?: { - scheduleIds: Array; - }; - path?: never; - query?: never; - url: "/api/v1/backups/reorder"; + body?: { + scheduleIds: Array; + }; + path?: never; + query?: never; + url: '/api/v1/backups/reorder'; }; export type ReorderBackupSchedulesResponses = { - /** - * Backup schedules reordered successfully - */ - 200: { - success: boolean; - }; + /** + * Backup schedules reordered successfully + */ + 200: { + success: boolean; + }; }; -export type ReorderBackupSchedulesResponse = - ReorderBackupSchedulesResponses[keyof ReorderBackupSchedulesResponses]; +export type ReorderBackupSchedulesResponse = ReorderBackupSchedulesResponses[keyof ReorderBackupSchedulesResponses]; export type ListNotificationDestinationsData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/notifications/destinations"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/notifications/destinations'; }; export type ListNotificationDestinationsResponses = { - /** - * A list of notification destinations - */ - 200: Array<{ - config: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - createdAt: number; - enabled: boolean; - id: number; - name: string; - type: - | "custom" - | "discord" - | "email" - | "generic" - | "gotify" - | "ntfy" - | "pushover" - | "slack" - | "telegram"; - updatedAt: number; - }>; + /** + * A list of notification destinations + */ + 200: Array<{ + config: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + createdAt: number; + enabled: boolean; + id: number; + name: string; + type: 'custom' | 'discord' | 'email' | 'generic' | 'gotify' | 'ntfy' | 'pushover' | 'slack' | 'telegram'; + updatedAt: number; + }>; }; -export type ListNotificationDestinationsResponse = - ListNotificationDestinationsResponses[keyof ListNotificationDestinationsResponses]; +export type ListNotificationDestinationsResponse = ListNotificationDestinationsResponses[keyof ListNotificationDestinationsResponses]; export type CreateNotificationDestinationData = { - body?: { - config: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - name: string; - }; - path?: never; - query?: never; - url: "/api/v1/notifications/destinations"; + body?: { + config: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + name: string; + }; + path?: never; + query?: never; + url: '/api/v1/notifications/destinations'; }; export type CreateNotificationDestinationResponses = { - /** - * Notification destination created successfully - */ - 201: { - config: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - createdAt: number; - enabled: boolean; - id: number; - name: string; - type: - | "custom" - | "discord" - | "email" - | "generic" - | "gotify" - | "ntfy" - | "pushover" - | "slack" - | "telegram"; - updatedAt: number; - }; + /** + * Notification destination created successfully + */ + 201: { + config: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + createdAt: number; + enabled: boolean; + id: number; + name: string; + type: 'custom' | 'discord' | 'email' | 'generic' | 'gotify' | 'ntfy' | 'pushover' | 'slack' | 'telegram'; + updatedAt: number; + }; }; -export type CreateNotificationDestinationResponse = - CreateNotificationDestinationResponses[keyof CreateNotificationDestinationResponses]; +export type CreateNotificationDestinationResponse = CreateNotificationDestinationResponses[keyof CreateNotificationDestinationResponses]; export type DeleteNotificationDestinationData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/api/v1/notifications/destinations/{id}"; + body?: never; + path: { + id: string; + }; + query?: never; + url: '/api/v1/notifications/destinations/{id}'; }; export type DeleteNotificationDestinationErrors = { - /** - * Notification destination not found - */ - 404: unknown; + /** + * Notification destination not found + */ + 404: unknown; }; export type DeleteNotificationDestinationResponses = { - /** - * Notification destination deleted successfully - */ - 200: { - message: string; - }; + /** + * Notification destination deleted successfully + */ + 200: { + message: string; + }; }; -export type DeleteNotificationDestinationResponse = - DeleteNotificationDestinationResponses[keyof DeleteNotificationDestinationResponses]; +export type DeleteNotificationDestinationResponse = DeleteNotificationDestinationResponses[keyof DeleteNotificationDestinationResponses]; export type GetNotificationDestinationData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/api/v1/notifications/destinations/{id}"; + body?: never; + path: { + id: string; + }; + query?: never; + url: '/api/v1/notifications/destinations/{id}'; }; export type GetNotificationDestinationErrors = { - /** - * Notification destination not found - */ - 404: unknown; + /** + * Notification destination not found + */ + 404: unknown; }; export type GetNotificationDestinationResponses = { - /** - * Notification destination details - */ - 200: { - config: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - createdAt: number; - enabled: boolean; - id: number; - name: string; - type: - | "custom" - | "discord" - | "email" - | "generic" - | "gotify" - | "ntfy" - | "pushover" - | "slack" - | "telegram"; - updatedAt: number; - }; + /** + * Notification destination details + */ + 200: { + config: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + createdAt: number; + enabled: boolean; + id: number; + name: string; + type: 'custom' | 'discord' | 'email' | 'generic' | 'gotify' | 'ntfy' | 'pushover' | 'slack' | 'telegram'; + updatedAt: number; + }; }; -export type GetNotificationDestinationResponse = - GetNotificationDestinationResponses[keyof GetNotificationDestinationResponses]; +export type GetNotificationDestinationResponse = GetNotificationDestinationResponses[keyof GetNotificationDestinationResponses]; export type UpdateNotificationDestinationData = { - body?: { - config?: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - enabled?: boolean; - name?: string; - }; - path: { - id: string; - }; - query?: never; - url: "/api/v1/notifications/destinations/{id}"; + body?: { + config?: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + enabled?: boolean; + name?: string; + }; + path: { + id: string; + }; + query?: never; + url: '/api/v1/notifications/destinations/{id}'; }; export type UpdateNotificationDestinationErrors = { - /** - * Notification destination not found - */ - 404: unknown; + /** + * Notification destination not found + */ + 404: unknown; }; export type UpdateNotificationDestinationResponses = { - /** - * Notification destination updated successfully - */ - 200: { - config: - | { - apiToken: string; - priority: -1 | 0 | 1; - type: "pushover"; - userKey: string; - devices?: string; - } - | { - botToken: string; - chatId: string; - type: "telegram"; - } - | { - from: string; - smtpHost: string; - smtpPort: number; - to: Array; - type: "email"; - useTLS: boolean; - password?: string; - username?: string; - } - | { - method: "GET" | "POST"; - type: "generic"; - url: string; - contentType?: string; - headers?: Array; - messageKey?: string; - titleKey?: string; - useJson?: boolean; - } - | { - priority: "default" | "high" | "low" | "max" | "min"; - topic: string; - type: "ntfy"; - accessToken?: string; - password?: string; - serverUrl?: string; - username?: string; - } - | { - priority: number; - serverUrl: string; - token: string; - type: "gotify"; - path?: string; - } - | { - shoutrrrUrl: string; - type: "custom"; - } - | { - type: "discord"; - webhookUrl: string; - avatarUrl?: string; - threadId?: string; - username?: string; - } - | { - type: "slack"; - webhookUrl: string; - channel?: string; - iconEmoji?: string; - username?: string; - }; - createdAt: number; - enabled: boolean; - id: number; - name: string; - type: - | "custom" - | "discord" - | "email" - | "generic" - | "gotify" - | "ntfy" - | "pushover" - | "slack" - | "telegram"; - updatedAt: number; - }; + /** + * Notification destination updated successfully + */ + 200: { + config: { + apiToken: string; + priority: -1 | 0 | 1; + type: 'pushover'; + userKey: string; + devices?: string; + } | { + botToken: string; + chatId: string; + type: 'telegram'; + } | { + from: string; + smtpHost: string; + smtpPort: number; + to: Array; + type: 'email'; + useTLS: boolean; + password?: string; + username?: string; + } | { + method: 'GET' | 'POST'; + type: 'generic'; + url: string; + contentType?: string; + headers?: Array; + messageKey?: string; + titleKey?: string; + useJson?: boolean; + } | { + priority: 'default' | 'high' | 'low' | 'max' | 'min'; + topic: string; + type: 'ntfy'; + accessToken?: string; + password?: string; + serverUrl?: string; + username?: string; + } | { + priority: number; + serverUrl: string; + token: string; + type: 'gotify'; + path?: string; + } | { + shoutrrrUrl: string; + type: 'custom'; + } | { + type: 'discord'; + webhookUrl: string; + avatarUrl?: string; + threadId?: string; + username?: string; + } | { + type: 'slack'; + webhookUrl: string; + channel?: string; + iconEmoji?: string; + username?: string; + }; + createdAt: number; + enabled: boolean; + id: number; + name: string; + type: 'custom' | 'discord' | 'email' | 'generic' | 'gotify' | 'ntfy' | 'pushover' | 'slack' | 'telegram'; + updatedAt: number; + }; }; -export type UpdateNotificationDestinationResponse = - UpdateNotificationDestinationResponses[keyof UpdateNotificationDestinationResponses]; +export type UpdateNotificationDestinationResponse = UpdateNotificationDestinationResponses[keyof UpdateNotificationDestinationResponses]; export type TestNotificationDestinationData = { - body?: never; - path: { - id: string; - }; - query?: never; - url: "/api/v1/notifications/destinations/{id}/test"; + body?: never; + path: { + id: string; + }; + query?: never; + url: '/api/v1/notifications/destinations/{id}/test'; }; export type TestNotificationDestinationErrors = { - /** - * Notification destination not found - */ - 404: unknown; - /** - * Cannot test disabled destination - */ - 409: unknown; - /** - * Failed to send test notification - */ - 500: unknown; + /** + * Notification destination not found + */ + 404: unknown; + /** + * Cannot test disabled destination + */ + 409: unknown; + /** + * Failed to send test notification + */ + 500: unknown; }; export type TestNotificationDestinationResponses = { - /** - * Test notification sent successfully - */ - 200: { - success: boolean; - }; + /** + * Test notification sent successfully + */ + 200: { + success: boolean; + }; }; -export type TestNotificationDestinationResponse = - TestNotificationDestinationResponses[keyof TestNotificationDestinationResponses]; +export type TestNotificationDestinationResponse = TestNotificationDestinationResponses[keyof TestNotificationDestinationResponses]; export type GetSystemInfoData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/system/info"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/system/info'; }; export type GetSystemInfoResponses = { - /** - * System information with enabled capabilities - */ - 200: { - capabilities: { - rclone: boolean; - sysAdmin: boolean; - }; - }; + /** + * System information with enabled capabilities + */ + 200: { + capabilities: { + rclone: boolean; + sysAdmin: boolean; + }; + }; }; -export type GetSystemInfoResponse = - GetSystemInfoResponses[keyof GetSystemInfoResponses]; +export type GetSystemInfoResponse = GetSystemInfoResponses[keyof GetSystemInfoResponses]; export type GetUpdatesData = { - body?: never; - path?: never; - query?: never; - url: "/api/v1/system/updates"; + body?: never; + path?: never; + query?: never; + url: '/api/v1/system/updates'; }; export type GetUpdatesResponses = { - /** - * Update information and missed releases - */ - 200: { - currentVersion: string; - hasUpdate: boolean; - latestVersion: string; - missedReleases: Array<{ - body: string; - publishedAt: string; - url: string; - version: string; - }>; - }; + /** + * Update information and missed releases + */ + 200: { + currentVersion: string; + hasUpdate: boolean; + latestVersion: string; + missedReleases: Array<{ + body: string; + publishedAt: string; + url: string; + version: string; + }>; + }; }; export type GetUpdatesResponse = GetUpdatesResponses[keyof GetUpdatesResponses]; export type DownloadResticPasswordData = { - body?: { - password: string; - }; - path?: never; - query?: never; - url: "/api/v1/system/restic-password"; + body?: { + password: string; + }; + path?: never; + query?: never; + url: '/api/v1/system/restic-password'; }; export type DownloadResticPasswordResponses = { - /** - * Restic password file content - */ - 200: string; + /** + * Restic password file content + */ + 200: string; }; -export type DownloadResticPasswordResponse = - DownloadResticPasswordResponses[keyof DownloadResticPasswordResponses]; +export type DownloadResticPasswordResponse = DownloadResticPasswordResponses[keyof DownloadResticPasswordResponses]; diff --git a/app/client/modules/repositories/tabs/info.tsx b/app/client/modules/repositories/tabs/info.tsx index e22b8c6a..085378a1 100644 --- a/app/client/modules/repositories/tabs/info.tsx +++ b/app/client/modules/repositories/tabs/info.tsx @@ -7,6 +7,7 @@ import { Button } from "~/client/components/ui/button"; import { Input } from "~/client/components/ui/input"; import { Label } from "~/client/components/ui/label"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "~/client/components/ui/select"; +import { Checkbox } from "~/client/components/ui/checkbox"; import { AlertDialog, AlertDialogAction, @@ -20,7 +21,8 @@ import { import type { Repository } from "~/client/lib/types"; import { REPOSITORY_BASE } from "~/client/lib/constants"; import { updateRepositoryMutation } from "~/client/api-client/@tanstack/react-query.gen"; -import type { CompressionMode, RepositoryConfig } from "~/schemas/restic"; +import type { CompressionMode, RepositoryConfig, BandwidthUnit } from "~/schemas/restic"; +import { BANDWIDTH_UNITS } from "~/schemas/restic"; type Props = { repository: Repository; @@ -43,6 +45,28 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => { const [compressionMode, setCompressionMode] = useState( (repository.compressionMode as CompressionMode) || "off", ); + + // Bandwidth limit states + const [uploadLimitEnabled, setUploadLimitEnabled] = useState( + (repository as any).uploadLimitEnabled ?? false + ); + const [uploadLimitValue, setUploadLimitValue] = useState( + (repository as any).uploadLimitValue ?? 0 + ); + const [uploadLimitUnit, setUploadLimitUnit] = useState( + (repository as any).uploadLimitUnit ?? "Mbps" + ); + + const [downloadLimitEnabled, setDownloadLimitEnabled] = useState( + (repository as any).downloadLimitEnabled ?? false + ); + const [downloadLimitValue, setDownloadLimitValue] = useState( + (repository as any).downloadLimitValue ?? 0 + ); + const [downloadLimitUnit, setDownloadLimitUnit] = useState( + (repository as any).downloadLimitUnit ?? "Mbps" + ); + const [showConfirmDialog, setShowConfirmDialog] = useState(false); const effectiveLocalPath = getEffectiveLocalPath(repository); @@ -67,12 +91,32 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => { const confirmUpdate = () => { updateMutation.mutate({ path: { id: repository.id }, - body: { name, compressionMode }, + body: { + name, + compressionMode, + uploadLimit: { + enabled: uploadLimitEnabled, + value: uploadLimitValue, + unit: uploadLimitUnit, + }, + downloadLimit: { + enabled: downloadLimitEnabled, + value: downloadLimitValue, + unit: downloadLimitUnit, + }, + }, }); }; const hasChanges = - name !== repository.name || compressionMode !== ((repository.compressionMode as CompressionMode) || "off"); + name !== repository.name || + compressionMode !== ((repository.compressionMode as CompressionMode) || "off") || + uploadLimitEnabled !== ((repository as any).uploadLimitEnabled ?? false) || + uploadLimitValue !== ((repository as any).uploadLimitValue ?? 0) || + uploadLimitUnit !== ((repository as any).uploadLimitUnit ?? "Mbps") || + downloadLimitEnabled !== ((repository as any).downloadLimitEnabled ?? false) || + downloadLimitValue !== ((repository as any).downloadLimitValue ?? 0) || + downloadLimitUnit !== ((repository as any).downloadLimitUnit ?? "Mbps"); const config = repository.config as RepositoryConfig; @@ -112,6 +156,108 @@ export const RepositoryInfoTabContent = ({ repository }: Props) => { + {/* Bandwidth Limits Section */} +
+

Bandwidth Limits

+
+ {/* Upload Limit */} +
+
+ setUploadLimitEnabled(!!checked)} + /> +
+ +

+ Limit upload speed to the repository +

+
+
+ + {uploadLimitEnabled && ( +
+
+
+ setUploadLimitValue(parseFloat(e.target.value) || 0)} + /> +
+ +
+
+ )} +
+ + {/* Download Limit */} +
+
+ setDownloadLimitEnabled(!!checked)} + /> +
+ +

+ Limit download speed from the repository +

+
+
+ + {downloadLimitEnabled && ( +
+
+
+ setDownloadLimitValue(parseFloat(e.target.value) || 0)} + /> +
+ +
+
+ )} +
+
+
+

Repository Information

diff --git a/app/server/modules/repositories/repositories.dto.ts b/app/server/modules/repositories/repositories.dto.ts index 56a215e3..660b67b8 100644 --- a/app/server/modules/repositories/repositories.dto.ts +++ b/app/server/modules/repositories/repositories.dto.ts @@ -137,6 +137,16 @@ export const deleteRepositoryDto = describeRoute({ export const updateRepositoryBody = type({ name: "string?", compressionMode: type.valueOf(COMPRESSION_MODES).optional(), + "uploadLimit?": { + enabled: "boolean", + value: "number >= 0", + unit: "string", + }, + "downloadLimit?": { + enabled: "boolean", + value: "number >= 0", + unit: "string", + }, }); export type UpdateRepositoryBody = typeof updateRepositoryBody.infer; diff --git a/app/server/modules/repositories/repositories.service.ts b/app/server/modules/repositories/repositories.service.ts index ea713699..d6c80a49 100644 --- a/app/server/modules/repositories/repositories.service.ts +++ b/app/server/modules/repositories/repositories.service.ts @@ -469,7 +469,15 @@ const tagSnapshots = async ( } }; -const updateRepository = async (id: string, updates: { name?: string; compressionMode?: CompressionMode }) => { +const updateRepository = async ( + id: string, + updates: { + name?: string; + compressionMode?: CompressionMode; + uploadLimit?: { enabled: boolean; value: number; unit: string }; + downloadLimit?: { enabled: boolean; value: number; unit: string }; + }, +) => { const existing = await findRepository(id); if (!existing) { @@ -488,14 +496,30 @@ const updateRepository = async (id: string, updates: { name?: string; compressio newName = updates.name.trim(); } + const updateData: Record = { + name: newName, + compressionMode: updates.compressionMode ?? existing.compressionMode, + updatedAt: Date.now(), + config: encryptedConfig, + }; + + // Update upload limit if provided + if (updates.uploadLimit !== undefined) { + updateData.uploadLimitEnabled = updates.uploadLimit.enabled; + updateData.uploadLimitValue = updates.uploadLimit.value; + updateData.uploadLimitUnit = updates.uploadLimit.unit; + } + + // Update download limit if provided + if (updates.downloadLimit !== undefined) { + updateData.downloadLimitEnabled = updates.downloadLimit.enabled; + updateData.downloadLimitValue = updates.downloadLimit.value; + updateData.downloadLimitUnit = updates.downloadLimit.unit; + } + const [updated] = await db .update(repositoriesTable) - .set({ - name: newName, - compressionMode: updates.compressionMode ?? existing.compressionMode, - updatedAt: Date.now(), - config: encryptedConfig, - }) + .set(updateData) .where(eq(repositoriesTable.id, existing.id)) .returning();