export type GetApiV1SharesStoragesStorageIdFilesArgs = {'App-ID': string, 'Auth-Token': string, storage_id: string, directory_path: string, name: string}; export type GetApiV1SharesStoragesStorageIdFilesOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Check if a specific file is already on the storage for shares * * GET /v1/shares/storages/{storage_id}/files/ */ export const getApiV1SharesStoragesStorageIdFiles = async (args: GetApiV1SharesStoragesStorageIdFilesArgs, options: GetApiV1SharesStoragesStorageIdFilesOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) if (args.directory_path != null) query.append("directory_path", String(args.directory_path)) if (args.name != null) query.append("name", String(args.name)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/shares/storages/${encodeURIComponent(String(args.storage_id))}/files/${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };