Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Latest commit

 

History

History
142 lines (111 loc) · 3.63 KB

README.md

File metadata and controls

142 lines (111 loc) · 3.63 KB

DEPRECATED

Build Status

Download

#GithubAndroidSdk

Join the chat at https://gitter.im/gitskarios/GithubAndroidSdk

USAGE

You should be using jCenter() as a repository for your libraries, if not, add this to your main build.gradle:

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
    classpath 'com.android.tools.build:gradle:X.X.X'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Or add repository url in your top-level build.gradle

maven {
    url  "http://dl.bintray.com/alorma/maven"
}

Add dependency in your project build.gradle

    compile 'com.github.alorma:github-sdk:3.2.5'

Or grab it via maven

<dependency>
    <groupId>com.github.alorma</groupId>
    <artifactId>github-sdk</artifactId>
    <version>3.2.2</version>
    <type>apklib</type>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.github.alorma</groupId>
    <artifactId>github-sdk</artifactId>
    <version>3.2.2</version>
    <type>jar</type>
    <scope>provided</scope>
</dependency>

INIT

    TokenProvider.setTokenProviderInstance(new TokenProviderInterface() {
      @Override
      public String getToken() {
        ...
      }
    });

    UrlProvider.setUrlProviderInstance(new UrlProviderInterface() {
      @Override
      public String getUrl() {
        ...
      }
    });

    UsernameProvider.setUsernameProviderInterface(new UsernameProviderInterface() {
      @Override
      public String getUsername() {
        ...
      }
    });

    LogProvider.setTokenProviderInstance(new LogProviderInterface() {
      @Override
      public void log(String message) {
        ...
      }
    });

EXAMPLE

Get repositories list:

GithubReposClient client = new UserReposClient(getActivity(), username);
client.observable()
.observeOn(AndroidSchedulers.mainThread()
.subscribeOn(Schedulers.io())
.subscribe( ... );

Paginated:

UserReposClient client = new UserReposClient(getActivity(), username, page);
client.observable()
.observeOn(AndroidSchedulers.mainThread()
.subscribeOn(Schedulers.io())
.subscribe( ... );

##LICENSE

The MIT License (MIT)

Copyright (c) 2016 Bernat Borrás Paronella

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.