agentmail 0.5.27 → 0.5.28

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 (125) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/accounts/client/Client.d.ts +38 -1
  3. package/dist/cjs/api/resources/accounts/client/Client.js +111 -1
  4. package/dist/cjs/api/resources/accounts/types/Account.d.ts +4 -0
  5. package/dist/cjs/api/resources/accounts/types/AccountStatus.d.ts +8 -0
  6. package/dist/cjs/api/resources/accounts/types/AccountStatus.js +11 -0
  7. package/dist/cjs/api/resources/accounts/types/UpdateAccountRequest.d.ts +9 -0
  8. package/dist/cjs/api/resources/accounts/types/UpdateAccountRequest.js +3 -0
  9. package/dist/cjs/api/resources/accounts/types/UpdateAccountStatus.d.ts +10 -0
  10. package/dist/cjs/api/resources/accounts/types/UpdateAccountStatus.js +13 -0
  11. package/dist/cjs/api/resources/accounts/types/index.d.ts +3 -0
  12. package/dist/cjs/api/resources/accounts/types/index.js +3 -0
  13. package/dist/cjs/api/resources/apiKeys/types/ApiKeyPermissions.d.ts +5 -0
  14. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +3 -0
  15. package/dist/cjs/api/resources/inboxes/client/Client.js +21 -16
  16. package/dist/cjs/api/resources/inboxes/resources/accounts/client/Client.d.ts +42 -0
  17. package/dist/cjs/api/resources/inboxes/resources/accounts/client/Client.js +197 -0
  18. package/dist/cjs/api/resources/inboxes/resources/accounts/client/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/inboxes/resources/accounts/client/index.js +17 -0
  20. package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.d.ts +10 -0
  21. package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.js +3 -0
  22. package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/inboxes/resources/accounts/client/requests/index.js +2 -0
  24. package/dist/cjs/api/resources/inboxes/resources/accounts/exports.d.ts +2 -0
  25. package/dist/cjs/api/resources/inboxes/resources/accounts/exports.js +21 -0
  26. package/dist/cjs/api/resources/inboxes/resources/accounts/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/inboxes/resources/accounts/index.js +17 -0
  28. package/dist/cjs/api/resources/inboxes/resources/index.d.ts +2 -0
  29. package/dist/cjs/api/resources/inboxes/resources/index.js +3 -1
  30. package/dist/cjs/api/resources/pods/client/Client.d.ts +3 -0
  31. package/dist/cjs/api/resources/pods/client/Client.js +21 -16
  32. package/dist/cjs/api/resources/pods/resources/accounts/client/Client.d.ts +42 -0
  33. package/dist/cjs/api/resources/pods/resources/accounts/client/Client.js +197 -0
  34. package/dist/cjs/api/resources/pods/resources/accounts/client/index.d.ts +1 -0
  35. package/dist/cjs/api/resources/pods/resources/accounts/client/index.js +17 -0
  36. package/dist/cjs/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.d.ts +10 -0
  37. package/dist/cjs/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.js +3 -0
  38. package/dist/cjs/api/resources/pods/resources/accounts/client/requests/index.d.ts +1 -0
  39. package/dist/cjs/api/resources/pods/resources/accounts/client/requests/index.js +2 -0
  40. package/dist/cjs/api/resources/pods/resources/accounts/exports.d.ts +2 -0
  41. package/dist/cjs/api/resources/pods/resources/accounts/exports.js +21 -0
  42. package/dist/cjs/api/resources/pods/resources/accounts/index.d.ts +1 -0
  43. package/dist/cjs/api/resources/pods/resources/accounts/index.js +17 -0
  44. package/dist/cjs/api/resources/pods/resources/index.d.ts +2 -0
  45. package/dist/cjs/api/resources/pods/resources/index.js +3 -1
  46. package/dist/cjs/api/resources/webhooks/types/CreateWebhookRequest.d.ts +4 -0
  47. package/dist/cjs/api/resources/webhooks/types/UpdatePodWebhookRequest.d.ts +5 -1
  48. package/dist/cjs/serialization/resources/accounts/types/Account.d.ts +3 -0
  49. package/dist/cjs/serialization/resources/accounts/types/Account.js +3 -0
  50. package/dist/cjs/serialization/resources/accounts/types/AccountStatus.d.ts +7 -0
  51. package/dist/cjs/serialization/resources/accounts/types/AccountStatus.js +39 -0
  52. package/dist/cjs/serialization/resources/accounts/types/UpdateAccountRequest.d.ts +10 -0
  53. package/dist/cjs/serialization/resources/accounts/types/UpdateAccountRequest.js +42 -0
  54. package/dist/cjs/serialization/resources/accounts/types/UpdateAccountStatus.d.ts +7 -0
  55. package/dist/cjs/serialization/resources/accounts/types/UpdateAccountStatus.js +39 -0
  56. package/dist/cjs/serialization/resources/accounts/types/index.d.ts +3 -0
  57. package/dist/cjs/serialization/resources/accounts/types/index.js +3 -0
  58. package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.d.ts +1 -0
  59. package/dist/cjs/serialization/resources/apiKeys/types/ApiKeyPermissions.js +1 -0
  60. package/dist/cjs/version.d.ts +1 -1
  61. package/dist/cjs/version.js +1 -1
  62. package/dist/esm/BaseClient.mjs +2 -2
  63. package/dist/esm/api/resources/accounts/client/Client.d.mts +38 -1
  64. package/dist/esm/api/resources/accounts/client/Client.mjs +111 -1
  65. package/dist/esm/api/resources/accounts/types/Account.d.mts +4 -0
  66. package/dist/esm/api/resources/accounts/types/AccountStatus.d.mts +8 -0
  67. package/dist/esm/api/resources/accounts/types/AccountStatus.mjs +8 -0
  68. package/dist/esm/api/resources/accounts/types/UpdateAccountRequest.d.mts +9 -0
  69. package/dist/esm/api/resources/accounts/types/UpdateAccountRequest.mjs +2 -0
  70. package/dist/esm/api/resources/accounts/types/UpdateAccountStatus.d.mts +10 -0
  71. package/dist/esm/api/resources/accounts/types/UpdateAccountStatus.mjs +10 -0
  72. package/dist/esm/api/resources/accounts/types/index.d.mts +3 -0
  73. package/dist/esm/api/resources/accounts/types/index.mjs +3 -0
  74. package/dist/esm/api/resources/apiKeys/types/ApiKeyPermissions.d.mts +5 -0
  75. package/dist/esm/api/resources/inboxes/client/Client.d.mts +3 -0
  76. package/dist/esm/api/resources/inboxes/client/Client.mjs +5 -0
  77. package/dist/esm/api/resources/inboxes/resources/accounts/client/Client.d.mts +42 -0
  78. package/dist/esm/api/resources/inboxes/resources/accounts/client/Client.mjs +160 -0
  79. package/dist/esm/api/resources/inboxes/resources/accounts/client/index.d.mts +1 -0
  80. package/dist/esm/api/resources/inboxes/resources/accounts/client/index.mjs +1 -0
  81. package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.d.mts +10 -0
  82. package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/ListAccountsRequest.mjs +2 -0
  83. package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/index.d.mts +1 -0
  84. package/dist/esm/api/resources/inboxes/resources/accounts/client/requests/index.mjs +1 -0
  85. package/dist/esm/api/resources/inboxes/resources/accounts/exports.d.mts +2 -0
  86. package/dist/esm/api/resources/inboxes/resources/accounts/exports.mjs +3 -0
  87. package/dist/esm/api/resources/inboxes/resources/accounts/index.d.mts +1 -0
  88. package/dist/esm/api/resources/inboxes/resources/accounts/index.mjs +1 -0
  89. package/dist/esm/api/resources/inboxes/resources/index.d.mts +2 -0
  90. package/dist/esm/api/resources/inboxes/resources/index.mjs +2 -0
  91. package/dist/esm/api/resources/pods/client/Client.d.mts +3 -0
  92. package/dist/esm/api/resources/pods/client/Client.mjs +5 -0
  93. package/dist/esm/api/resources/pods/resources/accounts/client/Client.d.mts +42 -0
  94. package/dist/esm/api/resources/pods/resources/accounts/client/Client.mjs +160 -0
  95. package/dist/esm/api/resources/pods/resources/accounts/client/index.d.mts +1 -0
  96. package/dist/esm/api/resources/pods/resources/accounts/client/index.mjs +1 -0
  97. package/dist/esm/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.d.mts +10 -0
  98. package/dist/esm/api/resources/pods/resources/accounts/client/requests/ListAccountsRequest.mjs +2 -0
  99. package/dist/esm/api/resources/pods/resources/accounts/client/requests/index.d.mts +1 -0
  100. package/dist/esm/api/resources/pods/resources/accounts/client/requests/index.mjs +1 -0
  101. package/dist/esm/api/resources/pods/resources/accounts/exports.d.mts +2 -0
  102. package/dist/esm/api/resources/pods/resources/accounts/exports.mjs +3 -0
  103. package/dist/esm/api/resources/pods/resources/accounts/index.d.mts +1 -0
  104. package/dist/esm/api/resources/pods/resources/accounts/index.mjs +1 -0
  105. package/dist/esm/api/resources/pods/resources/index.d.mts +2 -0
  106. package/dist/esm/api/resources/pods/resources/index.mjs +2 -0
  107. package/dist/esm/api/resources/webhooks/types/CreateWebhookRequest.d.mts +4 -0
  108. package/dist/esm/api/resources/webhooks/types/UpdatePodWebhookRequest.d.mts +5 -1
  109. package/dist/esm/serialization/resources/accounts/types/Account.d.mts +3 -0
  110. package/dist/esm/serialization/resources/accounts/types/Account.mjs +3 -0
  111. package/dist/esm/serialization/resources/accounts/types/AccountStatus.d.mts +7 -0
  112. package/dist/esm/serialization/resources/accounts/types/AccountStatus.mjs +3 -0
  113. package/dist/esm/serialization/resources/accounts/types/UpdateAccountRequest.d.mts +10 -0
  114. package/dist/esm/serialization/resources/accounts/types/UpdateAccountRequest.mjs +6 -0
  115. package/dist/esm/serialization/resources/accounts/types/UpdateAccountStatus.d.mts +7 -0
  116. package/dist/esm/serialization/resources/accounts/types/UpdateAccountStatus.mjs +3 -0
  117. package/dist/esm/serialization/resources/accounts/types/index.d.mts +3 -0
  118. package/dist/esm/serialization/resources/accounts/types/index.mjs +3 -0
  119. package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.d.mts +1 -0
  120. package/dist/esm/serialization/resources/apiKeys/types/ApiKeyPermissions.mjs +1 -0
  121. package/dist/esm/version.d.mts +1 -1
  122. package/dist/esm/version.mjs +1 -1
  123. package/dist/llms.txt +8 -2
  124. package/package.json +23 -1
  125. package/reference.md +393 -1
@@ -0,0 +1,160 @@
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 AccountsClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * Lists accounts held by the inbox, across all providers. Requires `inbox_read`.
25
+ *
26
+ * @param {AgentMail.inboxes.InboxId} inbox_id
27
+ * @param {AgentMail.inboxes.ListAccountsRequest} request
28
+ * @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @throws {@link AgentMail.ValidationError}
31
+ *
32
+ * @example
33
+ * await client.inboxes.accounts.list("inbox_id")
34
+ */
35
+ list(inbox_id, request = {}, requestOptions) {
36
+ return core.HttpResponsePromise.fromPromise(this.__list(inbox_id, request, requestOptions));
37
+ }
38
+ __list(inbox_id_1) {
39
+ return __awaiter(this, arguments, void 0, function* (inbox_id, request = {}, requestOptions) {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41
+ const { limit, pageToken, ascending } = request;
42
+ const _queryParams = {
43
+ limit,
44
+ page_token: pageToken,
45
+ ascending,
46
+ };
47
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
48
+ 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);
49
+ const _response = yield core.fetcher({
50
+ 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)
51
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/accounts`),
52
+ method: "GET",
53
+ headers: _headers,
54
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
55
+ 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,
56
+ 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,
57
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
58
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
59
+ logging: this._options.logging,
60
+ });
61
+ if (_response.ok) {
62
+ return {
63
+ data: serializers.ListAccountsResponse.parseOrThrow(_response.body, {
64
+ unrecognizedObjectKeys: "passthrough",
65
+ allowUnrecognizedUnionMembers: true,
66
+ allowUnrecognizedEnumValues: true,
67
+ skipValidation: true,
68
+ breadcrumbsPrefix: ["response"],
69
+ }),
70
+ rawResponse: _response.rawResponse,
71
+ };
72
+ }
73
+ if (_response.error.reason === "status-code") {
74
+ switch (_response.error.statusCode) {
75
+ case 400:
76
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
77
+ unrecognizedObjectKeys: "passthrough",
78
+ allowUnrecognizedUnionMembers: true,
79
+ allowUnrecognizedEnumValues: true,
80
+ skipValidation: true,
81
+ breadcrumbsPrefix: ["response"],
82
+ }), _response.rawResponse);
83
+ default:
84
+ throw new errors.AgentMailError({
85
+ statusCode: _response.error.statusCode,
86
+ body: _response.error.body,
87
+ rawResponse: _response.rawResponse,
88
+ });
89
+ }
90
+ }
91
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/accounts");
92
+ });
93
+ }
94
+ /**
95
+ * Returns one account held by the inbox. An account elsewhere is a 404. Requires
96
+ * `inbox_read`.
97
+ *
98
+ * @param {AgentMail.inboxes.InboxId} inbox_id
99
+ * @param {AgentMail.AccountId} account_id
100
+ * @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
101
+ *
102
+ * @throws {@link AgentMail.NotFoundError}
103
+ *
104
+ * @example
105
+ * await client.inboxes.accounts.get("inbox_id", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
106
+ */
107
+ get(inbox_id, account_id, requestOptions) {
108
+ return core.HttpResponsePromise.fromPromise(this.__get(inbox_id, account_id, requestOptions));
109
+ }
110
+ __get(inbox_id, account_id, requestOptions) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
113
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
114
+ 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);
115
+ const _response = yield core.fetcher({
116
+ 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)
117
+ .http, `/v0/inboxes/${core.url.encodePathParam(serializers.inboxes.InboxId.jsonOrThrow(inbox_id, { omitUndefined: true }))}/accounts/${core.url.encodePathParam(serializers.AccountId.jsonOrThrow(account_id, { omitUndefined: true }))}`),
118
+ method: "GET",
119
+ headers: _headers,
120
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
121
+ 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,
122
+ 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,
123
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
124
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
125
+ logging: this._options.logging,
126
+ });
127
+ if (_response.ok) {
128
+ return {
129
+ data: serializers.Account.parseOrThrow(_response.body, {
130
+ unrecognizedObjectKeys: "passthrough",
131
+ allowUnrecognizedUnionMembers: true,
132
+ allowUnrecognizedEnumValues: true,
133
+ skipValidation: true,
134
+ breadcrumbsPrefix: ["response"],
135
+ }),
136
+ rawResponse: _response.rawResponse,
137
+ };
138
+ }
139
+ if (_response.error.reason === "status-code") {
140
+ switch (_response.error.statusCode) {
141
+ case 404:
142
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
143
+ unrecognizedObjectKeys: "passthrough",
144
+ allowUnrecognizedUnionMembers: true,
145
+ allowUnrecognizedEnumValues: true,
146
+ skipValidation: true,
147
+ breadcrumbsPrefix: ["response"],
148
+ }), _response.rawResponse);
149
+ default:
150
+ throw new errors.AgentMailError({
151
+ statusCode: _response.error.statusCode,
152
+ body: _response.error.body,
153
+ rawResponse: _response.rawResponse,
154
+ });
155
+ }
156
+ }
157
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/inboxes/{inbox_id}/accounts/{account_id}");
158
+ });
159
+ }
160
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,10 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListAccountsRequest {
7
+ limit?: AgentMail.Limit;
8
+ pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { ListAccountsRequest } from "./ListAccountsRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { AccountsClient } 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 { AccountsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -1,3 +1,5 @@
1
+ export * from "./accounts/client/requests/index.mjs";
2
+ export * as accounts from "./accounts/index.mjs";
1
3
  export * from "./apiKeys/client/requests/index.mjs";
2
4
  export * as apiKeys from "./apiKeys/index.mjs";
3
5
  export * from "./drafts/client/requests/index.mjs";
@@ -1,3 +1,5 @@
1
+ export * from "./accounts/client/requests/index.mjs";
2
+ export * as accounts from "./accounts/index.mjs";
1
3
  export * from "./apiKeys/client/requests/index.mjs";
2
4
  export * as apiKeys from "./apiKeys/index.mjs";
3
5
  export * from "./drafts/client/requests/index.mjs";
@@ -2,6 +2,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie
2
2
  import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
3
  import * as core from "../../../../core/index.mjs";
4
4
  import * as AgentMail from "../../../index.mjs";
5
+ import { AccountsClient } from "../resources/accounts/client/Client.mjs";
5
6
  import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
6
7
  import { DomainsClient } from "../resources/domains/client/Client.mjs";
7
8
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
@@ -25,6 +26,7 @@ export declare class PodsClient {
25
26
  protected _lists: ListsClient | undefined;
26
27
  protected _metrics: MetricsClient | undefined;
27
28
  protected _apiKeys: ApiKeysClient | undefined;
29
+ protected _accounts: AccountsClient | undefined;
28
30
  constructor(options?: PodsClient.Options);
29
31
  get inboxes(): InboxesClient;
30
32
  get threads(): ThreadsClient;
@@ -34,6 +36,7 @@ export declare class PodsClient {
34
36
  get lists(): ListsClient;
35
37
  get metrics(): MetricsClient;
36
38
  get apiKeys(): ApiKeysClient;
39
+ get accounts(): AccountsClient;
37
40
  /**
38
41
  * **CLI:**
39
42
  * ```bash
@@ -16,6 +16,7 @@ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCode
16
16
  import * as errors from "../../../../errors/index.mjs";
17
17
  import * as serializers from "../../../../serialization/index.mjs";
18
18
  import * as AgentMail from "../../../index.mjs";
19
+ import { AccountsClient } from "../resources/accounts/client/Client.mjs";
19
20
  import { ApiKeysClient } from "../resources/apiKeys/client/Client.mjs";
20
21
  import { DomainsClient } from "../resources/domains/client/Client.mjs";
21
22
  import { DraftsClient } from "../resources/drafts/client/Client.mjs";
@@ -60,6 +61,10 @@ export class PodsClient {
60
61
  var _a;
61
62
  return ((_a = this._apiKeys) !== null && _a !== void 0 ? _a : (this._apiKeys = new ApiKeysClient(this._options)));
62
63
  }
64
+ get accounts() {
65
+ var _a;
66
+ return ((_a = this._accounts) !== null && _a !== void 0 ? _a : (this._accounts = new AccountsClient(this._options)));
67
+ }
63
68
  /**
64
69
  * **CLI:**
65
70
  * ```bash
@@ -0,0 +1,42 @@
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 AccountsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class AccountsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<AccountsClient.Options>;
12
+ constructor(options?: AccountsClient.Options);
13
+ /**
14
+ * Lists accounts held by inboxes in the pod, across all providers. Requires `inbox_read`.
15
+ *
16
+ * @param {AgentMail.pods.PodId} pod_id
17
+ * @param {AgentMail.pods.ListAccountsRequest} request
18
+ * @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link AgentMail.ValidationError}
21
+ *
22
+ * @example
23
+ * await client.pods.accounts.list("pod_id")
24
+ */
25
+ list(pod_id: AgentMail.pods.PodId, request?: AgentMail.pods.ListAccountsRequest, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<AgentMail.ListAccountsResponse>;
26
+ private __list;
27
+ /**
28
+ * Returns one account held by inboxes in the pod. An account elsewhere is a 404. Requires
29
+ * `inbox_read`.
30
+ *
31
+ * @param {AgentMail.pods.PodId} pod_id
32
+ * @param {AgentMail.AccountId} account_id
33
+ * @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
34
+ *
35
+ * @throws {@link AgentMail.NotFoundError}
36
+ *
37
+ * @example
38
+ * await client.pods.accounts.get("pod_id", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
39
+ */
40
+ get(pod_id: AgentMail.pods.PodId, account_id: AgentMail.AccountId, requestOptions?: AccountsClient.RequestOptions): core.HttpResponsePromise<AgentMail.Account>;
41
+ private __get;
42
+ }
@@ -0,0 +1,160 @@
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 AccountsClient {
20
+ constructor(options = {}) {
21
+ this._options = normalizeClientOptionsWithAuth(options);
22
+ }
23
+ /**
24
+ * Lists accounts held by inboxes in the pod, across all providers. Requires `inbox_read`.
25
+ *
26
+ * @param {AgentMail.pods.PodId} pod_id
27
+ * @param {AgentMail.pods.ListAccountsRequest} request
28
+ * @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
29
+ *
30
+ * @throws {@link AgentMail.ValidationError}
31
+ *
32
+ * @example
33
+ * await client.pods.accounts.list("pod_id")
34
+ */
35
+ list(pod_id, request = {}, requestOptions) {
36
+ return core.HttpResponsePromise.fromPromise(this.__list(pod_id, request, requestOptions));
37
+ }
38
+ __list(pod_id_1) {
39
+ return __awaiter(this, arguments, void 0, function* (pod_id, request = {}, requestOptions) {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
41
+ const { limit, pageToken, ascending } = request;
42
+ const _queryParams = {
43
+ limit,
44
+ page_token: pageToken,
45
+ ascending,
46
+ };
47
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
48
+ 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);
49
+ const _response = yield core.fetcher({
50
+ 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)
51
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/accounts`),
52
+ method: "GET",
53
+ headers: _headers,
54
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
55
+ 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,
56
+ 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,
57
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
58
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
59
+ logging: this._options.logging,
60
+ });
61
+ if (_response.ok) {
62
+ return {
63
+ data: serializers.ListAccountsResponse.parseOrThrow(_response.body, {
64
+ unrecognizedObjectKeys: "passthrough",
65
+ allowUnrecognizedUnionMembers: true,
66
+ allowUnrecognizedEnumValues: true,
67
+ skipValidation: true,
68
+ breadcrumbsPrefix: ["response"],
69
+ }),
70
+ rawResponse: _response.rawResponse,
71
+ };
72
+ }
73
+ if (_response.error.reason === "status-code") {
74
+ switch (_response.error.statusCode) {
75
+ case 400:
76
+ throw new AgentMail.ValidationError(serializers.ValidationErrorResponse.parseOrThrow(_response.error.body, {
77
+ unrecognizedObjectKeys: "passthrough",
78
+ allowUnrecognizedUnionMembers: true,
79
+ allowUnrecognizedEnumValues: true,
80
+ skipValidation: true,
81
+ breadcrumbsPrefix: ["response"],
82
+ }), _response.rawResponse);
83
+ default:
84
+ throw new errors.AgentMailError({
85
+ statusCode: _response.error.statusCode,
86
+ body: _response.error.body,
87
+ rawResponse: _response.rawResponse,
88
+ });
89
+ }
90
+ }
91
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/accounts");
92
+ });
93
+ }
94
+ /**
95
+ * Returns one account held by inboxes in the pod. An account elsewhere is a 404. Requires
96
+ * `inbox_read`.
97
+ *
98
+ * @param {AgentMail.pods.PodId} pod_id
99
+ * @param {AgentMail.AccountId} account_id
100
+ * @param {AccountsClient.RequestOptions} requestOptions - Request-specific configuration.
101
+ *
102
+ * @throws {@link AgentMail.NotFoundError}
103
+ *
104
+ * @example
105
+ * await client.pods.accounts.get("pod_id", "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32")
106
+ */
107
+ get(pod_id, account_id, requestOptions) {
108
+ return core.HttpResponsePromise.fromPromise(this.__get(pod_id, account_id, requestOptions));
109
+ }
110
+ __get(pod_id, account_id, requestOptions) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
113
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
114
+ 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);
115
+ const _response = yield core.fetcher({
116
+ 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)
117
+ .http, `/v0/pods/${core.url.encodePathParam(serializers.pods.PodId.jsonOrThrow(pod_id, { omitUndefined: true }))}/accounts/${core.url.encodePathParam(serializers.AccountId.jsonOrThrow(account_id, { omitUndefined: true }))}`),
118
+ method: "GET",
119
+ headers: _headers,
120
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
121
+ 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,
122
+ 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,
123
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
124
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
125
+ logging: this._options.logging,
126
+ });
127
+ if (_response.ok) {
128
+ return {
129
+ data: serializers.Account.parseOrThrow(_response.body, {
130
+ unrecognizedObjectKeys: "passthrough",
131
+ allowUnrecognizedUnionMembers: true,
132
+ allowUnrecognizedEnumValues: true,
133
+ skipValidation: true,
134
+ breadcrumbsPrefix: ["response"],
135
+ }),
136
+ rawResponse: _response.rawResponse,
137
+ };
138
+ }
139
+ if (_response.error.reason === "status-code") {
140
+ switch (_response.error.statusCode) {
141
+ case 404:
142
+ throw new AgentMail.NotFoundError(serializers.ErrorResponse.parseOrThrow(_response.error.body, {
143
+ unrecognizedObjectKeys: "passthrough",
144
+ allowUnrecognizedUnionMembers: true,
145
+ allowUnrecognizedEnumValues: true,
146
+ skipValidation: true,
147
+ breadcrumbsPrefix: ["response"],
148
+ }), _response.rawResponse);
149
+ default:
150
+ throw new errors.AgentMailError({
151
+ statusCode: _response.error.statusCode,
152
+ body: _response.error.body,
153
+ rawResponse: _response.rawResponse,
154
+ });
155
+ }
156
+ }
157
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v0/pods/{pod_id}/accounts/{account_id}");
158
+ });
159
+ }
160
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,10 @@
1
+ import type * as AgentMail from "../../../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListAccountsRequest {
7
+ limit?: AgentMail.Limit;
8
+ pageToken?: AgentMail.PageToken;
9
+ ascending?: AgentMail.Ascending;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { ListAccountsRequest } from "./ListAccountsRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { AccountsClient } 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 { AccountsClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -1,3 +1,5 @@
1
+ export * from "./accounts/client/requests/index.mjs";
2
+ export * as accounts from "./accounts/index.mjs";
1
3
  export * from "./apiKeys/client/requests/index.mjs";
2
4
  export * as apiKeys from "./apiKeys/index.mjs";
3
5
  export * from "./domains/client/requests/index.mjs";
@@ -1,3 +1,5 @@
1
+ export * from "./accounts/client/requests/index.mjs";
2
+ export * as accounts from "./accounts/index.mjs";
1
3
  export * from "./apiKeys/client/requests/index.mjs";
2
4
  export * as apiKeys from "./apiKeys/index.mjs";
3
5
  export * from "./domains/client/requests/index.mjs";
@@ -1,4 +1,8 @@
1
1
  import type * as AgentMail from "../../../index.mjs";
2
2
  export interface CreateWebhookRequest extends AgentMail.webhooks.CreatePodWebhookRequest {
3
+ /**
4
+ * Pods for which to send events. Maximum 10 per webhook. The webhook receives an event that matches
5
+ * any listed pod or inbox, so a listed pod already covers every inbox in it.
6
+ */
3
7
  podIds?: AgentMail.PodIds;
4
8
  }
@@ -4,7 +4,11 @@ import type * as AgentMail from "../../../index.mjs";
4
4
  * its `event_types`, but not the pod scope itself.
5
5
  */
6
6
  export interface UpdatePodWebhookRequest extends AgentMail.webhooks.UpdateInboxWebhookRequest {
7
- /** Inbox IDs to subscribe to the webhook. */
7
+ /**
8
+ * Inbox IDs to subscribe to the webhook. This only adds to what the webhook receives: on a webhook
9
+ * that covers its whole pod, it changes nothing. To receive only specific inboxes, create a webhook
10
+ * with `inbox_ids` instead.
11
+ */
8
12
  addInboxIds?: AgentMail.InboxIds;
9
13
  /** Inbox IDs to unsubscribe from the webhook. */
10
14
  removeInboxIds?: AgentMail.InboxIds;
@@ -5,6 +5,7 @@ import { OrganizationId } from "../../../types/OrganizationId.mjs";
5
5
  import { InboxId } from "../../inboxes/types/InboxId.mjs";
6
6
  import { PodId } from "../../pods/types/PodId.mjs";
7
7
  import { AccountId } from "./AccountId.mjs";
8
+ import { AccountStatus } from "./AccountStatus.mjs";
8
9
  import { ProviderId } from "./ProviderId.mjs";
9
10
  export declare const Account: core.serialization.ObjectSchema<serializers.Account.Raw, AgentMail.Account>;
10
11
  export declare namespace Account {
@@ -18,5 +19,7 @@ export declare namespace Account {
18
19
  first_signed_in_at: string;
19
20
  last_signed_in_at: string;
20
21
  sign_in_count: number;
22
+ status?: AccountStatus.Raw | null;
23
+ disabled_at?: string | null;
21
24
  }
22
25
  }
@@ -4,6 +4,7 @@ import { OrganizationId } from "../../../types/OrganizationId.mjs";
4
4
  import { InboxId } from "../../inboxes/types/InboxId.mjs";
5
5
  import { PodId } from "../../pods/types/PodId.mjs";
6
6
  import { AccountId } from "./AccountId.mjs";
7
+ import { AccountStatus } from "./AccountStatus.mjs";
7
8
  import { ProviderId } from "./ProviderId.mjs";
8
9
  export const Account = core.serialization.object({
9
10
  accountId: core.serialization.property("account_id", AccountId),
@@ -15,4 +16,6 @@ export const Account = core.serialization.object({
15
16
  firstSignedInAt: core.serialization.property("first_signed_in_at", core.serialization.date()),
16
17
  lastSignedInAt: core.serialization.property("last_signed_in_at", core.serialization.date()),
17
18
  signInCount: core.serialization.property("sign_in_count", core.serialization.number()),
19
+ status: AccountStatus.optional(),
20
+ disabledAt: core.serialization.property("disabled_at", core.serialization.date().optional()),
18
21
  });
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ export declare const AccountStatus: core.serialization.Schema<serializers.AccountStatus.Raw, AgentMail.AccountStatus>;
5
+ export declare namespace AccountStatus {
6
+ type Raw = "disabled";
7
+ }
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ export const AccountStatus = core.serialization.enum_(["disabled"]);
@@ -0,0 +1,10 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ import { UpdateAccountStatus } from "./UpdateAccountStatus.mjs";
5
+ export declare const UpdateAccountRequest: core.serialization.ObjectSchema<serializers.UpdateAccountRequest.Raw, AgentMail.UpdateAccountRequest>;
6
+ export declare namespace UpdateAccountRequest {
7
+ interface Raw {
8
+ status?: UpdateAccountStatus.Raw | null;
9
+ }
10
+ }
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as core from "../../../../core/index.mjs";
3
+ import { UpdateAccountStatus } from "./UpdateAccountStatus.mjs";
4
+ export const UpdateAccountRequest = core.serialization.object({
5
+ status: UpdateAccountStatus.optional(),
6
+ });
@@ -0,0 +1,7 @@
1
+ import type * as AgentMail from "../../../../api/index.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import type * as serializers from "../../../index.mjs";
4
+ export declare const UpdateAccountStatus: core.serialization.Schema<serializers.UpdateAccountStatus.Raw, AgentMail.UpdateAccountStatus>;
5
+ export declare namespace UpdateAccountStatus {
6
+ type Raw = "enabled" | "disabled";
7
+ }