All Downloads are FREE. Search and download functionalities are using the official Maven repository.

twitter4j.TwitterBase Maven / Gradle / Ivy

There is a newer version: 4.1.2
Show newest version
/*
 * Copyright 2007 Yusuke Yamamoto
 *
 * 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 twitter4j;

import twitter4j.auth.Authorization;
import twitter4j.conf.Configuration;
import twitter4j.util.function.Consumer;

/**
 * @author Yusuke Yamamoto - yusuke at mac.com
 * @since Twitter4J 2.2.0
 */
public interface TwitterBase {

    /**
     * Returns authenticating user's screen name.
* This method may internally call verifyCredentials() on the first invocation if
* - this instance is authenticated by Basic and email address is supplied instead of screen name, or * - this instance is authenticated by OAuth.
* Note that this method returns a transiently cached (will be lost upon serialization) screen name while it is possible to change a user's screen name.
* * @return the authenticating screen name * @throws TwitterException when verifyCredentials threw an exception. * @throws IllegalStateException if no credentials are supplied. i.e.) this is an anonymous Twitter instance * @since Twitter4J 2.1.1 */ String getScreenName() throws TwitterException, IllegalStateException; /** * Returns authenticating user's user id.
* This method may internally call verifyCredentials() on the first invocation if
* - this instance is authenticated by Basic and email address is supplied instead of screen name, or * - this instance is authenticated by OAuth.
* * @return the authenticating user's id * @throws TwitterException when verifyCredentials threw an exception. * @throws IllegalStateException if no credentials are supplied. i.e.) this is an anonymous Twitter instance * @since Twitter4J 2.1.1 */ long getId() throws TwitterException, IllegalStateException; /** * Registers a RateLimitStatusListener for account associated rate limits * * @param listener the listener to be added * @see Rate Limiting | Twitter Developers * @since Twitter4J 2.1.12 */ void addRateLimitStatusListener(RateLimitStatusListener listener); /** * Registers a lambda action for account associated rate limits * * @param action the action to be added * @see Rate Limiting | Twitter Developers * @since Twitter4J 4.0.4 */ void onRateLimitStatus(Consumer action); /** * Registers a RateLimitStatusListener for account associated rate limits * * @param action the action to be added * @see Rate Limiting | Twitter Developers * @since Twitter4J 4.0.4 */ void onRateLimitReached(Consumer action); /** * Returns the authorization scheme for this instance.
* The returned type will be either of BasicAuthorization, OAuthAuthorization, or NullAuthorization * * @return the authorization scheme for this instance */ Authorization getAuthorization(); /** * Returns the configuration associated with this instance * * @return configuration associated with this instance * @since Twitter4J 2.1.8 */ Configuration getConfiguration(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy