@bluecopa/core 0.1.86 → 0.1.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,3 +4,4 @@ export * from './getConversation';
4
4
  export * from './createConversation';
5
5
  export * from './replyToConversation';
6
6
  export * from './getMessageBySenderId';
7
+ export * from './searchMessages';
@@ -0,0 +1,23 @@
1
+ import { PageChunkEmailMessage } from './getMessageBySenderId';
2
+ export interface EmailMessageSearchRequest {
3
+ accountId: string;
4
+ from?: string;
5
+ to: string[];
6
+ cc: string[];
7
+ subjectContains?: string;
8
+ dateFrom?: string;
9
+ dateTo?: string;
10
+ hasAttachment: boolean;
11
+ senderId?: string;
12
+ page: number;
13
+ pageSize: number;
14
+ sortBy: "DATE" | "SUBJECT" | "FROM_ADDRESS";
15
+ sortDirection: "ASC" | "DESC";
16
+ }
17
+ /**
18
+ * Searches email messages with structured filters.
19
+ * @param body - The search request (accountId, recipient filters, date range, paging, sort)
20
+ * @returns Promise<PageChunkEmailMessage> Paginated list of matching messages
21
+ * @throws { message, status } on failure
22
+ */
23
+ export declare function searchMessages(body: EmailMessageSearchRequest): Promise<PageChunkEmailMessage>;
package/dist/index.d.ts CHANGED
@@ -47,4 +47,5 @@ export type { TcnProcessDialData } from './api/tcn/processManualDial';
47
47
  export type { TcnConnectedParty } from './api/tcn/agentGetConnectedParty';
48
48
  export type { TcnCallData } from './api/tcn/getCallData';
49
49
  export type { FilterOnSenderId, EmailMessage, PageChunkEmailMessage, } from './api/emailEngine/getMessageBySenderId';
50
+ export type { EmailMessageSearchRequest, } from './api/emailEngine/searchMessages';
50
51
  export type { RenderTemplateRequest, RenderTemplateResponse, RenderTemplateWarning, TemplateEngine, } from './api/templates/render';
package/dist/index.es.js CHANGED
@@ -11940,13 +11940,29 @@ async function getMessageBySenderId(params) {
11940
11940
  throw { message, status };
11941
11941
  }
11942
11942
  }
11943
+ async function searchMessages(body) {
11944
+ var _a, _b, _c, _d, _e;
11945
+ if (!((_a = body == null ? void 0 : body.accountId) == null ? void 0 : _a.trim())) {
11946
+ throw { message: "accountId is required", status: 400 };
11947
+ }
11948
+ try {
11949
+ const response = await apiClient.post("/email/messages/search", body);
11950
+ return ((_b = response.data) == null ? void 0 : _b.data) ?? response.data;
11951
+ } catch (error) {
11952
+ const axiosError = error;
11953
+ const message = ((_d = (_c = axiosError.response) == null ? void 0 : _c.data) == null ? void 0 : _d.message) || axiosError.message || "An unexpected error occurred while searching messages";
11954
+ const status = ((_e = axiosError.response) == null ? void 0 : _e.status) || 500;
11955
+ throw { message, status };
11956
+ }
11957
+ }
11943
11958
  const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
11944
11959
  __proto__: null,
11945
11960
  createConversation,
11946
11961
  getAllConversations,
11947
11962
  getConversation,
11948
11963
  getMessageBySenderId,
11949
- replyToConversation
11964
+ replyToConversation,
11965
+ searchMessages
11950
11966
  }, Symbol.toStringTag, { value: "Module" }));
11951
11967
  async function getAuthUrl() {
11952
11968
  var _a, _b, _c;