Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mailgun.js

Package Overview
Dependencies
Maintainers
3
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailgun.js - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

dist/lib/interfaces/Ips.d.ts

2

dist/lib/client.d.ts

@@ -12,2 +12,3 @@ import Request from './request';

import ParseClient from './parse';
import IpsClient from './ips';
export default class Client {

@@ -25,3 +26,4 @@ private request;

parse: ParseClient;
ips: IpsClient;
constructor(options: Options, formData: FormData);
}

@@ -61,3 +61,12 @@ import Request from './request';

updateTracking(domain: string, type: string, data: any): Promise<any>;
getIps(domain: string): Promise<string[]>;
assignIp(domain: string, ip: string): Promise<{
body: any;
status: number;
}>;
deleteIp(domain: string, ip: string): Promise<{
body: any;
status: number;
}>;
}
export {};

2

dist/mailgun.js.LICENSE.txt
/*! MIT License © Sindre Sorhus */
/*! mailgun.js v3.0.0 */
/*! mailgun.js v3.1.0 */

@@ -16,2 +16,3 @@ const defaults = require('lodash.defaults');

import ParseClient from './parse';
import IpsClient from './ips';

@@ -31,2 +32,3 @@ export default class Client {

public parse;
public ips;

@@ -56,2 +58,3 @@ constructor(options: Options, formData: FormData) {

this.routes = new RoutesClient(this.request);
this.ips = new IpsClient(this.request);

@@ -58,0 +61,0 @@ if (config.public_key) {

@@ -67,3 +67,7 @@ import map from 'lodash.map';

_parseDomain(response: {
body: {domain: any, receiving_dns_records: any, sending_dns_records: any }
body: {
domain: any,
receiving_dns_records: any,
sending_dns_records: any
}
}) {

@@ -116,2 +120,17 @@ return new Domain(

}
// IPs
getIps(domain: string) {
return this.request.get(urljoin('/v2/domains', domain, 'ips'))
.then((response: { body: { items: string[] } }) => response?.body?.items);
}
assignIp(domain: string, ip: string) {
return this.request.post(urljoin('/v2/domains', domain, 'ips'), { ip });
}
deleteIp(domain: string, ip: string) {
return this.request.delete(urljoin('/v2/domains', domain, 'ips', ip));
}
}
{
"name": "mailgun.js",
"version": "3.0.0",
"version": "3.1.0",
"main": "dist/mailgun.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

@@ -80,2 +80,4 @@ # Mailgun.js [![Build Status](https://travis-ci.org/mailgun/mailgun-js.svg)](https://travis-ci.org/mailgun/mailgun-js)

- [updateTracking](#updatetracking)
- [getIps](#getips)
- [assignIp](#assignip)
- [events](#events)

@@ -486,2 +488,58 @@ - [get](#get-1)

#### getIps
`mg.domains.getIps(domain)`
Example:
```js
mg.domains.getIps('foobar.example.com')
.then(msg => console.log(msg)) // logs response data
.catch(err => console.log(err)); // logs any error
```
Promise Returns:
```
["192.168.0.1", "192.168.0.2"]
```
#### assignIp
`mg.domains.assignIp(domain, ip)`
Example:
```js
mg.domains.assignIp('foobar.example.com', "192.168.0.3")
.then(msg => console.log(msg)) // logs response data
.catch(err => console.log(err)); // logs any error
```
```
{
message: 'success'
}
```
#### deleteIp
`mg.domains.deleteIp(domain, ip)`
Example:
```js
mg.domains.deleteIp('foobar.example.com', "192.168.0.3")
.then(msg => console.log(msg)) // logs response data
.catch(err => console.log(err)); // logs any error
```
```
{
message: 'success'
}
```
### events

@@ -488,0 +546,0 @@

@@ -188,2 +188,13 @@ const formData = require('form-data');

});
describe('getIps', () => {
it('should return list of dedicated ips', () => {
const items = ['192.161.0.1', '192.168.0.2']
api.get('/v2/domains/domain.com/ips').reply(200, { items });
return client.getIps('domain.com').then( (items: string[]) => {
items.should.eql(items);
});
});
});
});

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc