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 9ededb1

Browse files
Added DOCUMENTATION and updated travis file
1 parent 7ab26f8 commit 9ededb1

File tree

3 files changed

+324
-298
lines changed

3 files changed

+324
-298
lines changed

‎.travis.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ install:
44
- nuget restore MessageMediaWebhooks.sln
55
- nuget install NUnit.Runners -Version 3.2.1 -OutputDirectory testrunner
66
script:
7-
- xbuild /p:Configuration=Release MessageMediaWebhooks.sln
7+
- msbuild /t:restore /p:Configuration=Release MessageMediaWebhooks.sln
8+
- msbuild /p:Configuration=Release MessageMediaWebhooks.sln
89
- mono ./testrunner/NUnit.ConsoleRunner.3.2.1/tools/nunit3-console.exe ./MessageMediaWebhooks.Tests/bin/Release/MessageMediaWebhooks.Tests.dll

‎DOCUMENTATION.md‎

Lines changed: 304 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,304 @@
1+
# Getting started
2+
3+
TODO: Add a description
4+
5+
## How to Build
6+
7+
The generated code uses the Newtonsoft Json.NET NuGet Package. If the automatic NuGet package restore
8+
is enabled, these dependencies will be installed automatically. Therefore,
9+
you will need internet access for build.
10+
11+
1. Open the solution (MessageMediaWebhooks.sln) file.
12+
2. Invoke the build process using `Ctrl+Shift+B` shortcut key or using the `Build` menu as shown below.
13+
14+
![Building SDK using Visual Studio](https://apidocs.io/illustration/cs?step=buildSDK&workspaceFolder=MessageMediaWebhooks-CSharp&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks.Tests)
15+
16+
## How to Use
17+
18+
The build process generates a portable class library, which can be used like a normal class library. The generated library is compatible with Windows Forms, Windows RT, Windows Phone 8,
19+
Silverlight 5, Xamarin iOS, Xamarin Android and Mono. More information on how to use can be found at the [MSDN Portable Class Libraries documentation](http://msdn.microsoft.com/en-us/library/vstudio/gg597391%28v=vs.100%29.aspx).
20+
21+
The following section explains how to use the MessageMediaWebhooks library in a new console project.
22+
23+
### 1. Starting a new project
24+
25+
For starting a new project, right click on the current solution from the *solution explorer* and choose ``` Add -> New Project ```.
26+
27+
![Add a new project in the existing solution using Visual Studio](https://apidocs.io/illustration/cs?step=addProject&workspaceFolder=MessageMediaWebhooks-CSharp&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks.Tests)
28+
29+
Next, choose "Console Application", provide a ``` TestConsoleProject ``` as the project name and click ``` OK ```.
30+
31+
![Create a new console project using Visual Studio](https://apidocs.io/illustration/cs?step=createProject&workspaceFolder=MessageMediaWebhooks-CSharp&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks.Tests)
32+
33+
### 2. Set as startup project
34+
35+
The new console project is the entry point for the eventual execution. This requires us to set the ``` TestConsoleProject ``` as the start-up project. To do this, right-click on the ``` TestConsoleProject ``` and choose ``` Set as StartUp Project ``` form the context menu.
36+
37+
![Set the new cosole project as the start up project](https://apidocs.io/illustration/cs?step=setStartup&workspaceFolder=MessageMediaWebhooks-CSharp&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks.Tests)
38+
39+
### 3. Add reference of the library project
40+
41+
In order to use the MessageMediaWebhooks library in the new project, first we must add a projet reference to the ``` TestConsoleProject ```. First, right click on the ``` References ``` node in the *solution explorer* and click ``` Add Reference... ```.
42+
43+
![Open references of the TestConsoleProject](https://apidocs.io/illustration/cs?step=addReference&workspaceFolder=MessageMediaWebhooks-CSharp&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks.Tests)
44+
45+
Next, a window will be displayed where we must set the ``` checkbox ``` on ``` MessageMediaWebhooks.Tests ``` and click ``` OK ```. By doing this, we have added a reference of the ```MessageMediaWebhooks.Tests``` project into the new ``` TestConsoleProject ```.
46+
47+
![Add a reference to the TestConsoleProject](https://apidocs.io/illustration/cs?step=createReference&workspaceFolder=MessageMediaWebhooks-CSharp&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks.Tests)
48+
49+
### 4. Write sample code
50+
51+
Once the ``` TestConsoleProject ``` is created, a file named ``` Program.cs ``` will be visible in the *solution explorer* with an empty ``` Main ``` method. This is the entry point for the execution of the entire solution.
52+
Here, you can add code to initialize the client library and acquire the instance of a *Controller* class. Sample code to initialize the client library and using controller methods is given in the subsequent sections.
53+
54+
![Add a reference to the TestConsoleProject](https://apidocs.io/illustration/cs?step=addCode&workspaceFolder=MessageMediaWebhooks-CSharp&workspaceName=MessageMediaWebhooks&projectName=MessageMediaWebhooks.Tests)
55+
56+
## How to Test
57+
58+
The generated SDK also contain one or more Tests, which are contained in the Tests project.
59+
In order to invoke these test cases, you will need *NUnit 3.0 Test Adapter Extension for Visual Studio*.
60+
Once the SDK is complied, the test cases should appear in the Test Explorer window.
61+
Here, you can click *Run All* to execute these test cases.
62+
63+
## Initialization
64+
65+
### Authentication
66+
In order to setup authentication and initialization of the API client, you need the following information.
67+
68+
| Parameter | Description |
69+
|-----------|-------------|
70+
| basicAuthUserName | The username to use with basic authentication |
71+
| basicAuthPassword | The password to use with basic authentication |
72+
73+
74+
75+
API client can be initialized as following.
76+
77+
```csharp
78+
// Configuration parameters and credentials
79+
string basicAuthUserName = "basicAuthUserName"; // The username to use with basic authentication
80+
string basicAuthPassword = "basicAuthPassword"; // The password to use with basic authentication
81+
82+
MessageMediaWebhooksClient client = new MessageMediaWebhooksClient(basicAuthUserName, basicAuthPassword);
83+
```
84+
85+
86+
87+
# Class Reference
88+
89+
## <a name="list_of_controllers"></a>List of Controllers
90+
91+
* [APIController](#api_controller)
92+
93+
## <a name="api_controller"></a>![Class: ](https://apidocs.io/img/class.png "MessageMedia.Webhooks.Controllers.APIController") APIController
94+
95+
### Get singleton instance
96+
97+
The singleton instance of the ``` APIController ``` class can be accessed from the API Client.
98+
99+
```csharp
100+
IAPIController client = client.Client;
101+
```
102+
103+
### <a name="create"></a>![Method: ](https://apidocs.io/img/method.png "MessageMedia.Webhooks.Controllers.APIController.Create") Create
104+
105+
> This will create a webhook for the specified `events`
106+
> ### Parameters
107+
> **list of supported parameters in `template` according to the message type :**
108+
> you must escape the json for the template parameter. see example .
109+
> | Data | parameter name | DR| MO | MO MMS | Comment |
110+
> |:--|--|--|--|--|--|
111+
> | **service type** | $type| ``OK`` |`OK`| `OK`| |
112+
> | **Message ID** | $mtId, $messageId| `OK` |`OK`| `OK`| |
113+
> | **Delivery report ID** |$drId, $reportId | `OK` || | |
114+
> | **Reply ID**| $moId, $replyId| |`OK`| `OK`||
115+
> | **Account ID** | $accountId| `OK` |`OK`| `OK`||
116+
> | **Message Timestamp** | $submittedTimestamp| `OK` |`OK`| `OK`||
117+
> | **Provider Timestamp** | $receivedTimestamp| `OK` |`OK`| `OK`||
118+
> | **Message status** | $status| `OK` ||||
119+
> | **Status code** | $statusCode| `OK` ||||
120+
> | **External metadata** | $metadata.get('key')| `OK` |`OK`| `OK`||
121+
> | **Source address**| $sourceAddress| `OK` |`OK`| `OK`||
122+
> | **Destination address**| $destinationAddress| |`OK`| `OK`||
123+
> | **Message content**| $mtContent, $messageContent| `OK` |`OK`| `OK`||
124+
> | **Reply Content**| $moContent, $replyContent| |`OK`| `OK`||
125+
> | **Retry Count**| $retryCount| `OK` |`OK`| `OK`||
126+
> **list of allowed `events` :**
127+
> you can combine all the events whatever the message type.(at least one Event set otherwise the webhook won't be created)
128+
> + **events for SMS**
129+
> + `RECEIVED_SMS`
130+
> + `OPT_OUT_SMS`
131+
> + **events for MMS**
132+
> + `RECEIVED_MMS`
133+
> + **events for DR**
134+
> + `ENROUTE_DR`
135+
> + `EXPIRED_DR`
136+
> + `REJECTED_DR`
137+
> + `FAILED_DR`
138+
> + `DELIVERED_DR`
139+
> + `SUBMITTED_DR`
140+
> a **Response 400 is returned when** :
141+
> <ul>
142+
> <li>the `url` is not valid </li>
143+
> <li>the `events` is null/empty </li>
144+
> <li>the `encoding` is null </li>
145+
> <li>the `method` is null </li>
146+
> <li>the `headers` has a `ContentType` attribute </li>
147+
> </ul>
148+
149+
150+
```csharp
151+
Task<dynamic> Create(string contentType, Webhooks.Models.CreateRequest body)
152+
```
153+
154+
#### Parameters
155+
156+
| Parameter | Tags | Description |
157+
|-----------|------|-------------|
158+
| contentType | ``` Required ``` | TODO: Add a parameter description |
159+
| body | ``` Required ``` | TODO: Add a parameter description |
160+
161+
162+
#### Example Usage
163+
164+
```csharp
165+
string contentType = "Content-Type";
166+
var body = new Webhooks.Models.CreateRequest();
167+
168+
dynamic result = await client.Create(contentType, body);
169+
170+
```
171+
172+
#### Errors
173+
174+
| Error Code | Error Description |
175+
|------------|-------------------|
176+
| 400 | TODO: Add an error description |
177+
178+
179+
### <a name="delete_delete_and_update_webhook"></a>![Method: ](https://apidocs.io/img/method.png "MessageMedia.Webhooks.Controllers.APIController.DeleteDeleteAndUpdateWebhook") DeleteDeleteAndUpdateWebhook
180+
181+
> This will delete the webhook wuth the give id.
182+
> a **Response 404 is returned when** :
183+
> <ul>
184+
> <li>there is no webhook with this `webhookId` </li>
185+
> </ul>
186+
187+
188+
```csharp
189+
Task DeleteDeleteAndUpdateWebhook(Guid webhookId)
190+
```
191+
192+
#### Parameters
193+
194+
| Parameter | Tags | Description |
195+
|-----------|------|-------------|
196+
| webhookId | ``` Required ``` | TODO: Add a parameter description |
197+
198+
199+
#### Example Usage
200+
201+
```csharp
202+
Guid webhookId = a7f11bb0-f299-4861-a5ca-9b29d04bc5ad;
203+
204+
await client.DeleteDeleteAndUpdateWebhook(webhookId);
205+
206+
```
207+
208+
#### Errors
209+
210+
| Error Code | Error Description |
211+
|------------|-------------------|
212+
| 404 | TODO: Add an error description |
213+
214+
215+
### <a name="retrieve"></a>![Method: ](https://apidocs.io/img/method.png "MessageMedia.Webhooks.Controllers.APIController.Retrieve") Retrieve
216+
217+
> This will retrieve all webhooks for the account we're connected with.
218+
> a **Response 400 is returned when** :
219+
> <ul>
220+
> <li>the `page` query parameter is not valid </li>
221+
> <li>the `pageSize` query parameter is not valid </li>
222+
> </ul>
223+
224+
225+
```csharp
226+
Task<Webhooks.Models.RetrieveResponse> Retrieve(int? page = null, int? pageSize = null)
227+
```
228+
229+
#### Parameters
230+
231+
| Parameter | Tags | Description |
232+
|-----------|------|-------------|
233+
| page | ``` Optional ``` | TODO: Add a parameter description |
234+
| pageSize | ``` Optional ``` | TODO: Add a parameter description |
235+
236+
237+
#### Example Usage
238+
239+
```csharp
240+
int? page = '1';
241+
int? pageSize = '10';
242+
243+
Webhooks.Models.RetrieveResponse result = await client.Retrieve(page, pageSize);
244+
245+
```
246+
247+
#### Errors
248+
249+
| Error Code | Error Description |
250+
|------------|-------------------|
251+
| 400 | TODO: Add an error description |
252+
253+
254+
### <a name="update"></a>![Method: ](https://apidocs.io/img/method.png "MessageMedia.Webhooks.Controllers.APIController.Update") Update
255+
256+
> This will update a webhook and returned the updated Webhook.
257+
> you can update all the attributes individually or together.
258+
> PS : the new value will override the previous one.
259+
> ### Parameters
260+
> + same parameters rules as create webhook apply
261+
> a **Response 404 is returned when** :
262+
> <ul>
263+
> <li>there is no webhook with this `webhookId` </li>
264+
> </ul>
265+
> a **Response 400 is returned when** :
266+
> <ul>
267+
> <li>all attributes are null </li>
268+
> <li>events array is empty </li>
269+
> <li>content-Type is set in the headers instead of using the `encoding` attribute </li>
270+
> </ul>
271+
272+
273+
```csharp
274+
Task Update(Guid webhookId, string contentType, Webhooks.Models.UpdateRequest body)
275+
```
276+
277+
#### Parameters
278+
279+
| Parameter | Tags | Description |
280+
|-----------|------|-------------|
281+
| webhookId | ``` Required ``` | TODO: Add a parameter description |
282+
| contentType | ``` Required ``` | TODO: Add a parameter description |
283+
| body | ``` Required ``` | TODO: Add a parameter description |
284+
285+
286+
#### Example Usage
287+
288+
```csharp
289+
Guid webhookId = Guid.NewGuid();
290+
string contentType = "Content-Type";
291+
var body = new Webhooks.Models.UpdateRequest();
292+
293+
await client.Update(webhookId, contentType, body);
294+
295+
```
296+
297+
#### Errors
298+
299+
| Error Code | Error Description |
300+
|------------|-------------------|
301+
| 404 | TODO: Add an error description |
302+
303+
304+
[Back to List of Controllers](#list_of_controllers)

0 commit comments

Comments
(0)

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