@51eat/sdk 0.0.19 → 0.0.20

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.
Files changed (201) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/resources/business/client/Client.d.ts +6 -0
  4. package/dist/cjs/api/resources/business/client/Client.js +14 -4
  5. package/dist/cjs/api/resources/business/resources/gallery/client/Client.d.ts +86 -0
  6. package/dist/cjs/api/resources/business/resources/gallery/client/Client.js +364 -0
  7. package/dist/cjs/api/resources/business/resources/gallery/client/index.d.ts +1 -0
  8. package/dist/cjs/api/resources/business/resources/gallery/client/index.js +17 -0
  9. package/dist/cjs/api/resources/business/resources/gallery/client/requests/DeleteGalleryRequest.d.ts +10 -0
  10. package/dist/cjs/api/resources/business/resources/gallery/client/requests/DeleteGalleryRequest.js +3 -0
  11. package/dist/cjs/api/resources/business/resources/gallery/client/requests/ReorderGalleryRequest.d.ts +21 -0
  12. package/dist/cjs/api/resources/business/resources/gallery/client/requests/ReorderGalleryRequest.js +3 -0
  13. package/dist/cjs/api/resources/business/resources/gallery/client/requests/StoreGalleryPhotoRequest.d.ts +11 -0
  14. package/dist/cjs/api/resources/business/resources/gallery/client/requests/StoreGalleryPhotoRequest.js +3 -0
  15. package/dist/cjs/api/resources/business/resources/gallery/client/requests/UpdateGalleryPhotoRequest.d.ts +11 -0
  16. package/dist/cjs/api/resources/business/resources/gallery/client/requests/UpdateGalleryPhotoRequest.js +3 -0
  17. package/dist/cjs/api/resources/business/resources/gallery/client/requests/index.d.ts +4 -0
  18. package/dist/cjs/api/resources/business/resources/gallery/client/requests/index.js +2 -0
  19. package/dist/cjs/api/resources/business/resources/gallery/exports.d.ts +2 -0
  20. package/dist/cjs/api/resources/business/resources/gallery/exports.js +21 -0
  21. package/dist/cjs/api/resources/business/resources/gallery/index.d.ts +2 -0
  22. package/dist/cjs/api/resources/business/resources/gallery/index.js +18 -0
  23. package/dist/cjs/api/resources/business/resources/gallery/types/DeleteGalleryResponse.d.ts +9 -0
  24. package/dist/cjs/api/resources/business/resources/gallery/types/DeleteGalleryResponse.js +10 -0
  25. package/dist/cjs/api/resources/business/resources/gallery/types/ListGalleryResponse.d.ts +4 -0
  26. package/dist/cjs/api/resources/business/resources/gallery/types/ListGalleryResponse.js +3 -0
  27. package/dist/cjs/api/resources/business/resources/gallery/types/ReorderGalleryResponse.d.ts +9 -0
  28. package/dist/cjs/api/resources/business/resources/gallery/types/ReorderGalleryResponse.js +10 -0
  29. package/dist/cjs/api/resources/business/resources/gallery/types/UpdateGalleryResponse.d.ts +4 -0
  30. package/dist/cjs/api/resources/business/resources/gallery/types/UpdateGalleryResponse.js +3 -0
  31. package/dist/cjs/api/resources/business/resources/gallery/types/UploadGalleryResponse.d.ts +4 -0
  32. package/dist/cjs/api/resources/business/resources/gallery/types/UploadGalleryResponse.js +3 -0
  33. package/dist/cjs/api/resources/business/resources/gallery/types/index.d.ts +5 -0
  34. package/dist/cjs/api/resources/business/resources/gallery/types/index.js +21 -0
  35. package/dist/cjs/api/resources/business/resources/index.d.ts +4 -0
  36. package/dist/cjs/api/resources/business/resources/index.js +5 -1
  37. package/dist/cjs/api/resources/business/resources/messaging/client/Client.d.ts +15 -0
  38. package/dist/cjs/api/resources/business/resources/messaging/client/Client.js +21 -0
  39. package/dist/cjs/api/resources/business/resources/messaging/client/index.d.ts +1 -0
  40. package/dist/cjs/api/resources/business/resources/messaging/client/index.js +2 -0
  41. package/dist/cjs/api/resources/business/resources/messaging/exports.d.ts +3 -0
  42. package/dist/cjs/api/resources/business/resources/messaging/exports.js +22 -0
  43. package/dist/cjs/api/resources/business/resources/messaging/index.d.ts +2 -0
  44. package/dist/cjs/api/resources/business/resources/messaging/index.js +18 -0
  45. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/Client.d.ts +45 -0
  46. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/Client.js +182 -0
  47. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/index.d.ts +1 -0
  48. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/index.js +17 -0
  49. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/requests/GetConversationsRequest.d.ts +10 -0
  50. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/requests/GetConversationsRequest.js +3 -0
  51. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/requests/ListConversationsRequest.d.ts +10 -0
  52. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/requests/ListConversationsRequest.js +3 -0
  53. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/requests/index.d.ts +2 -0
  54. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/client/requests/index.js +2 -0
  55. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/exports.d.ts +2 -0
  56. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/exports.js +21 -0
  57. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/index.d.ts +2 -0
  58. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/index.js +18 -0
  59. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/types/GetConversationsResponse.d.ts +4 -0
  60. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/types/GetConversationsResponse.js +3 -0
  61. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/types/ListConversationsResponse.d.ts +4 -0
  62. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/types/ListConversationsResponse.js +3 -0
  63. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/types/index.d.ts +2 -0
  64. package/dist/cjs/api/resources/business/resources/messaging/resources/conversations/types/index.js +18 -0
  65. package/dist/cjs/api/resources/business/resources/messaging/resources/index.d.ts +6 -0
  66. package/dist/cjs/api/resources/business/resources/messaging/resources/index.js +45 -0
  67. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/Client.d.ts +81 -0
  68. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/Client.js +312 -0
  69. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/index.d.ts +1 -0
  70. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/index.js +17 -0
  71. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/ListMessagesRequest.d.ts +14 -0
  72. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/ListMessagesRequest.js +3 -0
  73. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/MarkAsReadMessagesRequest.d.ts +10 -0
  74. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/MarkAsReadMessagesRequest.js +3 -0
  75. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/StoreMessageRequest.d.ts +22 -0
  76. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/StoreMessageRequest.js +12 -0
  77. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/UnreadCountMessagesRequest.d.ts +10 -0
  78. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/UnreadCountMessagesRequest.js +3 -0
  79. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/index.d.ts +4 -0
  80. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/client/requests/index.js +5 -0
  81. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/exports.d.ts +2 -0
  82. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/exports.js +21 -0
  83. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/index.d.ts +2 -0
  84. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/index.js +18 -0
  85. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/types/ListMessagesResponse.d.ts +4 -0
  86. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/types/ListMessagesResponse.js +3 -0
  87. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/types/SendMessagesResponse.d.ts +4 -0
  88. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/types/SendMessagesResponse.js +3 -0
  89. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/types/index.d.ts +2 -0
  90. package/dist/cjs/api/resources/business/resources/messaging/resources/messages/types/index.js +18 -0
  91. package/dist/cjs/api/types/BusinessConversation.d.ts +20 -0
  92. package/dist/cjs/api/types/BusinessConversation.js +3 -0
  93. package/dist/cjs/api/types/BusinessMessage.d.ts +20 -0
  94. package/dist/cjs/api/types/BusinessMessage.js +3 -0
  95. package/dist/cjs/api/types/BusinessPhoto.d.ts +9 -0
  96. package/dist/cjs/api/types/BusinessPhoto.js +3 -0
  97. package/dist/cjs/api/types/index.d.ts +3 -0
  98. package/dist/cjs/api/types/index.js +3 -0
  99. package/dist/cjs/version.d.ts +1 -1
  100. package/dist/cjs/version.js +1 -1
  101. package/dist/esm/BaseClient.mjs +2 -2
  102. package/dist/esm/api/resources/business/client/Client.d.mts +6 -0
  103. package/dist/esm/api/resources/business/client/Client.mjs +10 -0
  104. package/dist/esm/api/resources/business/resources/gallery/client/Client.d.mts +86 -0
  105. package/dist/esm/api/resources/business/resources/gallery/client/Client.mjs +327 -0
  106. package/dist/esm/api/resources/business/resources/gallery/client/index.d.mts +1 -0
  107. package/dist/esm/api/resources/business/resources/gallery/client/index.mjs +1 -0
  108. package/dist/esm/api/resources/business/resources/gallery/client/requests/DeleteGalleryRequest.d.mts +10 -0
  109. package/dist/esm/api/resources/business/resources/gallery/client/requests/DeleteGalleryRequest.mjs +2 -0
  110. package/dist/esm/api/resources/business/resources/gallery/client/requests/ReorderGalleryRequest.d.mts +21 -0
  111. package/dist/esm/api/resources/business/resources/gallery/client/requests/ReorderGalleryRequest.mjs +2 -0
  112. package/dist/esm/api/resources/business/resources/gallery/client/requests/StoreGalleryPhotoRequest.d.mts +11 -0
  113. package/dist/esm/api/resources/business/resources/gallery/client/requests/StoreGalleryPhotoRequest.mjs +2 -0
  114. package/dist/esm/api/resources/business/resources/gallery/client/requests/UpdateGalleryPhotoRequest.d.mts +11 -0
  115. package/dist/esm/api/resources/business/resources/gallery/client/requests/UpdateGalleryPhotoRequest.mjs +2 -0
  116. package/dist/esm/api/resources/business/resources/gallery/client/requests/index.d.mts +4 -0
  117. package/dist/esm/api/resources/business/resources/gallery/client/requests/index.mjs +1 -0
  118. package/dist/esm/api/resources/business/resources/gallery/exports.d.mts +2 -0
  119. package/dist/esm/api/resources/business/resources/gallery/exports.mjs +3 -0
  120. package/dist/esm/api/resources/business/resources/gallery/index.d.mts +2 -0
  121. package/dist/esm/api/resources/business/resources/gallery/index.mjs +2 -0
  122. package/dist/esm/api/resources/business/resources/gallery/types/DeleteGalleryResponse.d.mts +9 -0
  123. package/dist/esm/api/resources/business/resources/gallery/types/DeleteGalleryResponse.mjs +7 -0
  124. package/dist/esm/api/resources/business/resources/gallery/types/ListGalleryResponse.d.mts +4 -0
  125. package/dist/esm/api/resources/business/resources/gallery/types/ListGalleryResponse.mjs +2 -0
  126. package/dist/esm/api/resources/business/resources/gallery/types/ReorderGalleryResponse.d.mts +9 -0
  127. package/dist/esm/api/resources/business/resources/gallery/types/ReorderGalleryResponse.mjs +7 -0
  128. package/dist/esm/api/resources/business/resources/gallery/types/UpdateGalleryResponse.d.mts +4 -0
  129. package/dist/esm/api/resources/business/resources/gallery/types/UpdateGalleryResponse.mjs +2 -0
  130. package/dist/esm/api/resources/business/resources/gallery/types/UploadGalleryResponse.d.mts +4 -0
  131. package/dist/esm/api/resources/business/resources/gallery/types/UploadGalleryResponse.mjs +2 -0
  132. package/dist/esm/api/resources/business/resources/gallery/types/index.d.mts +5 -0
  133. package/dist/esm/api/resources/business/resources/gallery/types/index.mjs +5 -0
  134. package/dist/esm/api/resources/business/resources/index.d.mts +4 -0
  135. package/dist/esm/api/resources/business/resources/index.mjs +4 -0
  136. package/dist/esm/api/resources/business/resources/messaging/client/Client.d.mts +15 -0
  137. package/dist/esm/api/resources/business/resources/messaging/client/Client.mjs +17 -0
  138. package/dist/esm/api/resources/business/resources/messaging/client/index.d.mts +1 -0
  139. package/dist/esm/api/resources/business/resources/messaging/client/index.mjs +1 -0
  140. package/dist/esm/api/resources/business/resources/messaging/exports.d.mts +3 -0
  141. package/dist/esm/api/resources/business/resources/messaging/exports.mjs +4 -0
  142. package/dist/esm/api/resources/business/resources/messaging/index.d.mts +2 -0
  143. package/dist/esm/api/resources/business/resources/messaging/index.mjs +2 -0
  144. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/Client.d.mts +45 -0
  145. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/Client.mjs +145 -0
  146. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/index.d.mts +1 -0
  147. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/index.mjs +1 -0
  148. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/requests/GetConversationsRequest.d.mts +10 -0
  149. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/requests/GetConversationsRequest.mjs +2 -0
  150. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/requests/ListConversationsRequest.d.mts +10 -0
  151. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/requests/ListConversationsRequest.mjs +2 -0
  152. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/requests/index.d.mts +2 -0
  153. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/client/requests/index.mjs +1 -0
  154. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/exports.d.mts +2 -0
  155. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/exports.mjs +3 -0
  156. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/index.d.mts +2 -0
  157. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/index.mjs +2 -0
  158. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/types/GetConversationsResponse.d.mts +4 -0
  159. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/types/GetConversationsResponse.mjs +2 -0
  160. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/types/ListConversationsResponse.d.mts +4 -0
  161. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/types/ListConversationsResponse.mjs +2 -0
  162. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/types/index.d.mts +2 -0
  163. package/dist/esm/api/resources/business/resources/messaging/resources/conversations/types/index.mjs +2 -0
  164. package/dist/esm/api/resources/business/resources/messaging/resources/index.d.mts +6 -0
  165. package/dist/esm/api/resources/business/resources/messaging/resources/index.mjs +6 -0
  166. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/Client.d.mts +81 -0
  167. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/Client.mjs +275 -0
  168. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/index.d.mts +1 -0
  169. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/index.mjs +1 -0
  170. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/ListMessagesRequest.d.mts +14 -0
  171. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/ListMessagesRequest.mjs +2 -0
  172. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/MarkAsReadMessagesRequest.d.mts +10 -0
  173. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/MarkAsReadMessagesRequest.mjs +2 -0
  174. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/StoreMessageRequest.d.mts +22 -0
  175. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/StoreMessageRequest.mjs +9 -0
  176. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/UnreadCountMessagesRequest.d.mts +10 -0
  177. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/UnreadCountMessagesRequest.mjs +2 -0
  178. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/index.d.mts +4 -0
  179. package/dist/esm/api/resources/business/resources/messaging/resources/messages/client/requests/index.mjs +1 -0
  180. package/dist/esm/api/resources/business/resources/messaging/resources/messages/exports.d.mts +2 -0
  181. package/dist/esm/api/resources/business/resources/messaging/resources/messages/exports.mjs +3 -0
  182. package/dist/esm/api/resources/business/resources/messaging/resources/messages/index.d.mts +2 -0
  183. package/dist/esm/api/resources/business/resources/messaging/resources/messages/index.mjs +2 -0
  184. package/dist/esm/api/resources/business/resources/messaging/resources/messages/types/ListMessagesResponse.d.mts +4 -0
  185. package/dist/esm/api/resources/business/resources/messaging/resources/messages/types/ListMessagesResponse.mjs +2 -0
  186. package/dist/esm/api/resources/business/resources/messaging/resources/messages/types/SendMessagesResponse.d.mts +4 -0
  187. package/dist/esm/api/resources/business/resources/messaging/resources/messages/types/SendMessagesResponse.mjs +2 -0
  188. package/dist/esm/api/resources/business/resources/messaging/resources/messages/types/index.d.mts +2 -0
  189. package/dist/esm/api/resources/business/resources/messaging/resources/messages/types/index.mjs +2 -0
  190. package/dist/esm/api/types/BusinessConversation.d.mts +20 -0
  191. package/dist/esm/api/types/BusinessConversation.mjs +2 -0
  192. package/dist/esm/api/types/BusinessMessage.d.mts +20 -0
  193. package/dist/esm/api/types/BusinessMessage.mjs +2 -0
  194. package/dist/esm/api/types/BusinessPhoto.d.mts +9 -0
  195. package/dist/esm/api/types/BusinessPhoto.mjs +2 -0
  196. package/dist/esm/api/types/index.d.mts +3 -0
  197. package/dist/esm/api/types/index.mjs +3 -0
  198. package/dist/esm/version.d.mts +1 -1
  199. package/dist/esm/version.mjs +1 -1
  200. package/package.json +45 -1
  201. package/reference.md +643 -0
@@ -0,0 +1,45 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../../../core/index.mjs";
4
+ import * as FiveOneEat from "../../../../../../../index.mjs";
5
+ export declare namespace ConversationsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ConversationsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<ConversationsClient.Options>;
12
+ constructor(options?: ConversationsClient.Options);
13
+ /**
14
+ * Retrieve a paginated list of all conversations for the authenticated business,
15
+ * ordered by the most recent message first.
16
+ *
17
+ * @param {FiveOneEat.business.messaging.ListConversationsRequest} request
18
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link FiveOneEat.UnauthorizedError}
21
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
22
+ *
23
+ * @example
24
+ * await client.business.messaging.conversations.list()
25
+ */
26
+ list(request?: FiveOneEat.business.messaging.ListConversationsRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.messaging.ListConversationsResponse>;
27
+ private __list;
28
+ /**
29
+ * Retrieve details of a specific conversation including the customer information
30
+ * and the latest message.
31
+ *
32
+ * @param {FiveOneEat.business.messaging.GetConversationsRequest} request
33
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
34
+ *
35
+ * @throws {@link FiveOneEat.UnauthorizedError}
36
+ * @throws {@link FiveOneEat.ForbiddenError}
37
+ *
38
+ * @example
39
+ * await client.business.messaging.conversations.get({
40
+ * conversation: "550e8400-e29b-41d4-a716-446655440000"
41
+ * })
42
+ */
43
+ get(request: FiveOneEat.business.messaging.GetConversationsRequest, requestOptions?: ConversationsClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.messaging.GetConversationsResponse>;
44
+ private __get;
45
+ }
@@ -0,0 +1,145 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth, } from "../../../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../../../core/headers.mjs";
13
+ import * as core from "../../../../../../../../core/index.mjs";
14
+ import * as environments from "../../../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../../../errors/index.mjs";
17
+ import * as FiveOneEat from "../../../../../../../index.mjs";
18
+ export class ConversationsClient {
19
+ constructor(options = {}) {
20
+ this._options = normalizeClientOptionsWithAuth(options);
21
+ }
22
+ /**
23
+ * Retrieve a paginated list of all conversations for the authenticated business,
24
+ * ordered by the most recent message first.
25
+ *
26
+ * @param {FiveOneEat.business.messaging.ListConversationsRequest} request
27
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @throws {@link FiveOneEat.UnauthorizedError}
30
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
31
+ *
32
+ * @example
33
+ * await client.business.messaging.conversations.list()
34
+ */
35
+ list(request = {}, requestOptions) {
36
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
37
+ }
38
+ __list() {
39
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41
+ const { page, per_page: perPage } = request;
42
+ const _queryParams = {
43
+ page,
44
+ per_page: perPage,
45
+ };
46
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
47
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
48
+ const _response = yield core.fetcher({
49
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, "business/messaging/conversations"),
50
+ method: "GET",
51
+ headers: _headers,
52
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
53
+ queryString: core.url
54
+ .queryBuilder()
55
+ .addMany(_queryParams)
56
+ .mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
57
+ .build(),
58
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
59
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
60
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
61
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
62
+ logging: this._options.logging,
63
+ });
64
+ if (_response.ok) {
65
+ return {
66
+ data: _response.body,
67
+ rawResponse: _response.rawResponse,
68
+ };
69
+ }
70
+ if (_response.error.reason === "status-code") {
71
+ switch (_response.error.statusCode) {
72
+ case 401:
73
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
74
+ case 422:
75
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
76
+ default:
77
+ throw new errors.FiveOneEatError({
78
+ statusCode: _response.error.statusCode,
79
+ body: _response.error.body,
80
+ rawResponse: _response.rawResponse,
81
+ });
82
+ }
83
+ }
84
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/messaging/conversations");
85
+ });
86
+ }
87
+ /**
88
+ * Retrieve details of a specific conversation including the customer information
89
+ * and the latest message.
90
+ *
91
+ * @param {FiveOneEat.business.messaging.GetConversationsRequest} request
92
+ * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration.
93
+ *
94
+ * @throws {@link FiveOneEat.UnauthorizedError}
95
+ * @throws {@link FiveOneEat.ForbiddenError}
96
+ *
97
+ * @example
98
+ * await client.business.messaging.conversations.get({
99
+ * conversation: "550e8400-e29b-41d4-a716-446655440000"
100
+ * })
101
+ */
102
+ get(request, requestOptions) {
103
+ return core.HttpResponsePromise.fromPromise(this.__get(request, requestOptions));
104
+ }
105
+ __get(request, requestOptions) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
108
+ const { conversation } = request;
109
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
110
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
111
+ const _response = yield core.fetcher({
112
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `business/messaging/conversations/${core.url.encodePathParam(conversation)}`),
113
+ method: "GET",
114
+ headers: _headers,
115
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
116
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
117
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
118
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
119
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
120
+ logging: this._options.logging,
121
+ });
122
+ if (_response.ok) {
123
+ return {
124
+ data: _response.body,
125
+ rawResponse: _response.rawResponse,
126
+ };
127
+ }
128
+ if (_response.error.reason === "status-code") {
129
+ switch (_response.error.statusCode) {
130
+ case 401:
131
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
132
+ case 403:
133
+ throw new FiveOneEat.ForbiddenError(_response.error.body, _response.rawResponse);
134
+ default:
135
+ throw new errors.FiveOneEatError({
136
+ statusCode: _response.error.statusCode,
137
+ body: _response.error.body,
138
+ rawResponse: _response.rawResponse,
139
+ });
140
+ }
141
+ }
142
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/business/messaging/conversations/{conversation}");
143
+ });
144
+ }
145
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * conversation: "550e8400-e29b-41d4-a716-446655440000"
5
+ * }
6
+ */
7
+ export interface GetConversationsRequest {
8
+ /** The conversation ID */
9
+ conversation: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListConversationsRequest {
6
+ /** Page number for pagination */
7
+ page?: number;
8
+ /** Number of conversations per page */
9
+ per_page?: number;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,2 @@
1
+ export type { GetConversationsRequest } from "./GetConversationsRequest.mjs";
2
+ export type { ListConversationsRequest } from "./ListConversationsRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { ConversationsClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { ConversationsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../../../index.mjs";
2
+ export interface GetConversationsResponse {
3
+ data: FiveOneEat.BusinessConversation;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../../../../../index.mjs";
2
+ export interface ListConversationsResponse {
3
+ data: FiveOneEat.BusinessConversation[];
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./GetConversationsResponse.mjs";
2
+ export * from "./ListConversationsResponse.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./GetConversationsResponse.mjs";
2
+ export * from "./ListConversationsResponse.mjs";
@@ -0,0 +1,6 @@
1
+ export * from "./conversations/client/requests/index.mjs";
2
+ export * as conversations from "./conversations/index.mjs";
3
+ export * from "./conversations/types/index.mjs";
4
+ export * from "./messages/client/requests/index.mjs";
5
+ export * as messages from "./messages/index.mjs";
6
+ export * from "./messages/types/index.mjs";
@@ -0,0 +1,6 @@
1
+ export * from "./conversations/client/requests/index.mjs";
2
+ export * as conversations from "./conversations/index.mjs";
3
+ export * from "./conversations/types/index.mjs";
4
+ export * from "./messages/client/requests/index.mjs";
5
+ export * as messages from "./messages/index.mjs";
6
+ export * from "./messages/types/index.mjs";
@@ -0,0 +1,81 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../../../BaseClient.mjs";
3
+ import * as core from "../../../../../../../../core/index.mjs";
4
+ import * as FiveOneEat from "../../../../../../../index.mjs";
5
+ export declare namespace MessagesClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class MessagesClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<MessagesClient.Options>;
12
+ constructor(options?: MessagesClient.Options);
13
+ /**
14
+ * Retrieve a paginated list of all messages in a specific conversation,
15
+ * ordered by creation time (oldest first).
16
+ *
17
+ * @param {FiveOneEat.business.messaging.ListMessagesRequest} request
18
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link FiveOneEat.UnauthorizedError}
21
+ * @throws {@link FiveOneEat.ForbiddenError}
22
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
23
+ *
24
+ * @example
25
+ * await client.business.messaging.messages.list({
26
+ * conversation: "550e8400-e29b-41d4-a716-446655440000"
27
+ * })
28
+ */
29
+ list(request: FiveOneEat.business.messaging.ListMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.messaging.ListMessagesResponse>;
30
+ private __list;
31
+ /**
32
+ * Send a new message to a specific conversation as the business.
33
+ *
34
+ * @param {FiveOneEat.business.messaging.StoreMessageRequest} request
35
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link FiveOneEat.UnauthorizedError}
38
+ * @throws {@link FiveOneEat.ForbiddenError}
39
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
40
+ *
41
+ * @example
42
+ * await client.business.messaging.messages.send({
43
+ * conversation: "550e8400-e29b-41d4-a716-446655440000",
44
+ * content: "content"
45
+ * })
46
+ */
47
+ send(request: FiveOneEat.business.messaging.StoreMessageRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.business.messaging.SendMessagesResponse>;
48
+ private __send;
49
+ /**
50
+ * Mark all messages from the customer as read by the business user.
51
+ *
52
+ * @param {FiveOneEat.business.messaging.MarkAsReadMessagesRequest} request
53
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
54
+ *
55
+ * @throws {@link FiveOneEat.UnauthorizedError}
56
+ * @throws {@link FiveOneEat.ForbiddenError}
57
+ *
58
+ * @example
59
+ * await client.business.messaging.messages.markAsRead({
60
+ * conversation: "550e8400-e29b-41d4-a716-446655440000"
61
+ * })
62
+ */
63
+ markAsRead(request: FiveOneEat.business.messaging.MarkAsReadMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<number>;
64
+ private __markAsRead;
65
+ /**
66
+ * Get the count of unread messages from the customer in a specific conversation.
67
+ *
68
+ * @param {FiveOneEat.business.messaging.UnreadCountMessagesRequest} request
69
+ * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration.
70
+ *
71
+ * @throws {@link FiveOneEat.UnauthorizedError}
72
+ * @throws {@link FiveOneEat.ForbiddenError}
73
+ *
74
+ * @example
75
+ * await client.business.messaging.messages.unreadCount({
76
+ * conversation: "550e8400-e29b-41d4-a716-446655440000"
77
+ * })
78
+ */
79
+ unreadCount(request: FiveOneEat.business.messaging.UnreadCountMessagesRequest, requestOptions?: MessagesClient.RequestOptions): core.HttpResponsePromise<number>;
80
+ private __unreadCount;
81
+ }