export type CreateApiV1BillingPlansIdActivateArgs = {'Content-Type': string, id: string}; export type CreateApiV1BillingPlansIdActivateOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Activate plan * * POST /v1/billing/plans/{id}/activate */ export const createApiV1BillingPlansIdActivate = async (args: CreateApiV1BillingPlansIdActivateArgs, options?: CreateApiV1BillingPlansIdActivateOptions) => { const {baseUrl = "https://api-m.sandbox.paypal.com", fetch: fetchFn = fetch, Oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/billing/plans/${encodeURIComponent(String(args.id))}/activate${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 };