export type DeleteApiV2SoftwareLicenseLicenseIdArgs = {licenseId: number}; export type DeleteApiV2SoftwareLicenseLicenseIdOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a Software License * * DELETE /v2/software-license/{licenseId} * * Also accepts auth: sessionKey */ export const deleteApiV2SoftwareLicenseLicenseId = async (args: DeleteApiV2SoftwareLicenseLicenseIdArgs, options: DeleteApiV2SoftwareLicenseLicenseIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/software-license/${encodeURIComponent(String(args.licenseId))}${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 (await res.json()) as unknown };