-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathWebhookService.java
More file actions
34 lines (29 loc) · 1.02 KB
/
WebhookService.java
File metadata and controls
34 lines (29 loc) · 1.02 KB
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
package com.signnow.library.services;
import com.signnow.library.SNClient;
import com.signnow.library.dto.Webhook;
import com.signnow.library.exceptions.SNException;
import com.signnow.library.facades.Webhooks;
import java.util.Collections;
import java.util.Map;
public class WebhookService extends ApiService implements Webhooks {
public WebhookService(SNClient client) {
super(client);
}
@Override
public void add(String event, String entityId, String callback, Map<String, String> headers) throws SNException {
client.post(
"/api/v2/events",
null,
new Webhook.CreateRequest(event, entityId, callback, headers),
String.class
);
}
@Override
public void delete(String eventSubscriptionId) throws SNException {
client.delete(
"/api/v2/events/{eventSubscriptionId}",
Collections.singletonMap("eventSubscriptionId", eventSubscriptionId),
String.class
);
}
}