repositories {
jcenter()
}
dependencies {
compile 'com.ringcentral:ringcentral:0.2.4'
}
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
<dependency>
<groupId>com.ringcentral</groupId>
<artifactId>ringcentral</artifactId>
<version>0.2.4</version>
<type>pom</type>
</dependency>
RestClient restClient = new RestClient(appKey, appSecret, server);
restClient.authorize(username, extension, password);
The following code snippets are equivalent, you can choose whichever based on your preferences:
String endpoint = "/restapi/v1.0/account/~/extension/~/sms";
String endpoint = restClient.restApi("v1.0").account("~").extension("~").sms().endpoint();
String endpoint = restClient.restApi().account().extension().sms().endpoint();
The following code snippets are also equivalent, you can choose whichever based on your preferences:
MessageInfo messageInfo = restClient.post("/restapi/v1.0/account/~/extension/~/sms", postParameters, MessageInfo.class);
MessageInfo messageInfo = restClient.post(restClient.restApi("v1.0").account("~").extension("~").sms().endpoint(), postParameters, MessageInfo.class);
MessageInfo messageInfo = restClient.post(restClient.restApi().account().extension().sms().endpoint(), postParameters, MessageInfo.class);
MessageInfo messageInfo = restClient.restApi("v1.0").account("~").extension("~").sms().post(postParameters, MessageInfo.class);
MessageInfo messageInfo = restClient.restApi().account().extension().sms().post(postParameters, MessageInfo.class);
Both are OK:
ResponseBody responseBody = restClient.restApi().account().extension().sms().post(postParameters);
String stringBody = responseBody.string();
MessageInfo messageInfo = restClient.restApi().account().extension().sms().post(postParameters, MessageInfo.class);
Subscription subscription = restClient.subscription(
new String[]{
"/restapi/v1.0/glip/posts",
"/restapi/v1.0/account/~/extension/~/message-store",
// more event filters here
},
(message) -> {
// do something with message
});
subscription.subscribe();
You can simply start a new thread.
Please check the test cases.
cp src/test/resources/.env.sample src/test/resources/.env
edit src/test/resources/.env
./gradlew test
All the files inside src/main/java/com/ringcentral/definitions/
and src/main/java/com/ringcentral/paths/
are auto-generated.
Please refer to rc-codegen project.
The generated code is formatted by IntelliJ IDEA.
Update version numbers in build.gradle
.
./gradlew -PbintrayUser=bintrayUser -PbintrayApiKey=bintrayApiKey bintrayUpload
- Rewrite in Kotlin - optional, low priority