Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c9a4cdf

Browse files
Updated DOCUMENTATION and README
1 parent 47fa583 commit c9a4cdf

File tree

2 files changed

+391
-366
lines changed

2 files changed

+391
-366
lines changed

‎DOCUMENTATION.md

Lines changed: 373 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,373 @@
1+
# Getting started
2+
3+
TODO: Add a description
4+
5+
## How to Build
6+
7+
The generated code uses a few Maven dependencies e.g., Jackson, UniRest,
8+
and Apache HttpClient. The reference to these dependencies is already
9+
added in the pom.xml file will be installed automatically. Therefore,
10+
you will need internet access for a successful build.
11+
12+
* In order to open the client library in Eclipse click on ``` File -> Import ```.
13+
14+
![Importing SDK into Eclipse - Step 1](https://apidocs.io/illustration/java?step=import0&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
15+
16+
* In the import dialog, select ``` Existing Java Project ``` and click ``` Next ```.
17+
18+
![Importing SDK into Eclipse - Step 2](https://apidocs.io/illustration/java?step=import1&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
19+
20+
* Browse to locate the folder containing the source code. Select the detected location of the project and click ``` Finish ```.
21+
22+
![Importing SDK into Eclipse - Step 3](https://apidocs.io/illustration/java?step=import2&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
23+
24+
* Upon successful import, the project will be automatically built by Eclipse after automatically resolving the dependencies.
25+
26+
![Importing SDK into Eclipse - Step 4](https://apidocs.io/illustration/java?step=import3&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
27+
28+
## How to Use
29+
30+
The following section explains how to use the MessageMediaWebhooks library in a new console project.
31+
32+
### 1. Starting a new project
33+
34+
For starting a new project, click the menu command ``` File > New > Project ```.
35+
36+
![Add a new project in Eclipse](https://apidocs.io/illustration/java?step=createNewProject0&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
37+
38+
Next, choose ``` Maven > Maven Project ```and click ``` Next ```.
39+
40+
![Create a new Maven Project - Step 1](https://apidocs.io/illustration/java?step=createNewProject1&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
41+
42+
Here, make sure to use the current workspace by choosing ``` Use default Workspace location ```, as shown in the picture below and click ``` Next ```.
43+
44+
![Create a new Maven Project - Step 2](https://apidocs.io/illustration/java?step=createNewProject2&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
45+
46+
Following this, select the *quick start* project type to create a simple project with an existing class and a ``` main ``` method. To do this, choose ``` maven-archetype-quickstart ``` item from the list and click ``` Next ```.
47+
48+
![Create a new Maven Project - Step 3](https://apidocs.io/illustration/java?step=createNewProject3&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
49+
50+
In the last step, provide a ``` Group Id ``` and ``` Artifact Id ``` as shown in the picture below and click ``` Finish ```.
51+
52+
![Create a new Maven Project - Step 4](https://apidocs.io/illustration/java?step=createNewProject4&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
53+
54+
### 2. Add reference of the library project
55+
56+
The created Maven project manages its dependencies using its ``` pom.xml ``` file. In order to add a dependency on the *MessageMediaWebhooks* client library, double click on the ``` pom.xml ``` file in the ``` Package Explorer ```. Opening the ``` pom.xml ``` file will render a graphical view on the cavas. Here, switch to the ``` Dependencies ``` tab and click the ``` Add ``` button as shown in the picture below.
57+
58+
![Adding dependency to the client library - Step 1](https://apidocs.io/illustration/java?step=testProject0&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
59+
60+
Clicking the ``` Add ``` button will open a dialog where you need to specify MessageMediaWebhooks in ``` Group Id ``` and MessageMediaWebhooks in the ``` Artifact Id ``` fields. Once added click ``` OK ```. Save the ``` pom.xml ``` file.
61+
62+
![Adding dependency to the client library - Step 2](https://apidocs.io/illustration/java?step=testProject1&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
63+
64+
### 3. Write sample code
65+
66+
Once the ``` SimpleConsoleApp ``` is created, a file named ``` App.java ``` will be visible in the *Package Explorer* with a ``` main ``` method. This is the entry point for the execution of the created project.
67+
Here, you can add code to initialize the client library and instantiate a *Controller* class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.
68+
69+
![Adding dependency to the client library - Step 2](https://apidocs.io/illustration/java?step=testProject2&workspaceFolder=MessageMediaWebhooks-Java&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks&rootNamespace=com.messagemedia.webhooks)
70+
71+
## How to Test
72+
73+
The generated code and the server can be tested using automatically generated test cases.
74+
JUnit is used as the testing framework and test runner.
75+
76+
In Eclipse, for running the tests do the following:
77+
78+
1. Select the project *MessageMediaWebhooks* from the package explorer.
79+
2. Select "Run -> Run as -> JUnit Test" or use "Alt + Shift + X" followed by "T" to run the Tests.
80+
81+
## Initialization
82+
83+
### Authentication
84+
In order to setup authentication and initialization of the API client, you need the following information.
85+
86+
| Parameter | Description |
87+
|-----------|-------------|
88+
| basicAuthUserName | The username to use with basic authentication |
89+
| basicAuthPassword | The password to use with basic authentication |
90+
91+
92+
93+
API client can be initialized as following.
94+
95+
```java
96+
// Configuration parameters and credentials
97+
String basicAuthUserName = "basicAuthUserName"; // The username to use with basic authentication
98+
String basicAuthPassword = "basicAuthPassword"; // The password to use with basic authentication
99+
100+
MessageMediaWebhooksClient client = new MessageMediaWebhooksClient(basicAuthUserName, basicAuthPassword);
101+
```
102+
103+
104+
# Class Reference
105+
106+
## <a name="list_of_controllers"></a>List of Controllers
107+
108+
* [APIController](#api_controller)
109+
110+
## <a name="api_controller"></a>![Class: ](https://apidocs.io/img/class.png "com.messagemedia.webhooks.controllers.APIController") APIController
111+
112+
### Get singleton instance
113+
114+
The singleton instance of the ``` APIController ``` class can be accessed from the API Client.
115+
116+
```java
117+
APIController client = client.getClient();
118+
```
119+
120+
### <a name="create_async"></a>![Method: ](https://apidocs.io/img/method.png "com.messagemedia.webhooks.controllers.APIController.createAsync") createAsync
121+
122+
> This will create a webhook for the specified `events`
123+
> ### Parameters
124+
> **list of supported parameters in `template` according to the message type :**
125+
> you must escape the json for the template parameter. see example .
126+
> | Data | parameter name | DR| MO | MO MMS | Comment |
127+
> |:--|--|--|--|--|--|
128+
> | **service type** | $type| ``OK`` |`OK`| `OK`| |
129+
> | **Message ID** | $mtId, $messageId| `OK` |`OK`| `OK`| |
130+
> | **Delivery report ID** |$drId, $reportId | `OK` || | |
131+
> | **Reply ID**| $moId, $replyId| |`OK`| `OK`||
132+
> | **Account ID** | $accountId| `OK` |`OK`| `OK`||
133+
> | **Message Timestamp** | $submittedTimestamp| `OK` |`OK`| `OK`||
134+
> | **Provider Timestamp** | $receivedTimestamp| `OK` |`OK`| `OK`||
135+
> | **Message status** | $status| `OK` ||||
136+
> | **Status code** | $statusCode| `OK` ||||
137+
> | **External metadata** | $metadata.get('key')| `OK` |`OK`| `OK`||
138+
> | **Source address**| $sourceAddress| `OK` |`OK`| `OK`||
139+
> | **Destination address**| $destinationAddress| |`OK`| `OK`||
140+
> | **Message content**| $mtContent, $messageContent| `OK` |`OK`| `OK`||
141+
> | **Reply Content**| $moContent, $replyContent| |`OK`| `OK`||
142+
> | **Retry Count**| $retryCount| `OK` |`OK`| `OK`||
143+
> **list of allowed `events` :**
144+
> you can combine all the events whatever the message type.(at least one Event set otherwise the webhook won't be created)
145+
> + **events for SMS**
146+
> + `RECEIVED_SMS`
147+
> + `OPT_OUT_SMS`
148+
> + **events for MMS**
149+
> + `RECEIVED_MMS`
150+
> + **events for DR**
151+
> + `ENROUTE_DR`
152+
> + `EXPIRED_DR`
153+
> + `REJECTED_DR`
154+
> + `FAILED_DR`
155+
> + `DELIVERED_DR`
156+
> + `SUBMITTED_DR`
157+
> a **Response 400 is returned when** :
158+
> <ul>
159+
> <li>the `url` is not valid </li>
160+
> <li>the `events` is null/empty </li>
161+
> <li>the `encoding` is null </li>
162+
> <li>the `method` is null </li>
163+
> <li>the `headers` has a `ContentType` attribute </li>
164+
> </ul>
165+
166+
167+
```java
168+
void createAsync(
169+
final String contentType,
170+
final CreateRequest body,
171+
final APICallBack<DynamicResponse> callBack)
172+
```
173+
174+
#### Parameters
175+
176+
| Parameter | Tags | Description |
177+
|-----------|------|-------------|
178+
| contentType | ``` Required ``` | TODO: Add a parameter description |
179+
| body | ``` Required ``` | TODO: Add a parameter description |
180+
181+
182+
#### Example Usage
183+
184+
```java
185+
try {
186+
String contentType = "Content-Type";
187+
CreateRequest body = new CreateRequest();
188+
// Invoking the API call with sample inputs
189+
client.createAsync(contentType, body, new APICallBack<DynamicResponse>() {
190+
public void onSuccess(HttpContext context, DynamicResponse response) {
191+
// TODO success callback handler
192+
}
193+
public void onFailure(HttpContext context, Throwable error) {
194+
// TODO failure callback handler
195+
}
196+
});
197+
} catch(JsonProcessingException e) {
198+
// TODO Auto-generated catch block
199+
e.printStackTrace();
200+
}
201+
```
202+
203+
#### Errors
204+
205+
| Error Code | Error Description |
206+
|------------|-------------------|
207+
| 400 | TODO: Add an error description |
208+
209+
210+
211+
### <a name="delete_delete_and_update_webhook_async"></a>![Method: ](https://apidocs.io/img/method.png "com.messagemedia.webhooks.controllers.APIController.deleteDeleteAndUpdateWebhookAsync") deleteDeleteAndUpdateWebhookAsync
212+
213+
> This will delete the webhook wuth the give id.
214+
> a **Response 404 is returned when** :
215+
> <ul>
216+
> <li>there is no webhook with this `webhookId` </li>
217+
> </ul>
218+
219+
220+
```java
221+
void deleteDeleteAndUpdateWebhookAsync(
222+
final UUID webhookId,
223+
final APICallBack<Object> callBack)
224+
```
225+
226+
#### Parameters
227+
228+
| Parameter | Tags | Description |
229+
|-----------|------|-------------|
230+
| webhookId | ``` Required ``` | TODO: Add a parameter description |
231+
232+
233+
#### Example Usage
234+
235+
```java
236+
UUID webhookId = a7f11bb0-f299-4861-a5ca-9b29d04bc5ad;
237+
// Invoking the API call with sample inputs
238+
client.deleteDeleteAndUpdateWebhookAsync(webhookId, new APICallBack<void>() {
239+
public void onSuccess(HttpContext context, void response) {
240+
// TODO success callback handler
241+
}
242+
public void onFailure(HttpContext context, Throwable error) {
243+
// TODO failure callback handler
244+
}
245+
});
246+
247+
```
248+
249+
#### Errors
250+
251+
| Error Code | Error Description |
252+
|------------|-------------------|
253+
| 404 | TODO: Add an error description |
254+
255+
256+
257+
### <a name="retrieve_async"></a>![Method: ](https://apidocs.io/img/method.png "com.messagemedia.webhooks.controllers.APIController.retrieveAsync") retrieveAsync
258+
259+
> This will retrieve all webhooks for the account we're connected with.
260+
> a **Response 400 is returned when** :
261+
> <ul>
262+
> <li>the `page` query parameter is not valid </li>
263+
> <li>the `pageSize` query parameter is not valid </li>
264+
> </ul>
265+
266+
267+
```java
268+
void retrieveAsync(
269+
final Integer page,
270+
final Integer pageSize,
271+
final APICallBack<RetrieveResponse> callBack)
272+
```
273+
274+
#### Parameters
275+
276+
| Parameter | Tags | Description |
277+
|-----------|------|-------------|
278+
| page | ``` Optional ``` | TODO: Add a parameter description |
279+
| pageSize | ``` Optional ``` | TODO: Add a parameter description |
280+
281+
282+
#### Example Usage
283+
284+
```java
285+
Integer page = '1';
286+
Integer pageSize = '10';
287+
// Invoking the API call with sample inputs
288+
client.retrieveAsync(page, pageSize, new APICallBack<RetrieveResponse>() {
289+
public void onSuccess(HttpContext context, RetrieveResponse response) {
290+
// TODO success callback handler
291+
}
292+
public void onFailure(HttpContext context, Throwable error) {
293+
// TODO failure callback handler
294+
}
295+
});
296+
297+
```
298+
299+
#### Errors
300+
301+
| Error Code | Error Description |
302+
|------------|-------------------|
303+
| 400 | TODO: Add an error description |
304+
305+
306+
307+
### <a name="update_async"></a>![Method: ](https://apidocs.io/img/method.png "com.messagemedia.webhooks.controllers.APIController.updateAsync") updateAsync
308+
309+
> This will update a webhook and returned the updated Webhook.
310+
> you can update all the attributes individually or together.
311+
> PS : the new value will override the previous one.
312+
> ### Parameters
313+
> + same parameters rules as create webhook apply
314+
> a **Response 404 is returned when** :
315+
> <ul>
316+
> <li>there is no webhook with this `webhookId` </li>
317+
> </ul>
318+
> a **Response 400 is returned when** :
319+
> <ul>
320+
> <li>all attributes are null </li>
321+
> <li>events array is empty </li>
322+
> <li>content-Type is set in the headers instead of using the `encoding` attribute </li>
323+
> </ul>
324+
325+
326+
```java
327+
void updateAsync(
328+
final UUID webhookId,
329+
final String contentType,
330+
final UpdateRequest body,
331+
final APICallBack<Object> callBack)
332+
```
333+
334+
#### Parameters
335+
336+
| Parameter | Tags | Description |
337+
|-----------|------|-------------|
338+
| webhookId | ``` Required ``` | TODO: Add a parameter description |
339+
| contentType | ``` Required ``` | TODO: Add a parameter description |
340+
| body | ``` Required ``` | TODO: Add a parameter description |
341+
342+
343+
#### Example Usage
344+
345+
```java
346+
try {
347+
UUID webhookId = UUID.randomUUID();
348+
String contentType = "Content-Type";
349+
UpdateRequest body = new UpdateRequest();
350+
// Invoking the API call with sample inputs
351+
client.updateAsync(webhookId, contentType, body, new APICallBack<void>() {
352+
public void onSuccess(HttpContext context, void response) {
353+
// TODO success callback handler
354+
}
355+
public void onFailure(HttpContext context, Throwable error) {
356+
// TODO failure callback handler
357+
}
358+
});
359+
} catch(JsonProcessingException e) {
360+
// TODO Auto-generated catch block
361+
e.printStackTrace();
362+
}
363+
```
364+
365+
#### Errors
366+
367+
| Error Code | Error Description |
368+
|------------|-------------------|
369+
| 404 | TODO: Add an error description |
370+
371+
372+
373+
[Back to List of Controllers](#list_of_controllers)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /