export type RevokeRequest = {license_key: string, instance_id?: (string | null) | undefined}; export type CreateApiV1LicenseRevokeArgs = {'X-Api-Key': string, body: RevokeRequest}; export type CreateApiV1LicenseRevokeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Revoke * * POST /v1/license/revoke */ export const createApiV1LicenseRevoke = async (args: CreateApiV1LicenseRevokeArgs, options: CreateApiV1LicenseRevokeOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Api-Key'] != null) headers.set("X-Api-Key", String(args['X-Api-Key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/license/revoke${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };