export type DefinedCrowdPublicApiApiModelsSubscriptionsSubscriptionViewModel = {type: string, to: Array, emailListConsent: boolean}; export type UpdateApiV20PublicProjectsProjectIdSubscriptionsArgs = {projectId: string, body: Array}; export type UpdateApiV20PublicProjectsProjectIdSubscriptionsOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Put Subscriptions * * PUT /v2.0/public/projects/{projectId}/subscriptions */ export const updateApiV20PublicProjectsProjectIdSubscriptions = async (args: UpdateApiV20PublicProjectsProjectIdSubscriptionsArgs, options: UpdateApiV20PublicProjectsProjectIdSubscriptionsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/v2.0/public/projects/${encodeURIComponent(String(args.projectId))}/subscriptions${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };