export type DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdMessageStoreArgs = {accountId: string, extensionId: string, conversationId?: Array | undefined, dateTo?: string | undefined, type?: ('Fax' | 'SMS' | 'VoiceMail' | 'Pager' | 'Text' | 'All') | undefined}; export type DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdMessageStoreOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Conversation * * DELETE /restapi/v1.0/account/{accountId}/extension/{extensionId}/message-store */ export const deleteApiRestapiV10AccountAccountIdExtensionExtensionIdMessageStore = async (args: DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdMessageStoreArgs, options?: DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdMessageStoreOptions) => { const {baseUrl = "https://platform.ringcentral.com", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.conversationId ?? []) query.append("conversationId", String(item)) if (args.dateTo != null) query.append("dateTo", String(args.dateTo)) if (args.type != null) query.append("type", String(args.type)) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/restapi/v1.0/account/${encodeURIComponent(String(args.accountId))}/extension/${encodeURIComponent(String(args.extensionId))}/message-store${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 };