diff --git a/README.md b/README.md index e5e44cd8..5de8d062 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,12 @@ Building the API client library requires: ## Installation +First, clone the repo, simply execute: + +```shell +git clone https://github.com/OneSignal/onesignal-java-api.git +``` + To install the API client library to your local Maven repository, simply execute: ```shell @@ -35,7 +41,7 @@ Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) f ### Maven users -Add this dependency to your project's POM: +After you build and install to your local Maven repo ou deploy to the project repository, add this dependency to your project's POM: ```xml @@ -81,11 +87,14 @@ Please follow the [installation](#installation) instruction and execute the foll ```java // Import classes: +import java.util.Arrays; import com.onesignal.client.ApiClient; import com.onesignal.client.ApiException; import com.onesignal.client.Configuration; import com.onesignal.client.auth.*; -import com.onesignal.client.models.*; +import com.onesignal.client.model.CreateNotificationSuccessResponse; +import com.onesignal.client.model.Notification; +import com.onesignal.client.model.StringMap; import com.onesignal.client.api.DefaultApi; public class Example { @@ -106,14 +115,14 @@ public class Example { return notification; } - public static void main(String[] args) { + public static void main(String[] args) throws ApiException { // Setting up the client ApiClient defaultClient = Configuration.getDefaultApiClient(); HttpBearerAuth appKey = (HttpBearerAuth) defaultClient.getAuthentication("app_key"); appKey.setBearerToken(appKeyToken); HttpBearerAuth userKey = (HttpBearerAuth) defaultClient.getAuthentication("user_key"); userKey.setBearerToken(userKeyToken); - api = new DefaultApi(defaultClient); + DefaultApi api = new DefaultApi(defaultClient); // Setting up the notification Notification notification = createNotification(); @@ -122,7 +131,7 @@ public class Example { CreateNotificationSuccessResponse response = api.createNotification(notification); // Checking the result - System.out.print(response.getId(); + System.out.print(response.getId()); } }