Skip to content

Commit c8a5551

Browse files
Testing Ascii Doc
1 parent 446925e commit c8a5551

File tree

21 files changed

+273
-32
lines changed

21 files changed

+273
-32
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
= Restcomm Java Sdk
2+
3+
4+
5+
6+
7+
8+

restcomm-connect.java.sdk/src/main/asciidoc/index.adoc

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,95 @@ This Documentation provides the basic information on the usage of this SDK in pe
66

77
==== Table Of Contents
88

9+
910
* Getting Started
1011
* Accounts
1112
* Applications
13+
14+
===== Getting Started
15+
16+
Initializing the Restcomm Client with the Authentication and URL required
17+
18+
---------------------------------------------------------------------------------
19+
Restcomm.COMMON_URL = "http://localhost:8080/";
20+
Restcomm.init("username", "password");
21+
----------------------------------------------------------------------------------
22+
Incase you need to reset it,just use the '_invalidate()_' method available and initialize it again.
23+
24+
----------------------------------------------------------------------------------
25+
Restcomm.invalidate();
26+
Restcomm.COMMON_URL = "http://localhost:8080/";
27+
Restcomm.init("username", "password");
28+
----------------------------------------------------------------------------------
29+
30+
===== Accounts
31+
32+
===== MainAccount
33+
34+
Fetching the default Account with which we authenticated the Restcomm Client
35+
36+
---------------------------------------------------------------------------------
37+
Account mainAccount = Account.getAccount();
38+
----------------------------------------------------------------------------------
39+
The fields of the Account object can be obtained by invoking the respective '_get()_' method of that field
40+
----------------------------------------------------------------------------------
41+
String Sid,FriendlyName,EmailAddress;
42+
Sid = mainAccount.getSid();
43+
FriendlyName = mainAccount.getFriendly_name();
44+
EmailAddress = mainAccount.getEmail_address();
45+
----------------------------------------------------------------------------------
46+
For Modifying any field(s) of the Account, use the '_modifyAccountDetails()_' method
47+
----------------------------------------------------------------------------------
48+
mainAccount.modifyAccountDetails().newEmail("[email protected]").modify();
49+
----------------------------------------------------------------------------------
50+
In a similar way you can even modify multiple fields as shown below
51+
----------------------------------------------------------------------------------
52+
mainAccount.modifyAccountDetails().newEmail("[email protected]").newPassword("12345abcd").newStatus("suspended").modify();
53+
----------------------------------------------------------------------------------
54+
===== *Note:*
55+
* After modifying an Account,if we require the Account Object for further operations, we need to update the Object representing that Account too,
56+
57+
-------------------------------------------------------------------------------------------------------------------------------------------
58+
mainAccount = mainAccount.modifyAccountDetails().newEmail("[email protected]").newPassword("12345abcd").newStatus("suspended").modify();
59+
-------------------------------------------------------------------------------------------------------------------------------------------
60+
Creating a SubAccount under our MainAccount
61+
----
62+
Account.createSubAccount().FriendlyName("Paul").Password("restcomm1007").Role("Administrator").create();
63+
----
64+
To Capture the SubAccount created,
65+
----
66+
SubAccount SpareAccount = Account.createSubAccount().FriendlyName("Paul").Password("restcomm1007").Role("Administrator").create();
67+
----
68+
Fetching the List of SubAccounts under our Main Account
69+
----
70+
SubAccountList List = Account.getSubAccountList();
71+
SubAccount a = List.get(0);
72+
SubAccount b = List.get(1);
73+
......
74+
....
75+
----
76+
===== SubAccount
77+
78+
79+
Fetching a SubAccount with a given 'Sid', available under our MainAccount
80+
----
81+
SubAccount spareAccount = SubAccount.getSubAccount(Sid); //Sid is the actual Sid of the SubAccount we wish to fetch
82+
----
83+
The fields of the SubAccount object can be obtained by invoking the respective '_get()_' method of that field similar to that Of Accounts
84+
----------------------------------------------------------------------------------
85+
String FriendlyName;
86+
FriendlyName = spareAccount.getFriendly_name();
87+
----------------------------------------------------------------------------------
88+
89+
Modifying the SubAccount in a similar way as mentioned above
90+
----
91+
spareAccount = spareAccount.modifySubAccount().........modify();
92+
(Or)
93+
spareAccount = SubAccount.modifySubAccount(Sid).........modify(); //Sid is the actual Sid of the SubAccount we wish to modify
94+
----
95+
Deleting a SubAccount
96+
----
97+
spareAccount.delete();
98+
(Or)
99+
SubAccount.deleteSubAccount(Sid); //Sid is the Sid of the SubAccoun to be deleted
100+
----

restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/Accounts/Account.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public static AccountUpdater modifyDefaultAccount()
5454
{
5555
return new AccountUpdater(BASE_URL);
5656
}
57-
public SubAccountList getSubAccountList()
57+
/*public SubAccountList getSubAccountList()
5858
{
5959
return new SubAccountList(BASE_URL);
60-
}
61-
public static SubAccountList SubAccountList()
60+
}*/
61+
public static SubAccountList getSubAccountList()
6262
{
6363
return new SubAccountList(BASE_URL);
6464
}

restcomm-connect.java.sdk/src/main/java/org/restcomm/connect/java/sdk/Accounts/SubAccountUpdater.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public SubAccountUpdater newFriendlyName(String value)
6767
request.addPostParameters("FriendlyName", value);
6868
return this;
6969
}
70-
public SubAccount update()
70+
public SubAccount modify()
7171
{
7272
Restcomm.sendRequest(request);
7373
return (SubAccount)Utilities.AccountObject(Restcomm.getJSONResponse());

restcomm-connect.java.sdk/src/test/java/org/restcomm/connect/java/sdk/Accounts/SubAccountTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void testUpdateSubAccount() throws Exception {
8181
.withHeader("Content-Type", "application/json")
8282
.withBody(readFile(Path+"UpdateSubAccount.txt"))));
8383

84-
b=b.modifySubAccountDetails().newFriendlyName("Lion").update();
84+
b=b.modifySubAccountDetails().newFriendlyName("Lion").modify();
8585

8686
WireMock.verify(WireMock.putRequestedFor(WireMock.urlEqualTo("/Accounts.json/"+SubAccountSid)));
8787
assertEquals("Lion",b.getFriendly_name());
@@ -116,7 +116,7 @@ public void testGetSubAccountList() throws Exception{
116116
.withHeader("Content-Type", "application/json")
117117
.withBody(readFile(Path+"GetList.txt"))));
118118

119-
SubAccountList a = Account.SubAccountList();
119+
SubAccountList a = Account.getSubAccountList();
120120

121121
WireMock.verify(WireMock.getRequestedFor(WireMock.urlEqualTo("/Accounts.json/")));
122122
assertEquals(200, Restcomm.getStatusCode());

restcomm-connect.java.sdk/src/test/java/org/restcomm/connect/java/sdk/BasicTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class BasicTest {
3535
@BeforeClass
3636
public static void runOnceBeforeClass() {
3737

38-
Restcomm.COMMON_URL = "http://localhost:8080/";
38+
Restcomm.setCommonUrl("http://localhost:8080/");
3939
Restcomm.init("AC13b4372c92ed5c07d951cf842e2664ff", "cb0936cfee986d3e3ec6d1d77cc57888");
4040
//System.out.println("@BeforeClass - runOnceBeforeClass");
4141
}

restcomm-connect.java.sdk/target/classes/META-INF/maven/org.restcomm/restcomm-connect.java.sdk/pom.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Generated by Maven Integration for Eclipse
2-
#Mon Jun 19 16:04:03 IST 2017
2+
#Mon Jun 19 18:28:19 IST 2017
33
version=0.0.1-SNAPSHOT
44
groupId=org.restcomm
55
m2e.projectName=restcomm-connect.java.sdk
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<meta name="generator" content="Asciidoctor 1.5.3">
8+
<title>Restcomm Java Sdk</title>
9+
<link rel="stylesheet" href="./css/stylesheet.css">
10+
</head>
11+
<body class="article">
12+
<div id="header">
13+
<h1>Restcomm Java Sdk</h1>
14+
</div>
15+
<div id="content">
16+
17+
</div>
18+
<div id="footer">
19+
<div id="footer-text">
20+
Last updated 2017-06-19 18:28:19 +05:30
21+
</div>
22+
</div>
23+
</body>
24+
</html>

0 commit comments

Comments
 (0)