Skip to content

Commit

Permalink
Merge pull request #385 from mailgun/update-webhook-method
Browse files Browse the repository at this point in the history
Change webhooks `update` method
  • Loading branch information
olexandr-mazepa authored Sep 18, 2023
2 parents 970c9b6 + 3a3b8d8 commit 97f6852
Show file tree
Hide file tree
Showing 45 changed files with 24,361 additions and 399 deletions.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['trackclick.com'] }
}
```

Expand All @@ -1355,7 +1355,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
}
```

Expand Down Expand Up @@ -1392,10 +1392,24 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
}
```

```js
mg.webhooks.update('foobar.example.com', 'open', ['http://requestb.in', 'http://requestb1.in' ]) // bounce, deliver, drop, spam, unsubscribe, click, open
.then(msg => console.log(msg)) // logs response data
.catch(err => console.error(err)); // logs any error
```

Promise returns:
```JS
{
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in', 'http://requestb1.in'] }
}
```


- #### destroy

`mg.webhooks.destroy(domain, id)`
Expand All @@ -1412,7 +1426,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in']}
}
```

Expand Down
5 changes: 3 additions & 2 deletions dist/Classes/Webhooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Request from './common/Request';
export declare class Webhook implements WebhookResult {
id: string;
url: string | undefined;
constructor(id: string, url: string | undefined);
urls: string[];
constructor(id: string, url: string | undefined, urls: string[]);
}
export default class WebhooksClient implements IWebHooksClient {
request: Request;
Expand All @@ -16,6 +17,6 @@ export default class WebhooksClient implements IWebHooksClient {
list(domain: string, query: WebhooksQuery): Promise<WebhookList>;
get(domain: string, id: WebhooksIds): Promise<WebhookResult>;
create(domain: string, id: string, url: string, test?: boolean): Promise<WebhookResult | WebhookValidationResponse>;
update(domain: string, id: string, url: string): Promise<WebhookResult>;
update(domain: string, id: string, urlValues: string | string[]): Promise<WebhookResult>;
destroy(domain: string, id: string): Promise<WebhookResult>;
}
2 changes: 1 addition & 1 deletion dist/Interfaces/Webhooks/IWebHooksClient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export interface IWebHooksClient {
list(domain: string, query: WebhooksQuery): Promise<WebhookList>;
get(domain: string, id: WebhooksIds): Promise<WebhookResult>;
create(domain: string, id: string, url: string, test: boolean): Promise<WebhookResult | WebhookValidationResponse>;
update(domain: string, id: string, url: string): Promise<WebhookResult>;
update(domain: string, id: string, url: string | string[]): Promise<WebhookResult>;
destroy(domain: string, id: string): Promise<WebhookResult>;
}
22 changes: 18 additions & 4 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['trackclick.com'] }
}
```

Expand All @@ -1355,7 +1355,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
}
```

Expand Down Expand Up @@ -1392,10 +1392,24 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
}
```

```js
mg.webhooks.update('foobar.example.com', 'open', ['http://requestb.in', 'http://requestb1.in' ]) // bounce, deliver, drop, spam, unsubscribe, click, open
.then(msg => console.log(msg)) // logs response data
.catch(err => console.error(err)); // logs any error
```

Promise returns:
```JS
{
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in', 'http://requestb1.in'] }
}
```


- #### destroy

`mg.webhooks.destroy(domain, id)`
Expand All @@ -1412,7 +1426,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in']}
}
```

Expand Down
4 changes: 4 additions & 0 deletions dist/Types/Webhooks/Webhooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,9 @@ export type WebhookValidationResponse = {
};
export type WebhookResult = {
id: string;
/**
* @deprecated url property is deprecated. Use "urls" instead.
*/
url: string | undefined;
urls: string[];
};
14,297 changes: 14,294 additions & 3 deletions dist/mailgun.node.js

Large diffs are not rendered by default.

9,606 changes: 9,603 additions & 3 deletions dist/mailgun.web.js

Large diffs are not rendered by default.

21 changes: 17 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['trackclick.com'] }
}
```

Expand All @@ -1353,7 +1353,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
}
```

Expand Down Expand Up @@ -1390,7 +1390,20 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
}
```

```js
mg.webhooks.update('foobar.example.com', 'open', ['http://requestb.in', 'http://requestb1.in' ]) // bounce, deliver, drop, spam, unsubscribe, click, open
.then(msg => console.log(msg)) // logs response data
.catch(err => console.error(err)); // logs any error
```

Promise returns:
```JS
{
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in', 'http://requestb1.in'] }
}
```

Expand All @@ -1410,7 +1423,7 @@ Method naming conventions:

```JS
{
'open': { 'url': 'http://requestb.in' }
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in']}
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/classes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#### Defined in

[index.ts:14](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/index.ts#L14)
[index.ts:14](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/index.ts#L14)

## Properties

Expand All @@ -44,7 +44,7 @@

#### Defined in

[index.ts:12](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/index.ts#L12)
[index.ts:12](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/index.ts#L12)

## Accessors

Expand All @@ -58,7 +58,7 @@ typeof [`default`](default.md)

#### Defined in

[index.ts:11](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/index.ts#L11)
[index.ts:11](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/index.ts#L11)

## Methods

Expand All @@ -78,4 +78,4 @@ typeof [`default`](default.md)

#### Defined in

[index.ts:18](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/index.ts#L18)
[index.ts:18](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/index.ts#L18)
6 changes: 3 additions & 3 deletions docs/enums/Enums.Resolution.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#### Defined in

[Enums/index.ts:3](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L3)
[Enums/index.ts:3](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L3)

___

Expand All @@ -30,7 +30,7 @@ ___

#### Defined in

[Enums/index.ts:2](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L2)
[Enums/index.ts:2](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L2)

___

Expand All @@ -40,4 +40,4 @@ ___

#### Defined in

[Enums/index.ts:4](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L4)
[Enums/index.ts:4](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L4)
8 changes: 4 additions & 4 deletions docs/enums/Enums.SuppressionModels.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#### Defined in

[Enums/index.ts:8](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L8)
[Enums/index.ts:8](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L8)

___

Expand All @@ -31,7 +31,7 @@ ___

#### Defined in

[Enums/index.ts:9](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L9)
[Enums/index.ts:9](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L9)

___

Expand All @@ -41,7 +41,7 @@ ___

#### Defined in

[Enums/index.ts:10](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L10)
[Enums/index.ts:10](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L10)

___

Expand All @@ -51,4 +51,4 @@ ___

#### Defined in

[Enums/index.ts:11](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L11)
[Enums/index.ts:11](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L11)
14 changes: 7 additions & 7 deletions docs/enums/Enums.WebhooksIds.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#### Defined in

[Enums/index.ts:15](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L15)
[Enums/index.ts:15](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L15)

___

Expand All @@ -34,7 +34,7 @@ ___

#### Defined in

[Enums/index.ts:16](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L16)
[Enums/index.ts:16](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L16)

___

Expand All @@ -44,7 +44,7 @@ ___

#### Defined in

[Enums/index.ts:17](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L17)
[Enums/index.ts:17](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L17)

___

Expand All @@ -54,7 +54,7 @@ ___

#### Defined in

[Enums/index.ts:18](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L18)
[Enums/index.ts:18](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L18)

___

Expand All @@ -64,7 +64,7 @@ ___

#### Defined in

[Enums/index.ts:19](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L19)
[Enums/index.ts:19](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L19)

___

Expand All @@ -74,7 +74,7 @@ ___

#### Defined in

[Enums/index.ts:20](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L20)
[Enums/index.ts:20](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L20)

___

Expand All @@ -84,4 +84,4 @@ ___

#### Defined in

[Enums/index.ts:21](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L21)
[Enums/index.ts:21](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L21)
4 changes: 2 additions & 2 deletions docs/enums/Enums.YesNo.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#### Defined in

[Enums/index.ts:26](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L26)
[Enums/index.ts:26](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L26)

___

Expand All @@ -29,4 +29,4 @@ ___

#### Defined in

[Enums/index.ts:25](https://github.com/mailgun/mailgun.js/blob/a212f26/lib/Enums/index.ts#L25)
[Enums/index.ts:25](https://github.com/mailgun/mailgun.js/blob/633bce9/lib/Enums/index.ts#L25)
Loading

0 comments on commit 97f6852

Please sign in to comment.