export type PatchApiV2BillingProductsIdActivateArgs = {id: number}; export type PatchApiV2BillingProductsIdActivateOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Activates a product * * PATCH /v2/billing/products/{id}/activate * * Also accepts auth: sessionKey */ export const patchApiV2BillingProductsIdActivate = async (args: PatchApiV2BillingProductsIdActivateArgs, options: PatchApiV2BillingProductsIdActivateOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/billing/products/${encodeURIComponent(String(args.id))}/activate${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };