export type PatchApiPublicCommunitiesSubdomainWebhooksWebhookIdArgs = {webhookId: string, subdomain: string, 'x-api-key': string, body: {name?: string | undefined, active?: boolean | undefined, uri?: string | undefined, events?: (Array<'JOINED_COMMUNITY' | 'LEFT_COMMUNITY' | 'QUEST_SUCCEEDED' | 'QUEST_CLAIMED' | 'QUEST_FAILED' | 'QUEST_CLAIM_STATUS_UPDATED' | 'SPRINT_STARTED' | 'SPRINT_ENDED' | 'USER_BANNED'>) | undefined}}; export type PatchApiPublicCommunitiesSubdomainWebhooksWebhookIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a webhook * * PATCH /public/communities/{subdomain}/webhooks/{webhookId} */ export const patchApiPublicCommunitiesSubdomainWebhooksWebhookId = async (args: PatchApiPublicCommunitiesSubdomainWebhooksWebhookIdArgs, options?: PatchApiPublicCommunitiesSubdomainWebhooksWebhookIdOptions) => { const {baseUrl = "https://api-v2.zealy.io", 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(/\/+$/, '')}/public/communities/${encodeURIComponent(String(args.subdomain))}/webhooks/${encodeURIComponent(String(args.webhookId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };