export type DeleteApiV1PostsArgs = {account: number, body: Array}; export type DeleteApiV1PostsOptions = {baseUrl?: string | undefined, PublicAPIAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete posts * * DELETE /v1/posts */ export const deleteApiV1Posts = async (args: DeleteApiV1PostsArgs, options?: DeleteApiV1PostsOptions) => { const {baseUrl = "https://dev.srvr.postey.ai", fetch: fetchFn = fetch, PublicAPIAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args.account != null) query.append("account", String(args.account)) if (PublicAPIAuthentication !== undefined) headers.set('authorization', `Bearer ${PublicAPIAuthentication}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/posts${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };