Package com.mooltiverse.oss.nyx.services
Interface GitService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GitSessionauthenticateWithToken(String token)Authenticates by using the given token (Personal Access Token, OAuth)URIgetBaseURI()Returns the API base URI for the service instance.booleanping()Tries to contact the remote server to verify it's reachable and healthy.booleansupports(GitServiceFeature feature)Safely checks if the underlying implementation supports the given operation.
-
-
-
Method Detail
-
supports
boolean supports(GitServiceFeature feature)
Safely checks if the underlying implementation supports the given operation. If this method returnstruethen the underlying class will not raise anyUnsupportedOperationExceptionwhen invoking the specific methods.- Parameters:
feature- the feature to check for support.- Returns:
trueif the operation is supported,falseotherwise
-
getBaseURI
URI getBaseURI()
Returns the API base URI for the service instance.- Returns:
- the API base URI for the service instance
-
ping
boolean ping()
Tries to contact the remote server to verify it's reachable and healthy. Please note that this method sends unauthenticated requests that may fail because of rate limits so use it with care.- Returns:
trueif the operation succeeds,falseotherwise- Throws:
UnsupportedOperationException- if the underlying implementation does notsupporttheGitServiceFeature.PINGfeature.
-
authenticateWithToken
GitSession authenticateWithToken(String token) throws GitTransportException, GitAuthenticationException
Authenticates by using the given token (Personal Access Token, OAuth)- Parameters:
token- the token to use for authentication.- Returns:
- a session object that can be used to perform operations as an authenticated user
- Throws:
GitTransportException- if a transport related error occurs while communicating with the serverGitAuthenticationException- if authentication failsNullPointerException- if the given token isnullIllegalArgumentException- if given token is illegal for some reason (i.e. is an empry string)UnsupportedOperationException- if the underlying implementation does notsupporttheGitServiceFeature.TOKEN_AUTHENTICATIONfeature.
-
-