agentmail 0.3.2 → 0.3.3

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 (185) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +17 -12
  4. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +2 -1
  5. package/dist/cjs/api/resources/inboxes/resources/messages/client/requests/ListMessagesRequest.d.ts +1 -0
  6. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +2 -1
  7. package/dist/cjs/api/resources/inboxes/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  8. package/dist/cjs/api/resources/index.d.ts +3 -0
  9. package/dist/cjs/api/resources/index.js +4 -1
  10. package/dist/cjs/api/resources/lists/client/Client.d.ts +65 -0
  11. package/dist/cjs/api/resources/lists/client/Client.js +307 -0
  12. package/dist/cjs/api/resources/lists/client/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/lists/client/index.js +17 -0
  14. package/dist/cjs/api/resources/lists/client/requests/ListListEntriesRequest.d.ts +9 -0
  15. package/dist/cjs/api/resources/lists/client/requests/ListListEntriesRequest.js +3 -0
  16. package/dist/cjs/api/resources/lists/client/requests/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/lists/client/requests/index.js +2 -0
  18. package/dist/cjs/api/resources/lists/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/lists/index.js +18 -0
  20. package/dist/cjs/api/resources/lists/types/CreateListEntryRequest.d.ts +6 -0
  21. package/dist/cjs/api/resources/lists/types/CreateListEntryRequest.js +3 -0
  22. package/dist/cjs/api/resources/lists/types/Direction.d.ts +6 -0
  23. package/dist/cjs/api/resources/lists/types/Direction.js +9 -0
  24. package/dist/cjs/api/resources/lists/types/EntryType.d.ts +6 -0
  25. package/dist/cjs/api/resources/lists/types/EntryType.js +9 -0
  26. package/dist/cjs/api/resources/lists/types/ListEntry.d.ts +3 -0
  27. package/dist/cjs/api/resources/lists/types/ListEntry.js +3 -0
  28. package/dist/cjs/api/resources/lists/types/ListEntryBase.d.ts +13 -0
  29. package/dist/cjs/api/resources/lists/types/ListEntryBase.js +3 -0
  30. package/dist/cjs/api/resources/lists/types/ListListEntriesResponse.d.ts +8 -0
  31. package/dist/cjs/api/resources/lists/types/ListListEntriesResponse.js +3 -0
  32. package/dist/cjs/api/resources/lists/types/ListType.d.ts +6 -0
  33. package/dist/cjs/api/resources/lists/types/ListType.js +9 -0
  34. package/dist/cjs/api/resources/lists/types/PodListEntry.d.ts +7 -0
  35. package/dist/cjs/api/resources/lists/types/PodListEntry.js +3 -0
  36. package/dist/cjs/api/resources/lists/types/PodListListEntriesResponse.d.ts +8 -0
  37. package/dist/cjs/api/resources/lists/types/PodListListEntriesResponse.js +3 -0
  38. package/dist/cjs/api/resources/lists/types/index.d.ts +9 -0
  39. package/dist/cjs/api/resources/lists/types/index.js +25 -0
  40. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  41. package/dist/cjs/api/resources/pods/client/Client.js +7 -2
  42. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  43. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  44. package/dist/cjs/api/resources/pods/resources/lists/client/Client.d.ts +69 -0
  45. package/dist/cjs/api/resources/pods/resources/lists/client/Client.js +311 -0
  46. package/dist/cjs/api/resources/pods/resources/lists/client/index.d.ts +1 -0
  47. package/dist/cjs/api/resources/pods/resources/lists/client/index.js +17 -0
  48. package/dist/cjs/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.d.ts +9 -0
  49. package/dist/cjs/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.js +3 -0
  50. package/dist/cjs/api/resources/pods/resources/lists/client/requests/index.d.ts +1 -0
  51. package/dist/cjs/api/resources/pods/resources/lists/client/requests/index.js +2 -0
  52. package/dist/cjs/api/resources/pods/resources/lists/index.d.ts +1 -0
  53. package/dist/cjs/api/resources/pods/resources/lists/index.js +17 -0
  54. package/dist/cjs/api/resources/pods/resources/threads/client/Client.js +2 -1
  55. package/dist/cjs/api/resources/pods/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  56. package/dist/cjs/api/resources/threads/client/Client.js +2 -1
  57. package/dist/cjs/api/resources/threads/client/requests/ListThreadsRequest.d.ts +1 -0
  58. package/dist/cjs/api/types/IncludeBlocked.d.ts +4 -0
  59. package/dist/cjs/api/types/IncludeBlocked.js +3 -0
  60. package/dist/cjs/api/types/index.d.ts +1 -0
  61. package/dist/cjs/api/types/index.js +1 -0
  62. package/dist/cjs/serialization/resources/index.d.ts +2 -0
  63. package/dist/cjs/serialization/resources/index.js +3 -1
  64. package/dist/cjs/serialization/resources/lists/index.d.ts +1 -0
  65. package/dist/cjs/serialization/resources/lists/index.js +17 -0
  66. package/dist/cjs/serialization/resources/lists/types/CreateListEntryRequest.d.ts +10 -0
  67. package/dist/cjs/serialization/resources/lists/types/CreateListEntryRequest.js +42 -0
  68. package/dist/cjs/serialization/resources/lists/types/Direction.d.ts +7 -0
  69. package/dist/cjs/serialization/resources/lists/types/Direction.js +39 -0
  70. package/dist/cjs/serialization/resources/lists/types/EntryType.d.ts +7 -0
  71. package/dist/cjs/serialization/resources/lists/types/EntryType.js +39 -0
  72. package/dist/cjs/serialization/resources/lists/types/ListEntry.d.ts +9 -0
  73. package/dist/cjs/serialization/resources/lists/types/ListEntry.js +40 -0
  74. package/dist/cjs/serialization/resources/lists/types/ListEntryBase.d.ts +19 -0
  75. package/dist/cjs/serialization/resources/lists/types/ListEntryBase.js +51 -0
  76. package/dist/cjs/serialization/resources/lists/types/ListListEntriesResponse.d.ts +16 -0
  77. package/dist/cjs/serialization/resources/lists/types/ListListEntriesResponse.js +48 -0
  78. package/dist/cjs/serialization/resources/lists/types/ListType.d.ts +7 -0
  79. package/dist/cjs/serialization/resources/lists/types/ListType.js +39 -0
  80. package/dist/cjs/serialization/resources/lists/types/PodListEntry.d.ts +11 -0
  81. package/dist/cjs/serialization/resources/lists/types/PodListEntry.js +45 -0
  82. package/dist/cjs/serialization/resources/lists/types/PodListListEntriesResponse.d.ts +16 -0
  83. package/dist/cjs/serialization/resources/lists/types/PodListListEntriesResponse.js +48 -0
  84. package/dist/cjs/serialization/resources/lists/types/index.d.ts +9 -0
  85. package/dist/cjs/serialization/resources/lists/types/index.js +25 -0
  86. package/dist/cjs/serialization/types/IncludeBlocked.d.ts +7 -0
  87. package/dist/cjs/serialization/types/IncludeBlocked.js +39 -0
  88. package/dist/cjs/serialization/types/index.d.ts +1 -0
  89. package/dist/cjs/serialization/types/index.js +1 -0
  90. package/dist/cjs/version.d.ts +1 -1
  91. package/dist/cjs/version.js +1 -1
  92. package/dist/esm/BaseClient.mjs +2 -2
  93. package/dist/esm/Client.d.mts +3 -0
  94. package/dist/esm/Client.mjs +5 -0
  95. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +2 -1
  96. package/dist/esm/api/resources/inboxes/resources/messages/client/requests/ListMessagesRequest.d.mts +1 -0
  97. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +2 -1
  98. package/dist/esm/api/resources/inboxes/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  99. package/dist/esm/api/resources/index.d.mts +3 -0
  100. package/dist/esm/api/resources/index.mjs +3 -0
  101. package/dist/esm/api/resources/lists/client/Client.d.mts +65 -0
  102. package/dist/esm/api/resources/lists/client/Client.mjs +270 -0
  103. package/dist/esm/api/resources/lists/client/index.d.mts +1 -0
  104. package/dist/esm/api/resources/lists/client/index.mjs +1 -0
  105. package/dist/esm/api/resources/lists/client/requests/ListListEntriesRequest.d.mts +9 -0
  106. package/dist/esm/api/resources/lists/client/requests/ListListEntriesRequest.mjs +2 -0
  107. package/dist/esm/api/resources/lists/client/requests/index.d.mts +1 -0
  108. package/dist/esm/api/resources/lists/client/requests/index.mjs +1 -0
  109. package/dist/esm/api/resources/lists/index.d.mts +2 -0
  110. package/dist/esm/api/resources/lists/index.mjs +2 -0
  111. package/dist/esm/api/resources/lists/types/CreateListEntryRequest.d.mts +6 -0
  112. package/dist/esm/api/resources/lists/types/CreateListEntryRequest.mjs +2 -0
  113. package/dist/esm/api/resources/lists/types/Direction.d.mts +6 -0
  114. package/dist/esm/api/resources/lists/types/Direction.mjs +6 -0
  115. package/dist/esm/api/resources/lists/types/EntryType.d.mts +6 -0
  116. package/dist/esm/api/resources/lists/types/EntryType.mjs +6 -0
  117. package/dist/esm/api/resources/lists/types/ListEntry.d.mts +3 -0
  118. package/dist/esm/api/resources/lists/types/ListEntry.mjs +2 -0
  119. package/dist/esm/api/resources/lists/types/ListEntryBase.d.mts +13 -0
  120. package/dist/esm/api/resources/lists/types/ListEntryBase.mjs +2 -0
  121. package/dist/esm/api/resources/lists/types/ListListEntriesResponse.d.mts +8 -0
  122. package/dist/esm/api/resources/lists/types/ListListEntriesResponse.mjs +2 -0
  123. package/dist/esm/api/resources/lists/types/ListType.d.mts +6 -0
  124. package/dist/esm/api/resources/lists/types/ListType.mjs +6 -0
  125. package/dist/esm/api/resources/lists/types/PodListEntry.d.mts +7 -0
  126. package/dist/esm/api/resources/lists/types/PodListEntry.mjs +2 -0
  127. package/dist/esm/api/resources/lists/types/PodListListEntriesResponse.d.mts +8 -0
  128. package/dist/esm/api/resources/lists/types/PodListListEntriesResponse.mjs +2 -0
  129. package/dist/esm/api/resources/lists/types/index.d.mts +9 -0
  130. package/dist/esm/api/resources/lists/types/index.mjs +9 -0
  131. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  132. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  133. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  134. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  135. package/dist/esm/api/resources/pods/resources/lists/client/Client.d.mts +69 -0
  136. package/dist/esm/api/resources/pods/resources/lists/client/Client.mjs +274 -0
  137. package/dist/esm/api/resources/pods/resources/lists/client/index.d.mts +1 -0
  138. package/dist/esm/api/resources/pods/resources/lists/client/index.mjs +1 -0
  139. package/dist/esm/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.d.mts +9 -0
  140. package/dist/esm/api/resources/pods/resources/lists/client/requests/ListListEntriesRequest.mjs +2 -0
  141. package/dist/esm/api/resources/pods/resources/lists/client/requests/index.d.mts +1 -0
  142. package/dist/esm/api/resources/pods/resources/lists/client/requests/index.mjs +1 -0
  143. package/dist/esm/api/resources/pods/resources/lists/index.d.mts +1 -0
  144. package/dist/esm/api/resources/pods/resources/lists/index.mjs +1 -0
  145. package/dist/esm/api/resources/pods/resources/threads/client/Client.mjs +2 -1
  146. package/dist/esm/api/resources/pods/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  147. package/dist/esm/api/resources/threads/client/Client.mjs +2 -1
  148. package/dist/esm/api/resources/threads/client/requests/ListThreadsRequest.d.mts +1 -0
  149. package/dist/esm/api/types/IncludeBlocked.d.mts +4 -0
  150. package/dist/esm/api/types/IncludeBlocked.mjs +2 -0
  151. package/dist/esm/api/types/index.d.mts +1 -0
  152. package/dist/esm/api/types/index.mjs +1 -0
  153. package/dist/esm/serialization/resources/index.d.mts +2 -0
  154. package/dist/esm/serialization/resources/index.mjs +2 -0
  155. package/dist/esm/serialization/resources/lists/index.d.mts +1 -0
  156. package/dist/esm/serialization/resources/lists/index.mjs +1 -0
  157. package/dist/esm/serialization/resources/lists/types/CreateListEntryRequest.d.mts +10 -0
  158. package/dist/esm/serialization/resources/lists/types/CreateListEntryRequest.mjs +6 -0
  159. package/dist/esm/serialization/resources/lists/types/Direction.d.mts +7 -0
  160. package/dist/esm/serialization/resources/lists/types/Direction.mjs +3 -0
  161. package/dist/esm/serialization/resources/lists/types/EntryType.d.mts +7 -0
  162. package/dist/esm/serialization/resources/lists/types/EntryType.mjs +3 -0
  163. package/dist/esm/serialization/resources/lists/types/ListEntry.d.mts +9 -0
  164. package/dist/esm/serialization/resources/lists/types/ListEntry.mjs +4 -0
  165. package/dist/esm/serialization/resources/lists/types/ListEntryBase.d.mts +19 -0
  166. package/dist/esm/serialization/resources/lists/types/ListEntryBase.mjs +15 -0
  167. package/dist/esm/serialization/resources/lists/types/ListListEntriesResponse.d.mts +16 -0
  168. package/dist/esm/serialization/resources/lists/types/ListListEntriesResponse.mjs +12 -0
  169. package/dist/esm/serialization/resources/lists/types/ListType.d.mts +7 -0
  170. package/dist/esm/serialization/resources/lists/types/ListType.mjs +3 -0
  171. package/dist/esm/serialization/resources/lists/types/PodListEntry.d.mts +11 -0
  172. package/dist/esm/serialization/resources/lists/types/PodListEntry.mjs +9 -0
  173. package/dist/esm/serialization/resources/lists/types/PodListListEntriesResponse.d.mts +16 -0
  174. package/dist/esm/serialization/resources/lists/types/PodListListEntriesResponse.mjs +12 -0
  175. package/dist/esm/serialization/resources/lists/types/index.d.mts +9 -0
  176. package/dist/esm/serialization/resources/lists/types/index.mjs +9 -0
  177. package/dist/esm/serialization/types/IncludeBlocked.d.mts +7 -0
  178. package/dist/esm/serialization/types/IncludeBlocked.mjs +3 -0
  179. package/dist/esm/serialization/types/index.d.mts +1 -0
  180. package/dist/esm/serialization/types/index.mjs +1 -0
  181. package/dist/esm/version.d.mts +1 -1
  182. package/dist/esm/version.mjs +1 -1
  183. package/dist/llms.txt +7 -1
  184. package/package.json +1 -1
  185. package/reference.md +558 -0
@@ -0,0 +1,270 @@
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 serializers from "../../../../serialization/index.mjs";
18
+ import * as AgentMail from "../../../index.mjs";
19
+ export class ListsClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * @param {AgentMail.Direction} direction
25
+ * @param {AgentMail.ListType} type
26
+ * @param {AgentMail.CreateListEntryRequest} request
27
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @throws {@link AgentMail.ValidationError}
30
+ *
31
+ * @example
32
+ * await client.lists.create("send", "allow", {
33
+ * entry: "entry"
34
+ * })
35
+ */
36
+ create(direction, type, request, requestOptions) {
37
+ return core.HttpResponsePromise.fromPromise(this.__create(direction, type, request, requestOptions));
38
+ }
39
+ __create(direction, type, request, requestOptions) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
42
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
43
+ 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);
44
+ const _response = yield core.fetcher({
45
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
46
+ .http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}`),
47
+ method: "POST",
48
+ headers: _headers,
49
+ contentType: "application/json",
50
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
51
+ requestType: "json",
52
+ body: serializers.CreateListEntryRequest.jsonOrThrow(request, {
53
+ unrecognizedObjectKeys: "strip",
54
+ omitUndefined: true,
55
+ }),
56
+ 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,
57
+ 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,
58
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
59
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
60
+ logging: this._options.logging,
61
+ });
62
+ if (_response.ok) {
63
+ return {
64
+ data: serializers.ListEntry.parseOrThrow(_response.body, {
65
+ unrecognizedObjectKeys: "passthrough",
66
+ allowUnrecognizedUnionMembers: true,
67
+ allowUnrecognizedEnumValues: true,
68
+ skipValidation: true,
69
+ breadcrumbsPrefix: ["response"],
70
+ }),
71
+ rawResponse: _response.rawResponse,
72
+ };
73
+ }
74
+ if (_response.error.reason === "status-code") {
75
+ switch (_response.error.statusCode) {
76
+ case 400:
77
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
78
+ unrecognizedObjectKeys: "passthrough",
79
+ allowUnrecognizedUnionMembers: true,
80
+ allowUnrecognizedEnumValues: true,
81
+ skipValidation: true,
82
+ breadcrumbsPrefix: ["response"],
83
+ }), _response.rawResponse);
84
+ default:
85
+ throw new errors.AgentMailError({
86
+ statusCode: _response.error.statusCode,
87
+ body: _response.error.body,
88
+ rawResponse: _response.rawResponse,
89
+ });
90
+ }
91
+ }
92
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v0/lists/{direction}/{type}");
93
+ });
94
+ }
95
+ /**
96
+ * @param {AgentMail.Direction} direction
97
+ * @param {AgentMail.ListType} type
98
+ * @param {AgentMail.ListListEntriesRequest} request
99
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
100
+ *
101
+ * @example
102
+ * await client.lists.list("send", "allow")
103
+ */
104
+ list(direction, type, request = {}, requestOptions) {
105
+ return core.HttpResponsePromise.fromPromise(this.__list(direction, type, request, requestOptions));
106
+ }
107
+ __list(direction_1, type_1) {
108
+ return __awaiter(this, arguments, void 0, function* (direction, type, request = {}, requestOptions) {
109
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
110
+ const { limit, pageToken } = request;
111
+ const _queryParams = {
112
+ limit,
113
+ page_token: pageToken,
114
+ };
115
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
116
+ 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);
117
+ const _response = yield core.fetcher({
118
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
119
+ .http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}`),
120
+ method: "GET",
121
+ headers: _headers,
122
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
123
+ 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,
124
+ 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,
125
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
126
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
127
+ logging: this._options.logging,
128
+ });
129
+ if (_response.ok) {
130
+ return {
131
+ data: serializers.ListListEntriesResponse.parseOrThrow(_response.body, {
132
+ unrecognizedObjectKeys: "passthrough",
133
+ allowUnrecognizedUnionMembers: true,
134
+ allowUnrecognizedEnumValues: true,
135
+ skipValidation: true,
136
+ breadcrumbsPrefix: ["response"],
137
+ }),
138
+ rawResponse: _response.rawResponse,
139
+ };
140
+ }
141
+ if (_response.error.reason === "status-code") {
142
+ throw new errors.AgentMailError({
143
+ statusCode: _response.error.statusCode,
144
+ body: _response.error.body,
145
+ rawResponse: _response.rawResponse,
146
+ });
147
+ }
148
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/lists/{direction}/{type}");
149
+ });
150
+ }
151
+ /**
152
+ * @param {AgentMail.Direction} direction
153
+ * @param {AgentMail.ListType} type
154
+ * @param {string} entry - Email address or domain.
155
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
156
+ *
157
+ * @throws {@link AgentMail.NotFoundError}
158
+ *
159
+ * @example
160
+ * await client.lists.get("send", "allow", "entry")
161
+ */
162
+ get(direction, type, entry, requestOptions) {
163
+ return core.HttpResponsePromise.fromPromise(this.__get(direction, type, entry, requestOptions));
164
+ }
165
+ __get(direction, type, entry, requestOptions) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
168
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
169
+ 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);
170
+ const _response = yield core.fetcher({
171
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
172
+ .http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}/${core.url.encodePathParam(entry)}`),
173
+ method: "GET",
174
+ headers: _headers,
175
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
176
+ 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,
177
+ 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,
178
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
179
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
180
+ logging: this._options.logging,
181
+ });
182
+ if (_response.ok) {
183
+ return {
184
+ data: serializers.ListEntry.parseOrThrow(_response.body, {
185
+ unrecognizedObjectKeys: "passthrough",
186
+ allowUnrecognizedUnionMembers: true,
187
+ allowUnrecognizedEnumValues: true,
188
+ skipValidation: true,
189
+ breadcrumbsPrefix: ["response"],
190
+ }),
191
+ rawResponse: _response.rawResponse,
192
+ };
193
+ }
194
+ if (_response.error.reason === "status-code") {
195
+ switch (_response.error.statusCode) {
196
+ case 404:
197
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
198
+ unrecognizedObjectKeys: "passthrough",
199
+ allowUnrecognizedUnionMembers: true,
200
+ allowUnrecognizedEnumValues: true,
201
+ skipValidation: true,
202
+ breadcrumbsPrefix: ["response"],
203
+ }), _response.rawResponse);
204
+ default:
205
+ throw new errors.AgentMailError({
206
+ statusCode: _response.error.statusCode,
207
+ body: _response.error.body,
208
+ rawResponse: _response.rawResponse,
209
+ });
210
+ }
211
+ }
212
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/lists/{direction}/{type}/{entry}");
213
+ });
214
+ }
215
+ /**
216
+ * @param {AgentMail.Direction} direction
217
+ * @param {AgentMail.ListType} type
218
+ * @param {string} entry - Email address or domain.
219
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
220
+ *
221
+ * @throws {@link AgentMail.NotFoundError}
222
+ *
223
+ * @example
224
+ * await client.lists.delete("send", "allow", "entry")
225
+ */
226
+ delete(direction, type, entry, requestOptions) {
227
+ return core.HttpResponsePromise.fromPromise(this.__delete(direction, type, entry, requestOptions));
228
+ }
229
+ __delete(direction, type, entry, requestOptions) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
232
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
233
+ 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);
234
+ const _response = yield core.fetcher({
235
+ url: core.url.join((_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : ((_c = (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.AgentMailEnvironment.Prod)
236
+ .http, `/v0/lists/${core.url.encodePathParam(serializers.Direction.jsonOrThrow(direction, { omitUndefined: true }))}/${core.url.encodePathParam(serializers.ListType.jsonOrThrow(type, { omitUndefined: true }))}/${core.url.encodePathParam(entry)}`),
237
+ method: "DELETE",
238
+ headers: _headers,
239
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
240
+ 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,
241
+ 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,
242
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
243
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
244
+ logging: this._options.logging,
245
+ });
246
+ if (_response.ok) {
247
+ return { data: undefined, rawResponse: _response.rawResponse };
248
+ }
249
+ if (_response.error.reason === "status-code") {
250
+ switch (_response.error.statusCode) {
251
+ case 404:
252
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
253
+ unrecognizedObjectKeys: "passthrough",
254
+ allowUnrecognizedUnionMembers: true,
255
+ allowUnrecognizedEnumValues: true,
256
+ skipValidation: true,
257
+ breadcrumbsPrefix: ["response"],
258
+ }), _response.rawResponse);
259
+ default:
260
+ throw new errors.AgentMailError({
261
+ statusCode: _response.error.statusCode,
262
+ body: _response.error.body,
263
+ rawResponse: _response.rawResponse,
264
+ });
265
+ }
266
+ }
267
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v0/lists/{direction}/{type}/{entry}");
268
+ });
269
+ }
270
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ import type * as AgentMail from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListListEntriesRequest {
7
+ limit?: AgentMail.Limit;
8
+ pageToken?: AgentMail.PageToken;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { ListListEntriesRequest } from "./ListListEntriesRequest.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,6 @@
1
+ export interface CreateListEntryRequest {
2
+ /** Email address or domain to add. */
3
+ entry: string;
4
+ /** Reason for adding the entry. */
5
+ reason?: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ /** Direction of list entry. */
2
+ export declare const Direction: {
3
+ readonly Send: "send";
4
+ readonly Receive: "receive";
5
+ };
6
+ export type Direction = (typeof Direction)[keyof typeof Direction];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Direction of list entry. */
3
+ export const Direction = {
4
+ Send: "send",
5
+ Receive: "receive",
6
+ };
@@ -0,0 +1,6 @@
1
+ /** Whether the entry is an email address or domain. */
2
+ export declare const EntryType: {
3
+ readonly Email: "email";
4
+ readonly Domain: "domain";
5
+ };
6
+ export type EntryType = (typeof EntryType)[keyof typeof EntryType];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Whether the entry is an email address or domain. */
3
+ export const EntryType = {
4
+ Email: "email",
5
+ Domain: "domain",
6
+ };
@@ -0,0 +1,3 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface ListEntry extends AgentMail.ListEntryBase {
3
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,13 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface ListEntryBase {
3
+ /** Email address or domain of list entry. */
4
+ entry: string;
5
+ organizationId: AgentMail.OrganizationId;
6
+ /** Reason for adding the entry. */
7
+ reason?: string;
8
+ direction: AgentMail.Direction;
9
+ listType: AgentMail.ListType;
10
+ entryType: AgentMail.EntryType;
11
+ /** Time at which entry was created. */
12
+ createdAt: Date;
13
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface ListListEntriesResponse {
3
+ count: AgentMail.Count;
4
+ limit?: AgentMail.Limit;
5
+ nextPageToken?: AgentMail.PageToken;
6
+ /** Ordered by entry ascending. */
7
+ entries: AgentMail.ListEntry[];
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ /** Type of list entry. */
2
+ export declare const ListType: {
3
+ readonly Allow: "allow";
4
+ readonly Block: "block";
5
+ };
6
+ export type ListType = (typeof ListType)[keyof typeof ListType];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Type of list entry. */
3
+ export const ListType = {
4
+ Allow: "allow",
5
+ Block: "block",
6
+ };
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface PodListEntry extends AgentMail.ListEntryBase {
3
+ /** ID of pod. */
4
+ podId: string;
5
+ /** ID of inbox, if entry is inbox-scoped. */
6
+ inboxId?: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ import type * as AgentMail from "../../../index.mjs";
2
+ export interface PodListListEntriesResponse {
3
+ count: AgentMail.Count;
4
+ limit?: AgentMail.Limit;
5
+ nextPageToken?: AgentMail.PageToken;
6
+ /** Ordered by entry ascending. */
7
+ entries: AgentMail.PodListEntry[];
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ export * from "./CreateListEntryRequest.mjs";
2
+ export * from "./Direction.mjs";
3
+ export * from "./EntryType.mjs";
4
+ export * from "./ListEntry.mjs";
5
+ export * from "./ListEntryBase.mjs";
6
+ export * from "./ListListEntriesResponse.mjs";
7
+ export * from "./ListType.mjs";
8
+ export * from "./PodListEntry.mjs";
9
+ export * from "./PodListListEntriesResponse.mjs";
@@ -0,0 +1,9 @@
1
+ export * from "./CreateListEntryRequest.mjs";
2
+ export * from "./Direction.mjs";
3
+ export * from "./EntryType.mjs";
4
+ export * from "./ListEntry.mjs";
5
+ export * from "./ListEntryBase.mjs";
6
+ export * from "./ListListEntriesResponse.mjs";
7
+ export * from "./ListType.mjs";
8
+ export * from "./PodListEntry.mjs";
9
+ export * from "./PodListListEntriesResponse.mjs";
@@ -5,6 +5,7 @@ import * as AgentMail from "../../../index.mjs";
5
5
  import { DomainsClient } from "../resources/domains/client/Client.mjs";
6
6
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
7
7
  import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
8
+ import { ListsClient } from "../resources/lists/client/Client.mjs";
8
9
  import { ThreadsClient } from "../resources/threads/client/Client.mjs";
9
10
  export declare namespace PodsClient {
10
11
  type Options = BaseClientOptions;
@@ -17,11 +18,13 @@ export declare class PodsClient {
17
18
  protected _threads: ThreadsClient | undefined;
18
19
  protected _drafts: DraftsClient | undefined;
19
20
  protected _domains: DomainsClient | undefined;
21
+ protected _lists: ListsClient | undefined;
20
22
  constructor(options?: PodsClient.Options);
21
23
  get inboxes(): InboxesClient;
22
24
  get threads(): ThreadsClient;
23
25
  get drafts(): DraftsClient;
24
26
  get domains(): DomainsClient;
27
+ get lists(): ListsClient;
25
28
  /**
26
29
  * @param {AgentMail.pods.ListPodsRequest} request
27
30
  * @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -19,6 +19,7 @@ import * as AgentMail from "../../../index.mjs";
19
19
  import { DomainsClient } from "../resources/domains/client/Client.mjs";
20
20
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
21
21
  import { InboxesClient } from "../resources/inboxes/client/Client.mjs";
22
+ import { ListsClient } from "../resources/lists/client/Client.mjs";
22
23
  import { ThreadsClient } from "../resources/threads/client/Client.mjs";
23
24
  export class PodsClient {
24
25
  constructor(options = {}) {
@@ -40,6 +41,10 @@ export class PodsClient {
40
41
  var _a;
41
42
  return ((_a = this._domains) !== null && _a !== void 0 ? _a : (this._domains = new DomainsClient(this._options)));
42
43
  }
44
+ get lists() {
45
+ var _a;
46
+ return ((_a = this._lists) !== null && _a !== void 0 ? _a : (this._lists = new ListsClient(this._options)));
47
+ }
43
48
  /**
44
49
  * @param {AgentMail.pods.ListPodsRequest} request
45
50
  * @param {PodsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -4,5 +4,7 @@ export * from "./drafts/client/requests/index.mjs";
4
4
  export * as drafts from "./drafts/index.mjs";
5
5
  export * from "./inboxes/client/requests/index.mjs";
6
6
  export * as inboxes from "./inboxes/index.mjs";
7
+ export * from "./lists/client/requests/index.mjs";
8
+ export * as lists from "./lists/index.mjs";
7
9
  export * from "./threads/client/requests/index.mjs";
8
10
  export * as threads from "./threads/index.mjs";
@@ -4,5 +4,7 @@ export * from "./drafts/client/requests/index.mjs";
4
4
  export * as drafts from "./drafts/index.mjs";
5
5
  export * from "./inboxes/client/requests/index.mjs";
6
6
  export * as inboxes from "./inboxes/index.mjs";
7
+ export * from "./lists/client/requests/index.mjs";
8
+ export * as lists from "./lists/index.mjs";
7
9
  export * from "./threads/client/requests/index.mjs";
8
10
  export * as threads from "./threads/index.mjs";
@@ -0,0 +1,69 @@
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 AgentMail from "../../../../../index.mjs";
5
+ export declare namespace ListsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ListsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<ListsClient.Options>;
12
+ constructor(options?: ListsClient.Options);
13
+ /**
14
+ * @param {AgentMail.pods.PodId} pod_id
15
+ * @param {AgentMail.Direction} direction
16
+ * @param {AgentMail.ListType} type
17
+ * @param {AgentMail.CreateListEntryRequest} request
18
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link AgentMail.ValidationError}
21
+ *
22
+ * @example
23
+ * await client.pods.lists.create("pod_id", "send", "allow", {
24
+ * entry: "entry"
25
+ * })
26
+ */
27
+ create(pod_id: AgentMail.pods.PodId, direction: AgentMail.Direction, type: AgentMail.ListType, request: AgentMail.CreateListEntryRequest, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.PodListEntry>;
28
+ private __create;
29
+ /**
30
+ * @param {AgentMail.pods.PodId} pod_id
31
+ * @param {AgentMail.Direction} direction
32
+ * @param {AgentMail.ListType} type
33
+ * @param {AgentMail.pods.ListListEntriesRequest} request
34
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.pods.lists.list("pod_id", "send", "allow")
38
+ */
39
+ list(pod_id: AgentMail.pods.PodId, direction: AgentMail.Direction, type: AgentMail.ListType, request?: AgentMail.pods.ListListEntriesRequest, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.PodListListEntriesResponse>;
40
+ private __list;
41
+ /**
42
+ * @param {AgentMail.pods.PodId} pod_id
43
+ * @param {AgentMail.Direction} direction
44
+ * @param {AgentMail.ListType} type
45
+ * @param {string} entry - Email address or domain.
46
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
47
+ *
48
+ * @throws {@link AgentMail.NotFoundError}
49
+ *
50
+ * @example
51
+ * await client.pods.lists.get("pod_id", "send", "allow", "entry")
52
+ */
53
+ get(pod_id: AgentMail.pods.PodId, direction: AgentMail.Direction, type: AgentMail.ListType, entry: string, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<AgentMail.PodListEntry>;
54
+ private __get;
55
+ /**
56
+ * @param {AgentMail.pods.PodId} pod_id
57
+ * @param {AgentMail.Direction} direction
58
+ * @param {AgentMail.ListType} type
59
+ * @param {string} entry - Email address or domain.
60
+ * @param {ListsClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @throws {@link AgentMail.NotFoundError}
63
+ *
64
+ * @example
65
+ * await client.pods.lists.delete("pod_id", "send", "allow", "entry")
66
+ */
67
+ delete(pod_id: AgentMail.pods.PodId, direction: AgentMail.Direction, type: AgentMail.ListType, entry: string, requestOptions?: ListsClient.RequestOptions): core.HttpResponsePromise<void>;
68
+ private __delete;
69
+ }