001/*
002 * flattr4j - A Java library for Flattr
003 *
004 * Copyright (C) 2014 Richard "Shred" Körber
005 *   http://flattr4j.shredzone.org
006 *
007 * This program is free software: you can redistribute it and/or modify
008 * it under the terms of the GNU General Public License / GNU Lesser
009 * General Public License as published by the Free Software Foundation,
010 * either version 3 of the License, or (at your option) any later version.
011 *
012 * Licensed under the Apache License, Version 2.0 (the "License");
013 * you may not use this file except in compliance with the License.
014 *
015 * This program is distributed in the hope that it will be useful,
016 * but WITHOUT ANY WARRANTY; without even the implied warranty of
017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
018 */
019package org.shredzone.flattr4j.async;
020
021import java.util.concurrent.Callable;
022
023import org.shredzone.flattr4j.oauth.AccessToken;
024
025/**
026 * A {@link Callable} for a Flattr method.
027 *
028 * @author Iulius Gutberlet
029 * @author Richard "Shred" Körber
030 */
031public interface FlattrCallable<R> extends Callable<R> {
032
033    /**
034     * Sets the {@link AccessToken} to be used if the call requires authorization.
035     *
036     * @param token
037     *            {@link AccessToken}, or {@code null} if no authorization is needed
038     */
039    void setAccessToken(AccessToken token);
040
041    /**
042     * Shortcut to set an {@link AccessToken}.
043     *
044     * @param token
045     *            Access token, or {@code null} if no authorization is needed
046     */
047    void setAccessToken(String token);
048
049    /**
050     * Gets the result of the last call.
051     */
052    R getResult();
053
054}