mailgun.js 10.0.1 → 10.1.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/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  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.
4
4
 
5
+ ## [10.1.0](https://github.com/mailgun/mailgun.js/compare/v10.0.1...v10.1.0) (2024-01-31)
6
+
7
+
8
+ ### Features
9
+
10
+ * Add proxy configuration to the client ([fa013f1](https://github.com/mailgun/mailgun.js/commits/fa013f1f49792d1e42b4e718b629514198393f4e))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **docs:** Add url param for EU infrastructure ([360b867](https://github.com/mailgun/mailgun.js/commits/360b867c03da6f70669e6bba0c3070fdd9f10885))
16
+
17
+
18
+ ### Other changes
19
+
20
+ * Update readme ([3897e59](https://github.com/mailgun/mailgun.js/commits/3897e59554316994579960eb5f3ee7373b72f29d))
21
+
5
22
  ### [10.0.1](https://github.com/mailgun/mailgun.js/compare/v10.0.0...v10.0.1) (2024-01-26)
6
23
 
7
24
 
@@ -8,6 +8,7 @@ declare class Request {
8
8
  private headers;
9
9
  private formDataBuilder;
10
10
  private maxBodyLength;
11
+ private proxy;
11
12
  constructor(options: RequestOptions, formData: InputFormData);
12
13
  request(method: string, url: string, onCallOptions?: Record<string, unknown | Record<string, unknown>>): Promise<APIResponse>;
13
14
  private getResponseBody;
package/README.md CHANGED
@@ -42,6 +42,8 @@ Next, require the module and instantiate a mailgun client by calling `new Mailgu
42
42
 
43
43
  NOTE: starting from version 3.0 you need to pass FormData (we need this to keep library universal). For node.js you can use `form-data` library.
44
44
 
45
+ IMPORTANT: if you are using EU infrastructure, you need to also pass `url: 'https://api.eu.mailgun.net'` together with auth credentials as stated in [Mailgun docs](https://documentation.mailgun.com/en/latest/quickstart-sending.html#send-via-api)
46
+
45
47
  ### Imports
46
48
  Once the package is installed, you can import the library using `import` or `require` approach:
47
49
 
@@ -68,6 +70,29 @@ Primary accounts can make API calls on behalf of their subaccounts. [API documen
68
70
  // then, if you need to reset it back to the primary account:
69
71
  mg.resetSubaccount();
70
72
  ```
73
+
74
+ ### Proxy configuration
75
+ By leveraging client configuration options, users can effortlessly establish proxy connections that align with their network requirements.
76
+ Ex:
77
+ ```js
78
+ import * as FormData from 'form-data';
79
+ import Mailgun from 'mailgun.js';
80
+ const mailgun = new Mailgun(FormData);
81
+
82
+ const mg = mailgun.client({
83
+ username: 'api',
84
+ key: process.env.MAILGUN_API_KEY || 'key-yourkeyhere',
85
+ proxy: {
86
+ protocol: 'https' // 'http' ,
87
+ host: '127.0.0.1', // use your proxy host here
88
+ port: 9000, // use your proxy port here
89
+ auth: { // may be omitted if proxy doesn't require authentication
90
+ username: 'user_name', // provide username
91
+ password: 'user_password' // provide password
92
+ }
93
+ },
94
+ });
95
+ ```
71
96
  ### Types imports
72
97
  Starting from version **9.0.0.** Types can be includes as named import:
73
98
  ```TS
@@ -1,7 +1,9 @@
1
+ import { AxiosProxyConfig } from 'axios';
1
2
  export type MailgunClientOptions = {
2
3
  username: string;
3
4
  key: string;
4
5
  url?: string;
5
6
  public_key?: string;
6
7
  timeout?: number;
8
+ proxy?: AxiosProxyConfig;
7
9
  };