Class GitHubTokenProviderResult

java.lang.Object
com.github.copilot.rpc.GitHubTokenProviderResult

public final class GitHubTokenProviderResult extends Object
Result of acquiring a session-scoped GitHub token.

Token values are redacted from toString().

Since:
1.0.0
  • Method Details

    • token

      public static GitHubTokenProviderResult token(String accessToken, long expiresIn)
      Creates a token result.
      Parameters:
      accessToken - GitHub access token
      expiresIn - positive remaining lifetime in seconds when the callback completes
      Returns:
      the token result
    • token

      public static GitHubTokenProviderResult token(String accessToken, long expiresIn, String tokenType)
      Creates a token result with an explicit OAuth token type.
      Parameters:
      accessToken - GitHub access token
      expiresIn - positive remaining lifetime in seconds when the callback completes
      tokenType - OAuth token type, or null to use the runtime's bearer default
      Returns:
      the token result
    • cancelled

      public static GitHubTokenProviderResult cancelled()
      Creates an explicit cancellation result.
      Returns:
      the cancellation result
    • isCancelled

      public boolean isCancelled()
      Gets whether acquisition was cancelled.
      Returns:
      true for a cancellation result
    • getAccessToken

      public String getAccessToken()
      Gets the access token.
      Returns:
      the token, or null for cancellation
    • getExpiresIn

      public long getExpiresIn()
      Gets the remaining token lifetime.
      Returns:
      remaining lifetime in seconds
    • getTokenType

      public String getTokenType()
      Gets the OAuth token type.
      Returns:
      token type, or null for the runtime default
    • toString

      public String toString()
      Overrides:
      toString in class Object