export type DeleteApiV2PollsPollIdVotesVoteIdArgs = {'X-Signature'?: string | undefined, 'X-Timestamp'?: number | undefined, pollId: string, voteId: string}; export type DeleteApiV2PollsPollIdVotesVoteIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, hmacSignature?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a poll vote * * DELETE /v2/polls/{pollId}/votes/{voteId} * * Also accepts auth: oauth2ClientCredentials */ export const deleteApiV2PollsPollIdVotesVoteId = async (args: DeleteApiV2PollsPollIdVotesVoteIdArgs, options?: DeleteApiV2PollsPollIdVotesVoteIdOptions) => { const {baseUrl = "https://api.zenzap.co", fetch: fetchFn = fetch, bearerAuth, hmacSignature} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Signature'] != null) headers.set("X-Signature", String(args['X-Signature'])) if (args['X-Timestamp'] != null) headers.set("X-Timestamp", String(args['X-Timestamp'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) if (hmacSignature !== undefined) headers.set("X-Signature", hmacSignature) const url = `${baseUrl.replace(/\/+$/, '')}/v2/polls/${encodeURIComponent(String(args.pollId))}/votes/${encodeURIComponent(String(args.voteId))}${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 undefined };