Package com.mooltiverse.oss.nyx.services
Interface GitService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description GitSession
authenticateWithToken(String token)
Authenticates by using the given token (Personal Access Token, OAuth)URI
getBaseURI()
Returns the API base URI for the service instance.boolean
ping()
Tries to contact the remote server to verify it's reachable and healthy.boolean
supports(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 returnstrue
then the underlying class will not raise anyUnsupportedOperationException
when invoking the specific methods.- Parameters:
feature
- the feature to check for support.- Returns:
true
if the operation is supported,false
otherwise
-
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:
true
if the operation succeeds,false
otherwise- Throws:
UnsupportedOperationException
- if the underlying implementation does notsupport
theGitServiceFeature.PING
feature.
-
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 isnull
IllegalArgumentException
- if given token is illegal for some reason (i.e. is an empry string)UnsupportedOperationException
- if the underlying implementation does notsupport
theGitServiceFeature.TOKEN_AUTHENTICATION
feature.
-
-