Tabnine Logo
UserAPIAccount.setAPIKey
Code IndexAdd Tabnine to your IDE (free)

How to use
setAPIKey
method
in
org.dreamexposure.discal.core.object.web.UserAPIAccount

Best Java code snippets using org.dreamexposure.discal.core.object.web.UserAPIAccount.setAPIKey (Showing top 1 results out of 315)

origin: NovaFox161/DisCal-Discord-Bot

public UserAPIAccount getAPIAccount(String APIKey) {
  try {
    if (databaseInfo.getMySQL().checkConnection()) {
      String dataTableName = String.format("%sapi", databaseInfo.getPrefix());
      String query = "SELECT * FROM " + dataTableName + " WHERE API_KEY = ?";
      PreparedStatement statement = databaseInfo.getConnection().prepareStatement(query);
      statement.setString(1, APIKey);
      ResultSet res = statement.executeQuery();
      boolean hasStuff = res.next();
      if (hasStuff && res.getString("API_KEY") != null) {
        UserAPIAccount account = new UserAPIAccount();
        account.setAPIKey(APIKey);
        account.setUserId(res.getString("USER_ID"));
        account.setBlocked(res.getBoolean("BLOCKED"));
        account.setTimeIssued(res.getLong("TIME_ISSUED"));
        account.setUses(res.getInt("USES"));
        statement.close();
        return account;
      } else {
        //Data not present.
        statement.close();
        return null;
      }
    }
  } catch (SQLException e) {
    Logger.getLogger().exception(null, "Failed to get API Account.", e, this.getClass());
  }
  return null;
}
org.dreamexposure.discal.core.object.webUserAPIAccountsetAPIKey

Popular methods of UserAPIAccount

  • getAPIKey
  • getUses
  • isBlocked
  • setUses
  • <init>
  • getTimeIssued
  • getUserId
  • setBlocked
  • setTimeIssued
  • setUserId

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now