disqus/src/main/java/com/hkm/disqus/api/model/posts/Media.java
public class Media {

    @SerializedName("forum")
    public String forum;

    @SerializedName("thumbnailUrl")
    public String thumbnailUrl;

    @SerializedName("description")
    public String description;

    @SerializedName("thread")
    public String thread;

    @SerializedName("title")
    public String title;

    @SerializedName("url")
    public String url;

    @SerializedName("mediaType")
    public String mediaType;

    @SerializedName("html")
    public String html;

    @SerializedName("location")
    public String location;

    @SerializedName("resolvedUrl")
    public String resolvedUrl;

    @SerializedName("post")
    public String post;

    @SerializedName("thumbnailURL")
    public String thumbnailURL;

    @SerializedName("type")
    public String type;

    @SerializedName("metadata")
    public Metadata metadata;

}
disqus/src/main/java/com/hkm/disqus/api/resources/Threads.java
public interface Threads {

    /**
     * Closes a thread
     *
     * @param thread as is
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/close/">Documentation</a>
     */
    @POST("/threads/close.json")
    Response<List<Thread>> close(@Query("thread") long thread) throws ApiException;

    /**
     * Closes a thread
     *
     * @param thread as is
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/close/">Documentation</a>
     */
    @POST("/threads/close.json")
    Response<List<Thread>> close(@Query("thread") long[] thread) throws ApiException;

    /**
     * Creates a new thread
     *
     * @param forum the name of the forum
     * @param title the title of the topic
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/create/">Documentation</a>
     */
    @POST("/threads/create.json")
    Response<Thread> create(@Query("forum") String forum,
                            @Query("title") String title) throws ApiException;

    /**
     * Creates a new thread
     *
     * @param forum          string
     * @param title          string
     * @param optionalParams extra things
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/create/">Documentation</a>
     */
    @POST("/threads/create.json")
    Response<Thread> create(@Query("forum") String forum,
                            @Query("title") String title,
                            @QueryMap Map<String, String> optionalParams) throws ApiException;

    /**
     * Returns thread details
     *
     * @param thread as is
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/details/">Documentation</a>
     */
    @GET("/threads/details.json")
    Response<Thread> details(@Query("thread") long thread) throws ApiException;

    /**
     * Returns thread details
     *
     * @param thread as is
     * @param forum  as is
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/details/">Documentation</a>
     */
    @GET("/threads/details.json")
    Response<Thread> details(
            @Query("thread") long thread,
            @Query("forum") String forum) throws ApiException;


    /**
     * Returns thread details
     *
     * @param thread as 1194797 http://hypebeast.com/?p=1194797 in format
     * @param forum  as is
     * @param cb     the callback
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/details/">Documentation</a>
     */
    @GET("/threads/details.json")
    void detailsId(
            @Query("thread:ident") String thread,
            @Query("forum") String forum,
            Callback<Response<Thread>> cb
    ) throws ApiException;


    /**
     * Returns thread details
     *
     * @param thread as 1194797 http://hypebeast.com/?p=1194797 in format
     * @param forum  as is
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/details/">Documentation</a>
     */
    @GET("/threads/details.json")
    Response<Thread> details(
            @Query("thread:ident") String thread,
            @Query("forum") String forum) throws ApiException;


    /**
     * Returns thread details
     *
     * @param thread  as is
     * @param forum   as is
     * @param related as is
     * @return as is
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/threads/details/">Documentation</a>
     */
    @GET("/threads/details.json")
    Response<Thread> details(@Query("thread") long thread,
                             @Query("forum") String forum,
                             @Query("related") String[] related) throws ApiException;


    /**
     * * Return the list of the post from a specific thread ID
     * ex.
     * thread:ident  1008680 http://hypebeast.com/?p=1008680
     * forum     hypebeast
     *
     * @param identifer  Looks up a thread by ID
     * @param forum_name Defaults to null  looks up a forum by ID (aka short name)
     * @return the result
     * @throws ApiException any errors
     */
    @GET("/threads/listPosts.json")
    Response<List<Post>> listPostByID(@Query("thread:ident") String identifer, @Query("forum") String forum_name) throws ApiException;

    /**
     * @param identifer  the id in string
     * @param forum_name name
     * @param cb         callback object
     * @throws ApiException any errors
     */
    @GET("/threads/listPosts.json")
    void listPostByIDAsync(
            @Query("thread:ident") String identifer,
            @Query("forum") String forum_name,
            Callback<Response<List<Post>>> cb
    ) throws ApiException;
}
disqus/src/main/java/com/hkm/disqus/api/resources/Feeds.java
public interface Feeds {

    // No methods currently exist

}
disqus/src/main/java/com/hkm/disqus/api/resources/Posts.java
public interface Posts {

    /**
     * Approves the requested post
     *
     * @param post as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/approve/">Documentation</a>
     */
    @POST("/posts/approve.json")
    Response<List<Post>> approve(@Query("post") long post) throws ApiException;

    /**
     * Approves the requested posts
     *
     * @param posts as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/approve/">Documentation</a>
     */
    @POST("/posts/approve.json")
    Response<List<Post>> approve(@Query("post") long[] posts) throws ApiException;

    /**
     * Creates a new post
     *
     * @param message as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/create/">Documentation</a>
     */
    @POST("/posts/create.json")
    Response<Post> create(@Query("message") String message) throws ApiException;

    /**
     * Creates a new post
     *
     * @param message        as is
     * @param optionalParams as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/create/">Documentation</a>
     */
    @POST("/posts/create.json")
    Response<Post> create(
            @Query("message") String message,
            @QueryMap Map<String, String> optionalParams)
            throws ApiException;


    /**
     * create a post with call back
     *
     * @param messagek the message to send
     * @param state    Choices: unapproved, approved, spam, killed
     * @param thread   the thread ID
     * @param cbpost   the call back data type
     * @throws ApiException the error from transactions
     */

    @POST("/posts/create.json")
    void create(
            @Query("message") String messagek,
            @Query("state") String state,
            @Query("thread") String thread,
            Callback<Response<Post>> cbpost)
            throws ApiException;

    /**
     * create a post with call back
     *
     * @param messagek the message to send
     * @param thread   the thread ID
     * @param cbpost   the call back data type
     * @throws ApiException the error from transactions
     */
    @POST("/posts/create.json")
    void create(
            @Query("message") String messagek,
            @Query("thread") String thread,
            Callback<Response<Post>> cbpost)
            throws ApiException;

    /**
     * create a post with call back
     *
     * @param messagek the message to send
     * @param cbpost   the call back data type
     * @throws ApiException the error from transactions
     */
    @POST("/posts/create.json")
    void create(
            @Query("message") String messagek,
            Callback<Response<Post>> cbpost)
            throws ApiException;

    /**
     * Returns information about a post
     *
     * @param post as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/details/">Documentation</a>
     */
    @GET("/posts/details.json")
    public Response<Post> details(@Query("post") long post) throws ApiException;

    /**
     * Returns information about a post
     *
     * @param post    as is
     * @param related as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/details/">Documentation</a>
     */
    @GET("/posts/details.json")
    Response<Post> details(
            @Query("post") long post,
            @Query("related") String[] related)
            throws ApiException;

    /**
     * Returns the hierarchal tree of a post (all parents)
     *
     * @param post as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/getContext/">Documentation</a>
     */
    @GET("/posts/getContext.json")
    public Response<List<Post>> getContext(@Query("post") long post) throws ApiException;


    /**
     * @param post    as is
     * @param depth   as is
     * @param related as is
     * @return Response object schema
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/getContext/">Documentation</a>
     */
    @GET("/posts/getContext.json")
    public Response<List<Post>> getContext(
            @Query("post") long post,
            @Query("depth") Integer depth,
            @Query("related") String[] related)
            throws ApiException;

    /**
     * Returns a list of posts ordered by the date created
     *
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/list/">Documentation</a>
     */
    @GET("/posts/list.json")
    public Response<List<Post>> list() throws ApiException;

    /**
     * Returns a list of posts ordered by the date created
     *
     * @param optionalParams as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/list/">Documentation</a>
     */
    @GET("/posts/list.json")
    public Response<List<Post>> list(@QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of posts ordered by the number of likes recently
     *
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/listPopular/">Documentation</a>
     */
    @GET("/posts/listPopular.json")
    public Response<List<Post>> listPopular() throws ApiException;

    /**
     * Returns a list of posts ordered by the number of likes recently
     *
     * @param optionalParams as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/listPopular/">Documentation</a>
     */
    @GET("/posts/listPopular.json")
    public Response<List<Post>> listPopular(@QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Deletes the requested post
     *
     * @param post as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/remove/">Documentation</a>
     */
    @POST("/posts/remove.json")
    public Response<List<Post>> remove(@Query("post") long post) throws ApiException;

    /**
     * Deletes the requested posts
     *
     * @param posts as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/remove/">Documentation</a>
     */
    @POST("/posts/remove.json")
    public Response<List<Post>> remove(@Query("post") long[] posts) throws ApiException;

    /**
     * Reports a post
     *
     * @param post as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/report/">Documentation</a>
     */
    @POST("/posts/report.json")
    public Response<Post> report(@Query("post") long post) throws ApiException;

    /**
     * Undeletes the requested post
     *
     * @param post as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/restore/">Documentation</a>
     */
    @POST("/posts/restore.json")
    public Response<List<Post>> restore(@Query("post") long post) throws ApiException;

    /**
     * Undeletes the requested posts
     *
     * @param posts as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/restore/">Documentation</a>
     */
    @POST("/posts/restore.json")
    public Response<List<Post>> restore(@Query("post") long[] posts) throws ApiException;

    /**
     * Marks the requested post as spam
     *
     * @param post as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/spam/">Documentation</a>
     */
    @POST("/posts/spam.json")
    public Response<List<Post>> spam(@Query("post") long post) throws ApiException;

    /**
     * Marks the requested posts as spam
     *
     * @param posts as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/spam/">Documentation</a>
     */
    @POST("/posts/spam.json")
    public Response<List<Post>> spam(@Query("post") long[] posts) throws ApiException;

    /**
     * Updates information on a post
     *
     * @param post    as is
     * @param message as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/update/">Documentation</a>
     */
    @POST("/posts/update.json")
    public Response<Post> update(@Query("post") long post,
                                 @Query("message") String message) throws ApiException;

    /**
     * Register a vote on a post
     *
     * @param post as is
     * @param vote as is
     * @return as is
     * @throws ApiException any error incurred during the api transaction in http
     * @see <a href="https://disqus.com/api/docs/posts/vote/">Documentation</a>
     */
    @POST("/posts/vote.json")
    public Response<Vote> vote(@Query("post") long post,
                               @Query("vote") int vote) throws ApiException;

}
disqus/src/main/java/com/hkm/disqus/api/exception/BadRequestException.java
public class BadRequestException extends ApiException {

    public BadRequestException() {
    }

    public BadRequestException(String detailMessage) {
        super(detailMessage);
    }

    public BadRequestException(String detailMessage, Throwable throwable) {
        super(detailMessage, throwable);
    }

    public BadRequestException(Throwable throwable) {
        super(throwable);
    }

}
disqus/src/main/java/com/hkm/disqus/api/model/applications/Usage.java
public class Usage extends HashMap<Date, Integer> {
}
disqus/src/main/java/com/hkm/disqus/api/gson/ApplicationsUsageDeserializer.java
public class ApplicationsUsageDeserializer implements JsonDeserializer<Usage> {

    @Override
    public Usage deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
            throws JsonParseException {
        // JSON element should be an array
        if (json.isJsonArray()) {
            // Create usage
            Usage usage = new Usage();

            // Iterate the array
            for (JsonElement element : json.getAsJsonArray()) {
                // Each element should be an array containing a date and int
                if (element.isJsonArray() && element.getAsJsonArray().size() == 2) {
                    JsonArray jsonArray = element.getAsJsonArray();
                    Date date = context.deserialize(jsonArray.get(0), Date.class);
                    int count = jsonArray.get(1).getAsInt();
                    usage.put(date, count);
                }
            }
            return usage;
        }
        return null;
    }

}
disqus/src/main/java/com/hkm/disqus/api/resources/Blacklists.java
public interface Blacklists {

    /**
     * Adds a domain entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param domains     An array of domains to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @return A list of the entries added
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    Response<List<Entry>> addDomains(@Field("forum") String forum,
                                     @Field("domain") String[] domains,
                                     @Field("retroactive") int retroactive,
                                     @Field("notes") String notes)
            throws ApiException;

    /**
     * Adds a domain entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param domains     An array of domains to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @param callback    Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    void addDomains(@Field("forum") String forum,
                    @Field("domain") String[] domains,
                    @Field("retroactive") int retroactive,
                    @Field("notes") String notes,
                    Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Adds a word entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param words       An array of words to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @return A list of the entries added
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    Response<List<Entry>> addWords(@Field("forum") String forum,
                                   @Field("word") String[] words,
                                   @Field("retroactive") int retroactive,
                                   @Field("notes") String notes)
            throws ApiException;

    /**
     * Adds a word entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param words       An array of words to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @param callback    Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    void addWords(@Field("forum") String forum,
                  @Field("word") String[] words,
                  @Field("retroactive") int retroactive,
                  @Field("notes") String notes,
                  Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Adds an IP entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param ips         An array of ips to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @return A list of the entries added
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    Response<List<Entry>> addIps(@Field("forum") String forum,
                                 @Field("ip") String[] ips,
                                 @Field("retroactive") int retroactive,
                                 @Field("notes") String notes) throws ApiException;

    /**
     * Adds an IP entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param ips         An array of ips to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @param callback    Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    void addIps(@Field("forum") String forum,
                @Field("ip") String[] ips,
                @Field("retroactive") int retroactive,
                @Field("notes") String notes,
                Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Adds a user entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param users       An array of user ids to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @return A list of the entries added
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    Response<List<Entry>> addUsers(@Field("forum") String forum,
                                   @Field("user") Long[] users,
                                   @Field("retroactive") int retroactive,
                                   @Field("notes") String notes)
            throws ApiException;

    /**
     * Adds a user entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param users       An array of user ids to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @param callback    Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    void addUsers(@Field("forum") String forum,
                  @Field("user") Long[] users,
                  @Field("retroactive") int retroactive,
                  @Field("notes") String notes,
                  Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Adds an email entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param emails      An array of emails to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @return A list of the entries added
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    Response<List<Entry>> addEmails(@Field("forum") String forum,
                                    @Field("email") String[] emails,
                                    @Field("retroactive") int retroactive,
                                    @Field("notes") String notes)
            throws ApiException;

    /**
     * Adds an email entry/entries to the blacklist
     *
     * @param forum       The forum short name
     * @param emails      An array of emails to add
     * @param retroactive Apply to dates in the past
     * @param notes       Note to add to the entry
     * @param callback    Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/add/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/add.json")
    void addEmails(@Field("forum") String forum,
                   @Field("email") String[] emails,
                   @Field("retroactive") int retroactive,
                   @Field("notes") String notes,
                   Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Returns a list of all blacklist entries
     *
     * @param forum The forum short name
     * @return A list of the entries
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/list/">Documentation</a>
     */
    @GET("/blacklists/list.json")
    Response<List<Entry>> list(@Query("forum") String forum) throws ApiException;

    /**
     * Returns a list of all blacklist entries
     *
     * @param forum    The forum short name
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/list/">Documentation</a>
     */
    @GET("/blacklists/list.json")
    void list(@Query("forum") String forum,
              Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Returns a list of all blacklist entries
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of the entries
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/list/">Documentation</a>
     */
    @GET("/blacklists/list.json")
    Response<List<Entry>> list(@Query("forum") String forum,
                               @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of all blacklist entries
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @param callback       Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/list/">Documentation</a>
     */
    @GET("/blacklists/list.json")
    void list(@Query("forum") String forum,
              @QueryMap Map<String, String> optionalParams,
              Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Returns a list of all blacklist entries
     *
     * @param forum          The forum short name
     * @param related        Get relations in response
     * @param optionalParams A map of optional parameters
     * @return A list of the entries
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/list/">Documentation</a>
     */
    @GET("/blacklists/list.json")
    Response<List<Entry>> list(@Query("forum") String forum,
                               @Query("related") String[] related,
                               @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of all blacklist entries
     *
     * @param forum          The forum short name
     * @param related        Get relations in response
     * @param optionalParams A map of optional parameters
     * @param callback       Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/list/">Documentation</a>
     */
    @GET("/blacklists/list.json")
    void list(@Query("forum") String forum,
              @Query("related") String[] related,
              @QueryMap Map<String, String> optionalParams,
              Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Removes a domain entry/entries to the blacklist
     *
     * @param forum   The forum short name
     * @param domains An array of domains to remove
     * @return A list of the entries removed
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    Response<List<Entry>> removeDomains(@Field("forum") String forum,
                                        @Field("domain") String[] domains)
            throws ApiException;

    /**
     * Removes a domain entry/entries to the blacklist
     *
     * @param forum    The forum short name
     * @param domains  An array of domains to remove
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    void removeDomains(@Field("forum") String forum,
                       @Field("domain") String[] domains,
                       Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Removes a word entry/entries to the blacklist
     *
     * @param forum The forum short name
     * @param words An array of words to remove
     * @return A list of the entries removed
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    Response<List<Entry>> removeWords(@Field("forum") String forum,
                                      @Field("word") String[] words)
            throws ApiException;

    /**
     * Removes a word entry/entries to the blacklist
     *
     * @param forum    The forum short name
     * @param words    An array of words to remove
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    void removeWords(@Field("forum") String forum,
                     @Field("word") String[] words,
                     Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Removes an IP entry/entries to the blacklist
     *
     * @param forum The forum short name
     * @param ips   An array of ips to remove
     * @return A list of the entries removed
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    Response<List<Entry>> removeIps(@Field("forum") String forum,
                                    @Field("ip") String[] ips) throws ApiException;

    /**
     * Removes an IP entry/entries to the blacklist
     *
     * @param forum    The forum short name
     * @param ips      An array of ips to remove
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    void removeIps(@Field("forum") String forum,
                   @Field("ip") String[] ips,
                   Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Removes a user entry/entries to the blacklist
     *
     * @param forum The forum short name
     * @param users An array of user ids to remove
     * @return A list of the entries removed
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    Response<List<Entry>> removeUsers(@Field("forum") String forum,
                                      @Field("user") Long[] users)
            throws ApiException;

    /**
     * Removes a user entry/entries to the blacklist
     *
     * @param forum    The forum short name
     * @param users    An array of user ids to remove
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    void removeUsers(@Field("forum") String forum,
                     @Field("user") Long[] users,
                     Callback<Response<List<Entry>>> callback) throws ApiException;

    /**
     * Removes an email entry/entries to the blacklist
     *
     * @param forum  The forum short name
     * @param emails An array of emails to remove
     * @return A list of the entries removed
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    Response<List<Entry>> removeEmails(@Field("forum") String forum,
                                       @Field("email") String[] emails)
            throws ApiException;

    /**
     * Removes an email entry/entries to the blacklist
     *
     * @param forum    The forum short name
     * @param emails   An array of emails to remove
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/blacklists/remove/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/blacklists/remove.json")
    void removeEmails(@Field("forum") String forum,
                      @Field("email") String[] emails,
                      Callback<Response<List<Entry>>> callback) throws ApiException;

}
disqus/src/main/java/com/hkm/disqus/api/exception/APIIncorrectException.java
public class APIIncorrectException extends Exception {

    public APIIncorrectException() {
    }

    public APIIncorrectException(String detailMessage) {
        super(detailMessage);
    }

    public APIIncorrectException(String detailMessage, Throwable throwable) {
        super(detailMessage, throwable);
    }

    public APIIncorrectException(Throwable throwable) {
        super(throwable);
    }

}
disqus/src/main/java/com/hkm/disqus/api/resources/Users.java
public interface Users {

    @POST("/users/checkUsername.json")
    Response<String> checkUsername(@Query("username") String username);

    @GET("/users/details.json")
    Response<User> details(@Query("user") Long user);

}
disqus/src/main/java/com/hkm/disqus/api/resources/Categories.java
public interface Categories {

    /**
     * Creates a new category
     *
     * @param forum The forum short name
     * @param title The category title
     * @return The added category
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/create/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/categories/create.json")
    Response<Category> create(@Field("forum") String forum,
                              @Field("title") String title) throws ApiException;

    /**
     * Creates a new category
     *
     * @param forum     The forum short name
     * @param title     The category title
     * @param isDefault Is this the default category
     * @return The added category
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/create/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/categories/create.json")
    Response<Category> create(@Field("forum") String forum,
                              @Field("title") String title,
                              @Field("default") int isDefault) throws ApiException;

    /**
     * Returns category details
     *
     * @param category The category id
     * @return The category details
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/details/">Documentation</a>
     */
    @GET("/categories/details.json")
    Response<Category> details(@Query("category") long category) throws ApiException;

    /**
     * Returns a list of categories within a forum
     *
     * @param forum The forum short name
     * @return A list of categories
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/list/">Documentation</a>
     */
    @GET("/categories/list.json")
    Response<List<Category>> list(@Query("forum") String forum) throws ApiException;

    /**
     * Returns a list of categories within a forum
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of categories
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/list/">Documentation</a>
     */
    @GET("/categories/list.json")
    Response<List<Category>> list(@Query("forum") String forum,
                                  @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of categories within multiple forums
     *
     * @param forums The forum short names
     * @return A list of categories
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/list/">Documentation</a>
     */
    @GET("/categories/list.json")
    Response<List<Category>> list(@Query("forum") String[] forums)
            throws ApiException;

    /**
     * Returns a list of categories within multiple forums
     *
     * @param forums         The forum short names
     * @param optionalParams A map of optional parameters
     * @return A list of categories
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/list/">Documentation</a>
     */
    @GET("/categories/list.json")
    Response<List<Category>> list(@Query("forum") String[] forums,
                                  @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of posts within a category
     *
     * @param category The category id
     * @return A list of posts
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/listPosts/">Documentation</a>
     */
    @GET("/categories/listPosts.json")
    Response<List<Post>> listPosts(@Query("category") long category) throws ApiException;

    /**
     * Returns a list of posts within a category
     *
     * @param category       The category id
     * @param optionalParams A map of optional parameters
     * @return A list of posts
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/listPosts/">Documentation</a>
     */
    @GET("/categories/listPosts.json")
    Response<List<Post>> listPosts(@Query("category") long category,
                                   @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of posts within a category
     *
     * @param category       The category id
     * @param related        Specify relations to include with the response. Allows: forum, thread
     * @param include        Filter posts by status. Allows: unapproved, approved, spam, deleted,
     *                       flagged, highlighted
     * @param optionalParams A map of optional parameters
     * @return A list of posts
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/listPosts/">Documentation</a>
     */
    @GET("/categories/listPosts.json")
    Response<List<Post>> listPosts(@Query("category") long category,
                                   @Query("related") String[] related,
                                   @Query("include") String[] include,
                                   @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of threads within a category sorted by the date created
     *
     * @param category The category id
     * @return A list of threads
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/listThreads/">Documentation</a>
     */
    @GET("/categories/listThreads.json")
    Response<List<Thread>> listThreads(@Query("category") long category)
            throws ApiException;

    /**
     * Returns a list of threads within a category sorted by the date created
     *
     * @param category       The category id
     * @param optionalParams A map of optional parameters
     * @return A list of threads
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/listThreads/">Documentation</a>
     */
    @GET("/categories/listThreads.json")
    Response<List<Thread>> listThreads(@Query("category") long category,
                                       @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of threads within a category sorted by the date created
     *
     * @param category       The category id
     * @param related        Specify relations to include with the response. Allows: forum, author
     * @param optionalParams A map of optional parameters
     * @return A list of threads
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/categories/listThreads/">Documentation</a>
     */
    @GET("/categories/listThreads.json")
    Response<List<Thread>> listThreads(@Query("category") long category,
                                       @Query("related") String[] related,
                                       @QueryMap Map<String, String> optionalParams)
            throws ApiException;

}
disqus/src/main/java/com/hkm/disqus/api/gson/ThreadTypeAdapterFactory.java
public class ThreadTypeAdapterFactory implements TypeAdapterFactory {

    @Override
    public <T> TypeAdapter<T> create(final Gson gson, TypeToken<T> type) {
        // Return null if not the thread type
        if (!type.getType().equals(Thread.class)) {
            return null;
        }

        // Get delegate
        final TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);

        // Return adapter
        return new TypeAdapter<T>() {

            @Override
            public void write(JsonWriter out, T value) throws IOException {
                delegate.write(out, value);
            }

            @Override
            public T read(JsonReader in) throws IOException {
                JsonElement jsonTree = gson.fromJson(in, JsonElement.class);
                JsonElement forum = jsonTree.getAsJsonObject().get("forum");
                JsonElement author = jsonTree.getAsJsonObject().get("author");
                JsonElement category = jsonTree.getAsJsonObject().get("category");

                // Process the thread with the delegate
                T thread = delegate.fromJsonTree(jsonTree);

                // Process forum and author if needed
                if (forum.isJsonObject()) {
                    ((Thread) thread).forum = gson.fromJson(forum, Forum.class);
                }
                if (author.isJsonObject()) {
                    ((Thread) thread).author = gson.fromJson(author, User.class);
                }
                if (category.isJsonObject()) {
                    ((Thread) thread).category = gson.fromJson(category, Category.class);
                }

                // Return thread
                return thread;
            }

        };

    }

}
disqus/src/main/java/com/hkm/disqus/api/resources/Imports.java
public interface Imports {

    /**
     * Get import details
     *
     * @param forum forum name
     * @param group the group ID or name the group ID or name
     * @return return the result object schema
     * @throws ApiException any errors during the http transaction
     * @see <a href="https://disqus.com/api/docs/imports/">Documentation</a>
     */
    @GET("/imports/details.json")
    Response<Import> details(@Query("forum") String forum,
                             @Query("group") long group) throws ApiException;

    /**
     * Get list of imports
     *
     * @param forum forum name
     * @return return the result object schema
     * @throws ApiException any errors during the http transaction
     * @see <a href="https://disqus.com/api/docs/imports/">Documentation</a>
     */
    @GET("/imports/list.json")
    Response<List<Import>> list(@Query("forum") String forum) throws ApiException;

}
disqus/src/main/java/com/hkm/disqus/api/retrofitworker/Interceptor.java
public class Interceptor implements retrofit.RequestInterceptor {
    private static final String PARAM_API_KEY = "api_key";
    private static final String PARAM_ACCESS_TOKEN = "access_token";
    private static ApiConfig confg;

    public Interceptor(final ApiConfig configuration) {
        confg = configuration;
    }


    @Override
    public void intercept(RequestFacade request) {
        request.addQueryParam(PARAM_API_KEY, confg.getApiKey());
        // add the authenticated user to the request if available
        // if (confg.getAccessToken() != null) {
        // request.addQueryParam(PARAM_ACCESS_TOKEN, confg.getAccessToken());
        // }
    }
}
disqus/src/main/java/com/hkm/disqus/api/exception/ForbiddenException.java
public class ForbiddenException extends ApiException {

    public ForbiddenException() {
    }

    public ForbiddenException(String detailMessage) {
        super(detailMessage);
    }

    public ForbiddenException(String detailMessage, Throwable throwable) {
        super(detailMessage, throwable);
    }

    public ForbiddenException(Throwable throwable) {
        super(throwable);
    }

}
disqus/src/main/java/com/hkm/disqus/api/resources/Notes.java
public interface Notes {

    // No methods currently exist

}
disqus/src/main/java/com/hkm/disqus/api/gson/BlacklistsEntryTypeAdapterFactory.java
public class BlacklistsEntryTypeAdapterFactory implements TypeAdapterFactory {

    @Override
    public <T> TypeAdapter<T> create(final Gson gson, TypeToken<T> type) {
        // Return null if not a blacklist entry object
        if (!type.getType().equals(Entry.class)) {
            return null;
        }

        // Get delegate
        final TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);

        // Return adapter
        return new TypeAdapter<T>() {

            @Override
            public void write(JsonWriter out, T value) throws IOException {
                delegate.write(out, value);
            }

            @Override
            public T read(JsonReader in) throws IOException {
                JsonElement jsonTree = gson.fromJson(in, JsonElement.class);
                JsonElement value = jsonTree.getAsJsonObject().get("value");

                // Process the entry with the delegate
                T entry = delegate.fromJsonTree(jsonTree);

                // Process value if needed
                if (value.isJsonObject()) {
                    ((Entry) entry).value = gson.fromJson(value, User.class);
                }

                // Return entry
                return entry;
            }

        };
    }

}
disqus/src/main/java/com/hkm/disqus/api/exception/ApiException.java
public class ApiException extends Exception {

    public ApiException() {
    }

    public ApiException(String detailMessage) {
        super(detailMessage);
    }

    public ApiException(String detailMessage, Throwable throwable) {
        super(detailMessage, throwable);
    }

    public ApiException(Throwable throwable) {
        super(throwable);
    }

}
disqus/src/main/java/com/hkm/disqus/api/resources/notes/Templates.java
public interface Templates {

    // No methods currently exist

}
disqus/src/main/java/com/hkm/disqus/api/gson/GsonFactory.java
public class GsonFactory {

    public static Gson newGsonInstance() {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.excludeFieldsWithModifiers(Modifier.STATIC, Modifier.TRANSIENT);
        gsonBuilder.registerTypeAdapter(Date.class, new DateAdapter());
        return gsonBuilder.create();
    }
}
disqus/src/main/java/com/hkm/disqus/api/resources/Applications.java
public interface Applications {

    /**
     * Returns the API usage per day for this application
     *
     * @return Usage data for the application
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/applications/listUsage/">Documentation</a>
     */
    @GET("/applications/listUsage.json")
    Response<Usage> listUsage() throws ApiException;

    /**
     * Returns the API usage per day for this application
     *
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/applications/listUsage/">Documentation</a>
     */
    @GET("/applications/listUsage.json")
    void listUsage(Callback<Response<Usage>> callback) throws ApiException;

    /**
     * Returns the API usage per day for this application
     *
     * @param days Number of days
     * @return Usage data for the application
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/applications/listUsage/">Documentation</a>
     */
    @GET("/applications/listUsage.json")
    Response<Usage> listUsage(@Query("days") int days) throws ApiException;

    /**
     * Returns the API usage per day for this application
     *
     * @param days     Number of days
     * @param callback Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/applications/listUsage/">Documentation</a>
     */
    @GET("/applications/listUsage.json")
    void listUsage(@Query("days") int days,
                   Callback<Response<Usage>> callback) throws ApiException;

    /**
     * Returns the API usage per day for this application
     *
     * @param application Application id
     * @param days        Number of days
     * @return Usage data for the application
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/applications/listUsage/">Documentation</a>
     */
    @GET("/applications/listUsage.json")
    Response<Usage> listUsage(@Query("application") int application,
                              @Query("days") Integer days) throws ApiException;

    /**
     * Returns the API usage per day for this application
     *
     * @param application Application id
     * @param days        Number of days
     * @param callback    Callback for async result
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/applications/listUsage/">Documentation</a>
     */
    @GET("/applications/listUsage.json")
    void listUsage(@Query("application") int application,
                   @Query("days") Integer days,
                   Callback<Response<Usage>> callback) throws ApiException;

}
disqus/src/main/java/com/hkm/disqus/api/resources/Exports.java
public interface Exports {

    /**
     * Triggers an export of the forum which is sent via email. API returns an empty object for this
     * request. Response param format only has a single option so has been omitted.
     *
     * @param forum The forum short name
     * @return A response object, data can be ignored
     * @throws ApiException any errors
     * @see <a href="https://disqus.com/api/docs/exports/exportForum/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/exports/exportForum.json")
    Response<Object> exportForum(@Field("forum") String forum) throws ApiException;

}
disqus/src/main/java/com/hkm/disqus/api/exception/NotFoundException.java
public class NotFoundException extends Exception {

    public NotFoundException() {
    }

    public NotFoundException(String detailMessage) {
        super(detailMessage);
    }

    public NotFoundException(String detailMessage, Throwable throwable) {
        super(detailMessage, throwable);
    }

    public NotFoundException(Throwable throwable) {
        super(throwable);
    }

}
disqus/src/main/java/com/hkm/disqus/api/resources/Forums.java
public interface Forums {

    /**
     * Adds a moderator to a forum
     *
     * @param user  The user id of the moderator
     * @param forum The forum short name
     * @return The moderator id
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/addModerator/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/forums/addModerator.json")
    Response<Moderator> addModerator(@Field("user") long user, @Query("forum") String forum)
            throws ApiException;

    /**
     * Creates a new forum
     *
     * @param website   The website url
     * @param name      The name of the forum
     * @param shortName The forum short name
     * @return The created forum
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/create/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/forums/create.json")
    Response<Forum> create(@Field("website") String website,
                           @Field("name") String name,
                           @Field("short_name") String shortName) throws ApiException;

    /**
     * Creates a new forum
     *
     * @param website    The website url
     * @param name       The name of the forum
     * @param shortName  The forum short name
     * @param guidelines Forum guidelines
     * @return The created forum
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/create/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/forums/create.json")
    Response<Forum> create(@Field("website") String website,
                           @Field("name") String name,
                           @Field("short_name") String shortName,
                           @Field("guidelines") String guidelines) throws ApiException;

    /**
     * Returns forum details
     *
     * @param forum The forum short name
     * @return Details of the forum
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/details/">Documentation</a>
     */
    @GET("/forums/details.json")
    Response<Forum> details(@Query("forum") String forum) throws ApiException;

    /**
     * Returns forum details
     *
     * @param forum   The forum short name
     * @param related Specify relations to include with the response. Allows: author
     * @return Details of the forum
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/details/">Documentation</a>
     */
    @GET("/forums/details.json")
    Response<Forum> details(@Query("forum") String forum,
                            @Query("related") String[] related) throws ApiException;

    /**
     * Follow a forum
     *
     * @param target The forum short name
     * @return A response object, data can be ignored
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/follow/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/forums/follow.json")
    Response<List<Object>> follow(@Field("target") String target) throws ApiException;

    /**
     * Returns a list of categories within a forum
     *
     * @param forum The forum short name
     * @return A list of categories
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listCategories/">Documentation</a>
     */
    @GET("/forums/listCategories.json")
    Response<List<Category>> listCategories(@Query("forum") String forum)
            throws ApiException;

    /**
     * Returns a list of categories within a forum
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of categories
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listCategories/">Documentation</a>
     */
    @GET("/forums/listCategories.json")
    Response<List<Category>> listCategories(@Query("forum") String forum,
                                            @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of users following a forum
     *
     * @param forum The forum short name
     * @return A list of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listFollowers/">Documentation</a>
     */
    @GET("/forums/listFollowers.json")
    Response<List<User>> listFollowers(@Query("forum") String forum)
            throws ApiException;

    /**
     * Returns a list of users following a forum
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listFollowers/">Documentation</a>
     */
    @GET("/forums/listFollowers.json")
    Response<List<User>> listFollowers(@Query("forum") String forum,
                                       @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of all moderators on a forum
     *
     * @param forum The forum short name
     * @return A list of moderators
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listModerators/">Documentation</a>
     */
    @GET("/forums/listModerators.json")
    Response<List<Moderator>> listModerators(@Query("forum") String forum)
            throws ApiException;

    /**
     * Returns a list of users active within a forum ordered by most comments made
     *
     * @param forum The forum short name
     * @return A list of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listMostActiveUsers/">Documentation</a>
     */
    @GET("/forums/listMostActiveUsers.json")
    Response<List<User>> listMostActiveUsers(@Query("forum") String forum)
            throws ApiException;

    /**
     * Returns a list of users active within a forum ordered by most comments made
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listMostActiveUsers/">Documentation</a>
     */
    @GET("/forums/listMostActiveUsers.json")
    Response<List<User>> listMostActiveUsers(@Query("forum") String forum,
                                             @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of users active within a forum ordered by most likes received
     *
     * @param forum The forum short name
     * @return A list of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listMostLikedUsers/">Documentation</a>
     */
    @GET("/forums/listMostLikedUsers.json")
    Response<List<User>> listMostLikedUsers(@Query("forum") String forum)
            throws ApiException;

    /**
     * Returns a list of users active within a forum ordered by most likes received
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listMostLikedUsers/">Documentation</a>
     */
    @GET("/forums/listMostLikedUsers.json")
    Response<List<User>> listMostLikedUsers(@Query("forum") String forum,
                                            @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of posts within a forum
     *
     * @param forum The forum short name
     * @return A list if posts
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listPosts/">Documentation</a>
     */
    @GET("/forums/listPosts.json")
    Response<List<Post>> listPosts(@Query("forum") String forum) throws ApiException;

    /**
     * Returns a list of posts within a forum
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of posts
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listPosts/">Documentation</a>
     */
    @GET("/forums/listPosts.json")
    Response<List<Post>> listPosts(@Query("forum") String forum,
                                   @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of posts within a forum
     *
     * @param forum          The forum short name
     * @param related        Specify relations to include with the response. Allows: thread
     * @param include        Filter posts by status. Allows: unapproved, approved, spam, deleted,
     *                       flagged, highlighted
     * @param optionalParams A map of optional parameters
     * @return A list of posts
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listPosts/">Documentation</a>
     */
    @GET("/forums/listPosts.json")
    Response<List<Post>> listPosts(@Query("forum") String forum,
                                   @Query("related") String[] related,
                                   @Query("include") String[] include,
                                   @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of threads within a forum sorted by the date created
     *
     * @param forum The forum short name
     * @return A list of threads
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listThreads/">Documentation</a>
     */
    @GET("/forums/listThreads.json")
    Response<List<Thread>> listThreads(@Query("forum") String forum) throws ApiException;

    /**
     * Returns a list of threads within a forum sorted by the date created
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A list of threads
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listThreads/">Documentation</a>
     */
    @GET("/forums/listThreads.json")
    Response<List<Thread>> listThreads(@Query("forum") String forum,
                                       @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of threads within a forum sorted by the date created
     *
     * @param forum          The forum short name
     * @param related        Specify relations to include with the response. Allows: forum, author
     * @param include        Filter threads by status. Allows: open, closed, killed
     * @param optionalParams A map of optional parameters
     * @return A list of threads
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listThreads/">Documentation</a>
     */
    @GET("/forums/listThreads.json")
    Response<List<Thread>> listThreads(@Query("forum") String forum,
                                       @Query("related") String[] related,
                                       @Query("include") String[] include,
                                       @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Returns a list of users active within a forum
     *
     * @param forum The forum short name
     * @return A list of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listUsers/">Documentation</a>
     */
    @GET("/forums/listUsers.json")
    Response<List<User>> listUsers(@Query("forum") String forum) throws ApiException;

    /**
     * Returns a list of users active within a forum
     *
     * @param forum          The forum short name
     * @param optionalParams A map of optional parameters
     * @return A List of users
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/listUsers/">Documentation</a>
     */
    @GET("/forums/listUsers.json")
    Response<List<User>> listUsers(@Query("forum") String forum,
                                   @QueryMap Map<String, String> optionalParams)
            throws ApiException;

    /**
     * Removes a moderator from a forum
     *
     * @param moderator The moderator id
     * @return The removed moderator
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/removeModerator/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/forums/removeModerator.json")
    Response<Moderator> removeModerator(@Field("moderator") long moderator)
            throws ApiException;

    /**
     * Unfollow a forum
     *
     * @param target The forum short name
     * @return A response object, data can be ignored
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/unfollow/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/forums/unfollow.json")
    Response<List<Object>> unfollow(@Field("target") String target) throws ApiException;

    /**
     * Updates forum details
     *
     * @param forum      The forum short name
     * @param website    The website url
     * @param name       The name of the forum
     * @param guidelines Forum guidelines
     * @return The updated forum
     * @throws ApiException any error inccured
     * @see <a href="https://disqus.com/api/docs/forums/update/">Documentation</a>
     */
    @FormUrlEncoded
    @POST("/forums/update.json")
    Response<Forum> update(@Field("forum") String forum,
                           @Field("website") String website,
                           @Field("name") String name,
                           @Field("guidelines") String guidelines) throws ApiException;

}
disqus/src/main/java/com/hkm/disqus/DisqusConstants.java
public class DisqusConstants {
    public static final int apiVersion = 2;
    /**
     * Authorize URL
     */
    public static final String AUTHORIZE_URL = "https://disqus.com/api/oauth/2.0/authorize/";
    public static final String AUTHORIZE_ACCESS_TOKEN = "https://disqus.com/api/oauth/2.0/access_token/";
    public static final String ACTION_REFRESH_TOKEN = "com.hkm.disqus.refresh_token";
    /**
     * Currently available scopes
     */
    public static final String SCOPE_READ = "read";
    public static final String SCOPE_WRITE = "write";
    public static final String SCOPE_EMAIL = "email";
    public static final String SCOPE_ADMIN = "admin";

    /**
     * Params used in Disqus urls
     */
    public static final String PARAM_CLIENT_ID = "client_id";
    public static final String PARAM_CLIENT_SECRET = "client_secret";
    public static final String PARAM_SCOPE = "scope";
    public static final String PARAM_RESPONSE_TYPE = "response_type";
    public static final String PARAM_REDIRECT_URI = "redirect_uri";
    public static final String PARAM_USERNAME = "username";
    public static final String PARAM_USER_ID = "user_id";
    public static final String PARAM_ACCESS_TOKEN = "access_token";
    public static final String PARAM_EXPIRES_IN = "expires_in";
    public static final String PARAM_TOKEN_TYPE = "token_type";
    public static final String PARAM_STATE = "state";
    public static final String PARAM_GRANTTYPE = "grant_type";
    public static final String PARAM_CODE = "code";

    /**
     * Authorization response types
     */
    public static final String RESPONSE_TYPE_TOKEN = "token";
    public static final String RESPONSE_TYPE_CODE = "code";
    /**
     * Date format
     */
    public static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";

    /**
     * other configuration value
     */
    public static final String auth_code = "authorization_code";
    public static final String refresh = "refresh_token";
    public static final String authorizeCode = "/?code=";
}
disqus/src/main/java/com/hkm/disqus/api/resources/AccessTokenService.java
public interface AccessTokenService {

    @FormUrlEncoded
    @POST("/oauth/2.0/access_token/")
    void PostToken(@Field("grant_type") String grantType,
                   @Field("client_id") String clientId,
                   @Field("client_secret") String clientSecret,
                   @Field("redirect_uri") String redirectUrl,
                   @Field("code") String authCode,
                   Callback<AccessToken> callback);

    @POST("/oauth/2.0/access_token/")
    void PostRefreshToken(@Query("grant_type") String grantType,
                          @Query("client_id") String clientId,
                          @Query("client_secret") String clientSecret,
                          @Query("refresh_token") String refreshToken,
                          Callback<AccessToken> callback);

}
disqus/src/main/java/com/hkm/disqus/api/gson/PostTypeAdapterFactory.java
public class PostTypeAdapterFactory implements TypeAdapterFactory {

    @Override
    public <T> TypeAdapter<T> create(final Gson gson, TypeToken<T> type) {
        // Return null if not a post object
        if (!type.getType().equals(Post.class)) {
            return null;
        }

        // Get delegate
        final TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);

        // Return adapter
        return new TypeAdapter<T>() {

            @Override
            public void write(JsonWriter out, T value) throws IOException {
                delegate.write(out, value);
            }

            @Override
            public T read(JsonReader in) throws IOException {
                JsonElement jsonTree = gson.fromJson(in, JsonElement.class);
                JsonElement forum = jsonTree.getAsJsonObject().get("forum");
                JsonElement thread = jsonTree.getAsJsonObject().get("thread");

                // Process the post with the delegate
                T post = delegate.fromJsonTree(jsonTree);

                // Process forum and thread if needed
                if (forum.isJsonObject()) {
                    ((Post) post).forum = gson.fromJson(forum, Forum.class);
                }
                if (thread.isJsonObject()) {
                    ((Post) post).thread = gson.fromJson(thread, Thread.class);
                }

                // Return post
                return post;
            }

        };

    }

}


Question: import android.content.Context;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.hkm.disqus.DisqusConstants;
import com.hkm.disqus.api.exception.APIIncorrectException;
import com.hkm.disqus.api.exception.ApiException;
import com.hkm.disqus.api.exception.BadRequestException;
import com.hkm.disqus.api.exception.ForbiddenException;
import com.hkm.disqus.api.exception.NotFoundException;
import com.hkm.disqus.api.gson.ApplicationsUsageDeserializer;
import com.hkm.disqus.api.gson.BlacklistsEntryTypeAdapterFactory;
import com.hkm.disqus.api.gson.GsonFactory;
import com.hkm.disqus.api.gson.PostTypeAdapterFactory;
import com.hkm.disqus.api.gson.ThreadTypeAdapterFactory;
import com.hkm.disqus.api.model.applications.Usage;
import com.hkm.disqus.api.model.posts.Media;
import com.hkm.disqus.api.resources.AccessTokenService;
import com.hkm.disqus.api.resources.Applications;
import com.hkm.disqus.api.resources.Blacklists;
import com.hkm.disqus.api.resources.Categories;
import com.hkm.disqus.api.resources.Exports;
import com.hkm.disqus.api.resources.Feeds;
import com.hkm.disqus.api.resources.Forums;
import com.hkm.disqus.api.resources.Imports;
import com.hkm.disqus.api.resources.Notes;
import com.hkm.disqus.api.resources.Posts;
import com.hkm.disqus.api.resources.Threads;
import com.hkm.disqus.api.resources.Users;
import com.hkm.disqus.api.resources.notes.Templates;
import com.hkm.disqus.api.retrofitworker.Interceptor;
import retrofit.ErrorHandler;
import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;
import retrofit.converter.GsonConverter;
/*
 * Copyright 2014 Phil Bayfield
 *
 * 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.
 */
package com.hkm.disqus.api;




/**
 * A wrapper round the Retrofit {@link RestAdapter}
 */
public class ApiClient {

    /**
     * Base URL for all Disqus endpoints
     */
    private static final String BASE_URL = "https://disqus.com/api/3.0";
    private static final String BASE_LOGIN = "https://disqus.com/api";

    /**
     * User agent
     */
    private static final String USER_AGENT = "Disqus Android/1.1";

    /**
     * Rest adapter
     */
    private RestAdapter mAdapter;
    /**
     * disqusloginactivityframelayout adapter
     */
    private RestAdapter mLoginAdapter;
    /**
     * the API configurations
     */
    protected final ApiConfig _config;
    private final Gson gsonsetup;
    private final ErrorHandler handlerError;

    /**
     * Set config and set up the {@link RestAdapter}
     *
     * @param config the collection of configuration
     */
    public ApiClient(final ApiConfig config) {
        // Build Gson with Disqus date format and type adapters
        gsonsetup = new GsonBuilder()
                .setDateFormat(DisqusConstants.DATE_FORMAT)
                .registerTypeAdapter(Usage.class, new ApplicationsUsageDeserializer())
                .registerTypeAdapterFactory(new BlacklistsEntryTypeAdapterFactory())
                .registerTypeAdapterFactory(new PostTypeAdapterFactory())
                .registerTypeAdapterFactory(new ThreadTypeAdapterFactory())
                .create();
        handlerError = new ErrorHandler() {
            @Override
            public Throwable handleError(RetrofitError cause) {
                Response response = cause.getResponse();
                if (response != null) {
                    switch (response.getStatus()) {
                        case 400:
                            return new BadRequestException(cause);
                        case 401:
                            return new ForbiddenException(cause);
                        case 404:
Answer:                             return new NotFoundException(cause);