mailgun.js 12.4.0 → 12.5.0

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.
package/README.md CHANGED
@@ -260,7 +260,7 @@ The following service methods are available to instantiated clients. The example
260
260
  - [get](#get-3)
261
261
  - [Example with Date and *Filter field*](#example-with-date-and-filter-field)
262
262
  - [logs](#logs)
263
- - [get](#get-4)
263
+ - [list](#list-3)
264
264
  - [stats](#stats)
265
265
  - [Stats Options](#stats-options)
266
266
  - [getDomain](#getdomain)
@@ -269,11 +269,11 @@ The following service methods are available to instantiated clients. The example
269
269
  - [getAccount](#getaccount-1)
270
270
  - [getAccountUsage](#getaccountusage)
271
271
  - [suppressions](#suppressions)
272
- - [list](#list-3)
272
+ - [list](#list-4)
273
273
  - [Bounces Example](#bounces-example)
274
274
  - [Unsubscribes Example](#unsubscribes-example)
275
275
  - [Complaints Example](#complaints-example)
276
- - [get](#get-5)
276
+ - [get](#get-4)
277
277
  - [Bounces Example](#bounces-example-1)
278
278
  - [Unsubscribes Example](#unsubscribes-example-1)
279
279
  - [Complaints Example](#complaints-example-1)
@@ -288,27 +288,27 @@ The following service methods are available to instantiated clients. The example
288
288
  - [Unsubscribes Example](#unsubscribes-example-3)
289
289
  - [Complaints Example](#complaints-example-3)
290
290
  - [webhooks](#webhooks)
291
- - [list](#list-4)
292
- - [get](#get-6)
291
+ - [list](#list-5)
292
+ - [get](#get-5)
293
293
  - [create](#create-5)
294
294
  - [update](#update-2)
295
295
  - [destroy](#destroy-4)
296
296
  - [routes](#routes)
297
- - [list](#list-5)
298
- - [get](#get-7)
297
+ - [list](#list-6)
298
+ - [get](#get-6)
299
299
  - [create](#create-6)
300
300
  - [update](#update-3)
301
301
  - [destroy](#destroy-5)
302
302
  - [validate](#validate)
303
- - [get](#get-8)
303
+ - [get](#get-7)
304
304
  - [multiple validation](#multiple-validation)
305
305
  - [create](#create-7)
306
- - [list](#list-6)
307
- - [get](#get-9)
306
+ - [list](#list-7)
307
+ - [get](#get-8)
308
308
  - [destroy](#destroy-6)
309
309
  - [mailing lists](#mailing-lists)
310
- - [list](#list-7)
311
- - [get](#get-10)
310
+ - [list](#list-8)
311
+ - [get](#get-9)
312
312
  - [create](#create-8)
313
313
  - [update](#update-4)
314
314
  - [destroy](#destroy-7)
@@ -320,8 +320,8 @@ The following service methods are available to instantiated clients. The example
320
320
  - [updateMember](#updatemember)
321
321
  - [destroyMember](#destroymember)
322
322
  - [subaccounts](#subaccounts)
323
- - [list](#list-8)
324
- - [get](#get-11)
323
+ - [list](#list-9)
324
+ - [get](#get-10)
325
325
  - [create](#create-9)
326
326
  - [enable](#enable)
327
327
  - [disable](#disable)
@@ -331,32 +331,36 @@ The following service methods are available to instantiated clients. The example
331
331
  - [updateSubaccountFeature](#updatesubaccountfeature)
332
332
  - [inbox placements](#inbox-placements)
333
333
  - [SeedsLists](#seedslists)
334
- - [list](#list-9)
335
- - [get](#get-12)
334
+ - [list](#list-10)
335
+ - [get](#get-11)
336
336
  - [create](#create-10)
337
337
  - [update](#update-5)
338
338
  - [destroy](#destroy-9)
339
339
  - [SeedsLists Attributes](#attributes)
340
- - [list](#list-10)
341
- - [get](#get-13)
342
- - [SeedsLists Filters](#filters)
343
340
  - [list](#list-11)
341
+ - [get](#get-12)
342
+ - [SeedsLists Filters](#filters)
343
+ - [list](#list-12)
344
344
  - [Providers](#providers)
345
- - [list](#list-12)
346
- - [Results](#results)
347
345
  - [list](#list-13)
348
- - [get](#get-14)
346
+ - [Results](#results)
347
+ - [list](#list-14)
348
+ - [get](#get-13)
349
349
  - [destroy](#destroy-10)
350
350
  - [getResultByShareId](#getresultbyshareid)
351
351
  - [Results Attributes](#attributes-1)
352
- - [list](#list-14)
353
- - [get](#get-15)
354
- - [Results Filters](#filters-1)
355
352
  - [list](#list-15)
353
+ - [get](#get-14)
354
+ - [Results Filters](#filters-1)
355
+ - [list](#list-16)
356
356
  - [Sharing](#sharing)
357
- - [get](#get-16)
357
+ - [get](#get-15)
358
358
  - [update](#update-6)
359
359
  - [Run Test](#run-test)
360
+ - [DKIM Management](#dkim-management)
361
+ - [update](#update-7)
362
+ - [Bounce Classification](#bounce-classification)
363
+ - [list](#list-16)
360
364
  - [Navigation thru lists](#navigation-thru-lists)
361
365
  - [Browser Demo](#browser-demo)
362
366
  - [Development](#development)
@@ -2314,17 +2318,17 @@ The following service methods are available to instantiated clients. The example
2314
2318
  ### Logs
2315
2319
  Mailgun keeps track of every inbound and outbound message event and stores this log data. This data can be queried and filtered to provide insights into the health of your email infrastructure.
2316
2320
 
2317
- - #### get
2321
+ - #### list
2318
2322
  Gets customer event logs for an account
2319
2323
 
2320
2324
  [API Reference](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/stats)
2321
2325
 
2322
- ```mg.logs.get(query)```
2326
+ ```mg.logs.list(query)```
2323
2327
 
2324
2328
  Example:
2325
2329
 
2326
2330
  ```JS
2327
- mg.events.get({
2331
+ mg.logs.list({
2328
2332
  start: new Date('2025-11-17T13:00:00Z'), // required
2329
2333
  end: new Date('2025-11-30T13:05:00Z'), // required
2330
2334
  include_totals: true,
@@ -4771,6 +4775,7 @@ The following service methods are available to instantiated clients. The example
4771
4775
  [API Reference](https://documentation.mailgun.com/docs/inboxready/api-reference/optimize/inboxready/inbox-placement/get-v4-inbox-sharing--result-)
4772
4776
 
4773
4777
  `mg.inboxPlacements.results.sharing.get('result_id');`
4778
+
4774
4779
  Example:
4775
4780
  ```JS
4776
4781
  mg.inboxPlacements.results.sharing.get('result_id');
@@ -4857,6 +4862,161 @@ The following service methods are available to instantiated clients. The example
4857
4862
  }
4858
4863
  }
4859
4864
 
4865
+ ### DKIM Management
4866
+ - #### update
4867
+ Updates DKIM key rotation configuration for a domain
4868
+
4869
+ [API Reference](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/dkim-security/put-v1-dkim-management-domains--name--rotation)
4870
+
4871
+ `mg.dkimManagement.update(domain_name, configurationData)`
4872
+
4873
+ Example:
4874
+ ```JS
4875
+ mg.dkimManagement.update('foobar.example.com', {
4876
+ rotation_enabled: true,
4877
+ rotation_interval: '120h0m0s'
4878
+ })
4879
+ .then(data => console.log(data)) // logs response data
4880
+ .catch(err => console.error(err)); //logs any error
4881
+ ```
4882
+
4883
+ Promise returns: DKIMUpdateRotationResult
4884
+ ```JS
4885
+ {
4886
+ domain: {
4887
+ id: 'domain_id',
4888
+ account_id: 'account_id',
4889
+ sid: 'sid',
4890
+ name: 'foobar.example.com',
4891
+ state: 'active',
4892
+ active_selector: 'active_selector',
4893
+ rotation_enabled: 'true',
4894
+ rotation_interval: '120h0m0s',
4895
+ records: [
4896
+ {
4897
+ name: 'record name',
4898
+ type: 'CNAME',
4899
+ identifier: 'DKIM',
4900
+ value: 'record value',
4901
+ comment: 'Customer DKIM CNAME Record'
4902
+ },
4903
+ ....
4904
+ ]
4905
+ }
4906
+ }
4907
+ ```
4908
+
4909
+ - #### rotateImmediately
4910
+ Immediately rotate your DKIM key. This will trigger a rotation even if auto-rotation is disabled on the domain.
4911
+
4912
+ [API Reference](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/dkim-security/post-v1-dkim-management-domains--name--rotate)
4913
+
4914
+ `mg.dkimManagement.rotateImmediately(domain_name)`
4915
+
4916
+ Example:
4917
+ ```JS
4918
+ mg.dkimManagement.rotateImmediately('foobar.example.com')
4919
+ .then(data => console.log(data)) // logs response data
4920
+ .catch(err => console.error(err)); //logs any error
4921
+ ```
4922
+
4923
+ Promise returns: DKIMRotateImmediatelyResult
4924
+ ```JS
4925
+ {
4926
+ message: "ok";
4927
+ }
4928
+ ```
4929
+
4930
+ ### Bounce Classification
4931
+ - #### list
4932
+ Returns bounce classification entities
4933
+
4934
+ [API Reference](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/bounce-classification/post-v2-bounce-classification-metrics)
4935
+
4936
+ `mg.bounceClassification.list(query)`
4937
+
4938
+ Example:
4939
+ ```JS
4940
+ mg.bounceClassification.bounceClassification({
4941
+ start: new Date('2025-12-01T13:00:00Z'),
4942
+ end: new Date('2025-12-31T13:05:00Z'),
4943
+ include_subaccounts: true,
4944
+ resolution: 'day',
4945
+ duration: '48h',
4946
+ dimensions: [
4947
+ 'entity-name',
4948
+ 'domain.name'
4949
+ ],
4950
+ metrics: [
4951
+ 'critical_bounce_count',
4952
+ 'non_critical_bounce_count',
4953
+ 'critical_delay_count',
4954
+ 'non_critical_delay_count',
4955
+ 'delivered_smtp_count',
4956
+ 'classified_failures_count',
4957
+ 'critical_bounce_rate',
4958
+ 'non_critical_bounce_rate',
4959
+ 'critical_delay_rate',
4960
+ 'non_critical_delay_rate'
4961
+ ],
4962
+ filter: {
4963
+ AND: [
4964
+ {
4965
+ attribute: 'domain.name',
4966
+ comparator: '=',
4967
+ values: [
4968
+ {
4969
+ value: 'example.com'
4970
+ }
4971
+ ]
4972
+ }
4973
+ ]
4974
+ },
4975
+ pagination: {
4976
+ limit: 25,
4977
+ skip: 0,
4978
+ sort: 'entity-name:asc'
4979
+ }
4980
+ })
4981
+ .then(data => console.log(data)) // logs response data
4982
+ .catch(err => console.error(err)); //logs any error
4983
+ ```
4984
+
4985
+ Promise returns: BounceClassificationResult
4986
+ ```JS
4987
+ {
4988
+ start: new Date('2025-12-01T13:00:00.000Z'),
4989
+ end: new Date('2025-12-31T13:05:00.000Z'),
4990
+ resolution: 'day',
4991
+ duration: '720h5m0s',
4992
+ dimensions: [ 'entity-name', 'domain.name' ],
4993
+ pagination: { sort: 'entity-name:asc', skip: 0, limit: 25, total: 1 },
4994
+ items: [
4995
+ {
4996
+ 'account.name': 'subaccount name',
4997
+ 'entity-name': 'Gmail',
4998
+ 'domain.name': 'example.com',
4999
+ 'envelope.i-ip-pool-name': 'default',
5000
+ 'envelope.sending-ip': '1.2.3.4',
5001
+ timestamp: 'Tue, 02 Dec 2025 22:04:05 +0000',
5002
+ tags: 'daily, campaign1',
5003
+ metrics: {
5004
+ 'critical_bounce_count': 10,
5005
+ 'non_critical_bounce_count': 20,
5006
+ 'critical_delay_count': 30,
5007
+ 'non_critical_delay_count': 40,
5008
+ 'classified_failures_count': 100,
5009
+ 'delivered_smtp_count': 1000,
5010
+ 'critical_bounce_rate': 1,
5011
+ 'non_critical_bounce_rate': 2,
5012
+ 'critical_delay_rate': 3,
5013
+ 'non_critical_delay_rate': 4
5014
+ }
5015
+ }
5016
+ ]
5017
+ }
5018
+ ```
5019
+
4860
5020
  ## Pagination
4861
5021
  Most of the methods that return items in a list support pagination.
4862
5022
  There are two ways to receive part of the list:
@@ -0,0 +1,11 @@
1
+ import Request from '../common/Request.js';
2
+ import { IBounceClassificationClient } from '../../Interfaces/index.js';
3
+ import { BounceClassificationQueryData, BounceClassificationResult } from '../../Types/index.js';
4
+ export default class BounceClassificationClient implements IBounceClassificationClient {
5
+ request: Request;
6
+ constructor(request: Request);
7
+ private prepareDate;
8
+ private parseQuery;
9
+ private parseResponse;
10
+ list(queryData: BounceClassificationQueryData): Promise<BounceClassificationResult>;
11
+ }
@@ -0,0 +1,10 @@
1
+ import { DKIMRotateImmediatelyResult, DKIMRotationData, DKIMUpdateRotationResult } from '../../definitions.js';
2
+ import { IDKIMManagementClient } from '../../Interfaces/DKIM/IDKIMManagementClient.js';
3
+ import Request from '../common/Request.js';
4
+ export default class DKIMManagementClient implements IDKIMManagementClient {
5
+ request: Request;
6
+ constructor(request: Request);
7
+ private prepareBooleanValues;
8
+ update(domainName: string, data: DKIMRotationData): Promise<DKIMUpdateRotationResult>;
9
+ rotateImmediately(domainName: string): Promise<DKIMRotateImmediatelyResult>;
10
+ }
@@ -1,7 +1,6 @@
1
1
  import Request from './common/Request.js';
2
2
  import { MailgunClientOptions, InputFormData } from '../Types/index.js';
3
- import { IDomainsClient, IWebHooksClient, IMailgunClient, IMailingListsClient, IEventClient, IStatsClient, ISuppressionClient, IMessagesClient, IRoutesClient, IValidationClient, IIPsClient, IIPPoolsClient, ISubaccountsClient, IInboxPlacementsClient, IMetricsClient } from '../Interfaces/index.js';
4
- import { ILogsClient } from '../Interfaces/Logs/ILogsClient.js';
3
+ import { IDomainsClient, IWebHooksClient, IMailgunClient, IMailingListsClient, IEventClient, IStatsClient, ISuppressionClient, IMessagesClient, IRoutesClient, IValidationClient, IIPsClient, IIPPoolsClient, ISubaccountsClient, IInboxPlacementsClient, IMetricsClient, IDKIMManagementClient, ILogsClient, IBounceClassificationClient } from '../Interfaces/index.js';
5
4
  export default class MailgunClient implements IMailgunClient {
6
5
  request: Request;
7
6
  domains: IDomainsClient;
@@ -19,6 +18,8 @@ export default class MailgunClient implements IMailgunClient {
19
18
  subaccounts: ISubaccountsClient;
20
19
  inboxPlacements: IInboxPlacementsClient;
21
20
  logs: ILogsClient;
21
+ dkimManagement: IDKIMManagementClient;
22
+ bounceClassification: IBounceClassificationClient;
22
23
  constructor(options: MailgunClientOptions, formData: InputFormData);
23
24
  setSubaccount(subaccountId: string): void;
24
25
  resetSubaccount(): void;
@@ -11,12 +11,13 @@ export declare enum SuppressionModels {
11
11
  }
12
12
  export declare enum WebhooksIds {
13
13
  CLICKED = "clicked",
14
- COMPLAINED = "complained",
15
- DELIVERED = "delivered",
16
14
  OPENED = "opened",
15
+ UNSUBSCRIBED = "unsubscribe",
16
+ DELIVERED = "delivered",
17
17
  PERMANENT_FAIL = "permanent_fail",
18
18
  TEMPORARY_FAIL = "temporary_fail",
19
- UNSUBSCRIBED = "unsubscribe"
19
+ COMPLAINED = "complained",
20
+ ACCEPTED = "accepted"
20
21
  }
21
22
  export declare enum YesNo {
22
23
  YES = "yes",
@@ -0,0 +1,4 @@
1
+ import { BounceClassificationQueryData, BounceClassificationResult } from '../../Types/index.js';
2
+ export interface IBounceClassificationClient {
3
+ list(data: BounceClassificationQueryData): Promise<BounceClassificationResult>;
4
+ }
@@ -0,0 +1 @@
1
+ export * from './IBounceClassificationClient.js';
@@ -0,0 +1,5 @@
1
+ import { DKIMRotateImmediatelyResult, DKIMRotationData, DKIMUpdateRotationResult } from '../../Types/DKIM/index.js';
2
+ export interface IDKIMManagementClient {
3
+ update(domainName: string, data: DKIMRotationData): Promise<DKIMUpdateRotationResult>;
4
+ rotateImmediately(domainName: string): Promise<DKIMRotateImmediatelyResult>;
5
+ }
@@ -0,0 +1 @@
1
+ export * from './IDKIMManagementClient.js';
@@ -14,6 +14,8 @@ import { IInboxPlacementsClient } from '../InboxPlacements/index.js';
14
14
  import { IMetricsClient } from '../Metrics/MetricsClient.js';
15
15
  import type Request from '../../Classes/common/Request.js';
16
16
  import { ILogsClient } from '../Logs/ILogsClient.js';
17
+ import { IDKIMManagementClient } from '../DKIM/IDKIMManagementClient.js';
18
+ import { IBounceClassificationClient } from '../BounceClassification/IBounceClassificationClient.js';
17
19
  export interface IMailgunClient {
18
20
  request: Request;
19
21
  domains: IDomainsClient;
@@ -33,4 +35,6 @@ export interface IMailgunClient {
33
35
  setSubaccount(subaccountId: string): void;
34
36
  resetSubaccount(): void;
35
37
  logs: ILogsClient;
38
+ dkimManagement: IDKIMManagementClient;
39
+ bounceClassification: IBounceClassificationClient;
36
40
  }
@@ -14,3 +14,6 @@ export * from './IPPools/index.js';
14
14
  export * from './Subaccounts/index.js';
15
15
  export * from './InboxPlacements/index.js';
16
16
  export * from './Metrics/MetricsClient.js';
17
+ export * from './Logs/ILogsClient.js';
18
+ export * from './DKIM/IDKIMManagementClient.js';
19
+ export * from './BounceClassification/IBounceClassificationClient.js';
@@ -0,0 +1,73 @@
1
+ export type BounceClassificationQueryDimensions = 'entity-name' | 'domain.name' | 'envelope.sending-ip' | 'account.name' | 'envelope.i-ip-pool-name' | 'tags' | 'tag' | 'recipient-domain' | 'group-id' | 'criticality' | 'severity' | 'category' | 'timestamp';
2
+ export type BounceClassificationQueryMetrics = 'critical_bounce_count' | 'non_critical_bounce_count' | 'critical_delay_count' | 'non_critical_delay_count' | 'delivered_smtp_count' | 'classified_failures_count' | 'critical_bounce_rate' | 'non_critical_bounce_rate' | 'critical_delay_rate' | 'non_critical_delay_rate';
3
+ export type BounceClassificationQueryFilterAttribute = 'entity-name' | 'domain.name' | 'envelope.sending-ip' | 'account.name' | 'envelope.i-ip-pool-name' | 'tags' | 'tag' | 'recipient-domain' | 'group-id' | 'criticality' | 'severity' | 'category';
4
+ export type BounceClassificationQueryFilter = {
5
+ AND: {
6
+ attribute: BounceClassificationQueryFilterAttribute;
7
+ comparator: string;
8
+ values: {
9
+ label: string;
10
+ value: string;
11
+ }[];
12
+ }[];
13
+ };
14
+ export type BounceClassificationQueryData = {
15
+ start?: Date;
16
+ end?: Date;
17
+ resolution?: 'hour' | 'day';
18
+ duration?: string;
19
+ dimensions?: BounceClassificationQueryDimensions[];
20
+ metrics?: BounceClassificationQueryMetrics[];
21
+ filter?: BounceClassificationQueryFilter;
22
+ 'include_subaccounts'?: boolean;
23
+ 'pagination': {
24
+ sort?: string;
25
+ skip?: number;
26
+ limit?: number;
27
+ };
28
+ };
29
+ export type BounceClassificationAPIQuery = Omit<BounceClassificationQueryData, 'start' | 'end'> & {
30
+ start?: string;
31
+ end?: string;
32
+ };
33
+ export type BounceClassificationResultItem = {
34
+ 'account.id': string | null;
35
+ 'account.name': string | null;
36
+ 'entity-name': string | null;
37
+ 'recipient-provider': string | null;
38
+ 'recipient-domain': string | null;
39
+ 'domain.name': string | null;
40
+ 'envelope.i-ip-pool-id': string | null;
41
+ 'envelope.i-ip-pool-name': string | null;
42
+ 'envelope.sending-ip': string | null;
43
+ timestamp: string | null;
44
+ tags: string | null;
45
+ tag: string | null;
46
+ criticality: string | null;
47
+ severity: string | null;
48
+ category: string | null;
49
+ 'group-id': string | null;
50
+ 'sample-text': string | null;
51
+ explanation: string | null;
52
+ metrics: {
53
+ [K in BounceClassificationQueryMetrics]: number;
54
+ };
55
+ };
56
+ export type BounceClassificationResult = {
57
+ start: Date;
58
+ end: Date;
59
+ resolution: 'hour' | 'day' | 'month';
60
+ duration?: string;
61
+ dimensions?: BounceClassificationQueryDimensions[];
62
+ pagination: {
63
+ sort: string;
64
+ skip: number;
65
+ limit: number;
66
+ total: number;
67
+ };
68
+ items: BounceClassificationResultItem[];
69
+ };
70
+ export type BounceClassificationAPIResponse = Omit<BounceClassificationResult, 'start' | 'end'> & {
71
+ start: string;
72
+ end: string;
73
+ };
@@ -0,0 +1 @@
1
+ export * from './BounceClassification.js';
@@ -11,6 +11,7 @@ import type { IpPoolDeleteData } from '../IPPools/index.js';
11
11
  import type { MetricsQuery } from '../Metrics/index.js';
12
12
  import type { FormDataInput } from './FormData.js';
13
13
  import { LogsQuery } from '../Logs/Logs.js';
14
+ import { BounceClassificationAPIQuery } from '../BounceClassification/BounceClassification.js';
14
15
  export type OnCallEmptyHeaders = {
15
16
  [key: string]: undefined;
16
17
  };
@@ -37,7 +38,7 @@ export type GetQueryTypes = IPsListQuery | RoutesListQuery | SubaccountsQuery |
37
38
  searchParams?: Array<Array<string>>;
38
39
  } | ValidationQuery;
39
40
  export type DeleteQueryTypes = DeletedDomainKeysQuery;
40
- export type PostDataTypes = InboxPlacementsData | MetricsQuery | LogsQuery | string;
41
+ export type PostDataTypes = InboxPlacementsData | MetricsQuery | LogsQuery | BounceClassificationAPIQuery | string;
41
42
  export type PutDataTypes = SeedsListsUpdatingData | object | FormDataInput | ConnectionSettings;
42
43
  export type RequestData = IpPoolDeleteData | PostDataTypes | PutDataTypes | NodeFormData | FormData;
43
44
  export type ContainsPrefix<T extends string> = `${T}${string}`;
@@ -0,0 +1,29 @@
1
+ export type DKIMRotationData = {
2
+ 'rotation_enabled': boolean | string;
3
+ 'rotation_interval'?: string;
4
+ };
5
+ type DKIMRecord = {
6
+ name: string;
7
+ type: string;
8
+ identifier: string;
9
+ value: string;
10
+ comment: string;
11
+ };
12
+ type DKIMDomain = {
13
+ id: string;
14
+ 'account_id': string;
15
+ sid: string;
16
+ name: string;
17
+ state: string;
18
+ 'active_selector': string;
19
+ 'rotation_enabled': string;
20
+ 'rotation_interval': string;
21
+ records: DKIMRecord[];
22
+ };
23
+ export type DKIMUpdateRotationResult = {
24
+ domain: DKIMDomain;
25
+ };
26
+ export type DKIMRotateImmediatelyResult = {
27
+ message: string;
28
+ };
29
+ export {};
@@ -0,0 +1 @@
1
+ export * from './DKIM.js';
@@ -13,3 +13,6 @@ export * from './Subaccounts/index.js';
13
13
  export * from './Suppressions/index.js';
14
14
  export * from './Validations/index.js';
15
15
  export * from './Webhooks/index.js';
16
+ export * from './Logs/index.js';
17
+ export * from './DKIM/index.js';
18
+ export * from './BounceClassification/index.js';
package/Types/index.js CHANGED
@@ -464,7 +464,8 @@ var FormDataBuilder = /** @class */ (function () {
464
464
  }
465
465
  if (_this.attachmentsHandler.isStream(objData)) {
466
466
  var blob = _this.attachmentsHandler.getBlobFromStream(objData, options.knownLength);
467
- browserFormData.set(key, blob, options.filename);
467
+ // Needs to be append for multiple files, otherwise only last file is attached.
468
+ browserFormData.append(key, blob, options.filename);
468
469
  }
469
470
  }
470
471
  };
@@ -5326,12 +5327,13 @@ var SuppressionModels;
5326
5327
  var WebhooksIds;
5327
5328
  (function (WebhooksIds) {
5328
5329
  WebhooksIds["CLICKED"] = "clicked";
5329
- WebhooksIds["COMPLAINED"] = "complained";
5330
- WebhooksIds["DELIVERED"] = "delivered";
5331
5330
  WebhooksIds["OPENED"] = "opened";
5331
+ WebhooksIds["UNSUBSCRIBED"] = "unsubscribe";
5332
+ WebhooksIds["DELIVERED"] = "delivered";
5332
5333
  WebhooksIds["PERMANENT_FAIL"] = "permanent_fail";
5333
5334
  WebhooksIds["TEMPORARY_FAIL"] = "temporary_fail";
5334
- WebhooksIds["UNSUBSCRIBED"] = "unsubscribe";
5335
+ WebhooksIds["COMPLAINED"] = "complained";
5336
+ WebhooksIds["ACCEPTED"] = "accepted";
5335
5337
  })(WebhooksIds || (WebhooksIds = {}));
5336
5338
  var YesNo;
5337
5339
  (function (YesNo) {
@@ -7207,6 +7209,88 @@ var LogsClient = /** @class */ (function () {
7207
7209
  return LogsClient;
7208
7210
  }());
7209
7211
 
7212
+ var DKIMManagementClient = /** @class */ (function () {
7213
+ function DKIMManagementClient(request) {
7214
+ this.request = request;
7215
+ }
7216
+ DKIMManagementClient.prototype.prepareBooleanValues = function (data) {
7217
+ var res = __assign(__assign({}, data), { rotation_enabled: '' });
7218
+ if (Object.keys(data).includes('rotation_enabled')) {
7219
+ res.rotation_enabled = "".concat(data.rotation_enabled);
7220
+ }
7221
+ return res;
7222
+ };
7223
+ DKIMManagementClient.prototype.update = function (domainName, data) {
7224
+ return __awaiter(this, void 0, void 0, function () {
7225
+ var preparedData, response;
7226
+ return __generator(this, function (_a) {
7227
+ switch (_a.label) {
7228
+ case 0:
7229
+ preparedData = this.prepareBooleanValues(data);
7230
+ return [4 /*yield*/, this.request.putWithFD(urljoin('v1/dkim_management/domains/', domainName, 'rotation'), preparedData)];
7231
+ case 1:
7232
+ response = _a.sent();
7233
+ return [2 /*return*/, response.body];
7234
+ }
7235
+ });
7236
+ });
7237
+ };
7238
+ DKIMManagementClient.prototype.rotateImmediately = function (domainName) {
7239
+ return __awaiter(this, void 0, void 0, function () {
7240
+ var response;
7241
+ return __generator(this, function (_a) {
7242
+ switch (_a.label) {
7243
+ case 0: return [4 /*yield*/, this.request.post(urljoin('v1/dkim_management/domains/', domainName, 'rotate'), {})];
7244
+ case 1:
7245
+ response = _a.sent();
7246
+ return [2 /*return*/, response.body];
7247
+ }
7248
+ });
7249
+ });
7250
+ };
7251
+ return DKIMManagementClient;
7252
+ }());
7253
+
7254
+ var BounceClassificationClient = /** @class */ (function () {
7255
+ function BounceClassificationClient(request) {
7256
+ this.request = request;
7257
+ }
7258
+ BounceClassificationClient.prototype.prepareDate = function (date) {
7259
+ var formattedDate = "".concat(date.toUTCString().slice(0, 25), " -0000"); // expected format 'Wed, 03 Dec 2025 00:00:00 -0000'
7260
+ return formattedDate;
7261
+ };
7262
+ BounceClassificationClient.prototype.parseQuery = function (queryData) {
7263
+ var res = __assign(__assign({}, queryData), { start: undefined, end: undefined, include_subaccounts: undefined });
7264
+ if (queryData.start) {
7265
+ res.start = this.prepareDate(queryData.start);
7266
+ }
7267
+ if (queryData.end) {
7268
+ res.end = this.prepareDate(queryData.end);
7269
+ }
7270
+ return res;
7271
+ };
7272
+ BounceClassificationClient.prototype.parseResponse = function (body) {
7273
+ var res = __assign(__assign({}, body), { start: new Date(body.start), end: new Date(body.end) });
7274
+ return res;
7275
+ };
7276
+ BounceClassificationClient.prototype.list = function (queryData) {
7277
+ return __awaiter(this, void 0, void 0, function () {
7278
+ var preparedQueryData, response;
7279
+ return __generator(this, function (_a) {
7280
+ switch (_a.label) {
7281
+ case 0:
7282
+ preparedQueryData = this.parseQuery(queryData);
7283
+ return [4 /*yield*/, this.request.post('/v2/bounce-classification/metrics', preparedQueryData)];
7284
+ case 1:
7285
+ response = _a.sent();
7286
+ return [2 /*return*/, this.parseResponse(response.body)];
7287
+ }
7288
+ });
7289
+ });
7290
+ };
7291
+ return BounceClassificationClient;
7292
+ }());
7293
+
7210
7294
  var MailgunClient = /** @class */ (function () {
7211
7295
  function MailgunClient(options, formData) {
7212
7296
  var config = __assign({}, options);
@@ -7254,6 +7338,8 @@ var MailgunClient = /** @class */ (function () {
7254
7338
  this.subaccounts = new SubaccountsClient(this.request);
7255
7339
  this.inboxPlacements = new InboxPlacementsClient(this.request, seedsListsClient, inboxPlacementsResultsClient, inboxPlacementsProvidersClient);
7256
7340
  this.logs = new LogsClient(this.request);
7341
+ this.dkimManagement = new DKIMManagementClient(this.request);
7342
+ this.bounceClassification = new BounceClassificationClient(this.request);
7257
7343
  }
7258
7344
  MailgunClient.prototype.setSubaccount = function (subaccountId) {
7259
7345
  var _a;