chore: gen api client
This commit is contained in:
parent
9475903ebb
commit
55d894c6f3
15 changed files with 325 additions and 946 deletions
|
|
@ -1,10 +1,6 @@
|
||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
import {
|
import { type DefaultError, queryOptions, type UseMutationOptions } from "@tanstack/react-query";
|
||||||
type DefaultError,
|
|
||||||
queryOptions,
|
|
||||||
type UseMutationOptions,
|
|
||||||
} from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import { client } from "../client.gen";
|
import { client } from "../client.gen";
|
||||||
import {
|
import {
|
||||||
|
|
@ -179,8 +175,7 @@ const createQueryKey = <TOptions extends Options>(
|
||||||
): [QueryKey<TOptions>[0]] => {
|
): [QueryKey<TOptions>[0]] => {
|
||||||
const params: QueryKey<TOptions>[0] = {
|
const params: QueryKey<TOptions>[0] = {
|
||||||
_id: id,
|
_id: id,
|
||||||
baseUrl:
|
baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl,
|
||||||
options?.baseUrl || (options?.client ?? client).getConfig().baseUrl,
|
|
||||||
} as QueryKey<TOptions>[0];
|
} as QueryKey<TOptions>[0];
|
||||||
if (infinite) {
|
if (infinite) {
|
||||||
params._infinite = infinite;
|
params._infinite = infinite;
|
||||||
|
|
@ -203,19 +198,13 @@ const createQueryKey = <TOptions extends Options>(
|
||||||
return [params];
|
return [params];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getStatusQueryKey = (options?: Options<GetStatusData>) =>
|
export const getStatusQueryKey = (options?: Options<GetStatusData>) => createQueryKey("getStatus", options);
|
||||||
createQueryKey("getStatus", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get authentication system status
|
* Get authentication system status
|
||||||
*/
|
*/
|
||||||
export const getStatusOptions = (options?: Options<GetStatusData>) =>
|
export const getStatusOptions = (options?: Options<GetStatusData>) =>
|
||||||
queryOptions<
|
queryOptions<GetStatusResponse, DefaultError, GetStatusResponse, ReturnType<typeof getStatusQueryKey>>({
|
||||||
GetStatusResponse,
|
|
||||||
DefaultError,
|
|
||||||
GetStatusResponse,
|
|
||||||
ReturnType<typeof getStatusQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await getStatus({
|
const { data } = await getStatus({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -228,19 +217,13 @@ export const getStatusOptions = (options?: Options<GetStatusData>) =>
|
||||||
queryKey: getStatusQueryKey(options),
|
queryKey: getStatusQueryKey(options),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const listVolumesQueryKey = (options?: Options<ListVolumesData>) =>
|
export const listVolumesQueryKey = (options?: Options<ListVolumesData>) => createQueryKey("listVolumes", options);
|
||||||
createQueryKey("listVolumes", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all volumes
|
* List all volumes
|
||||||
*/
|
*/
|
||||||
export const listVolumesOptions = (options?: Options<ListVolumesData>) =>
|
export const listVolumesOptions = (options?: Options<ListVolumesData>) =>
|
||||||
queryOptions<
|
queryOptions<ListVolumesResponse, DefaultError, ListVolumesResponse, ReturnType<typeof listVolumesQueryKey>>({
|
||||||
ListVolumesResponse,
|
|
||||||
DefaultError,
|
|
||||||
ListVolumesResponse,
|
|
||||||
ReturnType<typeof listVolumesQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await listVolumes({
|
const { data } = await listVolumes({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -258,16 +241,8 @@ export const listVolumesOptions = (options?: Options<ListVolumesData>) =>
|
||||||
*/
|
*/
|
||||||
export const createVolumeMutation = (
|
export const createVolumeMutation = (
|
||||||
options?: Partial<Options<CreateVolumeData>>,
|
options?: Partial<Options<CreateVolumeData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<CreateVolumeResponse, DefaultError, Options<CreateVolumeData>> => {
|
||||||
CreateVolumeResponse,
|
const mutationOptions: UseMutationOptions<CreateVolumeResponse, DefaultError, Options<CreateVolumeData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<CreateVolumeData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
CreateVolumeResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<CreateVolumeData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await createVolume({
|
const { data } = await createVolume({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -285,16 +260,8 @@ export const createVolumeMutation = (
|
||||||
*/
|
*/
|
||||||
export const testConnectionMutation = (
|
export const testConnectionMutation = (
|
||||||
options?: Partial<Options<TestConnectionData>>,
|
options?: Partial<Options<TestConnectionData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<TestConnectionResponse, DefaultError, Options<TestConnectionData>> => {
|
||||||
TestConnectionResponse,
|
const mutationOptions: UseMutationOptions<TestConnectionResponse, DefaultError, Options<TestConnectionData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<TestConnectionData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
TestConnectionResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<TestConnectionData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await testConnection({
|
const { data } = await testConnection({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -312,16 +279,8 @@ export const testConnectionMutation = (
|
||||||
*/
|
*/
|
||||||
export const deleteVolumeMutation = (
|
export const deleteVolumeMutation = (
|
||||||
options?: Partial<Options<DeleteVolumeData>>,
|
options?: Partial<Options<DeleteVolumeData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<DeleteVolumeResponse, DefaultError, Options<DeleteVolumeData>> => {
|
||||||
DeleteVolumeResponse,
|
const mutationOptions: UseMutationOptions<DeleteVolumeResponse, DefaultError, Options<DeleteVolumeData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<DeleteVolumeData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
DeleteVolumeResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<DeleteVolumeData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await deleteVolume({
|
const { data } = await deleteVolume({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -334,19 +293,13 @@ export const deleteVolumeMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getVolumeQueryKey = (options: Options<GetVolumeData>) =>
|
export const getVolumeQueryKey = (options: Options<GetVolumeData>) => createQueryKey("getVolume", options);
|
||||||
createQueryKey("getVolume", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a volume by name
|
* Get a volume by name
|
||||||
*/
|
*/
|
||||||
export const getVolumeOptions = (options: Options<GetVolumeData>) =>
|
export const getVolumeOptions = (options: Options<GetVolumeData>) =>
|
||||||
queryOptions<
|
queryOptions<GetVolumeResponse, DefaultError, GetVolumeResponse, ReturnType<typeof getVolumeQueryKey>>({
|
||||||
GetVolumeResponse,
|
|
||||||
DefaultError,
|
|
||||||
GetVolumeResponse,
|
|
||||||
ReturnType<typeof getVolumeQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await getVolume({
|
const { data } = await getVolume({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -364,16 +317,8 @@ export const getVolumeOptions = (options: Options<GetVolumeData>) =>
|
||||||
*/
|
*/
|
||||||
export const updateVolumeMutation = (
|
export const updateVolumeMutation = (
|
||||||
options?: Partial<Options<UpdateVolumeData>>,
|
options?: Partial<Options<UpdateVolumeData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<UpdateVolumeResponse, DefaultError, Options<UpdateVolumeData>> => {
|
||||||
UpdateVolumeResponse,
|
const mutationOptions: UseMutationOptions<UpdateVolumeResponse, DefaultError, Options<UpdateVolumeData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<UpdateVolumeData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
UpdateVolumeResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<UpdateVolumeData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await updateVolume({
|
const { data } = await updateVolume({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -391,16 +336,8 @@ export const updateVolumeMutation = (
|
||||||
*/
|
*/
|
||||||
export const mountVolumeMutation = (
|
export const mountVolumeMutation = (
|
||||||
options?: Partial<Options<MountVolumeData>>,
|
options?: Partial<Options<MountVolumeData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<MountVolumeResponse, DefaultError, Options<MountVolumeData>> => {
|
||||||
MountVolumeResponse,
|
const mutationOptions: UseMutationOptions<MountVolumeResponse, DefaultError, Options<MountVolumeData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<MountVolumeData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
MountVolumeResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<MountVolumeData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await mountVolume({
|
const { data } = await mountVolume({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -418,16 +355,8 @@ export const mountVolumeMutation = (
|
||||||
*/
|
*/
|
||||||
export const unmountVolumeMutation = (
|
export const unmountVolumeMutation = (
|
||||||
options?: Partial<Options<UnmountVolumeData>>,
|
options?: Partial<Options<UnmountVolumeData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<UnmountVolumeResponse, DefaultError, Options<UnmountVolumeData>> => {
|
||||||
UnmountVolumeResponse,
|
const mutationOptions: UseMutationOptions<UnmountVolumeResponse, DefaultError, Options<UnmountVolumeData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<UnmountVolumeData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
UnmountVolumeResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<UnmountVolumeData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await unmountVolume({
|
const { data } = await unmountVolume({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -445,16 +374,8 @@ export const unmountVolumeMutation = (
|
||||||
*/
|
*/
|
||||||
export const healthCheckVolumeMutation = (
|
export const healthCheckVolumeMutation = (
|
||||||
options?: Partial<Options<HealthCheckVolumeData>>,
|
options?: Partial<Options<HealthCheckVolumeData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<HealthCheckVolumeResponse, DefaultError, Options<HealthCheckVolumeData>> => {
|
||||||
HealthCheckVolumeResponse,
|
const mutationOptions: UseMutationOptions<HealthCheckVolumeResponse, DefaultError, Options<HealthCheckVolumeData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<HealthCheckVolumeData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
HealthCheckVolumeResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<HealthCheckVolumeData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await healthCheckVolume({
|
const { data } = await healthCheckVolume({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -467,19 +388,13 @@ export const healthCheckVolumeMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listFilesQueryKey = (options: Options<ListFilesData>) =>
|
export const listFilesQueryKey = (options: Options<ListFilesData>) => createQueryKey("listFiles", options);
|
||||||
createQueryKey("listFiles", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List files in a volume directory
|
* List files in a volume directory
|
||||||
*/
|
*/
|
||||||
export const listFilesOptions = (options: Options<ListFilesData>) =>
|
export const listFilesOptions = (options: Options<ListFilesData>) =>
|
||||||
queryOptions<
|
queryOptions<ListFilesResponse, DefaultError, ListFilesResponse, ReturnType<typeof listFilesQueryKey>>({
|
||||||
ListFilesResponse,
|
|
||||||
DefaultError,
|
|
||||||
ListFilesResponse,
|
|
||||||
ReturnType<typeof listFilesQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await listFiles({
|
const { data } = await listFiles({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -492,16 +407,13 @@ export const listFilesOptions = (options: Options<ListFilesData>) =>
|
||||||
queryKey: listFilesQueryKey(options),
|
queryKey: listFilesQueryKey(options),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const browseFilesystemQueryKey = (
|
export const browseFilesystemQueryKey = (options?: Options<BrowseFilesystemData>) =>
|
||||||
options?: Options<BrowseFilesystemData>,
|
createQueryKey("browseFilesystem", options);
|
||||||
) => createQueryKey("browseFilesystem", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse directories on the host filesystem
|
* Browse directories on the host filesystem
|
||||||
*/
|
*/
|
||||||
export const browseFilesystemOptions = (
|
export const browseFilesystemOptions = (options?: Options<BrowseFilesystemData>) =>
|
||||||
options?: Options<BrowseFilesystemData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
BrowseFilesystemResponse,
|
BrowseFilesystemResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -520,16 +432,13 @@ export const browseFilesystemOptions = (
|
||||||
queryKey: browseFilesystemQueryKey(options),
|
queryKey: browseFilesystemQueryKey(options),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const listRepositoriesQueryKey = (
|
export const listRepositoriesQueryKey = (options?: Options<ListRepositoriesData>) =>
|
||||||
options?: Options<ListRepositoriesData>,
|
createQueryKey("listRepositories", options);
|
||||||
) => createQueryKey("listRepositories", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all repositories
|
* List all repositories
|
||||||
*/
|
*/
|
||||||
export const listRepositoriesOptions = (
|
export const listRepositoriesOptions = (options?: Options<ListRepositoriesData>) =>
|
||||||
options?: Options<ListRepositoriesData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
ListRepositoriesResponse,
|
ListRepositoriesResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -553,16 +462,8 @@ export const listRepositoriesOptions = (
|
||||||
*/
|
*/
|
||||||
export const createRepositoryMutation = (
|
export const createRepositoryMutation = (
|
||||||
options?: Partial<Options<CreateRepositoryData>>,
|
options?: Partial<Options<CreateRepositoryData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<CreateRepositoryResponse, DefaultError, Options<CreateRepositoryData>> => {
|
||||||
CreateRepositoryResponse,
|
const mutationOptions: UseMutationOptions<CreateRepositoryResponse, DefaultError, Options<CreateRepositoryData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<CreateRepositoryData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
CreateRepositoryResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<CreateRepositoryData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await createRepository({
|
const { data } = await createRepository({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -575,16 +476,13 @@ export const createRepositoryMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listRcloneRemotesQueryKey = (
|
export const listRcloneRemotesQueryKey = (options?: Options<ListRcloneRemotesData>) =>
|
||||||
options?: Options<ListRcloneRemotesData>,
|
createQueryKey("listRcloneRemotes", options);
|
||||||
) => createQueryKey("listRcloneRemotes", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all configured rclone remotes on the host system
|
* List all configured rclone remotes on the host system
|
||||||
*/
|
*/
|
||||||
export const listRcloneRemotesOptions = (
|
export const listRcloneRemotesOptions = (options?: Options<ListRcloneRemotesData>) =>
|
||||||
options?: Options<ListRcloneRemotesData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
ListRcloneRemotesResponse,
|
ListRcloneRemotesResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -608,16 +506,8 @@ export const listRcloneRemotesOptions = (
|
||||||
*/
|
*/
|
||||||
export const deleteRepositoryMutation = (
|
export const deleteRepositoryMutation = (
|
||||||
options?: Partial<Options<DeleteRepositoryData>>,
|
options?: Partial<Options<DeleteRepositoryData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<DeleteRepositoryResponse, DefaultError, Options<DeleteRepositoryData>> => {
|
||||||
DeleteRepositoryResponse,
|
const mutationOptions: UseMutationOptions<DeleteRepositoryResponse, DefaultError, Options<DeleteRepositoryData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<DeleteRepositoryData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
DeleteRepositoryResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<DeleteRepositoryData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await deleteRepository({
|
const { data } = await deleteRepository({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -630,19 +520,13 @@ export const deleteRepositoryMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRepositoryQueryKey = (options: Options<GetRepositoryData>) =>
|
export const getRepositoryQueryKey = (options: Options<GetRepositoryData>) => createQueryKey("getRepository", options);
|
||||||
createQueryKey("getRepository", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a single repository by ID
|
* Get a single repository by ID
|
||||||
*/
|
*/
|
||||||
export const getRepositoryOptions = (options: Options<GetRepositoryData>) =>
|
export const getRepositoryOptions = (options: Options<GetRepositoryData>) =>
|
||||||
queryOptions<
|
queryOptions<GetRepositoryResponse, DefaultError, GetRepositoryResponse, ReturnType<typeof getRepositoryQueryKey>>({
|
||||||
GetRepositoryResponse,
|
|
||||||
DefaultError,
|
|
||||||
GetRepositoryResponse,
|
|
||||||
ReturnType<typeof getRepositoryQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await getRepository({
|
const { data } = await getRepository({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -660,16 +544,8 @@ export const getRepositoryOptions = (options: Options<GetRepositoryData>) =>
|
||||||
*/
|
*/
|
||||||
export const updateRepositoryMutation = (
|
export const updateRepositoryMutation = (
|
||||||
options?: Partial<Options<UpdateRepositoryData>>,
|
options?: Partial<Options<UpdateRepositoryData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<UpdateRepositoryResponse, DefaultError, Options<UpdateRepositoryData>> => {
|
||||||
UpdateRepositoryResponse,
|
const mutationOptions: UseMutationOptions<UpdateRepositoryResponse, DefaultError, Options<UpdateRepositoryData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<UpdateRepositoryData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
UpdateRepositoryResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<UpdateRepositoryData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await updateRepository({
|
const { data } = await updateRepository({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -687,16 +563,8 @@ export const updateRepositoryMutation = (
|
||||||
*/
|
*/
|
||||||
export const deleteSnapshotsMutation = (
|
export const deleteSnapshotsMutation = (
|
||||||
options?: Partial<Options<DeleteSnapshotsData>>,
|
options?: Partial<Options<DeleteSnapshotsData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<DeleteSnapshotsResponse, DefaultError, Options<DeleteSnapshotsData>> => {
|
||||||
DeleteSnapshotsResponse,
|
const mutationOptions: UseMutationOptions<DeleteSnapshotsResponse, DefaultError, Options<DeleteSnapshotsData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<DeleteSnapshotsData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
DeleteSnapshotsResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<DeleteSnapshotsData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await deleteSnapshots({
|
const { data } = await deleteSnapshots({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -709,19 +577,13 @@ export const deleteSnapshotsMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listSnapshotsQueryKey = (options: Options<ListSnapshotsData>) =>
|
export const listSnapshotsQueryKey = (options: Options<ListSnapshotsData>) => createQueryKey("listSnapshots", options);
|
||||||
createQueryKey("listSnapshots", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all snapshots in a repository
|
* List all snapshots in a repository
|
||||||
*/
|
*/
|
||||||
export const listSnapshotsOptions = (options: Options<ListSnapshotsData>) =>
|
export const listSnapshotsOptions = (options: Options<ListSnapshotsData>) =>
|
||||||
queryOptions<
|
queryOptions<ListSnapshotsResponse, DefaultError, ListSnapshotsResponse, ReturnType<typeof listSnapshotsQueryKey>>({
|
||||||
ListSnapshotsResponse,
|
|
||||||
DefaultError,
|
|
||||||
ListSnapshotsResponse,
|
|
||||||
ReturnType<typeof listSnapshotsQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await listSnapshots({
|
const { data } = await listSnapshots({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -739,16 +601,8 @@ export const listSnapshotsOptions = (options: Options<ListSnapshotsData>) =>
|
||||||
*/
|
*/
|
||||||
export const deleteSnapshotMutation = (
|
export const deleteSnapshotMutation = (
|
||||||
options?: Partial<Options<DeleteSnapshotData>>,
|
options?: Partial<Options<DeleteSnapshotData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<DeleteSnapshotResponse, DefaultError, Options<DeleteSnapshotData>> => {
|
||||||
DeleteSnapshotResponse,
|
const mutationOptions: UseMutationOptions<DeleteSnapshotResponse, DefaultError, Options<DeleteSnapshotData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<DeleteSnapshotData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
DeleteSnapshotResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<DeleteSnapshotData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await deleteSnapshot({
|
const { data } = await deleteSnapshot({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -761,16 +615,13 @@ export const deleteSnapshotMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSnapshotDetailsQueryKey = (
|
export const getSnapshotDetailsQueryKey = (options: Options<GetSnapshotDetailsData>) =>
|
||||||
options: Options<GetSnapshotDetailsData>,
|
createQueryKey("getSnapshotDetails", options);
|
||||||
) => createQueryKey("getSnapshotDetails", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get details of a specific snapshot
|
* Get details of a specific snapshot
|
||||||
*/
|
*/
|
||||||
export const getSnapshotDetailsOptions = (
|
export const getSnapshotDetailsOptions = (options: Options<GetSnapshotDetailsData>) =>
|
||||||
options: Options<GetSnapshotDetailsData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
GetSnapshotDetailsResponse,
|
GetSnapshotDetailsResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -789,16 +640,13 @@ export const getSnapshotDetailsOptions = (
|
||||||
queryKey: getSnapshotDetailsQueryKey(options),
|
queryKey: getSnapshotDetailsQueryKey(options),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const listSnapshotFilesQueryKey = (
|
export const listSnapshotFilesQueryKey = (options: Options<ListSnapshotFilesData>) =>
|
||||||
options: Options<ListSnapshotFilesData>,
|
createQueryKey("listSnapshotFiles", options);
|
||||||
) => createQueryKey("listSnapshotFiles", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List files and directories in a snapshot
|
* List files and directories in a snapshot
|
||||||
*/
|
*/
|
||||||
export const listSnapshotFilesOptions = (
|
export const listSnapshotFilesOptions = (options: Options<ListSnapshotFilesData>) =>
|
||||||
options: Options<ListSnapshotFilesData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
ListSnapshotFilesResponse,
|
ListSnapshotFilesResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -822,16 +670,8 @@ export const listSnapshotFilesOptions = (
|
||||||
*/
|
*/
|
||||||
export const restoreSnapshotMutation = (
|
export const restoreSnapshotMutation = (
|
||||||
options?: Partial<Options<RestoreSnapshotData>>,
|
options?: Partial<Options<RestoreSnapshotData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<RestoreSnapshotResponse, DefaultError, Options<RestoreSnapshotData>> => {
|
||||||
RestoreSnapshotResponse,
|
const mutationOptions: UseMutationOptions<RestoreSnapshotResponse, DefaultError, Options<RestoreSnapshotData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<RestoreSnapshotData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
RestoreSnapshotResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<RestoreSnapshotData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await restoreSnapshot({
|
const { data } = await restoreSnapshot({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -849,16 +689,8 @@ export const restoreSnapshotMutation = (
|
||||||
*/
|
*/
|
||||||
export const doctorRepositoryMutation = (
|
export const doctorRepositoryMutation = (
|
||||||
options?: Partial<Options<DoctorRepositoryData>>,
|
options?: Partial<Options<DoctorRepositoryData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<DoctorRepositoryResponse, DefaultError, Options<DoctorRepositoryData>> => {
|
||||||
DoctorRepositoryResponse,
|
const mutationOptions: UseMutationOptions<DoctorRepositoryResponse, DefaultError, Options<DoctorRepositoryData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<DoctorRepositoryData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
DoctorRepositoryResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<DoctorRepositoryData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await doctorRepository({
|
const { data } = await doctorRepository({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -876,16 +708,8 @@ export const doctorRepositoryMutation = (
|
||||||
*/
|
*/
|
||||||
export const tagSnapshotsMutation = (
|
export const tagSnapshotsMutation = (
|
||||||
options?: Partial<Options<TagSnapshotsData>>,
|
options?: Partial<Options<TagSnapshotsData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<TagSnapshotsResponse, DefaultError, Options<TagSnapshotsData>> => {
|
||||||
TagSnapshotsResponse,
|
const mutationOptions: UseMutationOptions<TagSnapshotsResponse, DefaultError, Options<TagSnapshotsData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<TagSnapshotsData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
TagSnapshotsResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<TagSnapshotsData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await tagSnapshots({
|
const { data } = await tagSnapshots({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -898,16 +722,13 @@ export const tagSnapshotsMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listBackupSchedulesQueryKey = (
|
export const listBackupSchedulesQueryKey = (options?: Options<ListBackupSchedulesData>) =>
|
||||||
options?: Options<ListBackupSchedulesData>,
|
createQueryKey("listBackupSchedules", options);
|
||||||
) => createQueryKey("listBackupSchedules", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all backup schedules
|
* List all backup schedules
|
||||||
*/
|
*/
|
||||||
export const listBackupSchedulesOptions = (
|
export const listBackupSchedulesOptions = (options?: Options<ListBackupSchedulesData>) =>
|
||||||
options?: Options<ListBackupSchedulesData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
ListBackupSchedulesResponse,
|
ListBackupSchedulesResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -931,11 +752,7 @@ export const listBackupSchedulesOptions = (
|
||||||
*/
|
*/
|
||||||
export const createBackupScheduleMutation = (
|
export const createBackupScheduleMutation = (
|
||||||
options?: Partial<Options<CreateBackupScheduleData>>,
|
options?: Partial<Options<CreateBackupScheduleData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<CreateBackupScheduleResponse, DefaultError, Options<CreateBackupScheduleData>> => {
|
||||||
CreateBackupScheduleResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<CreateBackupScheduleData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
CreateBackupScheduleResponse,
|
CreateBackupScheduleResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -958,11 +775,7 @@ export const createBackupScheduleMutation = (
|
||||||
*/
|
*/
|
||||||
export const deleteBackupScheduleMutation = (
|
export const deleteBackupScheduleMutation = (
|
||||||
options?: Partial<Options<DeleteBackupScheduleData>>,
|
options?: Partial<Options<DeleteBackupScheduleData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<DeleteBackupScheduleResponse, DefaultError, Options<DeleteBackupScheduleData>> => {
|
||||||
DeleteBackupScheduleResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<DeleteBackupScheduleData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
DeleteBackupScheduleResponse,
|
DeleteBackupScheduleResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -980,16 +793,13 @@ export const deleteBackupScheduleMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getBackupScheduleQueryKey = (
|
export const getBackupScheduleQueryKey = (options: Options<GetBackupScheduleData>) =>
|
||||||
options: Options<GetBackupScheduleData>,
|
createQueryKey("getBackupSchedule", options);
|
||||||
) => createQueryKey("getBackupSchedule", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a backup schedule by ID
|
* Get a backup schedule by ID
|
||||||
*/
|
*/
|
||||||
export const getBackupScheduleOptions = (
|
export const getBackupScheduleOptions = (options: Options<GetBackupScheduleData>) =>
|
||||||
options: Options<GetBackupScheduleData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
GetBackupScheduleResponse,
|
GetBackupScheduleResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1013,11 +823,7 @@ export const getBackupScheduleOptions = (
|
||||||
*/
|
*/
|
||||||
export const updateBackupScheduleMutation = (
|
export const updateBackupScheduleMutation = (
|
||||||
options?: Partial<Options<UpdateBackupScheduleData>>,
|
options?: Partial<Options<UpdateBackupScheduleData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<UpdateBackupScheduleResponse, DefaultError, Options<UpdateBackupScheduleData>> => {
|
||||||
UpdateBackupScheduleResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<UpdateBackupScheduleData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
UpdateBackupScheduleResponse,
|
UpdateBackupScheduleResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1035,16 +841,13 @@ export const updateBackupScheduleMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getBackupScheduleForVolumeQueryKey = (
|
export const getBackupScheduleForVolumeQueryKey = (options: Options<GetBackupScheduleForVolumeData>) =>
|
||||||
options: Options<GetBackupScheduleForVolumeData>,
|
createQueryKey("getBackupScheduleForVolume", options);
|
||||||
) => createQueryKey("getBackupScheduleForVolume", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a backup schedule for a specific volume
|
* Get a backup schedule for a specific volume
|
||||||
*/
|
*/
|
||||||
export const getBackupScheduleForVolumeOptions = (
|
export const getBackupScheduleForVolumeOptions = (options: Options<GetBackupScheduleForVolumeData>) =>
|
||||||
options: Options<GetBackupScheduleForVolumeData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
GetBackupScheduleForVolumeResponse,
|
GetBackupScheduleForVolumeResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1068,16 +871,8 @@ export const getBackupScheduleForVolumeOptions = (
|
||||||
*/
|
*/
|
||||||
export const runBackupNowMutation = (
|
export const runBackupNowMutation = (
|
||||||
options?: Partial<Options<RunBackupNowData>>,
|
options?: Partial<Options<RunBackupNowData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<RunBackupNowResponse, DefaultError, Options<RunBackupNowData>> => {
|
||||||
RunBackupNowResponse,
|
const mutationOptions: UseMutationOptions<RunBackupNowResponse, DefaultError, Options<RunBackupNowData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<RunBackupNowData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
RunBackupNowResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<RunBackupNowData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await runBackupNow({
|
const { data } = await runBackupNow({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -1095,16 +890,8 @@ export const runBackupNowMutation = (
|
||||||
*/
|
*/
|
||||||
export const stopBackupMutation = (
|
export const stopBackupMutation = (
|
||||||
options?: Partial<Options<StopBackupData>>,
|
options?: Partial<Options<StopBackupData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<StopBackupResponse, DefaultError, Options<StopBackupData>> => {
|
||||||
StopBackupResponse,
|
const mutationOptions: UseMutationOptions<StopBackupResponse, DefaultError, Options<StopBackupData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<StopBackupData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
StopBackupResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<StopBackupData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await stopBackup({
|
const { data } = await stopBackup({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -1122,16 +909,8 @@ export const stopBackupMutation = (
|
||||||
*/
|
*/
|
||||||
export const runForgetMutation = (
|
export const runForgetMutation = (
|
||||||
options?: Partial<Options<RunForgetData>>,
|
options?: Partial<Options<RunForgetData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<RunForgetResponse, DefaultError, Options<RunForgetData>> => {
|
||||||
RunForgetResponse,
|
const mutationOptions: UseMutationOptions<RunForgetResponse, DefaultError, Options<RunForgetData>> = {
|
||||||
DefaultError,
|
|
||||||
Options<RunForgetData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
|
||||||
RunForgetResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<RunForgetData>
|
|
||||||
> = {
|
|
||||||
mutationFn: async (fnOptions) => {
|
mutationFn: async (fnOptions) => {
|
||||||
const { data } = await runForget({
|
const { data } = await runForget({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -1144,16 +923,13 @@ export const runForgetMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getScheduleNotificationsQueryKey = (
|
export const getScheduleNotificationsQueryKey = (options: Options<GetScheduleNotificationsData>) =>
|
||||||
options: Options<GetScheduleNotificationsData>,
|
createQueryKey("getScheduleNotifications", options);
|
||||||
) => createQueryKey("getScheduleNotifications", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get notification assignments for a backup schedule
|
* Get notification assignments for a backup schedule
|
||||||
*/
|
*/
|
||||||
export const getScheduleNotificationsOptions = (
|
export const getScheduleNotificationsOptions = (options: Options<GetScheduleNotificationsData>) =>
|
||||||
options: Options<GetScheduleNotificationsData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
GetScheduleNotificationsResponse,
|
GetScheduleNotificationsResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1177,11 +953,7 @@ export const getScheduleNotificationsOptions = (
|
||||||
*/
|
*/
|
||||||
export const updateScheduleNotificationsMutation = (
|
export const updateScheduleNotificationsMutation = (
|
||||||
options?: Partial<Options<UpdateScheduleNotificationsData>>,
|
options?: Partial<Options<UpdateScheduleNotificationsData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<UpdateScheduleNotificationsResponse, DefaultError, Options<UpdateScheduleNotificationsData>> => {
|
||||||
UpdateScheduleNotificationsResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<UpdateScheduleNotificationsData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
UpdateScheduleNotificationsResponse,
|
UpdateScheduleNotificationsResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1199,16 +971,13 @@ export const updateScheduleNotificationsMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getScheduleMirrorsQueryKey = (
|
export const getScheduleMirrorsQueryKey = (options: Options<GetScheduleMirrorsData>) =>
|
||||||
options: Options<GetScheduleMirrorsData>,
|
createQueryKey("getScheduleMirrors", options);
|
||||||
) => createQueryKey("getScheduleMirrors", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get mirror repository assignments for a backup schedule
|
* Get mirror repository assignments for a backup schedule
|
||||||
*/
|
*/
|
||||||
export const getScheduleMirrorsOptions = (
|
export const getScheduleMirrorsOptions = (options: Options<GetScheduleMirrorsData>) =>
|
||||||
options: Options<GetScheduleMirrorsData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
GetScheduleMirrorsResponse,
|
GetScheduleMirrorsResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1232,11 +1001,7 @@ export const getScheduleMirrorsOptions = (
|
||||||
*/
|
*/
|
||||||
export const updateScheduleMirrorsMutation = (
|
export const updateScheduleMirrorsMutation = (
|
||||||
options?: Partial<Options<UpdateScheduleMirrorsData>>,
|
options?: Partial<Options<UpdateScheduleMirrorsData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<UpdateScheduleMirrorsResponse, DefaultError, Options<UpdateScheduleMirrorsData>> => {
|
||||||
UpdateScheduleMirrorsResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<UpdateScheduleMirrorsData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
UpdateScheduleMirrorsResponse,
|
UpdateScheduleMirrorsResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1254,16 +1019,13 @@ export const updateScheduleMirrorsMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMirrorCompatibilityQueryKey = (
|
export const getMirrorCompatibilityQueryKey = (options: Options<GetMirrorCompatibilityData>) =>
|
||||||
options: Options<GetMirrorCompatibilityData>,
|
createQueryKey("getMirrorCompatibility", options);
|
||||||
) => createQueryKey("getMirrorCompatibility", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get mirror compatibility info for all repositories relative to a backup schedule's primary repository
|
* Get mirror compatibility info for all repositories relative to a backup schedule's primary repository
|
||||||
*/
|
*/
|
||||||
export const getMirrorCompatibilityOptions = (
|
export const getMirrorCompatibilityOptions = (options: Options<GetMirrorCompatibilityData>) =>
|
||||||
options: Options<GetMirrorCompatibilityData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
GetMirrorCompatibilityResponse,
|
GetMirrorCompatibilityResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1287,11 +1049,7 @@ export const getMirrorCompatibilityOptions = (
|
||||||
*/
|
*/
|
||||||
export const reorderBackupSchedulesMutation = (
|
export const reorderBackupSchedulesMutation = (
|
||||||
options?: Partial<Options<ReorderBackupSchedulesData>>,
|
options?: Partial<Options<ReorderBackupSchedulesData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<ReorderBackupSchedulesResponse, DefaultError, Options<ReorderBackupSchedulesData>> => {
|
||||||
ReorderBackupSchedulesResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<ReorderBackupSchedulesData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
ReorderBackupSchedulesResponse,
|
ReorderBackupSchedulesResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1309,16 +1067,13 @@ export const reorderBackupSchedulesMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const listNotificationDestinationsQueryKey = (
|
export const listNotificationDestinationsQueryKey = (options?: Options<ListNotificationDestinationsData>) =>
|
||||||
options?: Options<ListNotificationDestinationsData>,
|
createQueryKey("listNotificationDestinations", options);
|
||||||
) => createQueryKey("listNotificationDestinations", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all notification destinations
|
* List all notification destinations
|
||||||
*/
|
*/
|
||||||
export const listNotificationDestinationsOptions = (
|
export const listNotificationDestinationsOptions = (options?: Options<ListNotificationDestinationsData>) =>
|
||||||
options?: Options<ListNotificationDestinationsData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
ListNotificationDestinationsResponse,
|
ListNotificationDestinationsResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1391,16 +1146,13 @@ export const deleteNotificationDestinationMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getNotificationDestinationQueryKey = (
|
export const getNotificationDestinationQueryKey = (options: Options<GetNotificationDestinationData>) =>
|
||||||
options: Options<GetNotificationDestinationData>,
|
createQueryKey("getNotificationDestination", options);
|
||||||
) => createQueryKey("getNotificationDestination", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a notification destination by ID
|
* Get a notification destination by ID
|
||||||
*/
|
*/
|
||||||
export const getNotificationDestinationOptions = (
|
export const getNotificationDestinationOptions = (options: Options<GetNotificationDestinationData>) =>
|
||||||
options: Options<GetNotificationDestinationData>,
|
|
||||||
) =>
|
|
||||||
queryOptions<
|
queryOptions<
|
||||||
GetNotificationDestinationResponse,
|
GetNotificationDestinationResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1451,11 +1203,7 @@ export const updateNotificationDestinationMutation = (
|
||||||
*/
|
*/
|
||||||
export const testNotificationDestinationMutation = (
|
export const testNotificationDestinationMutation = (
|
||||||
options?: Partial<Options<TestNotificationDestinationData>>,
|
options?: Partial<Options<TestNotificationDestinationData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<TestNotificationDestinationResponse, DefaultError, Options<TestNotificationDestinationData>> => {
|
||||||
TestNotificationDestinationResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<TestNotificationDestinationData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
TestNotificationDestinationResponse,
|
TestNotificationDestinationResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
@ -1473,19 +1221,13 @@ export const testNotificationDestinationMutation = (
|
||||||
return mutationOptions;
|
return mutationOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getSystemInfoQueryKey = (options?: Options<GetSystemInfoData>) =>
|
export const getSystemInfoQueryKey = (options?: Options<GetSystemInfoData>) => createQueryKey("getSystemInfo", options);
|
||||||
createQueryKey("getSystemInfo", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get system information including available capabilities
|
* Get system information including available capabilities
|
||||||
*/
|
*/
|
||||||
export const getSystemInfoOptions = (options?: Options<GetSystemInfoData>) =>
|
export const getSystemInfoOptions = (options?: Options<GetSystemInfoData>) =>
|
||||||
queryOptions<
|
queryOptions<GetSystemInfoResponse, DefaultError, GetSystemInfoResponse, ReturnType<typeof getSystemInfoQueryKey>>({
|
||||||
GetSystemInfoResponse,
|
|
||||||
DefaultError,
|
|
||||||
GetSystemInfoResponse,
|
|
||||||
ReturnType<typeof getSystemInfoQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await getSystemInfo({
|
const { data } = await getSystemInfo({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -1498,19 +1240,13 @@ export const getSystemInfoOptions = (options?: Options<GetSystemInfoData>) =>
|
||||||
queryKey: getSystemInfoQueryKey(options),
|
queryKey: getSystemInfoQueryKey(options),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const getUpdatesQueryKey = (options?: Options<GetUpdatesData>) =>
|
export const getUpdatesQueryKey = (options?: Options<GetUpdatesData>) => createQueryKey("getUpdates", options);
|
||||||
createQueryKey("getUpdates", options);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for application updates from GitHub
|
* Check for application updates from GitHub
|
||||||
*/
|
*/
|
||||||
export const getUpdatesOptions = (options?: Options<GetUpdatesData>) =>
|
export const getUpdatesOptions = (options?: Options<GetUpdatesData>) =>
|
||||||
queryOptions<
|
queryOptions<GetUpdatesResponse, DefaultError, GetUpdatesResponse, ReturnType<typeof getUpdatesQueryKey>>({
|
||||||
GetUpdatesResponse,
|
|
||||||
DefaultError,
|
|
||||||
GetUpdatesResponse,
|
|
||||||
ReturnType<typeof getUpdatesQueryKey>
|
|
||||||
>({
|
|
||||||
queryFn: async ({ queryKey, signal }) => {
|
queryFn: async ({ queryKey, signal }) => {
|
||||||
const { data } = await getUpdates({
|
const { data } = await getUpdates({
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -1528,11 +1264,7 @@ export const getUpdatesOptions = (options?: Options<GetUpdatesData>) =>
|
||||||
*/
|
*/
|
||||||
export const downloadResticPasswordMutation = (
|
export const downloadResticPasswordMutation = (
|
||||||
options?: Partial<Options<DownloadResticPasswordData>>,
|
options?: Partial<Options<DownloadResticPasswordData>>,
|
||||||
): UseMutationOptions<
|
): UseMutationOptions<DownloadResticPasswordResponse, DefaultError, Options<DownloadResticPasswordData>> => {
|
||||||
DownloadResticPasswordResponse,
|
|
||||||
DefaultError,
|
|
||||||
Options<DownloadResticPasswordData>
|
|
||||||
> => {
|
|
||||||
const mutationOptions: UseMutationOptions<
|
const mutationOptions: UseMutationOptions<
|
||||||
DownloadResticPasswordResponse,
|
DownloadResticPasswordResponse,
|
||||||
DefaultError,
|
DefaultError,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,6 @@
|
||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
import {
|
import { type ClientOptions, type Config, createClient, createConfig } from "./client";
|
||||||
type ClientOptions,
|
|
||||||
type Config,
|
|
||||||
createClient,
|
|
||||||
createConfig,
|
|
||||||
} from "./client";
|
|
||||||
import type { ClientOptions as ClientOptions2 } from "./types.gen";
|
import type { ClientOptions as ClientOptions2 } from "./types.gen";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,6 +15,4 @@ export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (
|
||||||
override?: Config<ClientOptions & T>,
|
override?: Config<ClientOptions & T>,
|
||||||
) => Config<Required<ClientOptions> & T>;
|
) => Config<Required<ClientOptions> & T>;
|
||||||
|
|
||||||
export const client = createClient(
|
export const client = createClient(createConfig<ClientOptions2>({ baseUrl: "http://localhost:4096" }));
|
||||||
createConfig<ClientOptions2>({ baseUrl: "http://localhost:4096" }),
|
|
||||||
);
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,7 @@
|
||||||
|
|
||||||
export type { Auth } from "../core/auth.gen";
|
export type { Auth } from "../core/auth.gen";
|
||||||
export type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
export type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
||||||
export {
|
export { formDataBodySerializer, jsonBodySerializer, urlSearchParamsBodySerializer } from "../core/bodySerializer.gen";
|
||||||
formDataBodySerializer,
|
|
||||||
jsonBodySerializer,
|
|
||||||
urlSearchParamsBodySerializer,
|
|
||||||
} from "../core/bodySerializer.gen";
|
|
||||||
export { buildClientParams } from "../core/params.gen";
|
export { buildClientParams } from "../core/params.gen";
|
||||||
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen";
|
export { serializeQueryKeyValue } from "../core/queryKeySerializer.gen";
|
||||||
export { createClient } from "./client.gen";
|
export { createClient } from "./client.gen";
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,14 @@
|
||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// 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 {
|
import type { ServerSentEventsOptions, ServerSentEventsResult } from "../core/serverSentEvents.gen";
|
||||||
ServerSentEventsOptions,
|
import type { Client as CoreClient, Config as CoreConfig } from "../core/types.gen";
|
||||||
ServerSentEventsResult,
|
|
||||||
} from "../core/serverSentEvents.gen";
|
|
||||||
import type {
|
|
||||||
Client as CoreClient,
|
|
||||||
Config as CoreConfig,
|
|
||||||
} from "../core/types.gen";
|
|
||||||
import type { Middleware } from "./utils.gen";
|
import type { Middleware } from "./utils.gen";
|
||||||
|
|
||||||
export type ResponseStyle = "data" | "fields";
|
export type ResponseStyle = "data" | "fields";
|
||||||
|
|
||||||
export interface Config<T extends ClientOptions = ClientOptions>
|
export interface Config<T extends ClientOptions = ClientOptions>
|
||||||
extends Omit<RequestInit, "body" | "headers" | "method">,
|
extends Omit<RequestInit, "body" | "headers" | "method">, CoreConfig {
|
||||||
CoreConfig {
|
|
||||||
/**
|
/**
|
||||||
* Base URL for all requests made by this client.
|
* Base URL for all requests made by this client.
|
||||||
*/
|
*/
|
||||||
|
|
@ -42,14 +35,7 @@ export interface Config<T extends ClientOptions = ClientOptions>
|
||||||
*
|
*
|
||||||
* @default 'auto'
|
* @default 'auto'
|
||||||
*/
|
*/
|
||||||
parseAs?:
|
parseAs?: "arrayBuffer" | "auto" | "blob" | "formData" | "json" | "stream" | "text";
|
||||||
| "arrayBuffer"
|
|
||||||
| "auto"
|
|
||||||
| "blob"
|
|
||||||
| "formData"
|
|
||||||
| "json"
|
|
||||||
| "stream"
|
|
||||||
| "text";
|
|
||||||
/**
|
/**
|
||||||
* Should we return only data or multiple fields (data, error, response, etc.)?
|
* Should we return only data or multiple fields (data, error, response, etc.)?
|
||||||
*
|
*
|
||||||
|
|
@ -69,17 +55,15 @@ export interface RequestOptions<
|
||||||
TResponseStyle extends ResponseStyle = "fields",
|
TResponseStyle extends ResponseStyle = "fields",
|
||||||
ThrowOnError extends boolean = boolean,
|
ThrowOnError extends boolean = boolean,
|
||||||
Url extends string = string,
|
Url extends string = string,
|
||||||
> extends Config<{
|
>
|
||||||
|
extends
|
||||||
|
Config<{
|
||||||
responseStyle: TResponseStyle;
|
responseStyle: TResponseStyle;
|
||||||
throwOnError: ThrowOnError;
|
throwOnError: ThrowOnError;
|
||||||
}>,
|
}>,
|
||||||
Pick<
|
Pick<
|
||||||
ServerSentEventsOptions<TData>,
|
ServerSentEventsOptions<TData>,
|
||||||
| "onSseError"
|
"onSseError" | "onSseEvent" | "sseDefaultRetryDelay" | "sseMaxRetryAttempts" | "sseMaxRetryDelay"
|
||||||
| "onSseEvent"
|
|
||||||
| "sseDefaultRetryDelay"
|
|
||||||
| "sseMaxRetryAttempts"
|
|
||||||
| "sseMaxRetryDelay"
|
|
||||||
> {
|
> {
|
||||||
/**
|
/**
|
||||||
* Any body that you want to add to your request.
|
* Any body that you want to add to your request.
|
||||||
|
|
@ -116,32 +100,22 @@ export type RequestResult<
|
||||||
? TData[keyof TData]
|
? TData[keyof TData]
|
||||||
: TData
|
: TData
|
||||||
: {
|
: {
|
||||||
data: TData extends Record<string, unknown>
|
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
||||||
? TData[keyof TData]
|
|
||||||
: TData;
|
|
||||||
request: Request;
|
request: Request;
|
||||||
response: Response;
|
response: Response;
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
: Promise<
|
: Promise<
|
||||||
TResponseStyle extends "data"
|
TResponseStyle extends "data"
|
||||||
?
|
? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined
|
||||||
| (TData extends Record<string, unknown>
|
|
||||||
? TData[keyof TData]
|
|
||||||
: TData)
|
|
||||||
| undefined
|
|
||||||
: (
|
: (
|
||||||
| {
|
| {
|
||||||
data: TData extends Record<string, unknown>
|
data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
|
||||||
? TData[keyof TData]
|
|
||||||
: TData;
|
|
||||||
error: undefined;
|
error: undefined;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
data: undefined;
|
data: undefined;
|
||||||
error: TError extends Record<string, unknown>
|
error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
|
||||||
? TError[keyof TError]
|
|
||||||
: TError;
|
|
||||||
}
|
}
|
||||||
) & {
|
) & {
|
||||||
request: Request;
|
request: Request;
|
||||||
|
|
@ -180,10 +154,7 @@ type RequestFn = <
|
||||||
TResponseStyle extends ResponseStyle = "fields",
|
TResponseStyle extends ResponseStyle = "fields",
|
||||||
>(
|
>(
|
||||||
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> &
|
options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, "method"> &
|
||||||
Pick<
|
Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, "method">,
|
||||||
Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>,
|
|
||||||
"method"
|
|
||||||
>,
|
|
||||||
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
||||||
|
|
||||||
type BuildUrlFn = <
|
type BuildUrlFn = <
|
||||||
|
|
@ -197,13 +168,7 @@ type BuildUrlFn = <
|
||||||
options: TData & Options<TData>,
|
options: TData & Options<TData>,
|
||||||
) => string;
|
) => string;
|
||||||
|
|
||||||
export type Client = CoreClient<
|
export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
|
||||||
RequestFn,
|
|
||||||
Config,
|
|
||||||
MethodFn,
|
|
||||||
BuildUrlFn,
|
|
||||||
SseFn
|
|
||||||
> & {
|
|
||||||
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -234,8 +199,5 @@ export type Options<
|
||||||
ThrowOnError extends boolean = boolean,
|
ThrowOnError extends boolean = boolean,
|
||||||
TResponse = unknown,
|
TResponse = unknown,
|
||||||
TResponseStyle extends ResponseStyle = "fields",
|
TResponseStyle extends ResponseStyle = "fields",
|
||||||
> = OmitKeys<
|
> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, "body" | "path" | "query" | "url"> &
|
||||||
RequestOptions<TResponse, TResponseStyle, ThrowOnError>,
|
|
||||||
"body" | "path" | "query" | "url"
|
|
||||||
> &
|
|
||||||
([TData] extends [never] ? unknown : Omit<TData, "url">);
|
([TData] extends [never] ? unknown : Omit<TData, "url">);
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,11 @@
|
||||||
import { getAuthToken } from "../core/auth.gen";
|
import { getAuthToken } from "../core/auth.gen";
|
||||||
import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
import type { QuerySerializerOptions } from "../core/bodySerializer.gen";
|
||||||
import { jsonBodySerializer } from "../core/bodySerializer.gen";
|
import { jsonBodySerializer } from "../core/bodySerializer.gen";
|
||||||
import {
|
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam } from "../core/pathSerializer.gen";
|
||||||
serializeArrayParam,
|
|
||||||
serializeObjectParam,
|
|
||||||
serializePrimitiveParam,
|
|
||||||
} from "../core/pathSerializer.gen";
|
|
||||||
import { getUrl } from "../core/utils.gen";
|
import { getUrl } from "../core/utils.gen";
|
||||||
import type {
|
import type { Client, ClientOptions, Config, RequestOptions } from "./types.gen";
|
||||||
Client,
|
|
||||||
ClientOptions,
|
|
||||||
Config,
|
|
||||||
RequestOptions,
|
|
||||||
} from "./types.gen";
|
|
||||||
|
|
||||||
export const createQuerySerializer = <T = unknown>({
|
export const createQuerySerializer = <T = unknown>({ parameters = {}, ...args }: QuerySerializerOptions = {}) => {
|
||||||
parameters = {},
|
|
||||||
...args
|
|
||||||
}: QuerySerializerOptions = {}) => {
|
|
||||||
const querySerializer = (queryParams: T) => {
|
const querySerializer = (queryParams: T) => {
|
||||||
const search: string[] = [];
|
const search: string[] = [];
|
||||||
if (queryParams && typeof queryParams === "object") {
|
if (queryParams && typeof queryParams === "object") {
|
||||||
|
|
@ -70,9 +58,7 @@ export const createQuerySerializer = <T = unknown>({
|
||||||
/**
|
/**
|
||||||
* Infers parseAs value from provided Content-Type header.
|
* Infers parseAs value from provided Content-Type header.
|
||||||
*/
|
*/
|
||||||
export const getParseAs = (
|
export const getParseAs = (contentType: string | null): Exclude<Config["parseAs"], "auto"> => {
|
||||||
contentType: string | null,
|
|
||||||
): Exclude<Config["parseAs"], "auto"> => {
|
|
||||||
if (!contentType) {
|
if (!contentType) {
|
||||||
// If no Content-Type header is provided, the best we can do is return the raw response body,
|
// 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.
|
// which is effectively the same as the 'stream' option.
|
||||||
|
|
@ -85,10 +71,7 @@ export const getParseAs = (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
||||||
cleanContent.startsWith("application/json") ||
|
|
||||||
cleanContent.endsWith("+json")
|
|
||||||
) {
|
|
||||||
return "json";
|
return "json";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,11 +79,7 @@ export const getParseAs = (
|
||||||
return "formData";
|
return "formData";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
||||||
["application/", "audio/", "image/", "video/"].some((type) =>
|
|
||||||
cleanContent.startsWith(type),
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return "blob";
|
return "blob";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,11 +99,7 @@ const checkForExistence = (
|
||||||
if (!name) {
|
if (!name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (
|
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
||||||
options.headers.has(name) ||
|
|
||||||
options.query?.[name] ||
|
|
||||||
options.headers.get("Cookie")?.includes(`${name}=`)
|
|
||||||
) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -197,19 +172,14 @@ const headersEntries = (headers: Headers): Array<[string, string]> => {
|
||||||
return entries;
|
return entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mergeHeaders = (
|
export const mergeHeaders = (...headers: Array<Required<Config>["headers"] | undefined>): Headers => {
|
||||||
...headers: Array<Required<Config>["headers"] | undefined>
|
|
||||||
): Headers => {
|
|
||||||
const mergedHeaders = new Headers();
|
const mergedHeaders = new Headers();
|
||||||
for (const header of headers) {
|
for (const header of headers) {
|
||||||
if (!header) {
|
if (!header) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const iterator =
|
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
||||||
header instanceof Headers
|
|
||||||
? headersEntries(header)
|
|
||||||
: Object.entries(header);
|
|
||||||
|
|
||||||
for (const [key, value] of iterator) {
|
for (const [key, value] of iterator) {
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
|
|
@ -221,10 +191,7 @@ export const mergeHeaders = (
|
||||||
} else if (value !== undefined) {
|
} else if (value !== undefined) {
|
||||||
// assume object headers are meant to be JSON stringified, i.e. their
|
// assume object headers are meant to be JSON stringified, i.e. their
|
||||||
// content value in OpenAPI specification is 'application/json'
|
// content value in OpenAPI specification is 'application/json'
|
||||||
mergedHeaders.set(
|
mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : (value as string));
|
||||||
key,
|
|
||||||
typeof value === "object" ? JSON.stringify(value) : (value as string),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -238,16 +205,9 @@ type ErrInterceptor<Err, Res, Req, Options> = (
|
||||||
options: Options,
|
options: Options,
|
||||||
) => Err | Promise<Err>;
|
) => Err | Promise<Err>;
|
||||||
|
|
||||||
type ReqInterceptor<Req, Options> = (
|
type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
||||||
request: Req,
|
|
||||||
options: Options,
|
|
||||||
) => Req | Promise<Req>;
|
|
||||||
|
|
||||||
type ResInterceptor<Res, Req, Options> = (
|
type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
||||||
response: Res,
|
|
||||||
request: Req,
|
|
||||||
options: Options,
|
|
||||||
) => Res | Promise<Res>;
|
|
||||||
|
|
||||||
class Interceptors<Interceptor> {
|
class Interceptors<Interceptor> {
|
||||||
fns: Array<Interceptor | null> = [];
|
fns: Array<Interceptor | null> = [];
|
||||||
|
|
@ -275,10 +235,7 @@ class Interceptors<Interceptor> {
|
||||||
return this.fns.indexOf(id);
|
return this.fns.indexOf(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
update(
|
update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false {
|
||||||
id: number | Interceptor,
|
|
||||||
fn: Interceptor,
|
|
||||||
): number | Interceptor | false {
|
|
||||||
const index = this.getInterceptorIndex(id);
|
const index = this.getInterceptorIndex(id);
|
||||||
if (this.fns[index]) {
|
if (this.fns[index]) {
|
||||||
this.fns[index] = fn;
|
this.fns[index] = fn;
|
||||||
|
|
@ -299,12 +256,7 @@ export interface Middleware<Req, Res, Err, Options> {
|
||||||
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
response: Interceptors<ResInterceptor<Res, Req, Options>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createInterceptors = <Req, Res, Err, Options>(): Middleware<
|
export const createInterceptors = <Req, Res, Err, Options>(): Middleware<Req, Res, Err, Options> => ({
|
||||||
Req,
|
|
||||||
Res,
|
|
||||||
Err,
|
|
||||||
Options
|
|
||||||
> => ({
|
|
||||||
error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),
|
error: new Interceptors<ErrInterceptor<Err, Res, Req, Options>>(),
|
||||||
request: new Interceptors<ReqInterceptor<Req, Options>>(),
|
request: new Interceptors<ReqInterceptor<Req, Options>>(),
|
||||||
response: new Interceptors<ResInterceptor<Res, Req, Options>>(),
|
response: new Interceptors<ResInterceptor<Res, Req, Options>>(),
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,7 @@ export const getAuthToken = async (
|
||||||
auth: Auth,
|
auth: Auth,
|
||||||
callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
|
callback: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken,
|
||||||
): Promise<string | undefined> => {
|
): Promise<string | undefined> => {
|
||||||
const token =
|
const token = typeof callback === "function" ? await callback(auth) : callback;
|
||||||
typeof callback === "function" ? await callback(auth) : callback;
|
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
import type {
|
import type { ArrayStyle, ObjectStyle, SerializerOptions } from "./pathSerializer.gen";
|
||||||
ArrayStyle,
|
|
||||||
ObjectStyle,
|
|
||||||
SerializerOptions,
|
|
||||||
} from "./pathSerializer.gen";
|
|
||||||
|
|
||||||
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
export type QuerySerializer = (query: Record<string, unknown>) => string;
|
||||||
|
|
||||||
|
|
@ -24,11 +20,7 @@ export type QuerySerializerOptions = QuerySerializerOptionsObject & {
|
||||||
parameters?: Record<string, QuerySerializerOptionsObject>;
|
parameters?: Record<string, QuerySerializerOptionsObject>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const serializeFormDataPair = (
|
const serializeFormDataPair = (data: FormData, key: string, value: unknown): void => {
|
||||||
data: FormData,
|
|
||||||
key: string,
|
|
||||||
value: unknown,
|
|
||||||
): void => {
|
|
||||||
if (typeof value === "string" || value instanceof Blob) {
|
if (typeof value === "string" || value instanceof Blob) {
|
||||||
data.append(key, value);
|
data.append(key, value);
|
||||||
} else if (value instanceof Date) {
|
} else if (value instanceof Date) {
|
||||||
|
|
@ -38,11 +30,7 @@ const serializeFormDataPair = (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const serializeUrlSearchParamsPair = (
|
const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value: unknown): void => {
|
||||||
data: URLSearchParams,
|
|
||||||
key: string,
|
|
||||||
value: unknown,
|
|
||||||
): void => {
|
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
data.append(key, value);
|
data.append(key, value);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -51,9 +39,7 @@ const serializeUrlSearchParamsPair = (
|
||||||
};
|
};
|
||||||
|
|
||||||
export const formDataBodySerializer = {
|
export const formDataBodySerializer = {
|
||||||
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): FormData => {
|
||||||
body: T,
|
|
||||||
): FormData => {
|
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
|
|
||||||
Object.entries(body).forEach(([key, value]) => {
|
Object.entries(body).forEach(([key, value]) => {
|
||||||
|
|
@ -73,15 +59,11 @@ export const formDataBodySerializer = {
|
||||||
|
|
||||||
export const jsonBodySerializer = {
|
export const jsonBodySerializer = {
|
||||||
bodySerializer: <T>(body: T): string =>
|
bodySerializer: <T>(body: T): string =>
|
||||||
JSON.stringify(body, (_key, value) =>
|
JSON.stringify(body, (_key, value) => (typeof value === "bigint" ? value.toString() : value)),
|
||||||
typeof value === "bigint" ? value.toString() : value,
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const urlSearchParamsBodySerializer = {
|
export const urlSearchParamsBodySerializer = {
|
||||||
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
|
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
|
||||||
body: T,
|
|
||||||
): string => {
|
|
||||||
const data = new URLSearchParams();
|
const data = new URLSearchParams();
|
||||||
|
|
||||||
Object.entries(body).forEach(([key, value]) => {
|
Object.entries(body).forEach(([key, value]) => {
|
||||||
|
|
|
||||||
|
|
@ -102,10 +102,7 @@ const stripEmptySlots = (params: Params) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const buildClientParams = (
|
export const buildClientParams = (args: ReadonlyArray<unknown>, fields: FieldsConfig) => {
|
||||||
args: ReadonlyArray<unknown>,
|
|
||||||
fields: FieldsConfig,
|
|
||||||
) => {
|
|
||||||
const params: Params = {
|
const params: Params = {
|
||||||
body: {},
|
body: {},
|
||||||
headers: {},
|
headers: {},
|
||||||
|
|
@ -148,15 +145,11 @@ export const buildClientParams = (
|
||||||
params[field.map] = value;
|
params[field.map] = value;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const extra = extraPrefixes.find(([prefix]) =>
|
const extra = extraPrefixes.find(([prefix]) => key.startsWith(prefix));
|
||||||
key.startsWith(prefix),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (extra) {
|
if (extra) {
|
||||||
const [prefix, slot] = extra;
|
const [prefix, slot] = extra;
|
||||||
(params[slot] as Record<string, unknown>)[
|
(params[slot] as Record<string, unknown>)[key.slice(prefix.length)] = value;
|
||||||
key.slice(prefix.length)
|
|
||||||
] = value;
|
|
||||||
} else if ("allowExtra" in config && config.allowExtra) {
|
} else if ("allowExtra" in config && config.allowExtra) {
|
||||||
for (const [slot, allowed] of Object.entries(config.allowExtra)) {
|
for (const [slot, allowed] of Object.entries(config.allowExtra)) {
|
||||||
if (allowed) {
|
if (allowed) {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// This file is auto-generated by @hey-api/openapi-ts
|
||||||
|
|
||||||
interface SerializeOptions<T>
|
interface SerializeOptions<T> extends SerializePrimitiveOptions, SerializerOptions<T> {}
|
||||||
extends SerializePrimitiveOptions,
|
|
||||||
SerializerOptions<T> {}
|
|
||||||
|
|
||||||
interface SerializePrimitiveOptions {
|
interface SerializePrimitiveOptions {
|
||||||
allowReserved?: boolean;
|
allowReserved?: boolean;
|
||||||
|
|
@ -76,9 +74,9 @@ export const serializeArrayParam = ({
|
||||||
value: unknown[];
|
value: unknown[];
|
||||||
}) => {
|
}) => {
|
||||||
if (!explode) {
|
if (!explode) {
|
||||||
const joinedValues = (
|
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v as string))).join(
|
||||||
allowReserved ? value : value.map((v) => encodeURIComponent(v as string))
|
separatorArrayNoExplode(style),
|
||||||
).join(separatorArrayNoExplode(style));
|
);
|
||||||
switch (style) {
|
switch (style) {
|
||||||
case "label":
|
case "label":
|
||||||
return `.${joinedValues}`;
|
return `.${joinedValues}`;
|
||||||
|
|
@ -105,16 +103,10 @@ export const serializeArrayParam = ({
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.join(separator);
|
.join(separator);
|
||||||
return style === "label" || style === "matrix"
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
||||||
? separator + joinedValues
|
|
||||||
: joinedValues;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const serializePrimitiveParam = ({
|
export const serializePrimitiveParam = ({ allowReserved, name, value }: SerializePrimitiveParam) => {
|
||||||
allowReserved,
|
|
||||||
name,
|
|
||||||
value,
|
|
||||||
}: SerializePrimitiveParam) => {
|
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
@ -146,11 +138,7 @@ export const serializeObjectParam = ({
|
||||||
if (style !== "deepObject" && !explode) {
|
if (style !== "deepObject" && !explode) {
|
||||||
let values: string[] = [];
|
let values: string[] = [];
|
||||||
Object.entries(value).forEach(([key, v]) => {
|
Object.entries(value).forEach(([key, v]) => {
|
||||||
values = [
|
values = [...values, key, allowReserved ? (v as string) : encodeURIComponent(v as string)];
|
||||||
...values,
|
|
||||||
key,
|
|
||||||
allowReserved ? (v as string) : encodeURIComponent(v as string),
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
const joinedValues = values.join(",");
|
const joinedValues = values.join(",");
|
||||||
switch (style) {
|
switch (style) {
|
||||||
|
|
@ -175,7 +163,5 @@ export const serializeObjectParam = ({
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.join(separator);
|
.join(separator);
|
||||||
return style === "label" || style === "matrix"
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
||||||
? separator + joinedValues
|
|
||||||
: joinedValues;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -3,23 +3,13 @@
|
||||||
/**
|
/**
|
||||||
* JSON-friendly union that mirrors what Pinia Colada can hash.
|
* JSON-friendly union that mirrors what Pinia Colada can hash.
|
||||||
*/
|
*/
|
||||||
export type JsonValue =
|
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.
|
* Replacer that converts non-JSON values (bigint, Date, etc.) to safe substitutes.
|
||||||
*/
|
*/
|
||||||
export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
|
export const queryKeyJsonReplacer = (_key: string, value: unknown) => {
|
||||||
if (
|
if (value === undefined || typeof value === "function" || typeof value === "symbol") {
|
||||||
value === undefined ||
|
|
||||||
typeof value === "function" ||
|
|
||||||
typeof value === "symbol"
|
|
||||||
) {
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (typeof value === "bigint") {
|
if (typeof value === "bigint") {
|
||||||
|
|
@ -61,9 +51,7 @@ const isPlainObject = (value: unknown): value is Record<string, unknown> => {
|
||||||
* Turns URLSearchParams into a sorted JSON object for deterministic keys.
|
* Turns URLSearchParams into a sorted JSON object for deterministic keys.
|
||||||
*/
|
*/
|
||||||
const serializeSearchParams = (params: URLSearchParams): JsonValue => {
|
const serializeSearchParams = (params: URLSearchParams): JsonValue => {
|
||||||
const entries = Array.from(params.entries()).sort(([a], [b]) =>
|
const entries = Array.from(params.entries()).sort(([a], [b]) => a.localeCompare(b));
|
||||||
a.localeCompare(b),
|
|
||||||
);
|
|
||||||
const result: Record<string, JsonValue> = {};
|
const result: Record<string, JsonValue> = {};
|
||||||
|
|
||||||
for (const [key, value] of entries) {
|
for (const [key, value] of entries) {
|
||||||
|
|
@ -86,26 +74,16 @@ const serializeSearchParams = (params: URLSearchParams): JsonValue => {
|
||||||
/**
|
/**
|
||||||
* Normalizes any accepted value into a JSON-friendly shape for query keys.
|
* Normalizes any accepted value into a JSON-friendly shape for query keys.
|
||||||
*/
|
*/
|
||||||
export const serializeQueryKeyValue = (
|
export const serializeQueryKeyValue = (value: unknown): JsonValue | undefined => {
|
||||||
value: unknown,
|
|
||||||
): JsonValue | undefined => {
|
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
||||||
typeof value === "string" ||
|
|
||||||
typeof value === "number" ||
|
|
||||||
typeof value === "boolean"
|
|
||||||
) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (value === undefined || typeof value === "function" || typeof value === "symbol") {
|
||||||
value === undefined ||
|
|
||||||
typeof value === "function" ||
|
|
||||||
typeof value === "symbol"
|
|
||||||
) {
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,10 +99,7 @@ export const serializeQueryKeyValue = (
|
||||||
return stringifyToJsonValue(value);
|
return stringifyToJsonValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (typeof URLSearchParams !== "undefined" && value instanceof URLSearchParams) {
|
||||||
typeof URLSearchParams !== "undefined" &&
|
|
||||||
value instanceof URLSearchParams
|
|
||||||
) {
|
|
||||||
return serializeSearchParams(value);
|
return serializeSearchParams(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,7 @@
|
||||||
|
|
||||||
import type { Config } from "./types.gen";
|
import type { Config } from "./types.gen";
|
||||||
|
|
||||||
export type ServerSentEventsOptions<TData = unknown> = Omit<
|
export type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, "method"> &
|
||||||
RequestInit,
|
|
||||||
"method"
|
|
||||||
> &
|
|
||||||
Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
|
Pick<Config, "method" | "responseTransformer" | "responseValidator"> & {
|
||||||
/**
|
/**
|
||||||
* Fetch API implementation. You can use this option to provide a custom
|
* Fetch API implementation. You can use this option to provide a custom
|
||||||
|
|
@ -74,16 +71,8 @@ export interface StreamEvent<TData = unknown> {
|
||||||
retry?: number;
|
retry?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ServerSentEventsResult<
|
export type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
|
||||||
TData = unknown,
|
stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
|
||||||
TReturn = void,
|
|
||||||
TNext = unknown,
|
|
||||||
> = {
|
|
||||||
stream: AsyncGenerator<
|
|
||||||
TData extends Record<string, unknown> ? TData[keyof TData] : TData,
|
|
||||||
TReturn,
|
|
||||||
TNext
|
|
||||||
>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createSseClient = <TData = unknown>({
|
export const createSseClient = <TData = unknown>({
|
||||||
|
|
@ -101,9 +90,7 @@ export const createSseClient = <TData = unknown>({
|
||||||
}: ServerSentEventsOptions): ServerSentEventsResult<TData> => {
|
}: ServerSentEventsOptions): ServerSentEventsResult<TData> => {
|
||||||
let lastEventId: string | undefined;
|
let lastEventId: string | undefined;
|
||||||
|
|
||||||
const sleep =
|
const sleep = sseSleepFn ?? ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
|
||||||
sseSleepFn ??
|
|
||||||
((ms: number) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
||||||
|
|
||||||
const createStream = async function* () {
|
const createStream = async function* () {
|
||||||
let retryDelay: number = sseDefaultRetryDelay ?? 3000;
|
let retryDelay: number = sseDefaultRetryDelay ?? 3000;
|
||||||
|
|
@ -141,16 +128,11 @@ export const createSseClient = <TData = unknown>({
|
||||||
const _fetch = options.fetch ?? globalThis.fetch;
|
const _fetch = options.fetch ?? globalThis.fetch;
|
||||||
const response = await _fetch(request);
|
const response = await _fetch(request);
|
||||||
|
|
||||||
if (!response.ok)
|
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
||||||
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
|
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
||||||
.pipeThrough(new TextDecoderStream())
|
|
||||||
.getReader();
|
|
||||||
|
|
||||||
let buffer = "";
|
let buffer = "";
|
||||||
|
|
||||||
|
|
@ -188,10 +170,7 @@ export const createSseClient = <TData = unknown>({
|
||||||
} else if (line.startsWith("id:")) {
|
} else if (line.startsWith("id:")) {
|
||||||
lastEventId = line.replace(/^id:\s*/, "");
|
lastEventId = line.replace(/^id:\s*/, "");
|
||||||
} else if (line.startsWith("retry:")) {
|
} else if (line.startsWith("retry:")) {
|
||||||
const parsed = Number.parseInt(
|
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
||||||
line.replace(/^retry:\s*/, ""),
|
|
||||||
10,
|
|
||||||
);
|
|
||||||
if (!Number.isNaN(parsed)) {
|
if (!Number.isNaN(parsed)) {
|
||||||
retryDelay = parsed;
|
retryDelay = parsed;
|
||||||
}
|
}
|
||||||
|
|
@ -243,18 +222,12 @@ export const createSseClient = <TData = unknown>({
|
||||||
// connection failed or aborted; retry after delay
|
// connection failed or aborted; retry after delay
|
||||||
onSseError?.(error);
|
onSseError?.(error);
|
||||||
|
|
||||||
if (
|
if (sseMaxRetryAttempts !== undefined && attempt >= sseMaxRetryAttempts) {
|
||||||
sseMaxRetryAttempts !== undefined &&
|
|
||||||
attempt >= sseMaxRetryAttempts
|
|
||||||
) {
|
|
||||||
break; // stop after firing error
|
break; // stop after firing error
|
||||||
}
|
}
|
||||||
|
|
||||||
// exponential backoff: double retry each attempt, cap at 30s
|
// exponential backoff: double retry each attempt, cap at 30s
|
||||||
const backoff = Math.min(
|
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
|
||||||
retryDelay * 2 ** (attempt - 1),
|
|
||||||
sseMaxRetryDelay ?? 30000,
|
|
||||||
);
|
|
||||||
await sleep(backoff);
|
await sleep(backoff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,11 @@
|
||||||
// This file is auto-generated by @hey-api/openapi-ts
|
// 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 {
|
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from "./bodySerializer.gen";
|
||||||
BodySerializer,
|
|
||||||
QuerySerializer,
|
|
||||||
QuerySerializerOptions,
|
|
||||||
} from "./bodySerializer.gen";
|
|
||||||
|
|
||||||
export type HttpMethod =
|
export type HttpMethod = "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
||||||
| "connect"
|
|
||||||
| "delete"
|
|
||||||
| "get"
|
|
||||||
| "head"
|
|
||||||
| "options"
|
|
||||||
| "patch"
|
|
||||||
| "post"
|
|
||||||
| "put"
|
|
||||||
| "trace";
|
|
||||||
|
|
||||||
export type Client<
|
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.
|
* Returns the final request URL.
|
||||||
*/
|
*/
|
||||||
|
|
@ -34,9 +15,7 @@ export type Client<
|
||||||
setConfig: (config: Config) => Config;
|
setConfig: (config: Config) => Config;
|
||||||
} & {
|
} & {
|
||||||
[K in HttpMethod]: MethodFn;
|
[K in HttpMethod]: MethodFn;
|
||||||
} & ([SseFn] extends [never]
|
} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } });
|
||||||
? { sse?: never }
|
|
||||||
: { sse: { [K in HttpMethod]: SseFn } });
|
|
||||||
|
|
||||||
export interface Config {
|
export interface Config {
|
||||||
/**
|
/**
|
||||||
|
|
@ -57,16 +36,7 @@ export interface Config {
|
||||||
*/
|
*/
|
||||||
headers?:
|
headers?:
|
||||||
| RequestInit["headers"]
|
| RequestInit["headers"]
|
||||||
| Record<
|
| Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
||||||
string,
|
|
||||||
| string
|
|
||||||
| number
|
|
||||||
| boolean
|
|
||||||
| (string | number | boolean)[]
|
|
||||||
| null
|
|
||||||
| undefined
|
|
||||||
| unknown
|
|
||||||
>;
|
|
||||||
/**
|
/**
|
||||||
* The request method.
|
* The request method.
|
||||||
*
|
*
|
||||||
|
|
@ -112,7 +82,5 @@ type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
export type OmitNever<T extends Record<string, unknown>> = {
|
export type OmitNever<T extends Record<string, unknown>> = {
|
||||||
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true
|
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
|
||||||
? never
|
|
||||||
: K]: T[K];
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
url = url.replace(
|
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
||||||
match,
|
|
||||||
serializeArrayParam({ explode, name, style, value }),
|
|
||||||
);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -76,9 +73,7 @@ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const replaceValue = encodeURIComponent(
|
const replaceValue = encodeURIComponent(style === "label" ? `.${value as string}` : (value as string));
|
||||||
style === "label" ? `.${value as string}` : (value as string),
|
|
||||||
);
|
|
||||||
url = url.replace(match, replaceValue);
|
url = url.replace(match, replaceValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -123,8 +118,7 @@ export function getValidRequestBody(options: {
|
||||||
|
|
||||||
if (isSerializedBody) {
|
if (isSerializedBody) {
|
||||||
if ("serializedBody" in options) {
|
if ("serializedBody" in options) {
|
||||||
const hasSerializedBody =
|
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== "";
|
||||||
options.serializedBody !== undefined && options.serializedBody !== "";
|
|
||||||
|
|
||||||
return hasSerializedBody ? options.serializedBody : null;
|
return hasSerializedBody ? options.serializedBody : null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,10 +114,10 @@ import type {
|
||||||
UpdateVolumeResponses,
|
UpdateVolumeResponses,
|
||||||
} from "./types.gen";
|
} from "./types.gen";
|
||||||
|
|
||||||
export type Options<
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<
|
||||||
TData extends TDataShape = TDataShape,
|
TData,
|
||||||
ThrowOnError extends boolean = boolean,
|
ThrowOnError
|
||||||
> = Options2<TData, ThrowOnError> & {
|
> & {
|
||||||
/**
|
/**
|
||||||
* You can provide a client instance returned by `createClient()` instead of
|
* You can provide a client instance returned by `createClient()` instead of
|
||||||
* individual options. This might be also useful if you want to implement a
|
* individual options. This might be also useful if you want to implement a
|
||||||
|
|
@ -134,9 +134,7 @@ export type Options<
|
||||||
/**
|
/**
|
||||||
* Get authentication system status
|
* Get authentication system status
|
||||||
*/
|
*/
|
||||||
export const getStatus = <ThrowOnError extends boolean = false>(
|
export const getStatus = <ThrowOnError extends boolean = false>(options?: Options<GetStatusData, ThrowOnError>) =>
|
||||||
options?: Options<GetStatusData, ThrowOnError>,
|
|
||||||
) =>
|
|
||||||
(options?.client ?? client).get<GetStatusResponses, unknown, ThrowOnError>({
|
(options?.client ?? client).get<GetStatusResponses, unknown, ThrowOnError>({
|
||||||
url: "/api/v1/auth/status",
|
url: "/api/v1/auth/status",
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -145,25 +143,14 @@ export const getStatus = <ThrowOnError extends boolean = false>(
|
||||||
/**
|
/**
|
||||||
* List all volumes
|
* List all volumes
|
||||||
*/
|
*/
|
||||||
export const listVolumes = <ThrowOnError extends boolean = false>(
|
export const listVolumes = <ThrowOnError extends boolean = false>(options?: Options<ListVolumesData, ThrowOnError>) =>
|
||||||
options?: Options<ListVolumesData, ThrowOnError>,
|
(options?.client ?? client).get<ListVolumesResponses, unknown, ThrowOnError>({ url: "/api/v1/volumes", ...options });
|
||||||
) =>
|
|
||||||
(options?.client ?? client).get<ListVolumesResponses, unknown, ThrowOnError>({
|
|
||||||
url: "/api/v1/volumes",
|
|
||||||
...options,
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new volume
|
* Create a new volume
|
||||||
*/
|
*/
|
||||||
export const createVolume = <ThrowOnError extends boolean = false>(
|
export const createVolume = <ThrowOnError extends boolean = false>(options?: Options<CreateVolumeData, ThrowOnError>) =>
|
||||||
options?: Options<CreateVolumeData, ThrowOnError>,
|
(options?.client ?? client).post<CreateVolumeResponses, unknown, ThrowOnError>({
|
||||||
) =>
|
|
||||||
(options?.client ?? client).post<
|
|
||||||
CreateVolumeResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/volumes",
|
url: "/api/v1/volumes",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -178,11 +165,7 @@ export const createVolume = <ThrowOnError extends boolean = false>(
|
||||||
export const testConnection = <ThrowOnError extends boolean = false>(
|
export const testConnection = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<TestConnectionData, ThrowOnError>,
|
options?: Options<TestConnectionData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).post<
|
(options?.client ?? client).post<TestConnectionResponses, unknown, ThrowOnError>({
|
||||||
TestConnectionResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/volumes/test-connection",
|
url: "/api/v1/volumes/test-connection",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -194,38 +177,26 @@ export const testConnection = <ThrowOnError extends boolean = false>(
|
||||||
/**
|
/**
|
||||||
* Delete a volume
|
* Delete a volume
|
||||||
*/
|
*/
|
||||||
export const deleteVolume = <ThrowOnError extends boolean = false>(
|
export const deleteVolume = <ThrowOnError extends boolean = false>(options: Options<DeleteVolumeData, ThrowOnError>) =>
|
||||||
options: Options<DeleteVolumeData, ThrowOnError>,
|
(options.client ?? client).delete<DeleteVolumeResponses, unknown, ThrowOnError>({
|
||||||
) =>
|
url: "/api/v1/volumes/{name}",
|
||||||
(options.client ?? client).delete<
|
...options,
|
||||||
DeleteVolumeResponses,
|
});
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({ url: "/api/v1/volumes/{name}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a volume by name
|
* Get a volume by name
|
||||||
*/
|
*/
|
||||||
export const getVolume = <ThrowOnError extends boolean = false>(
|
export const getVolume = <ThrowOnError extends boolean = false>(options: Options<GetVolumeData, ThrowOnError>) =>
|
||||||
options: Options<GetVolumeData, ThrowOnError>,
|
(options.client ?? client).get<GetVolumeResponses, GetVolumeErrors, ThrowOnError>({
|
||||||
) =>
|
url: "/api/v1/volumes/{name}",
|
||||||
(options.client ?? client).get<
|
...options,
|
||||||
GetVolumeResponses,
|
});
|
||||||
GetVolumeErrors,
|
|
||||||
ThrowOnError
|
|
||||||
>({ url: "/api/v1/volumes/{name}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a volume's configuration
|
* Update a volume's configuration
|
||||||
*/
|
*/
|
||||||
export const updateVolume = <ThrowOnError extends boolean = false>(
|
export const updateVolume = <ThrowOnError extends boolean = false>(options: Options<UpdateVolumeData, ThrowOnError>) =>
|
||||||
options: Options<UpdateVolumeData, ThrowOnError>,
|
(options.client ?? client).put<UpdateVolumeResponses, UpdateVolumeErrors, ThrowOnError>({
|
||||||
) =>
|
|
||||||
(options.client ?? client).put<
|
|
||||||
UpdateVolumeResponses,
|
|
||||||
UpdateVolumeErrors,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/volumes/{name}",
|
url: "/api/v1/volumes/{name}",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -237,9 +208,7 @@ export const updateVolume = <ThrowOnError extends boolean = false>(
|
||||||
/**
|
/**
|
||||||
* Mount a volume
|
* Mount a volume
|
||||||
*/
|
*/
|
||||||
export const mountVolume = <ThrowOnError extends boolean = false>(
|
export const mountVolume = <ThrowOnError extends boolean = false>(options: Options<MountVolumeData, ThrowOnError>) =>
|
||||||
options: Options<MountVolumeData, ThrowOnError>,
|
|
||||||
) =>
|
|
||||||
(options.client ?? client).post<MountVolumeResponses, unknown, ThrowOnError>({
|
(options.client ?? client).post<MountVolumeResponses, unknown, ThrowOnError>({
|
||||||
url: "/api/v1/volumes/{name}/mount",
|
url: "/api/v1/volumes/{name}/mount",
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -251,11 +220,10 @@ export const mountVolume = <ThrowOnError extends boolean = false>(
|
||||||
export const unmountVolume = <ThrowOnError extends boolean = false>(
|
export const unmountVolume = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<UnmountVolumeData, ThrowOnError>,
|
options: Options<UnmountVolumeData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).post<
|
(options.client ?? client).post<UnmountVolumeResponses, unknown, ThrowOnError>({
|
||||||
UnmountVolumeResponses,
|
url: "/api/v1/volumes/{name}/unmount",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/volumes/{name}/unmount", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a health check on a volume
|
* Perform a health check on a volume
|
||||||
|
|
@ -263,18 +231,15 @@ export const unmountVolume = <ThrowOnError extends boolean = false>(
|
||||||
export const healthCheckVolume = <ThrowOnError extends boolean = false>(
|
export const healthCheckVolume = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<HealthCheckVolumeData, ThrowOnError>,
|
options: Options<HealthCheckVolumeData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).post<
|
(options.client ?? client).post<HealthCheckVolumeResponses, HealthCheckVolumeErrors, ThrowOnError>({
|
||||||
HealthCheckVolumeResponses,
|
url: "/api/v1/volumes/{name}/health-check",
|
||||||
HealthCheckVolumeErrors,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/volumes/{name}/health-check", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List files in a volume directory
|
* List files in a volume directory
|
||||||
*/
|
*/
|
||||||
export const listFiles = <ThrowOnError extends boolean = false>(
|
export const listFiles = <ThrowOnError extends boolean = false>(options: Options<ListFilesData, ThrowOnError>) =>
|
||||||
options: Options<ListFilesData, ThrowOnError>,
|
|
||||||
) =>
|
|
||||||
(options.client ?? client).get<ListFilesResponses, unknown, ThrowOnError>({
|
(options.client ?? client).get<ListFilesResponses, unknown, ThrowOnError>({
|
||||||
url: "/api/v1/volumes/{name}/files",
|
url: "/api/v1/volumes/{name}/files",
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -286,11 +251,10 @@ export const listFiles = <ThrowOnError extends boolean = false>(
|
||||||
export const browseFilesystem = <ThrowOnError extends boolean = false>(
|
export const browseFilesystem = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<BrowseFilesystemData, ThrowOnError>,
|
options?: Options<BrowseFilesystemData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).get<
|
(options?.client ?? client).get<BrowseFilesystemResponses, unknown, ThrowOnError>({
|
||||||
BrowseFilesystemResponses,
|
url: "/api/v1/volumes/filesystem/browse",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/volumes/filesystem/browse", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all repositories
|
* List all repositories
|
||||||
|
|
@ -298,11 +262,10 @@ export const browseFilesystem = <ThrowOnError extends boolean = false>(
|
||||||
export const listRepositories = <ThrowOnError extends boolean = false>(
|
export const listRepositories = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<ListRepositoriesData, ThrowOnError>,
|
options?: Options<ListRepositoriesData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).get<
|
(options?.client ?? client).get<ListRepositoriesResponses, unknown, ThrowOnError>({
|
||||||
ListRepositoriesResponses,
|
url: "/api/v1/repositories",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/repositories", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new restic repository
|
* Create a new restic repository
|
||||||
|
|
@ -310,11 +273,7 @@ export const listRepositories = <ThrowOnError extends boolean = false>(
|
||||||
export const createRepository = <ThrowOnError extends boolean = false>(
|
export const createRepository = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<CreateRepositoryData, ThrowOnError>,
|
options?: Options<CreateRepositoryData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).post<
|
(options?.client ?? client).post<CreateRepositoryResponses, unknown, ThrowOnError>({
|
||||||
CreateRepositoryResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/repositories",
|
url: "/api/v1/repositories",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -329,11 +288,10 @@ export const createRepository = <ThrowOnError extends boolean = false>(
|
||||||
export const listRcloneRemotes = <ThrowOnError extends boolean = false>(
|
export const listRcloneRemotes = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<ListRcloneRemotesData, ThrowOnError>,
|
options?: Options<ListRcloneRemotesData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).get<
|
(options?.client ?? client).get<ListRcloneRemotesResponses, unknown, ThrowOnError>({
|
||||||
ListRcloneRemotesResponses,
|
url: "/api/v1/repositories/rclone-remotes",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/repositories/rclone-remotes", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a repository
|
* Delete a repository
|
||||||
|
|
@ -341,11 +299,10 @@ export const listRcloneRemotes = <ThrowOnError extends boolean = false>(
|
||||||
export const deleteRepository = <ThrowOnError extends boolean = false>(
|
export const deleteRepository = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<DeleteRepositoryData, ThrowOnError>,
|
options: Options<DeleteRepositoryData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).delete<
|
(options.client ?? client).delete<DeleteRepositoryResponses, unknown, ThrowOnError>({
|
||||||
DeleteRepositoryResponses,
|
url: "/api/v1/repositories/{id}",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/repositories/{id}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a single repository by ID
|
* Get a single repository by ID
|
||||||
|
|
@ -353,9 +310,10 @@ export const deleteRepository = <ThrowOnError extends boolean = false>(
|
||||||
export const getRepository = <ThrowOnError extends boolean = false>(
|
export const getRepository = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<GetRepositoryData, ThrowOnError>,
|
options: Options<GetRepositoryData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<GetRepositoryResponses, unknown, ThrowOnError>(
|
(options.client ?? client).get<GetRepositoryResponses, unknown, ThrowOnError>({
|
||||||
{ url: "/api/v1/repositories/{id}", ...options },
|
url: "/api/v1/repositories/{id}",
|
||||||
);
|
...options,
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a repository's name or settings
|
* Update a repository's name or settings
|
||||||
|
|
@ -363,11 +321,7 @@ export const getRepository = <ThrowOnError extends boolean = false>(
|
||||||
export const updateRepository = <ThrowOnError extends boolean = false>(
|
export const updateRepository = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<UpdateRepositoryData, ThrowOnError>,
|
options: Options<UpdateRepositoryData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).patch<
|
(options.client ?? client).patch<UpdateRepositoryResponses, UpdateRepositoryErrors, ThrowOnError>({
|
||||||
UpdateRepositoryResponses,
|
|
||||||
UpdateRepositoryErrors,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/repositories/{id}",
|
url: "/api/v1/repositories/{id}",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -382,11 +336,7 @@ export const updateRepository = <ThrowOnError extends boolean = false>(
|
||||||
export const deleteSnapshots = <ThrowOnError extends boolean = false>(
|
export const deleteSnapshots = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<DeleteSnapshotsData, ThrowOnError>,
|
options: Options<DeleteSnapshotsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).delete<
|
(options.client ?? client).delete<DeleteSnapshotsResponses, unknown, ThrowOnError>({
|
||||||
DeleteSnapshotsResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/repositories/{id}/snapshots",
|
url: "/api/v1/repositories/{id}/snapshots",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -401,9 +351,10 @@ export const deleteSnapshots = <ThrowOnError extends boolean = false>(
|
||||||
export const listSnapshots = <ThrowOnError extends boolean = false>(
|
export const listSnapshots = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<ListSnapshotsData, ThrowOnError>,
|
options: Options<ListSnapshotsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<ListSnapshotsResponses, unknown, ThrowOnError>(
|
(options.client ?? client).get<ListSnapshotsResponses, unknown, ThrowOnError>({
|
||||||
{ url: "/api/v1/repositories/{id}/snapshots", ...options },
|
url: "/api/v1/repositories/{id}/snapshots",
|
||||||
);
|
...options,
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a specific snapshot from a repository
|
* Delete a specific snapshot from a repository
|
||||||
|
|
@ -411,11 +362,10 @@ export const listSnapshots = <ThrowOnError extends boolean = false>(
|
||||||
export const deleteSnapshot = <ThrowOnError extends boolean = false>(
|
export const deleteSnapshot = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<DeleteSnapshotData, ThrowOnError>,
|
options: Options<DeleteSnapshotData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).delete<
|
(options.client ?? client).delete<DeleteSnapshotResponses, unknown, ThrowOnError>({
|
||||||
DeleteSnapshotResponses,
|
url: "/api/v1/repositories/{id}/snapshots/{snapshotId}",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get details of a specific snapshot
|
* Get details of a specific snapshot
|
||||||
|
|
@ -423,11 +373,10 @@ export const deleteSnapshot = <ThrowOnError extends boolean = false>(
|
||||||
export const getSnapshotDetails = <ThrowOnError extends boolean = false>(
|
export const getSnapshotDetails = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<GetSnapshotDetailsData, ThrowOnError>,
|
options: Options<GetSnapshotDetailsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<GetSnapshotDetailsResponses, unknown, ThrowOnError>({
|
||||||
GetSnapshotDetailsResponses,
|
url: "/api/v1/repositories/{id}/snapshots/{snapshotId}",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/repositories/{id}/snapshots/{snapshotId}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List files and directories in a snapshot
|
* List files and directories in a snapshot
|
||||||
|
|
@ -435,11 +384,7 @@ export const getSnapshotDetails = <ThrowOnError extends boolean = false>(
|
||||||
export const listSnapshotFiles = <ThrowOnError extends boolean = false>(
|
export const listSnapshotFiles = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<ListSnapshotFilesData, ThrowOnError>,
|
options: Options<ListSnapshotFilesData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<ListSnapshotFilesResponses, unknown, ThrowOnError>({
|
||||||
ListSnapshotFilesResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/repositories/{id}/snapshots/{snapshotId}/files",
|
url: "/api/v1/repositories/{id}/snapshots/{snapshotId}/files",
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
@ -450,11 +395,7 @@ export const listSnapshotFiles = <ThrowOnError extends boolean = false>(
|
||||||
export const restoreSnapshot = <ThrowOnError extends boolean = false>(
|
export const restoreSnapshot = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<RestoreSnapshotData, ThrowOnError>,
|
options: Options<RestoreSnapshotData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).post<
|
(options.client ?? client).post<RestoreSnapshotResponses, unknown, ThrowOnError>({
|
||||||
RestoreSnapshotResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/repositories/{id}/restore",
|
url: "/api/v1/repositories/{id}/restore",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -469,28 +410,23 @@ export const restoreSnapshot = <ThrowOnError extends boolean = false>(
|
||||||
export const doctorRepository = <ThrowOnError extends boolean = false>(
|
export const doctorRepository = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<DoctorRepositoryData, ThrowOnError>,
|
options: Options<DoctorRepositoryData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).post<
|
(options.client ?? client).post<DoctorRepositoryResponses, unknown, ThrowOnError>({
|
||||||
DoctorRepositoryResponses,
|
url: "/api/v1/repositories/{id}/doctor",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/repositories/{id}/doctor", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag multiple snapshots in a repository
|
* Tag multiple snapshots in a repository
|
||||||
*/
|
*/
|
||||||
export const tagSnapshots = <ThrowOnError extends boolean = false>(
|
export const tagSnapshots = <ThrowOnError extends boolean = false>(options: Options<TagSnapshotsData, ThrowOnError>) =>
|
||||||
options: Options<TagSnapshotsData, ThrowOnError>,
|
(options.client ?? client).post<TagSnapshotsResponses, unknown, ThrowOnError>({
|
||||||
) =>
|
url: "/api/v1/repositories/{id}/snapshots/tag",
|
||||||
(options.client ?? client).post<TagSnapshotsResponses, unknown, ThrowOnError>(
|
...options,
|
||||||
{
|
headers: {
|
||||||
url: "/api/v1/repositories/{id}/snapshots/tag",
|
"Content-Type": "application/json",
|
||||||
...options,
|
...options.headers,
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
...options.headers,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
);
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List all backup schedules
|
* List all backup schedules
|
||||||
|
|
@ -498,11 +434,10 @@ export const tagSnapshots = <ThrowOnError extends boolean = false>(
|
||||||
export const listBackupSchedules = <ThrowOnError extends boolean = false>(
|
export const listBackupSchedules = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<ListBackupSchedulesData, ThrowOnError>,
|
options?: Options<ListBackupSchedulesData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).get<
|
(options?.client ?? client).get<ListBackupSchedulesResponses, unknown, ThrowOnError>({
|
||||||
ListBackupSchedulesResponses,
|
url: "/api/v1/backups",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/backups", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new backup schedule for a volume
|
* Create a new backup schedule for a volume
|
||||||
|
|
@ -510,11 +445,7 @@ export const listBackupSchedules = <ThrowOnError extends boolean = false>(
|
||||||
export const createBackupSchedule = <ThrowOnError extends boolean = false>(
|
export const createBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<CreateBackupScheduleData, ThrowOnError>,
|
options?: Options<CreateBackupScheduleData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).post<
|
(options?.client ?? client).post<CreateBackupScheduleResponses, unknown, ThrowOnError>({
|
||||||
CreateBackupScheduleResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/backups",
|
url: "/api/v1/backups",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -529,11 +460,10 @@ export const createBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
export const deleteBackupSchedule = <ThrowOnError extends boolean = false>(
|
export const deleteBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<DeleteBackupScheduleData, ThrowOnError>,
|
options: Options<DeleteBackupScheduleData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).delete<
|
(options.client ?? client).delete<DeleteBackupScheduleResponses, unknown, ThrowOnError>({
|
||||||
DeleteBackupScheduleResponses,
|
url: "/api/v1/backups/{scheduleId}",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/backups/{scheduleId}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a backup schedule by ID
|
* Get a backup schedule by ID
|
||||||
|
|
@ -541,11 +471,10 @@ export const deleteBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
export const getBackupSchedule = <ThrowOnError extends boolean = false>(
|
export const getBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<GetBackupScheduleData, ThrowOnError>,
|
options: Options<GetBackupScheduleData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<GetBackupScheduleResponses, unknown, ThrowOnError>({
|
||||||
GetBackupScheduleResponses,
|
url: "/api/v1/backups/{scheduleId}",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/backups/{scheduleId}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a backup schedule
|
* Update a backup schedule
|
||||||
|
|
@ -553,11 +482,7 @@ export const getBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
export const updateBackupSchedule = <ThrowOnError extends boolean = false>(
|
export const updateBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<UpdateBackupScheduleData, ThrowOnError>,
|
options: Options<UpdateBackupScheduleData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).patch<
|
(options.client ?? client).patch<UpdateBackupScheduleResponses, unknown, ThrowOnError>({
|
||||||
UpdateBackupScheduleResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/backups/{scheduleId}",
|
url: "/api/v1/backups/{scheduleId}",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -569,45 +494,36 @@ export const updateBackupSchedule = <ThrowOnError extends boolean = false>(
|
||||||
/**
|
/**
|
||||||
* Get a backup schedule for a specific volume
|
* Get a backup schedule for a specific volume
|
||||||
*/
|
*/
|
||||||
export const getBackupScheduleForVolume = <
|
export const getBackupScheduleForVolume = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options: Options<GetBackupScheduleForVolumeData, ThrowOnError>,
|
options: Options<GetBackupScheduleForVolumeData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<GetBackupScheduleForVolumeResponses, unknown, ThrowOnError>({
|
||||||
GetBackupScheduleForVolumeResponses,
|
url: "/api/v1/backups/volume/{volumeId}",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/backups/volume/{volumeId}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trigger a backup immediately for a schedule
|
* Trigger a backup immediately for a schedule
|
||||||
*/
|
*/
|
||||||
export const runBackupNow = <ThrowOnError extends boolean = false>(
|
export const runBackupNow = <ThrowOnError extends boolean = false>(options: Options<RunBackupNowData, ThrowOnError>) =>
|
||||||
options: Options<RunBackupNowData, ThrowOnError>,
|
(options.client ?? client).post<RunBackupNowResponses, unknown, ThrowOnError>({
|
||||||
) =>
|
url: "/api/v1/backups/{scheduleId}/run",
|
||||||
(options.client ?? client).post<RunBackupNowResponses, unknown, ThrowOnError>(
|
...options,
|
||||||
{ url: "/api/v1/backups/{scheduleId}/run", ...options },
|
});
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop a backup that is currently in progress
|
* Stop a backup that is currently in progress
|
||||||
*/
|
*/
|
||||||
export const stopBackup = <ThrowOnError extends boolean = false>(
|
export const stopBackup = <ThrowOnError extends boolean = false>(options: Options<StopBackupData, ThrowOnError>) =>
|
||||||
options: Options<StopBackupData, ThrowOnError>,
|
(options.client ?? client).post<StopBackupResponses, StopBackupErrors, ThrowOnError>({
|
||||||
) =>
|
url: "/api/v1/backups/{scheduleId}/stop",
|
||||||
(options.client ?? client).post<
|
...options,
|
||||||
StopBackupResponses,
|
});
|
||||||
StopBackupErrors,
|
|
||||||
ThrowOnError
|
|
||||||
>({ url: "/api/v1/backups/{scheduleId}/stop", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manually apply retention policy to clean up old snapshots
|
* Manually apply retention policy to clean up old snapshots
|
||||||
*/
|
*/
|
||||||
export const runForget = <ThrowOnError extends boolean = false>(
|
export const runForget = <ThrowOnError extends boolean = false>(options: Options<RunForgetData, ThrowOnError>) =>
|
||||||
options: Options<RunForgetData, ThrowOnError>,
|
|
||||||
) =>
|
|
||||||
(options.client ?? client).post<RunForgetResponses, unknown, ThrowOnError>({
|
(options.client ?? client).post<RunForgetResponses, unknown, ThrowOnError>({
|
||||||
url: "/api/v1/backups/{scheduleId}/forget",
|
url: "/api/v1/backups/{scheduleId}/forget",
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -619,25 +535,18 @@ export const runForget = <ThrowOnError extends boolean = false>(
|
||||||
export const getScheduleNotifications = <ThrowOnError extends boolean = false>(
|
export const getScheduleNotifications = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<GetScheduleNotificationsData, ThrowOnError>,
|
options: Options<GetScheduleNotificationsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<GetScheduleNotificationsResponses, unknown, ThrowOnError>({
|
||||||
GetScheduleNotificationsResponses,
|
url: "/api/v1/backups/{scheduleId}/notifications",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/backups/{scheduleId}/notifications", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update notification assignments for a backup schedule
|
* Update notification assignments for a backup schedule
|
||||||
*/
|
*/
|
||||||
export const updateScheduleNotifications = <
|
export const updateScheduleNotifications = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options: Options<UpdateScheduleNotificationsData, ThrowOnError>,
|
options: Options<UpdateScheduleNotificationsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).put<
|
(options.client ?? client).put<UpdateScheduleNotificationsResponses, unknown, ThrowOnError>({
|
||||||
UpdateScheduleNotificationsResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/backups/{scheduleId}/notifications",
|
url: "/api/v1/backups/{scheduleId}/notifications",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -652,11 +561,10 @@ export const updateScheduleNotifications = <
|
||||||
export const getScheduleMirrors = <ThrowOnError extends boolean = false>(
|
export const getScheduleMirrors = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<GetScheduleMirrorsData, ThrowOnError>,
|
options: Options<GetScheduleMirrorsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<GetScheduleMirrorsResponses, unknown, ThrowOnError>({
|
||||||
GetScheduleMirrorsResponses,
|
url: "/api/v1/backups/{scheduleId}/mirrors",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/backups/{scheduleId}/mirrors", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update mirror repository assignments for a backup schedule
|
* Update mirror repository assignments for a backup schedule
|
||||||
|
|
@ -664,11 +572,7 @@ export const getScheduleMirrors = <ThrowOnError extends boolean = false>(
|
||||||
export const updateScheduleMirrors = <ThrowOnError extends boolean = false>(
|
export const updateScheduleMirrors = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<UpdateScheduleMirrorsData, ThrowOnError>,
|
options: Options<UpdateScheduleMirrorsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).put<
|
(options.client ?? client).put<UpdateScheduleMirrorsResponses, unknown, ThrowOnError>({
|
||||||
UpdateScheduleMirrorsResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/backups/{scheduleId}/mirrors",
|
url: "/api/v1/backups/{scheduleId}/mirrors",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -683,11 +587,10 @@ export const updateScheduleMirrors = <ThrowOnError extends boolean = false>(
|
||||||
export const getMirrorCompatibility = <ThrowOnError extends boolean = false>(
|
export const getMirrorCompatibility = <ThrowOnError extends boolean = false>(
|
||||||
options: Options<GetMirrorCompatibilityData, ThrowOnError>,
|
options: Options<GetMirrorCompatibilityData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<GetMirrorCompatibilityResponses, unknown, ThrowOnError>({
|
||||||
GetMirrorCompatibilityResponses,
|
url: "/api/v1/backups/{scheduleId}/mirrors/compatibility",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/backups/{scheduleId}/mirrors/compatibility", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reorder backup schedules by providing an array of schedule IDs in the desired order
|
* Reorder backup schedules by providing an array of schedule IDs in the desired order
|
||||||
|
|
@ -695,11 +598,7 @@ export const getMirrorCompatibility = <ThrowOnError extends boolean = false>(
|
||||||
export const reorderBackupSchedules = <ThrowOnError extends boolean = false>(
|
export const reorderBackupSchedules = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<ReorderBackupSchedulesData, ThrowOnError>,
|
options?: Options<ReorderBackupSchedulesData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).post<
|
(options?.client ?? client).post<ReorderBackupSchedulesResponses, unknown, ThrowOnError>({
|
||||||
ReorderBackupSchedulesResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/backups/reorder",
|
url: "/api/v1/backups/reorder",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -711,30 +610,21 @@ export const reorderBackupSchedules = <ThrowOnError extends boolean = false>(
|
||||||
/**
|
/**
|
||||||
* List all notification destinations
|
* List all notification destinations
|
||||||
*/
|
*/
|
||||||
export const listNotificationDestinations = <
|
export const listNotificationDestinations = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options?: Options<ListNotificationDestinationsData, ThrowOnError>,
|
options?: Options<ListNotificationDestinationsData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).get<
|
(options?.client ?? client).get<ListNotificationDestinationsResponses, unknown, ThrowOnError>({
|
||||||
ListNotificationDestinationsResponses,
|
url: "/api/v1/notifications/destinations",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/notifications/destinations", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new notification destination
|
* Create a new notification destination
|
||||||
*/
|
*/
|
||||||
export const createNotificationDestination = <
|
export const createNotificationDestination = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options?: Options<CreateNotificationDestinationData, ThrowOnError>,
|
options?: Options<CreateNotificationDestinationData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).post<
|
(options?.client ?? client).post<CreateNotificationDestinationResponses, unknown, ThrowOnError>({
|
||||||
CreateNotificationDestinationResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/notifications/destinations",
|
url: "/api/v1/notifications/destinations",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -746,9 +636,7 @@ export const createNotificationDestination = <
|
||||||
/**
|
/**
|
||||||
* Delete a notification destination
|
* Delete a notification destination
|
||||||
*/
|
*/
|
||||||
export const deleteNotificationDestination = <
|
export const deleteNotificationDestination = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options: Options<DeleteNotificationDestinationData, ThrowOnError>,
|
options: Options<DeleteNotificationDestinationData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).delete<
|
(options.client ?? client).delete<
|
||||||
|
|
@ -760,23 +648,18 @@ export const deleteNotificationDestination = <
|
||||||
/**
|
/**
|
||||||
* Get a notification destination by ID
|
* Get a notification destination by ID
|
||||||
*/
|
*/
|
||||||
export const getNotificationDestination = <
|
export const getNotificationDestination = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options: Options<GetNotificationDestinationData, ThrowOnError>,
|
options: Options<GetNotificationDestinationData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).get<
|
(options.client ?? client).get<GetNotificationDestinationResponses, GetNotificationDestinationErrors, ThrowOnError>({
|
||||||
GetNotificationDestinationResponses,
|
url: "/api/v1/notifications/destinations/{id}",
|
||||||
GetNotificationDestinationErrors,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/notifications/destinations/{id}", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a notification destination
|
* Update a notification destination
|
||||||
*/
|
*/
|
||||||
export const updateNotificationDestination = <
|
export const updateNotificationDestination = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options: Options<UpdateNotificationDestinationData, ThrowOnError>,
|
options: Options<UpdateNotificationDestinationData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).patch<
|
(options.client ?? client).patch<
|
||||||
|
|
@ -795,9 +678,7 @@ export const updateNotificationDestination = <
|
||||||
/**
|
/**
|
||||||
* Test a notification destination by sending a test message
|
* Test a notification destination by sending a test message
|
||||||
*/
|
*/
|
||||||
export const testNotificationDestination = <
|
export const testNotificationDestination = <ThrowOnError extends boolean = false>(
|
||||||
ThrowOnError extends boolean = false,
|
|
||||||
>(
|
|
||||||
options: Options<TestNotificationDestinationData, ThrowOnError>,
|
options: Options<TestNotificationDestinationData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options.client ?? client).post<
|
(options.client ?? client).post<
|
||||||
|
|
@ -812,18 +693,15 @@ export const testNotificationDestination = <
|
||||||
export const getSystemInfo = <ThrowOnError extends boolean = false>(
|
export const getSystemInfo = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<GetSystemInfoData, ThrowOnError>,
|
options?: Options<GetSystemInfoData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).get<
|
(options?.client ?? client).get<GetSystemInfoResponses, unknown, ThrowOnError>({
|
||||||
GetSystemInfoResponses,
|
url: "/api/v1/system/info",
|
||||||
unknown,
|
...options,
|
||||||
ThrowOnError
|
});
|
||||||
>({ url: "/api/v1/system/info", ...options });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for application updates from GitHub
|
* Check for application updates from GitHub
|
||||||
*/
|
*/
|
||||||
export const getUpdates = <ThrowOnError extends boolean = false>(
|
export const getUpdates = <ThrowOnError extends boolean = false>(options?: Options<GetUpdatesData, ThrowOnError>) =>
|
||||||
options?: Options<GetUpdatesData, ThrowOnError>,
|
|
||||||
) =>
|
|
||||||
(options?.client ?? client).get<GetUpdatesResponses, unknown, ThrowOnError>({
|
(options?.client ?? client).get<GetUpdatesResponses, unknown, ThrowOnError>({
|
||||||
url: "/api/v1/system/updates",
|
url: "/api/v1/system/updates",
|
||||||
...options,
|
...options,
|
||||||
|
|
@ -835,11 +713,7 @@ export const getUpdates = <ThrowOnError extends boolean = false>(
|
||||||
export const downloadResticPassword = <ThrowOnError extends boolean = false>(
|
export const downloadResticPassword = <ThrowOnError extends boolean = false>(
|
||||||
options?: Options<DownloadResticPasswordData, ThrowOnError>,
|
options?: Options<DownloadResticPasswordData, ThrowOnError>,
|
||||||
) =>
|
) =>
|
||||||
(options?.client ?? client).post<
|
(options?.client ?? client).post<DownloadResticPasswordResponses, unknown, ThrowOnError>({
|
||||||
DownloadResticPasswordResponses,
|
|
||||||
unknown,
|
|
||||||
ThrowOnError
|
|
||||||
>({
|
|
||||||
url: "/api/v1/system/restic-password",
|
url: "/api/v1/system/restic-password",
|
||||||
...options,
|
...options,
|
||||||
headers: {
|
headers: {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export default defineConfig({
|
||||||
input: `http://${config.serverIp}:4096/api/v1/openapi.json`,
|
input: `http://${config.serverIp}:4096/api/v1/openapi.json`,
|
||||||
output: {
|
output: {
|
||||||
path: "./app/client/api-client",
|
path: "./app/client/api-client",
|
||||||
format: "biome",
|
postProcess: ["oxfmt"],
|
||||||
},
|
},
|
||||||
plugins: [...defaultPlugins, "@tanstack/react-query", "@hey-api/client-fetch"],
|
plugins: [...defaultPlugins, "@tanstack/react-query", "@hey-api/client-fetch"],
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue