mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
118 lines
3.1 KiB
TypeScript
118 lines
3.1 KiB
TypeScript
// This file is auto-generated by @hey-api/openapi-ts
|
|
|
|
import type { Options as ClientOptions, TDataShape, Client } from "./client";
|
|
import type {
|
|
ListVolumesData,
|
|
ListVolumesResponses,
|
|
CreateVolumeData,
|
|
CreateVolumeResponses,
|
|
TestConnectionData,
|
|
TestConnectionResponses,
|
|
DeleteVolumeData,
|
|
DeleteVolumeResponses,
|
|
GetVolumeData,
|
|
GetVolumeResponses,
|
|
GetVolumeErrors,
|
|
UpdateVolumeData,
|
|
UpdateVolumeResponses,
|
|
UpdateVolumeErrors,
|
|
} from "./types.gen";
|
|
import { client as _heyApiClient } from "./client.gen";
|
|
|
|
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = ClientOptions<
|
|
TData,
|
|
ThrowOnError
|
|
> & {
|
|
/**
|
|
* You can provide a client instance returned by `createClient()` instead of
|
|
* individual options. This might be also useful if you want to implement a
|
|
* custom client.
|
|
*/
|
|
client?: Client;
|
|
/**
|
|
* You can pass arbitrary values through the `meta` object. This can be
|
|
* used to access values that aren't defined as part of the SDK function.
|
|
*/
|
|
meta?: Record<string, unknown>;
|
|
};
|
|
|
|
/**
|
|
* List all volumes
|
|
*/
|
|
export const listVolumes = <ThrowOnError extends boolean = false>(options?: Options<ListVolumesData, ThrowOnError>) => {
|
|
return (options?.client ?? _heyApiClient).get<ListVolumesResponses, unknown, ThrowOnError>({
|
|
url: "/api/v1/volumes",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Create a new volume
|
|
*/
|
|
export const createVolume = <ThrowOnError extends boolean = false>(
|
|
options?: Options<CreateVolumeData, ThrowOnError>,
|
|
) => {
|
|
return (options?.client ?? _heyApiClient).post<CreateVolumeResponses, unknown, ThrowOnError>({
|
|
url: "/api/v1/volumes",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Test connection to backend
|
|
*/
|
|
export const testConnection = <ThrowOnError extends boolean = false>(
|
|
options?: Options<TestConnectionData, ThrowOnError>,
|
|
) => {
|
|
return (options?.client ?? _heyApiClient).post<TestConnectionResponses, unknown, ThrowOnError>({
|
|
url: "/api/v1/volumes/test-connection",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options?.headers,
|
|
},
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Delete a volume
|
|
*/
|
|
export const deleteVolume = <ThrowOnError extends boolean = false>(
|
|
options: Options<DeleteVolumeData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).delete<DeleteVolumeResponses, unknown, ThrowOnError>({
|
|
url: "/api/v1/volumes/{name}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Get a volume by name
|
|
*/
|
|
export const getVolume = <ThrowOnError extends boolean = false>(options: Options<GetVolumeData, ThrowOnError>) => {
|
|
return (options.client ?? _heyApiClient).get<GetVolumeResponses, GetVolumeErrors, ThrowOnError>({
|
|
url: "/api/v1/volumes/{name}",
|
|
...options,
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Update a volume's configuration
|
|
*/
|
|
export const updateVolume = <ThrowOnError extends boolean = false>(
|
|
options: Options<UpdateVolumeData, ThrowOnError>,
|
|
) => {
|
|
return (options.client ?? _heyApiClient).put<UpdateVolumeResponses, UpdateVolumeErrors, ThrowOnError>({
|
|
url: "/api/v1/volumes/{name}",
|
|
...options,
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
...options.headers,
|
|
},
|
|
});
|
|
};
|