export type DeleteApiApiAuthApiKeysApiKeyIDArgs = {apiKeyID: string}; export type DeleteApiApiAuthApiKeysApiKeyIDOptions = {baseUrl: string, AuthenticationToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Revokes an API key * * DELETE /api/auth/api-keys/{apiKeyID} * * Also accepts auth: DEPRECATED - API Key, API Key, Basic Auth */ export const deleteApiApiAuthApiKeysApiKeyID = async (args: DeleteApiApiAuthApiKeysApiKeyIDArgs, options: DeleteApiApiAuthApiKeysApiKeyIDOptions) => { const {baseUrl, fetch: fetchFn = fetch, AuthenticationToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (AuthenticationToken !== undefined) headers.set("X-PL-AUTH", AuthenticationToken) const url = `${baseUrl.replace(/\/+$/, '')}/api/auth/api-keys/${encodeURIComponent(String(args.apiKeyID))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };