VOTO JAVA SDK


Source link: https://github.com/eyedol/voto-java-sdk

VOTO JAVA SDK

VOTO Java SDK is a wrapper around the VOTO API to make it very easy to use. The goal of this SDK is to ease VOTO API integration into both Android and Java applications.

It comes with three independent modules:

  • Synchronous module; Access the API synchronously
  • Asynchronous module; Access the API asynchronously
  • RxJava module; Access the API using RxJava

Note: These are not official libraries from the VOTO team.

### Setup Add gradle dependency:

Add jcenter repostory:

repositories {

  jcenter() 
}

Synchronous module:

dependencies {

  compile 'com.addhen:voto-sdk-sync:0.3.0' 
}

Asynchronous module:

dependencies {

  compile 'com.addhen:voto-sdk-async:0.3.0' 
}

RxJava module:

dependencies {

  compile 'com.addhen:voto-sdk-rxjava:0.3.0' 
}

Usage

GET Data From VOTO API

Build API Client
  • Synchronous:
SyncVotoApiClient syncVotoApilient = new SyncVotoApiClient.Builder(<api_key>)  .withLogLevel(HttpLoggingInterceptor.Level.BODY)  .build();
  • Asynchronous:
AsyncVotoApiClient asyncVotoClient = new AsyncVotoApiClient.Builder(<api_key>)  .withLogLevel(HttpLoggingInterceptor.Level.BODY)  .build();
  • RxJava:
RxJavaVotoApiClient rxVotoClient = new RxJavaVotoApiClient.Builder(<api_key>)  .withLogLevel(HttpLoggingInterceptor.Level.BODY)  .build();
Execute API Request
  • Synchronous:
SyncVotoApiClient syncVotoApiClient = new SyncVotoApiClient.Builder("api_key")  .withLogLevel(HttpLoggingInterceptor.Level.BODY)  .build();

ListSubscribersResponse listSubscribersResponse = null; try {

  listSubscribersResponse = syncVotoApiClient.listSubscribers(10);
 
}
 catch (IOException e) {

  e.printStackTrace();
 
}
  System.out.println(listSubscribersResponse);
  • Asynchronous:
AsyncVotoApiClient asyncVotoApiClient = new AsyncVotoApiClient.Builder("api_key")  .withLogLevel(HttpLoggingInterceptor.Level.BODY)  .build();

asyncVotoApiClient.listSubscribers(10, new Callback<ListSubscribersResponse>() {
  @Override
  public void onResponse(Call<ListSubscribersResponse> call, Response<ListSubscribersResponse> response) {

  ListSubscribersResponse listSubscribersResponse = response.body();

System.out.println(listSubscribersResponse);

  
}

@Override
  public void onFailure(Call<ListSubscribersResponse> call, Throwable t) {

t.printStackTrace();

  
}
 
}
);
  • RxJava:
RxJavaVotoApiClient rxJavaVotoApiClient = new RxJavaVotoApiClient.Builder("api_key")  .withLogLevel(HttpLoggingInterceptor.Level.BODY)  .build();

rxJavaVotoApiClient.listSubscribers(10).subscribe(new Action1<ListSubscribersResponse>() {
  @Override  public void call(ListSubscribersResponse listSubscribersResponse) {

System.out.println(listSubscribersResponse);

 
}
 
}
);

Run sample

Make sure you've your VOTO API key set in the local.properties file located in the root directory of the project. The property name should be votoApiKey. If you don't set this, a dummy API key will be used.

After setting the voto api key, issue ./gradlew run. This should run the sample app and output the results in the console.

License

Copyright 2016 Henry Addo Open Source Project  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

A reactive wrapper around Android's Google Play Services Wear API in Kotlin.

This is an event bus designed to allowing your application to communicate efficiently.

RxAndroidBle is a powerful painkiller for Android's Bluetooth Low Energy headaches. It is backed by RxJava, implementing complicated APIs as handy reactive observables.

Utils to work with Status Bar.

Simple Reactive wrapper for Android sensors.

Welcome Coordinator is a library for Android that helps you to create really awesome welcome wizards for your Apps, but this is not all, also you can use the library to create form wizards really nice.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes