Skip to content

Commit

Permalink
chore(release): 10.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
olexandr-mazepa committed Dec 30, 2024
1 parent 5c5802a commit ffb37a5
Show file tree
Hide file tree
Showing 52 changed files with 742 additions and 29,726 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [10.4.0](https://github.com/mailgun/mailgun.js/compare/v10.3.0...v10.4.0) (2024-12-30)


### Features

* Add support for metrics ([de16ccd](https://github.com/mailgun/mailgun.js/commits/de16ccd9b8dfdab5ab6e87fb8eba44cef80dd1a5))


### Other changes

* Add tests ([78f9990](https://github.com/mailgun/mailgun.js/commits/78f9990fe6e6972f52df1af8ad1e720110890aa7))
* Update readme ([a724689](https://github.com/mailgun/mailgun.js/commits/a7246892a24f98393453c6a0e53e8bdf4ec64fd8))

## [10.3.0](https://github.com/mailgun/mailgun.js/compare/v10.2.4...v10.3.0) (2024-12-23)


Expand Down
13 changes: 13 additions & 0 deletions dist/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [10.4.0](https://github.com/mailgun/mailgun.js/compare/v10.3.0...v10.4.0) (2024-12-30)


### Features

* Add support for metrics ([de16ccd](https://github.com/mailgun/mailgun.js/commits/de16ccd9b8dfdab5ab6e87fb8eba44cef80dd1a5))


### Other changes

* Add tests ([78f9990](https://github.com/mailgun/mailgun.js/commits/78f9990fe6e6972f52df1af8ad1e720110890aa7))
* Update readme ([a724689](https://github.com/mailgun/mailgun.js/commits/a7246892a24f98393453c6a0e53e8bdf4ec64fd8))

## [10.3.0](https://github.com/mailgun/mailgun.js/compare/v10.2.4...v10.3.0) (2024-12-23)


Expand Down
146 changes: 144 additions & 2 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ The following service methods are available to instantiated clients. The example
- [get](#get-1)
- [Example with Date and *Filter field*](#example-with-date-and-filter-field)
- [stats](#stats)
- [Stats Options](#stats-options)
- [getDomain](#getdomain)
- [getAccount](#getaccount)
- [Metrics](#metrics)
- [getAccount](#getaccount-1)
- [getAccountUsage](#getaccountusage)
- [suppressions](#suppressions)
- [list](#list-1)
- [Bounces Example](#bounces-example)
Expand Down Expand Up @@ -1023,7 +1027,7 @@ The following service methods are available to instantiated clients. The example
```

### Stats
- Stats Options
- #### Stats Options

| Parameter | Description |
|:-----------|:---------------------------------------------------------------------------------------------------------------------------|
Expand Down Expand Up @@ -1110,6 +1114,145 @@ The following service methods are available to instantiated clients. The example
}
```


```
### Metrics
Mailgun collects many different events and generates event metrics which are available in your Control Panel. This data is also available via our analytics metrics [API endpoint](https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/Metrics/#tag/Metrics).
- #### getAccount
Gets filtered metrics for an account
`mg.metrics.getAccount(MetricsQuery);`
Example:
```JS
mg.metrics.getAccount({
start: '2024-12-16T10:47:51.661Z',
end: '2024-12-23T10:47:51.661Z',
resolution: 'hour',
metrics: ['opened_count'],
filter: {
AND: [{
attribute: 'domain',
comparator: 'contains',
values: [{
value: 'mailgun'
}]
}]
},
include_subaccounts: true,
include_aggregates: true
})
.then(data => console.log(data)) // logs response data
.catch(err => console.error(err)); //logs any error
```
*getAccount* method accepts data object with next properties:
| Property | Type |Description |
|:--------------|:-----|:-----------------------------------------------------------------------------------------------------------------------------------|
| start | String that contains date in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14 or JS Date object | A start date (default: 7 days before current time)|
| end | String that contains date in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14 or JS Date object | An end date (default: current time)|
| resolution | String | A resolution in the format of 'day' 'hour' 'month'. Default is day.|
| duration | String | A duration in the format of '1d' '2h' '2m'. If duration is provided then it is calculated from the end date and overwrites the start date.|
| dimensions | Array of strings | Attributes of the metric data such as 'subaccount'.|
| metrics | Array of strings | Name of the metrics to receive the stats for such as 'processed_count'.|
| filter | object | Filters to apply to the query. The 'AND' property is required and should contains array of filters objects. See this [document](https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/Metrics/#tag/Metrics/operation/api.(*MetricsAPI).PostMetricQuery-fm-3!path=filter&t=request) for an object shape. |
| include_subaccounts | Boolean | Include stats from all subaccounts. |
| include_aggregates | Boolean | Include top-level aggregate metrics.|
Promise returns: MetricsResult
```JS
{
start: new Date('2024-12-16T01:00:00.000Z'),
end: new Date('2024-12-23T00:00:00.000Z'),
resolution: 'hour',
dimensions: [ 'time' ],
pagination: { sort: '', skip: 0, limit: 1500, total: 1 },
items: [
{
dimensions: [{
{
dimension: 'time',
value: 'Sat, 21 Dec 2024 17:00:00 +0000',
display_value: 'Sat, 21 Dec 2024 17:00:00 +0000'
}
}],
metrics: { opened_count: 1 }
},
...
],
aggregates: { metrics: { opened_count: 1 } },
status: 200
}
```
- #### getAccountUsage
Gets filtered **usage metrics** for an account
`mg.metrics.getAccountUsage(MetricsQuery);`
Example:
```JS
mg.metrics.getAccountUsage({
start: '2024-12-16T10:47:51.661Z',
end: '2024-12-23T10:47:51.661Z',
resolution: 'hour',
metrics: ['opened_count'],
filter: {
AND: [{
attribute: 'domain',
comparator: 'contains',
values: [{
value: 'mailgun'
}]
}]
},
include_subaccounts: true,
include_aggregates: true
})
.then(data => console.log(data)) // logs response data
.catch(err => console.error(err)); //logs any error
```
*getAccountUsage* method accepts data object with next properties:
| Property | Type |Description |
|:--------------|:-----|:-----------------------------------------------------------------------------------------------------------------------------------|
| start | String that contains date in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14 or JS Date object | A start date (default: 7 days before current time)|
| end | String that contains date in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14 or JS Date object | An end date (default: current time)|
| resolution | String | A resolution in the format of 'day' 'hour' 'month'. Default is day.|
| duration | String | A duration in the format of '1d' '2h' '2m'. If duration is provided then it is calculated from the end date and overwrites the start date.|
| dimensions | Array of strings | Attributes of the metric data such as 'subaccount'.|
| metrics | Array of strings | Name of the metrics to receive the stats for such as 'processed_count'.|
| filter | object | Filters to apply to the query. The 'AND' property is required and should contains array of filters objects. See this [document](https://documentation.mailgun.com/docs/mailgun/api-reference/openapi-final/tag/Metrics/#tag/Metrics/operation/api.(*MetricsAPI).PostMetricQuery-fm-3!path=filter&t=request) for an object shape. |
| include_subaccounts | Boolean | Include stats from all subaccounts. |
| include_aggregates | Boolean | Include top-level aggregate metrics.|
Promise returns: MetricsResult
```JS
{
start: new Date('2024-12-16T01:00:00.000Z'),
end: new Date('2024-12-23T00:00:00.000Z'),
resolution: 'hour',
dimensions: [ 'time' ],
pagination: { sort: '', skip: 0, limit: 1500, total: 1 },
items: [
{
dimensions: [{
{
dimension: 'time',
value: 'Sat, 21 Dec 2024 17:00:00 +0000',
display_value: 'Sat, 21 Dec 2024 17:00:00 +0000'
}
}],
metrics: { opened_count: 1 }
},
...
],
aggregates: { metrics: { opened_count: 1 } },
status: 200
}
```
### Suppressions
- #### list
Expand Down Expand Up @@ -3165,7 +3308,6 @@ A client to manage members within a specific mailing list.
results: 'link to result page',
}
}
```

## Navigation thru lists
Most of the methods that return items in a list support pagination.
Expand Down
Loading

0 comments on commit ffb37a5

Please sign in to comment.