Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContactsMethodsExample.java
More file actions
Latest commit
44 lines (35 loc) · 1.45 KB
/
Copy pathContactsMethodsExample.java
File metadata and controls
44 lines (35 loc) · 1.45 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
35
36
37
38
39
40
41
42
43
44
packagecom.greenapi.client.examples;
importcom.greenapi.client.pkg.api.GreenApi;
importcom.greenapi.client.pkg.models.request.AddContactReq;
importcom.greenapi.client.pkg.models.request.EditContactReq;
importcom.greenapi.client.pkg.models.request.DeleteContactReq;
importcom.greenapi.client.pkg.models.response.AddContactResp;
importcom.greenapi.client.pkg.models.response.EditContactResp;
importcom.greenapi.client.pkg.models.response.DeleteContactResp;
importlombok.extern.log4j.Log4j2;
importjava.util.ArrayList;
@Log4j2
classContactsMethodsExample {
privatevoidaddContact(GreenApigreenApi) {
varaddContactReq = AddContactReq.builder()
.chatId("11001234567@c.us")
.firstName("John")
.lastName("Doe")
.build();
varaddContactResp = greenApi.contacts.addContact(addContactReq).getBody();
}
privatevoideditContact(GreenApigreenApi) {
vareditContactReq = EditContactReq.builder()
.chatId("11001234567@c.us")
.firstName("Jane")
.lastName("Smith")
.build();
vareditContactResp = greenApi.contacts.editContact(editContactReq).getBody();
}
privatevoiddeleteContact(GreenApigreenApi) {
vardeleteContactReq = DeleteContactReq.builder()
.chatId("11001234567@c.us")
.build();
vardeleteContactResp = greenApi.contacts.deleteContact(deleteContactReq).getBody();
}
}