export type Search = {query?: string | undefined, from?: string | undefined, to?: string | undefined}; export type DeleteApiV3MessagesLogIdArgs = {logId: string, body: Search}; export type DeleteApiV3MessagesLogIdOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a list of messages by logid and query. * * DELETE /v3/messages/{logId} */ export const deleteApiV3MessagesLogId = async (args: DeleteApiV3MessagesLogIdArgs, options: DeleteApiV3MessagesLogIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) query.set("api_key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v3/messages/${encodeURIComponent(String(args.logId))}${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 };