-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathaccounts.webhooks.ts
64 lines (52 loc) · 1.74 KB
/
accounts.webhooks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import Gigya from './gigya';
import GigyaResponse from './interfaces/gigya-response';
import BaseParams from './interfaces/base-params';
export * from './interfaces/gigya-response';
export * from './interfaces/base-params';
export class Webhooks {
constructor(protected gigya: Gigya) {
}
/**
* This method is used to delete a webhook.
*
* @see http://developers.gigya.com/display/GD/accounts.webhooks.delete+REST
*/
public delete(params: BaseParams & WebhooksDeleteParams) {
return this.gigya.request('accounts.webhooks.delete', params);
}
/**
* This method is used to retrieve a list of all defined webhooks.
*
* @see http://developers.gigya.com/display/GD/accounts.webhooks.getAll+REST
*/
public getAll(params?: WebhooksGetAllParams) {
return this.gigya.request<WebhooksGetAllResponse>('accounts.webhooks.getAll', params || {});
}
/**
* This method is used to create a new webhook or update an existing one.
*
* @see http://developers.gigya.com/display/GD/accounts.webhooks.set+REST
*/
public set(params: BaseParams & WebhooksSetParams) {
return this.gigya.request<WebhooksGetAllResponse>('accounts.webhooks.set', params);
}
}
export type WebhooksEvents = Array<'accountCreated' | 'accountRegistered' | 'accountUpdated' | 'accountDeleted'>;
export interface Webhook {
url: string;
events: WebhooksEvents;
name: string;
active: boolean;
signingUserKey?: string;
};
export interface WebhooksDeleteParams {
name: string;
}
export interface WebhooksGetAllParams {
}
export interface WebhooksGetAllResponse {
webhooks: Array<Webhook>;
}
export interface WebhooksSetParams extends Webhook {
}
export default Webhooks;