mailgun.js 4.1.0 → 4.1.1
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 +7 -0
- package/dist/lib/request.d.ts +1 -0
- package/dist/mailgun.node.js +2 -2
- package/dist/mailgun.node.js.LICENSE.txt +1 -1
- package/dist/mailgun.web.js +2 -2
- package/dist/mailgun.web.js.LICENSE.txt +1 -1
- package/lib/ip-pools.ts +2 -2
- package/lib/request.ts +11 -0
- package/package.json +1 -1
package/lib/ip-pools.ts
CHANGED
|
@@ -16,12 +16,12 @@ export default class IpPoolsClient {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
create(data: { name: string, description?: string, ips?: string[] }) {
|
|
19
|
-
return this.request.
|
|
19
|
+
return this.request.postWithFD('/v1/ip_pools', data)
|
|
20
20
|
.then((response: { body: { message: string, pool_id: string } }) => response?.body);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
update(poolId: string, data: IpPoolUpdateData) : Promise<any> {
|
|
24
|
-
return this.request.
|
|
24
|
+
return this.request.patchWithFD(`/v1/ip_pools/${poolId}`, data)
|
|
25
25
|
.then((response: { body: any }) => response?.body);
|
|
26
26
|
}
|
|
27
27
|
|
package/lib/request.ts
CHANGED
|
@@ -165,6 +165,17 @@ class Request {
|
|
|
165
165
|
return this.command('put', url, formData, params);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
patchWithFD(url: string, data: any): Promise<APIResponse> {
|
|
169
|
+
if (!data) {
|
|
170
|
+
throw new Error('Please provide data object');
|
|
171
|
+
}
|
|
172
|
+
const params: any = {
|
|
173
|
+
headers: { 'Content-Type': null }
|
|
174
|
+
};
|
|
175
|
+
const formData = this.createFormData(data);
|
|
176
|
+
return this.command('patch', url, formData, params);
|
|
177
|
+
}
|
|
178
|
+
|
|
168
179
|
createFormData(data: any): NodeFormData | FormData {
|
|
169
180
|
const formData: NodeFormData | FormData = Object.keys(data)
|
|
170
181
|
.filter(function (key) { return data[key]; })
|