export type CreateApiApiBuildCacheNodesNamePurgeOptions = {baseUrl?: string | undefined, DevelocityAccessKeyOrToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes all entries from a Build Cache Node. * * POST /api/build-cache/nodes/{name}/purge */ export const createApiApiBuildCacheNodesNamePurge = async (options?: CreateApiApiBuildCacheNodesNamePurgeOptions) => { const {baseUrl = "https://develocity.example.com", fetch: fetchFn = fetch, DevelocityAccessKeyOrToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (DevelocityAccessKeyOrToken !== undefined) headers.set('authorization', `Bearer ${DevelocityAccessKeyOrToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/build-cache/nodes/${encodeURIComponent(String(args.name))}/purge${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };