agentmail 0.0.49 → 0.0.51

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 (87) hide show
  1. package/README.md +13 -2
  2. package/dist/cjs/Client.d.ts +2 -0
  3. package/dist/cjs/Client.js +2 -2
  4. package/dist/cjs/api/resources/domains/client/Client.d.ts +2 -0
  5. package/dist/cjs/api/resources/domains/client/Client.js +16 -9
  6. package/dist/cjs/api/resources/drafts/client/Client.d.ts +2 -0
  7. package/dist/cjs/api/resources/drafts/client/Client.js +8 -5
  8. package/dist/cjs/api/resources/drafts/types/CreateDraftRequest.d.ts +1 -0
  9. package/dist/cjs/api/resources/drafts/types/Draft.d.ts +2 -0
  10. package/dist/cjs/api/resources/drafts/types/DraftItem.d.ts +2 -0
  11. package/dist/cjs/api/resources/drafts/types/DraftSendAt.d.ts +7 -0
  12. package/dist/cjs/api/resources/drafts/types/DraftSendAt.js +5 -0
  13. package/dist/cjs/api/resources/drafts/types/DraftSendStatus.d.ts +12 -0
  14. package/dist/cjs/api/resources/drafts/types/DraftSendStatus.js +11 -0
  15. package/dist/cjs/api/resources/drafts/types/index.d.ts +2 -0
  16. package/dist/cjs/api/resources/drafts/types/index.js +2 -0
  17. package/dist/cjs/api/resources/inboxes/client/Client.d.ts +2 -0
  18. package/dist/cjs/api/resources/inboxes/client/Client.js +12 -7
  19. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.d.ts +16 -1
  20. package/dist/cjs/api/resources/inboxes/resources/drafts/client/Client.js +76 -10
  21. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.d.ts +2 -0
  22. package/dist/cjs/api/resources/inboxes/resources/messages/client/Client.js +28 -15
  23. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.d.ts +2 -0
  24. package/dist/cjs/api/resources/inboxes/resources/metrics/client/Client.js +4 -3
  25. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.d.ts +2 -0
  26. package/dist/cjs/api/resources/inboxes/resources/threads/client/Client.js +12 -7
  27. package/dist/cjs/api/resources/metrics/client/Client.d.ts +2 -0
  28. package/dist/cjs/api/resources/metrics/client/Client.js +4 -3
  29. package/dist/cjs/api/resources/threads/client/Client.d.ts +2 -0
  30. package/dist/cjs/api/resources/threads/client/Client.js +12 -7
  31. package/dist/cjs/api/resources/webhooks/client/Client.d.ts +2 -0
  32. package/dist/cjs/api/resources/webhooks/client/Client.js +16 -9
  33. package/dist/cjs/core/auth/AuthProvider.d.ts +4 -0
  34. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  35. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  36. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  37. package/dist/cjs/core/auth/index.d.ts +2 -0
  38. package/dist/cjs/core/fetcher/Fetcher.d.ts +1 -1
  39. package/dist/cjs/core/fetcher/Fetcher.js +2 -2
  40. package/dist/cjs/core/fetcher/index.d.ts +5 -5
  41. package/dist/cjs/core/fetcher/index.js +5 -5
  42. package/dist/cjs/version.d.ts +1 -1
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/esm/Client.d.mts +2 -0
  45. package/dist/esm/Client.mjs +2 -2
  46. package/dist/esm/api/resources/domains/client/Client.d.mts +2 -0
  47. package/dist/esm/api/resources/domains/client/Client.mjs +16 -9
  48. package/dist/esm/api/resources/drafts/client/Client.d.mts +2 -0
  49. package/dist/esm/api/resources/drafts/client/Client.mjs +8 -5
  50. package/dist/esm/api/resources/drafts/types/CreateDraftRequest.d.mts +1 -0
  51. package/dist/esm/api/resources/drafts/types/Draft.d.mts +2 -0
  52. package/dist/esm/api/resources/drafts/types/DraftItem.d.mts +2 -0
  53. package/dist/esm/api/resources/drafts/types/DraftSendAt.d.mts +7 -0
  54. package/dist/esm/api/resources/drafts/types/DraftSendAt.mjs +4 -0
  55. package/dist/esm/api/resources/drafts/types/DraftSendStatus.d.mts +12 -0
  56. package/dist/esm/api/resources/drafts/types/DraftSendStatus.mjs +8 -0
  57. package/dist/esm/api/resources/drafts/types/index.d.mts +2 -0
  58. package/dist/esm/api/resources/drafts/types/index.mjs +2 -0
  59. package/dist/esm/api/resources/inboxes/client/Client.d.mts +2 -0
  60. package/dist/esm/api/resources/inboxes/client/Client.mjs +12 -7
  61. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.d.mts +16 -1
  62. package/dist/esm/api/resources/inboxes/resources/drafts/client/Client.mjs +76 -10
  63. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.d.mts +2 -0
  64. package/dist/esm/api/resources/inboxes/resources/messages/client/Client.mjs +28 -15
  65. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.d.mts +2 -0
  66. package/dist/esm/api/resources/inboxes/resources/metrics/client/Client.mjs +4 -3
  67. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.d.mts +2 -0
  68. package/dist/esm/api/resources/inboxes/resources/threads/client/Client.mjs +12 -7
  69. package/dist/esm/api/resources/metrics/client/Client.d.mts +2 -0
  70. package/dist/esm/api/resources/metrics/client/Client.mjs +4 -3
  71. package/dist/esm/api/resources/threads/client/Client.d.mts +2 -0
  72. package/dist/esm/api/resources/threads/client/Client.mjs +12 -7
  73. package/dist/esm/api/resources/webhooks/client/Client.d.mts +2 -0
  74. package/dist/esm/api/resources/webhooks/client/Client.mjs +16 -9
  75. package/dist/esm/core/auth/AuthProvider.d.mts +4 -0
  76. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  77. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  78. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  79. package/dist/esm/core/auth/index.d.mts +2 -0
  80. package/dist/esm/core/fetcher/Fetcher.d.mts +1 -1
  81. package/dist/esm/core/fetcher/Fetcher.mjs +2 -2
  82. package/dist/esm/core/fetcher/index.d.mts +5 -5
  83. package/dist/esm/core/fetcher/index.mjs +2 -2
  84. package/dist/esm/version.d.mts +1 -1
  85. package/dist/esm/version.mjs +1 -1
  86. package/package.json +1 -1
  87. package/reference.md +57 -0
@@ -50,11 +50,12 @@ export class Threads {
50
50
  if (ascending != null) {
51
51
  _queryParams["ascending"] = ascending.toString();
52
52
  }
53
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
53
54
  const _response = yield core.fetcher({
54
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/threads`),
55
+ 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.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/threads`),
55
56
  method: "GET",
56
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
57
- queryParameters: _queryParams,
57
+ headers: _headers,
58
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
58
59
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
59
60
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
60
61
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -107,10 +108,12 @@ export class Threads {
107
108
  __get(inboxId, threadId, requestOptions) {
108
109
  return __awaiter(this, void 0, void 0, function* () {
109
110
  var _a, _b, _c;
111
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
110
112
  const _response = yield core.fetcher({
111
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/threads/${encodeURIComponent(threadId)}`),
113
+ 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.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/threads/${encodeURIComponent(threadId)}`),
112
114
  method: "GET",
113
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
115
+ headers: _headers,
116
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
114
117
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
115
118
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
116
119
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -156,10 +159,12 @@ export class Threads {
156
159
  __getAttachment(inboxId, threadId, attachmentId, requestOptions) {
157
160
  return __awaiter(this, void 0, void 0, function* () {
158
161
  var _a, _b, _c;
162
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
159
163
  const _response = yield core.fetcher({
160
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/threads/${encodeURIComponent(threadId)}/attachments/${encodeURIComponent(attachmentId)}`),
164
+ 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.Production).http, `/v0/inboxes/${encodeURIComponent(inboxId)}/threads/${encodeURIComponent(threadId)}/attachments/${encodeURIComponent(attachmentId)}`),
161
165
  method: "GET",
162
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
166
+ headers: _headers,
167
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
163
168
  responseType: "binary-response",
164
169
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
165
170
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -20,6 +20,8 @@ export declare namespace Metrics {
20
20
  maxRetries?: number;
21
21
  /** A hook to abort the request. */
22
22
  abortSignal?: AbortSignal;
23
+ /** Additional query string parameters to include in the request. */
24
+ queryParams?: Record<string, unknown>;
23
25
  /** Additional headers to include in the request. */
24
26
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
25
27
  }
@@ -45,11 +45,12 @@ export class Metrics {
45
45
  }
46
46
  _queryParams["start_timestamp"] = startTimestamp;
47
47
  _queryParams["end_timestamp"] = endTimestamp;
48
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
48
49
  const _response = yield core.fetcher({
49
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, "/v0/metrics"),
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.Production).http, "/v0/metrics"),
50
51
  method: "GET",
51
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
52
- queryParameters: _queryParams,
52
+ headers: _headers,
53
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
53
54
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
54
55
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
55
56
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -20,6 +20,8 @@ export declare namespace Threads {
20
20
  maxRetries?: number;
21
21
  /** A hook to abort the request. */
22
22
  abortSignal?: AbortSignal;
23
+ /** Additional query string parameters to include in the request. */
24
+ queryParams?: Record<string, unknown>;
23
25
  /** Additional headers to include in the request. */
24
26
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
25
27
  }
@@ -49,11 +49,12 @@ export class Threads {
49
49
  if (ascending != null) {
50
50
  _queryParams["ascending"] = ascending.toString();
51
51
  }
52
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
52
53
  const _response = yield core.fetcher({
53
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, "/v0/threads"),
54
+ 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.Production).http, "/v0/threads"),
54
55
  method: "GET",
55
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
56
- queryParameters: _queryParams,
56
+ headers: _headers,
57
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
57
58
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
58
59
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
59
60
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -105,10 +106,12 @@ export class Threads {
105
106
  __get(threadId, requestOptions) {
106
107
  return __awaiter(this, void 0, void 0, function* () {
107
108
  var _a, _b, _c;
109
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
108
110
  const _response = yield core.fetcher({
109
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/threads/${encodeURIComponent(threadId)}`),
111
+ 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.Production).http, `/v0/threads/${encodeURIComponent(threadId)}`),
110
112
  method: "GET",
111
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
113
+ headers: _headers,
114
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
112
115
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
113
116
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
114
117
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -154,10 +157,12 @@ export class Threads {
154
157
  __getAttachment(threadId, attachmentId, requestOptions) {
155
158
  return __awaiter(this, void 0, void 0, function* () {
156
159
  var _a, _b, _c;
160
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
157
161
  const _response = yield core.fetcher({
158
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/threads/${encodeURIComponent(threadId)}/attachments/${encodeURIComponent(attachmentId)}`),
162
+ 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.Production).http, `/v0/threads/${encodeURIComponent(threadId)}/attachments/${encodeURIComponent(attachmentId)}`),
159
163
  method: "GET",
160
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
164
+ headers: _headers,
165
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
161
166
  responseType: "binary-response",
162
167
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
163
168
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
@@ -20,6 +20,8 @@ export declare namespace Webhooks {
20
20
  maxRetries?: number;
21
21
  /** A hook to abort the request. */
22
22
  abortSignal?: AbortSignal;
23
+ /** Additional query string parameters to include in the request. */
24
+ queryParams?: Record<string, unknown>;
23
25
  /** Additional headers to include in the request. */
24
26
  headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
25
27
  }
@@ -40,11 +40,12 @@ export class Webhooks {
40
40
  if (pageToken != null) {
41
41
  _queryParams["page_token"] = pageToken;
42
42
  }
43
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
43
44
  const _response = yield core.fetcher({
44
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, "/v0/webhooks"),
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.Production).http, "/v0/webhooks"),
45
46
  method: "GET",
46
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
47
- queryParameters: _queryParams,
47
+ headers: _headers,
48
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
48
49
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
49
50
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
50
51
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -94,10 +95,12 @@ export class Webhooks {
94
95
  __get(webhookId, requestOptions) {
95
96
  return __awaiter(this, void 0, void 0, function* () {
96
97
  var _a, _b, _c;
98
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
97
99
  const _response = yield core.fetcher({
98
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/webhooks/${encodeURIComponent(webhookId)}`),
100
+ 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.Production).http, `/v0/webhooks/${encodeURIComponent(webhookId)}`),
99
101
  method: "GET",
100
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
102
+ headers: _headers,
103
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
101
104
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
102
105
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
103
106
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -154,11 +157,13 @@ export class Webhooks {
154
157
  __create(request, requestOptions) {
155
158
  return __awaiter(this, void 0, void 0, function* () {
156
159
  var _a, _b, _c;
160
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
157
161
  const _response = yield core.fetcher({
158
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, "/v0/webhooks"),
162
+ 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.Production).http, "/v0/webhooks"),
159
163
  method: "POST",
160
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
164
+ headers: _headers,
161
165
  contentType: "application/json",
166
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
162
167
  requestType: "json",
163
168
  body: request,
164
169
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -212,10 +217,12 @@ export class Webhooks {
212
217
  __delete(webhookId, requestOptions) {
213
218
  return __awaiter(this, void 0, void 0, function* () {
214
219
  var _a, _b, _c;
220
+ var _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
215
221
  const _response = yield core.fetcher({
216
- url: core.url.join((_a = (yield core.Supplier.get(this._options.baseUrl))) !== null && _a !== void 0 ? _a : ((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.AgentMailEnvironment.Production).http, `/v0/webhooks/${encodeURIComponent(webhookId)}`),
222
+ 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.Production).http, `/v0/webhooks/${encodeURIComponent(webhookId)}`),
217
223
  method: "DELETE",
218
- headers: mergeHeaders((_c = this._options) === null || _c === void 0 ? void 0 : _c.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
224
+ headers: _headers,
225
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
219
226
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
220
227
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
221
228
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -0,0 +1,4 @@
1
+ import { AuthRequest } from "./AuthRequest.mjs";
2
+ export interface AuthProvider {
3
+ getAuthRequest(): Promise<AuthRequest>;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Request parameters for authentication requests.
3
+ */
4
+ export interface AuthRequest {
5
+ /**
6
+ * The headers to be included in the request.
7
+ */
8
+ headers: Record<string, string>;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,2 +1,4 @@
1
+ export { AuthProvider } from "./AuthProvider.mjs";
2
+ export { type AuthRequest } from "./AuthRequest.mjs";
1
3
  export { BasicAuth } from "./BasicAuth.mjs";
2
4
  export { BearerToken } from "./BearerToken.mjs";
@@ -7,7 +7,7 @@ export declare namespace Fetcher {
7
7
  method: string;
8
8
  contentType?: string;
9
9
  headers?: Record<string, string | Supplier<string | undefined> | undefined>;
10
- queryParameters?: Record<string, string | string[] | object | object[] | null>;
10
+ queryParameters?: Record<string, unknown>;
11
11
  body?: unknown;
12
12
  timeoutMs?: number;
13
13
  maxRetries?: number;
@@ -8,15 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { toJson } from "../json.mjs";
11
- import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
12
- import { Supplier } from "./Supplier.mjs";
13
11
  import { createRequestUrl } from "./createRequestUrl.mjs";
14
12
  import { getErrorResponseBody } from "./getErrorResponseBody.mjs";
15
13
  import { getFetchFn } from "./getFetchFn.mjs";
16
14
  import { getRequestBody } from "./getRequestBody.mjs";
17
15
  import { getResponseBody } from "./getResponseBody.mjs";
18
16
  import { makeRequest } from "./makeRequest.mjs";
17
+ import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
19
18
  import { requestWithRetries } from "./requestWithRetries.mjs";
19
+ import { Supplier } from "./Supplier.mjs";
20
20
  function getHeaders(args) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
22
  const newHeaders = {};
@@ -1,9 +1,9 @@
1
1
  export type { APIResponse } from "./APIResponse.mjs";
2
- export { fetcher } from "./Fetcher.mjs";
2
+ export type { BinaryResponse } from "./BinaryResponse.mjs";
3
3
  export type { Fetcher, FetchFunction } from "./Fetcher.mjs";
4
+ export { fetcher } from "./Fetcher.mjs";
4
5
  export { getHeader } from "./getHeader.mjs";
5
- export { Supplier } from "./Supplier.mjs";
6
- export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
7
- export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
8
6
  export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
9
- export { BinaryResponse } from "./BinaryResponse.mjs";
7
+ export type { RawResponse, WithRawResponse } from "./RawResponse.mjs";
8
+ export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
9
+ export { Supplier } from "./Supplier.mjs";
@@ -1,5 +1,5 @@
1
1
  export { fetcher } from "./Fetcher.mjs";
2
2
  export { getHeader } from "./getHeader.mjs";
3
- export { Supplier } from "./Supplier.mjs";
4
- export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
5
3
  export { HttpResponsePromise } from "./HttpResponsePromise.mjs";
4
+ export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.mjs";
5
+ export { Supplier } from "./Supplier.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.49";
1
+ export declare const SDK_VERSION = "0.0.51";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.49";
1
+ export const SDK_VERSION = "0.0.51";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "private": false,
5
5
  "repository": "github:agentmail-to/agentmail-node",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -780,6 +780,7 @@ await client.inboxes.drafts.create("inbox_id", {
780
780
  subject: undefined,
781
781
  text: undefined,
782
782
  html: undefined,
783
+ send_at: undefined,
783
784
  });
784
785
  ```
785
786
 
@@ -890,6 +891,62 @@ await client.inboxes.drafts.send("inbox_id", "draft_id", {
890
891
  </dl>
891
892
  </details>
892
893
 
894
+ <details><summary><code>client.inboxes.drafts.<a href="/src/api/resources/inboxes/resources/drafts/client/Client.ts">delete</a>(inboxId, draftId) -> void</code></summary>
895
+ <dl>
896
+ <dd>
897
+
898
+ #### 🔌 Usage
899
+
900
+ <dl>
901
+ <dd>
902
+
903
+ <dl>
904
+ <dd>
905
+
906
+ ```typescript
907
+ await client.inboxes.drafts.delete("inbox_id", "draft_id");
908
+ ```
909
+
910
+ </dd>
911
+ </dl>
912
+ </dd>
913
+ </dl>
914
+
915
+ #### ⚙️ Parameters
916
+
917
+ <dl>
918
+ <dd>
919
+
920
+ <dl>
921
+ <dd>
922
+
923
+ **inboxId:** `AgentMail.InboxId`
924
+
925
+ </dd>
926
+ </dl>
927
+
928
+ <dl>
929
+ <dd>
930
+
931
+ **draftId:** `AgentMail.DraftId`
932
+
933
+ </dd>
934
+ </dl>
935
+
936
+ <dl>
937
+ <dd>
938
+
939
+ **requestOptions:** `Drafts.RequestOptions`
940
+
941
+ </dd>
942
+ </dl>
943
+ </dd>
944
+ </dl>
945
+
946
+ </dd>
947
+ </dl>
948
+ </details>
949
+
893
950
  ## Inboxes Messages
894
951
 
895
952
  <details><summary><code>client.inboxes.messages.<a href="/src/api/resources/inboxes/resources/messages/client/Client.ts">list</a>(inboxId, { ...params }) -> AgentMail.ListMessagesResponse</code></summary>