Disqus for Android


Лицензия

Лицензия

Группа

Группа

me.philio.disqus
Идентификатор

Идентификатор

disqus
Последняя версия

Последняя версия

0.0.11
Дата

Дата

Тип

Тип

aar
Описание

Описание

Disqus for Android
Disqus for Android
Ссылка на сайт

Ссылка на сайт

https://github.com/Philio/disqus-android
Система контроля версий

Система контроля версий

https://github.com/Philio/disqus-android

Скачать disqus

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/me.philio.disqus/disqus/ -->
<dependency>
    <groupId>me.philio.disqus</groupId>
    <artifactId>disqus</artifactId>
    <version>0.0.11</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/me.philio.disqus/disqus/
implementation 'me.philio.disqus:disqus:0.0.11'
// https://jarcasting.com/artifacts/me.philio.disqus/disqus/
implementation ("me.philio.disqus:disqus:0.0.11")
'me.philio.disqus:disqus:aar:0.0.11'
<dependency org="me.philio.disqus" name="disqus" rev="0.0.11">
  <artifact name="disqus" type="aar" />
</dependency>
@Grapes(
@Grab(group='me.philio.disqus', module='disqus', version='0.0.11')
)
libraryDependencies += "me.philio.disqus" % "disqus" % "0.0.11"
[me.philio.disqus/disqus "0.0.11"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.android.support » support-v4 jar 21.0.0
com.android.support » appcompat-v7 jar 21.0.0
com.squareup.retrofit : retrofit jar 1.7.1

Модули Проекта

Данный проект не имеет модулей.

Disqus for Android

About

This library implements the Disqus API for use in Android applications. The library is currently incomplete and under development so is subject to change.

Download

Gradle

Add the following to your build.gradle:

compile 'me.philio.disqus:disqus:0.0.11'

Authentication

Using AuthorizeActivity

  1. Use AuthorizeUtils.createIntent to create a new Intent with your application settings.

  2. Start the activity with startActivityForResult.

  3. Implement 'onActivityResult' to get the access token object:

     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         if (resultCode == RESULT_OK) {
             // Auth completed, get the access token
             AccessToken accessToken = data.getParcelableExtra(AuthorizeActivity.EXTRA_ACCESS_TOKEN);
         } else {
             // Auth failed
         }
    
         super.onActivityResult(requestCode, resultCode, data);
     }
    

Using AuthorizeFragment

  1. Add the fragment to your activity via AuthorizeFragment.newInstance.

  2. Your activity should implement the AuthorizeFragment.AuthorizeListener callback.

  3. You may need to handle failures/cancellations within your activity, e.g. if back is pressed as currently the cancel button on the Disqus auth page doesn't seem to work.

Google, Facebook, Twitter

Third party logins are not supported at this time.

Basic usage

Create configuration

Use the ApiConfig class to set your app configuration

ApiConfig apiConfig = new ApiConfig("MyApiKey", "AccessToken", LogLevel.BASIC);

Standard options

  • API key - mandatory for all requests.
  • Access token - required for requests that require authentication.
  • Referrer - required for some requests that perform domain checks, should match a domain in your Disqus app settings.
  • Log level - set the Retrofit logging level, see Square's docs for details.

Other options

  • API secret - intended for server to server requests as an alternative to the API key/access token and provided for completeness. Can be used from a mobile app but this presents security risks and is not recommended.

Create client

As of version 0.0.5 the library is using Retrofit for requests.

The ApiClient can be used to create Disqus resource objects based on the Retrofit interfaces defined in the me.philio.disqus.api.resources package. It works as a wrapper to the Retrofit RestAdapter and configures the adapter and deserialisation options for Gson.

ApiClient apiClient = new ApiClient(apiConfig);

Create resource and make requests

Applications applications = apiClient.createApplications();
Response<Usage> usage = applications.listUsage("MyApp", 7);

All resources and requests match the naming conventions defined in the Disqus API documentation, but often method signatures are kept as simple as possible.

In general:

  • Named parameters are required and should not be null.

  • Optional parameters can be provided as a Map where applicable, refer to the Disqus documentation for details of optional parameters.

Response format

All requests will return a Response object. Typical responses contain an error code (which will always be 0 as errors throw exceptions), an optional cursor (which can be used for pagination) and some data which is a generic type.

The data is usually an object or list of objects and for the majority of requests will be one of the models defined in the API package. Some requests return empty structures so to avoid parsing issues the data type is either Object or List<Object>, the response data for these requests can be disregarded.

Known issues

Disqus issues

  1. The cancel button for the authorisation page doesn't work.
  2. Related param has no effect when used with Blacklists.list() method.

Версии библиотеки

Версия
0.0.11
0.0.10
0.0.9
0.0.8
0.0.7
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1