export type DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdCallLogArgs = {accountId: string, extensionId: string, dateTo?: string | undefined}; export type DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdCallLogOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete User Call Records * * DELETE /restapi/v1.0/account/{accountId}/extension/{extensionId}/call-log */ export const deleteApiRestapiV10AccountAccountIdExtensionExtensionIdCallLog = async (args: DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdCallLogArgs, options?: DeleteApiRestapiV10AccountAccountIdExtensionExtensionIdCallLogOptions) => { const {baseUrl = "https://platform.ringcentral.com", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.dateTo != null) query.append("dateTo", String(args.dateTo)) 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))}/call-log${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 };