<commit_before>package de.golfgl.gdxgamesvcs;

import de.golfgl.gdxgamesvcs.achievement.IFetchAchievementsResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.IFetchGameStatesListResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ILoadGameStateResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ISaveGameStateResponseListener;
import de.golfgl.gdxgamesvcs.leaderboard.IFetchLeaderBoardEntriesResponseListener;

/**
 * This is the main interface for gdx-gamesvcs. Use this in your game core.
 * See the readme file for further information how to use this interface: https://github.com/MrStahlfelge/gdx-gamesvcs
 * <p>
 * Game service client classes implementing this interface are not thread-safe, so you should use references to it
 * either in your UI render thread only or synchronize calls yourself. Using the methods on your render thread is
 * safe and will not block the responsiveness of your game: Blocking calls are done asynchronous.
 * <p>
 * Created by <NAME> on 16.06.2017.
 */

public interface IGameServiceClient {

    public static final String GS_GAMEJOLT_ID = "GS_GAMEJOLT";
    public static final String GS_GOOGLEPLAYGAMES_ID = "GPGS";
    public static final String GS_AMAZONGC_ID = "GS_AMAZONGC";
    public static final String GS_KONGREGATE_ID = "GS_KONG";
    public static final String GS_NEWGROUNDS_ID = "GS_NGIO";

    /**
     * Gets an id for this game service for identifiying or showing labels
     *
     * @return Game Service ID
     */
    String getGameServiceId();

    /**
     * Set this listener to get callbacks from the game service client
     * <p>
     * This is not mandatory.
     *
     * @param gsListener your listening class, normally your Main Game class
     */
    void setListener(IGameServiceListener gsListener);

    /**
     * Connects to Gameservice and tries to get a user session.
     * <p>
     * It depends from the game service implementation what the connected state implies. See the documentation of
     * the specific service. This method should be called with silent param at application startup, and when resuming
     * in Android.
     * <p>
     * Note: Probably you have set up the GameService client with an initialize() method. It is not defined by
     * this interface because it depends on the service which parameters the method needs.
     *
     * @param silent if true, no error messages or log in prompts will be shown for. Use this at application start
     *               or after resuming the application in Android. If false, log in screens may appear for letting
     *               the user enter his credentials.
     * @return true if connection is already established or connection is pending. false if no connect is tried due to
     * unfulfilled prejudices (normally credentials not given).
     */
    boolean connect(boolean silent);

    /**
     * Disconnects from Gameservice by dropping an open connection or deactivating ping calls,
     * but does not close the user's session and so not invalidating a signin.
     * <p>
     * Use this in your main games pause() method on Android and when game is quit by the user.
     */
    void disconnect();

    /**
     * Signs explicitely out and disconnects from Gameservice. Use only when explicitely wanted by user to end his
     * session.
     */
    void logOff();

    /**
     * Gets Players display name, if possible.
     *
     * @return Display name, if available. May return null.
     */
    String getPlayerDisplayName();

    /**
     * Checks the connection status of the game service. See also isConnectionPending.
     *
     * @return true if connected, false otherwise
     */
    boolean isConnected();

    /**
     * Checks if a connection attempt is running
     *
     * @return
     */
    boolean isConnectionPending();

    /**
     * Opens user interface for leader boards, if available.
     *
     * @param leaderBoardId if null, then overview is opened (when supported)
     * @throws GameServiceException if not connected to service or operation not supported by client
     */
    void showLeaderboards(String leaderBoardId) throws GameServiceException;

    /**
     * Opens user interface for achievements, if available.
     *
     * @throws GameServiceException if not connected to service or operation not supported by client
     */
    void showAchievements() throws GameServiceException;

    /**
     * Fetch current player's achievements.
     * <p>
     * Should only be called when {@link GameServiceFeature#FetchAchievements} is supported,
     * check {@link #isFeatureSupported(GameServiceFeature)} prior to call this method.
     *
     * @param callback
     */
    boolean fetchAchievements(final IFetchAchievementsResponseListener callback);

    /**<commit_msg>Javadoc concerning session connection clarified<commit_after>package de.golfgl.gdxgamesvcs;

import de.golfgl.gdxgamesvcs.achievement.IFetchAchievementsResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.IFetchGameStatesListResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ILoadGameStateResponseListener;
import de.golfgl.gdxgamesvcs.gamestate.ISaveGameStateResponseListener;
import de.golfgl.gdxgamesvcs.leaderboard.IFetchLeaderBoardEntriesResponseListener;

/**
 * This is the main interface for gdx-gamesvcs. Use this in your game core.
 * See the readme file for further information how to use this interface: https://github.com/MrStahlfelge/gdx-gamesvcs
 * <p>
 * Game service client classes implementing this interface are not thread-safe, so you should use references to it
 * either in your UI render thread only or synchronize calls yourself. Using the methods on your render thread is
 * safe and will not block the responsiveness of your game: Blocking calls are done asynchronous.
 * <p>
 * Created by <NAME> on 16.06.2017.
 */

public interface IGameServiceClient {

    public static final String GS_GAMEJOLT_ID = "GS_GAMEJOLT";
    public static final String GS_GOOGLEPLAYGAMES_ID = "GPGS";
    public static final String GS_AMAZONGC_ID = "GS_AMAZONGC";
    public static final String GS_KONGREGATE_ID = "GS_KONG";
    public static final String GS_NEWGROUNDS_ID = "GS_NGIO";

    /**
     * Gets an id for this game service for identifiying or showing labels
     *
     * @return Game Service ID
     */
    String getGameServiceId();

    /**
     * Set this listener to get callbacks from the game service client
     * <p>
     * This is not mandatory.
     *
     * @param gsListener your listening class, normally your Main Game class
     */
    void setListener(IGameServiceListener gsListener);

    /**
     * Connects to a user session.
     * <p>
     * It depends from the game service implementation what the connected state implies. See the documentation of
     * the specific service. This method should be called with silent param at application startup, and when resuming
     * in Android.
     * <p>
     * Note: Probably you have set up the GameService client with an initialize() method. It is not defined by
     * this interface because it depends on the service which parameters the method needs.
     *
     * @see #isConnected()
     * @param silent if true, no error messages or log in prompts will be shown. Use this at application start
     *               or after resuming the application in Android. If false, log in screens may appear for letting
     *               the user enter his credentials.
     * @return true if connection is already established or connection is pending. false if no connect is tried due to
     * unfulfilled prejudices (normally credentials not given).
     */
    boolean connect(boolean silent);

    /**
     * Disconnects from Gameservice user session by dropping an open connection or deactivating ping calls,
     * but does not close the user's session and so not invalidating a signin.
     * <p>
     * Use this in your main games pause() method on Android and when game is quit by the user.
     *
     * @see #isConnected()
     */
    void disconnect();

    /**
     * Signs explicitely out and disconnects from Gameservice user session. Use only when explicitely wanted by user to
     * end his session.
     * <p>
     * Notes:
     * Some game services do not provide this feature, the user will stay logged in and connected to a user session.
     * Some game services will allow unauthenticated users to submit events or scores
     */
    void logOff();

    /**
     * Gets Players display name, if possible and user session is connected
     *
     * @return Display name, if available. May return null.
     */
    String getPlayerDisplayName();

    /**
     * Checks the connection status of the game service user session.
     * <p>
     * Note:
     * This method returns false if no user session is available, but the game service and some of its features may
     * be available. Some game services allow submitting events or scores without user context. So do not use this
     * method to check whether calling submit-Methods. Game service implementations will check all prerequisites for
     * you.
     *
     * @see #isConnectionPending()
     * @return true if connected to a user session, false otherwise
     */
    boolean isConnected();

    /**
     * Checks if a user session connection attempt is running
     *
     * @return
     */
    boolean isConnectionPending();

    /**
     * Opens user interface for leader boards, if available.
     *
     * @param leaderBoardId if null, then overview is opened (when supported)
     * @throws GameServiceException if not connected to service or operation not supported by client
     */
    void showLeaderboards(String leaderBoardId) throws GameServiceException;

    /**
     * Opens user interface for achievements, if available.
     *
     * @throws GameServiceException if not connected to service or operation not supported by client
     */
    void showAchievements() throws GameServiceException;

    /**
     * Fetch current player's achievements.
     * <p>
     * Should only be called when {@link GameServiceFeature#FetchAchievements} is supported,
     * check {@link #isFeatureSupported(GameServiceFeature)} prior to call this method.
     *
     * @param callback
     */
    boolean fetchAchievements(final IFetchAchievementsResponseListener callback);

    /**
{'fraction_non_alphanumeric': 0.06357487922705314, 'fraction_numerical': 0.0015458937198067632, 'mean_word_length': 3.091304347826087, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3829933', 'n_tokens_mistral': 2771, 'n_tokens_neox': 2673, 'n_words': 1151}