File tree Expand file tree Collapse file tree 2 files changed +51
-0
lines changed
Expand file tree Collapse file tree 2 files changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ ```
2+ TwilioApiClient client = new TwilioApiClient();
3+ client.addUrlPart('Accounts');
4+ client.addUrlPart('AC91c6dc4cca313b7a23b1b36b4a37e89c');
5+ client.addUrlPart('Messages');
6+ client.addUrlPart('.json');
7+
8+
9+ TwilioApiClientResponse response = client.doGet();
10+
11+ //Get Pagination Next URL
12+ String nextPage = response.getTwilioJsonParser().get('next_page_uri').getString();
13+ client.setNextUrl(nextPage);
14+
15+ //Validate that the url wasn't null
16+ if(client.hasNextPage()){
17+
18+ //Call get Next
19+ response = client.doGetNext();
20+
21+ //Get Pagination Previous URL
22+ String previousPage = response.getTwilioJsonParser().get('previous_page_uri').getString();
23+ client.setPreviousUrl(previousPage);
24+
25+ //Validate url wasn't null
26+ if(client.hasPreviousPage()){
27+ //Call get Previous
28+ response = client.doGetPrevious();
29+ system.debug(response.getTwilioJsonParser().get('uri').getString());
30+ }
31+ }
32+ ```
Original file line number Diff line number Diff line change 1+ ```
2+ //Post Example
3+ TwilioApiClient api = new TwilioApiClient();
4+ api.addUrlPart('Accounts');
5+ api.addUrlPart('AC91c6dc4cca313b7a23b1b36b4a37e89c');
6+ api.addUrlPart('Messages.json');
7+
8+ api.addParam('To','7152520504');
9+ api.addParam('From','7159727069');
10+ api.addParam('Body','Here is my message');
11+ TwilioApiClientResponse response = api.doPost();
12+
13+ //Example with key value pairs
14+ String sid = response.getTwilioJsonParser().get('sid').getString();
15+ Integer totalSegments = response.getTwilioJsonParser().get('num_segments').getInteger();
16+
17+ //Example a key with object
18+ String media = response.getTwilioJsonParser().get('subresource_uris').get('media').getString();
19+ ```
You can’t perform that action at this time.
0 commit comments