export type CreateApiV1ApiKeysKeyIdRollOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Roll API key * * POST /v1/api-keys/{key_id}/roll */ export const createApiV1ApiKeysKeyIdRoll = async (options?: CreateApiV1ApiKeysKeyIdRollOptions) => { const {baseUrl = "https://api.oilpriceapi.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyAuth !== undefined) headers.set("Authorization", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/api-keys/${encodeURIComponent(String(args.key_id))}/roll${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 };