export type MediaCacheStoreConfig3 = {path: string, writeRate: string, serverName: string, description: string, storeName: string, maxSize: string, writeRateMaxBucketSize: string, saveFieldList?: Array | undefined, version: string}; export type UpdateApiV3ServersServerNameMediacacheStoresStoreNameArgs = {serverName: string, storeName: string, body: MediaCacheStoreConfig3}; export type UpdateApiV3ServersServerNameMediacacheStoresStoreNameOptions = {baseUrl?: string | undefined, basicAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update media cache store V3 * * PUT /v3/servers/{serverName}/mediacache/stores/{storeName} */ export const updateApiV3ServersServerNameMediacacheStoresStoreName = async (args: UpdateApiV3ServersServerNameMediacacheStoresStoreNameArgs, options?: UpdateApiV3ServersServerNameMediacacheStoresStoreNameOptions) => { const {baseUrl = "http://localhost:8087", fetch: fetchFn = fetch, basicAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (basicAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${basicAuth.username}:${basicAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/servers/${encodeURIComponent(String(args.serverName))}/mediacache/stores/${encodeURIComponent(String(args.storeName))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };