public class GitLabApi extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GitLabApi.ApiVersion
Specifies the version of the GitLab API to communicate with.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PER_PAGE
GitLab4J default per page.
|
Constructor and Description |
---|
GitLabApi(GitLabApi.ApiVersion apiVersion,
String hostUrl,
Constants.TokenType tokenType,
String authToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
String hostUrl,
Constants.TokenType tokenType,
String authToken,
String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
String hostUrl,
Constants.TokenType tokenType,
String authToken,
String secretToken,
Map<String,Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server specified by GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
String hostUrl,
Session session)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
String hostUrl,
String privateToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
String hostUrl,
String privateToken,
String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
String hostUrl,
String privateToken,
String secretToken,
Map<String,Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server specified by GitLab API version.
|
GitLabApi(String hostUrl,
Constants.TokenType tokenType,
String authToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(String hostUrl,
Constants.TokenType tokenType,
String authToken,
String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(String hostUrl,
Constants.TokenType tokenType,
String authToken,
String secretToken,
Map<String,Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(String hostUrl,
Session session)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(String hostUrl,
String privateToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(String hostUrl,
String privateToken,
String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(String hostUrl,
String privateToken,
String secretToken,
Map<String,Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
Modifier and Type | Method and Description |
---|---|
protected static <T> Optional<T> |
createOptionalFromException(GitLabApiException glae)
Create and return an Optional instance associated with a GitLabApiException.
|
GitLabApi |
duplicate()
Create a new GitLabApi instance that is logically a duplicate of this instance, with the exception off sudo state.
|
void |
enableRequestResponseLogging()
Enable the logging of the requests to and the responses from the GitLab server API
using the GitLab4J shared Logger instance and Level.FINE as the level.
|
void |
enableRequestResponseLogging(Level level)
Enable the logging of the requests to and the responses from the GitLab server API
using the GitLab4J shared Logger instance.
|
void |
enableRequestResponseLogging(Level level,
int maxEntitySize)
Enable the logging of the requests to and the responses from the GitLab server API using the
GitLab4J shared Logger instance.
|
void |
enableRequestResponseLogging(Level level,
int maxEntitySize,
List<String> maskedHeaderNames)
Enable the logging of the requests to and the responses from the GitLab server API using the
GitLab4J shared Logger instance.
|
void |
enableRequestResponseLogging(Level level,
List<String> maskedHeaderNames)
Enable the logging of the requests to and the responses from the GitLab server API using the
GitLab4J shared Logger instance.
|
void |
enableRequestResponseLogging(Logger logger,
Level level)
Enable the logging of the requests to and the responses from the GitLab server API using the
specified logger.
|
void |
enableRequestResponseLogging(Logger logger,
Level level,
int maxEntitySize)
Enable the logging of the requests to and the responses from the GitLab server API using the
specified logger.
|
void |
enableRequestResponseLogging(Logger logger,
Level level,
int maxEntitySize,
List<String> maskedHeaderNames)
Enable the logging of the requests to and the responses from the GitLab server API using the
specified logger.
|
void |
enableRequestResponseLogging(Logger logger,
Level level,
List<String> maskedHeaderNames)
Enable the logging of the requests to and the responses from the GitLab server API using the
specified logger.
|
GitLabApi.ApiVersion |
getApiVersion()
Return the GitLab API version that this instance is using.
|
ApplicationsApi |
getApplicationsApi()
Gets the ApplicationsApi instance owned by this GitLabApi instance.
|
ApplicationSettingsApi |
getApplicationSettingsApi()
Gets the ApplicationSettingsApi instance owned by this GitLabApi instance.
|
String |
getAuthToken()
Get the auth token being used by this client.
|
AwardEmojiApi |
getAwardEmojiApi()
Gets the AwardEmojiApi instance owned by this GitLabApi instance.
|
BoardsApi |
getBoardsApi()
Gets the BoardsApi instance owned by this GitLabApi instance.
|
CommitsApi |
getCommitsApi()
Gets the CommitsApi instance owned by this GitLabApi instance.
|
ContainerRegistryApi |
getContainerRegistryApi()
Gets the ContainerRegistryApi instance owned by this GitLabApi instance.
|
int |
getDefaultPerPage()
Get the default number per page for calls that return multiple items.
|
DeployKeysApi |
getDeployKeysApi()
Gets the DeployKeysApi instance owned by this GitLabApi instance.
|
DiscussionsApi |
getDiscussionsApi()
Gets the DiscussionsApi instance owned by this GitLabApi instance.
|
EnvironmentsApi |
getEnvironmentsApi()
Gets the EnvironmentsApi instance owned by this GitLabApi instance.
|
EpicsApi |
getEpicsApi()
Gets the EpicsApi instance owned by this GitLabApi instance.
|
EventsApi |
getEventsApi()
Gets the EventsApi instance owned by this GitLabApi instance.
|
String |
getGitLabServerUrl()
Get the URL to the GitLab server.
|
GroupApi |
getGroupApi()
Gets the GroupApi instance owned by this GitLabApi instance.
|
HealthCheckApi |
getHealthCheckApi()
Gets the HealthCheckApi instance owned by this GitLabApi instance.
|
boolean |
getIgnoreCertificateErrors()
Returns true if the API is setup to ignore SSL certificate errors, otherwise returns false.
|
ImportExportApi |
getImportExportApi()
Gets the ImportExportApi instance owned by this GitLabApi instance.
|
IssuesApi |
getIssuesApi()
Gets the IssuesApi instance owned by this GitLabApi instance.
|
JobApi |
getJobApi()
Gets the JobApi instance owned by this GitLabApi instance.
|
LabelsApi |
getLabelsApi() |
LicenseApi |
getLicenseApi()
Gets the LicenseApi instance owned by this GitLabApi instance.
|
LicenseTemplatesApi |
getLicenseTemplatesApi()
Gets the LicenseTemplatesApi instance owned by this GitLabApi instance.
|
static Logger |
getLogger()
Get the GitLab4J shared Logger instance.
|
MarkdownApi |
getMarkdownApi()
Gets the MarkdownApi instance owned by this GitLabApi instance.
|
MergeRequestApi |
getMergeRequestApi()
Gets the MergeRequestApi instance owned by this GitLabApi instance.
|
MilestonesApi |
getMilestonesApi()
Gets the MilsestonesApi instance owned by this GitLabApi instance.
|
NamespaceApi |
getNamespaceApi()
Gets the NamespaceApi instance owned by this GitLabApi instance.
|
NotesApi |
getNotesApi()
Gets the NotesApi instance owned by this GitLabApi instance.
|
NotificationSettingsApi |
getNotificationSettingsApi()
Gets the NotesApi instance owned by this GitLabApi instance.
|
static GitLabApiException |
getOptionalException(Optional<?> optional)
Get the exception associated with the provided Optional instance, or null if no exception is
associated with the Optional instance.
|
PackagesApi |
getPackagesApi()
Gets the PackagesApi instance owned by this GitLabApi instance.
|
PipelineApi |
getPipelineApi()
Gets the PipelineApi instance owned by this GitLabApi instance.
|
ProjectApi |
getProjectApi()
Gets the ProjectApi instance owned by this GitLabApi instance.
|
ProtectedBranchesApi |
getProtectedBranchesApi()
Gets the ProtectedBranchesApi instance owned by this GitLabApi instance.
|
RepositoryApi |
getRepositoryApi()
Gets the RepositoryApi instance owned by this GitLabApi instance.
|
RepositoryFileApi |
getRepositoryFileApi()
Gets the RepositoryFileApi instance owned by this GitLabApi instance.
|
RunnersApi |
getRunnersApi()
Gets the RunnersApi instance owned by this GitLabApi instance.
|
SearchApi |
getSearchApi()
Gets the SearchApi instance owned by this GitLabApi instance.
|
String |
getSecretToken()
Get the secret token.
|
ServicesApi |
getServicesApi()
Gets the ServicesApi instance owned by this GitLabApi instance.
|
Session |
getSession()
Deprecated.
This method will be removed in Release 4.9.0
|
SessionApi |
getSessionApi()
Gets the SessionApi instance owned by this GitLabApi instance.
|
SnippetsApi |
getSnippetApi()
Gets the SnippetsApi instance owned by this GitLabApi instance.
|
Integer |
getSudoAsId()
Get the current sudo as ID, will return null if not in sudo mode.
|
SystemHooksApi |
getSystemHooksApi()
Gets the SystemHooksApi instance owned by this GitLabApi instance.
|
TagsApi |
getTagsApi()
Gets the TagsApi instance owned by this GitLabApi instance.
|
TodosApi |
getTodosApi()
Gets the TodosApi instance owned by this GitLabApi instance.
|
Constants.TokenType |
getTokenType()
Get the TokenType this client is using.
|
UserApi |
getUserApi()
Gets the UserApi instance owned by this GitLabApi instance.
|
Version |
getVersion()
Get the version info for the GitLab server using the GitLab Version API.
|
WikisApi |
getWikisApi()
Gets the WikisApi instance owned by this GitLabApi instance.
|
static GitLabApi |
login(GitLabApi.ApiVersion apiVersion,
String url,
String username,
String password)
Deprecated.
As of release 4.8.7, will be removed in 4.9.0
|
static GitLabApi |
login(GitLabApi.ApiVersion apiVersion,
String url,
String username,
String password,
boolean ignoreCertificateErrors)
Deprecated.
As of release 4.8.7, will be removed in 4.9.0
|
static GitLabApi |
login(String url,
String username,
String password)
Deprecated.
As of release 4.8.7, will be removed in 4.9.0
|
static GitLabApi |
login(String url,
String username,
String password,
boolean ignoreCertificateErrors)
Deprecated.
As of release 4.8.7, will be removed in 4.9.0
|
static GitLabApi |
oauth2Login(GitLabApi.ApiVersion apiVersion,
String url,
String username,
char[] password,
String secretToken,
Map<String,Object> clientConfigProperties,
boolean ignoreCertificateErrors)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static GitLabApi |
oauth2Login(GitLabApi.ApiVersion apiVersion,
String url,
String username,
CharSequence password,
String secretToken,
Map<String,Object> clientConfigProperties,
boolean ignoreCertificateErrors)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static GitLabApi |
oauth2Login(String url,
String username,
char[] password)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static GitLabApi |
oauth2Login(String url,
String username,
char[] password,
boolean ignoreCertificateErrors)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static GitLabApi |
oauth2Login(String url,
String username,
char[] password,
String secretToken,
Map<String,Object> clientConfigProperties,
boolean ignoreCertificateErrors)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static GitLabApi |
oauth2Login(String url,
String username,
CharSequence password)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static GitLabApi |
oauth2Login(String url,
String username,
CharSequence password,
boolean ignoreCertificateErrors)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static GitLabApi |
oauth2Login(String url,
String username,
CharSequence password,
String secretToken,
Map<String,Object> clientConfigProperties,
boolean ignoreCertificateErrors)
Logs into GitLab using OAuth2 with the provided
username and password ,
and creates a new GitLabApi instance using returned access token. |
static <T> T |
orElseThrow(Optional<T> optional)
Return the Optional instances contained value, if present, otherwise throw the exception that is
associated with the Optional instance.
|
void |
setDefaultPerPage(int defaultPerPage)
Set the default number per page for calls that return multiple items.
|
void |
setIgnoreCertificateErrors(boolean ignoreCertificateErrors)
Sets up the Jersey system ignore SSL certificate errors or not.
|
void |
setSudoAsId(Integer sudoAsId)
Sets up all future calls to the GitLab API to be done as another user specified by provided user ID.
|
void |
sudo(String sudoAsUsername)
Sets up all future calls to the GitLab API to be done as another user specified by sudoAsUsername.
|
void |
unsudo()
Turns off the currently configured sudo as ID.
|
GitLabApi |
withRequestResponseLogging()
Enable the logging of the requests to and the responses from the GitLab server API
using the GitLab4J shared Logger instance and Level.FINE as the level.
|
GitLabApi |
withRequestResponseLogging(Level level)
Enable the logging of the requests to and the responses from the GitLab server API
using the GitLab4J shared Logger instance.
|
GitLabApi |
withRequestResponseLogging(Logger logger,
Level level)
Enable the logging of the requests to and the responses from the GitLab server API.
|
public static final int DEFAULT_PER_PAGE
public GitLabApi(GitLabApi.ApiVersion apiVersion, String hostUrl, Constants.TokenType tokenType, String authToken)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab servertokenType
- the type of auth the token is for, PRIVATE or ACCESSauthToken
- the token to use for access to the APIpublic GitLabApi(GitLabApi.ApiVersion apiVersion, String hostUrl, String privateToken)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab serverprivateToken
- to private token to use for access to the APIpublic GitLabApi(String hostUrl, Constants.TokenType tokenType, String authToken)
hostUrl
- the URL of the GitLab servertokenType
- the type of auth the token is for, PRIVATE or ACCESSauthToken
- the token to use for access to the APIpublic GitLabApi(String hostUrl, String privateToken)
hostUrl
- the URL of the GitLab serverprivateToken
- to private token to use for access to the APIpublic GitLabApi(GitLabApi.ApiVersion apiVersion, String hostUrl, Session session)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab serversession
- the Session instance obtained by logining into the GitLab serverpublic GitLabApi(String hostUrl, Session session)
hostUrl
- the URL of the GitLab serversession
- the Session instance obtained by logining into the GitLab serverpublic GitLabApi(GitLabApi.ApiVersion apiVersion, String hostUrl, Constants.TokenType tokenType, String authToken, String secretToken)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab servertokenType
- the type of auth the token is for, PRIVATE or ACCESSauthToken
- the token to use for access to the APIsecretToken
- use this token to validate received payloadspublic GitLabApi(GitLabApi.ApiVersion apiVersion, String hostUrl, String privateToken, String secretToken)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab serverprivateToken
- to private token to use for access to the APIsecretToken
- use this token to validate received payloadspublic GitLabApi(String hostUrl, Constants.TokenType tokenType, String authToken, String secretToken)
hostUrl
- the URL of the GitLab servertokenType
- the type of auth the token is for, PRIVATE or ACCESSauthToken
- the token to use for access to the APIsecretToken
- use this token to validate received payloadspublic GitLabApi(String hostUrl, String privateToken, String secretToken)
hostUrl
- the URL of the GitLab serverprivateToken
- to private token to use for access to the APIsecretToken
- use this token to validate received payloadspublic GitLabApi(GitLabApi.ApiVersion apiVersion, String hostUrl, String privateToken, String secretToken, Map<String,Object> clientConfigProperties)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab serverprivateToken
- to private token to use for access to the APIsecretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionpublic GitLabApi(String hostUrl, Constants.TokenType tokenType, String authToken, String secretToken, Map<String,Object> clientConfigProperties)
hostUrl
- the URL of the GitLab servertokenType
- the type of auth the token is for, PRIVATE or ACCESSauthToken
- the token to use for access to the APIsecretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionpublic GitLabApi(String hostUrl, String privateToken, String secretToken, Map<String,Object> clientConfigProperties)
hostUrl
- the URL of the GitLab serverprivateToken
- to private token to use for access to the APIsecretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionpublic GitLabApi(GitLabApi.ApiVersion apiVersion, String hostUrl, Constants.TokenType tokenType, String authToken, String secretToken, Map<String,Object> clientConfigProperties)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab servertokenType
- the type of auth the token is for, PRIVATE or ACCESSauthToken
- to token to use for access to the APIsecretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionpublic static final Logger getLogger()
public final GitLabApi duplicate()
public static GitLabApi oauth2Login(String url, String username, CharSequence password) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- a CharSequence containing the password for a given username
GitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during executionpublic static GitLabApi oauth2Login(String url, String username, char[] password) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- a char array holding the password for a given username
GitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during executionpublic static GitLabApi oauth2Login(String url, String username, CharSequence password, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- a CharSequence containing the password for a given username
ignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during executionpublic static GitLabApi oauth2Login(String url, String username, char[] password, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- a char array holding the password for a given username
ignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during executionpublic static GitLabApi oauth2Login(String url, String username, CharSequence password, String secretToken, Map<String,Object> clientConfigProperties, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- a CharSequence containing the password for a given username
secretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during executionpublic static GitLabApi oauth2Login(String url, String username, char[] password, String secretToken, Map<String,Object> clientConfigProperties, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- a char array holding the password for a given username
secretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during executionpublic static GitLabApi oauth2Login(GitLabApi.ApiVersion apiVersion, String url, String username, char[] password, String secretToken, Map<String,Object> clientConfigProperties, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLapiVersion
- the ApiVersion specifying which version of the API to useusername
- user name for which private token should be obtainedpassword
- a char array holding the password for a given username
secretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during executionpublic static GitLabApi oauth2Login(GitLabApi.ApiVersion apiVersion, String url, String username, CharSequence password, String secretToken, Map<String,Object> clientConfigProperties, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using OAuth2 with the provided username
and password
,
and creates a new GitLabApi
instance using returned access token.
url
- GitLab URLapiVersion
- the ApiVersion specifying which version of the API to useusername
- user name for which private token should be obtainedpassword
- password for a given username
secretToken
- use this token to validate received payloadsclientConfigProperties
- Map instance with additional properties for the Jersey client connectionignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during execution@Deprecated public static GitLabApi login(GitLabApi.ApiVersion apiVersion, String url, String username, String password) throws GitLabApiException
Logs into GitLab using provided username
and password
, and creates a new GitLabApi
instance
using returned private token and the specified GitLab API version.
apiVersion
- the ApiVersion specifying which version of the API to useurl
- GitLab URLusername
- user name for which private token should be obtainedpassword
- password for a given username
GitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during execution@Deprecated public static GitLabApi login(String url, String username, String password) throws GitLabApiException
Logs into GitLab using provided username
and password
, and creates a new GitLabApi
instance
using returned private token using GitLab API version 4.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- password for a given username
GitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during execution@Deprecated public static GitLabApi login(GitLabApi.ApiVersion apiVersion, String url, String username, String password, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using provided username
and password
, and creates a new GitLabApi
instance
using returned private token and the specified GitLab API version.
apiVersion
- the ApiVersion specifying which version of the API to useurl
- GitLab URLusername
- user name for which private token should be obtainedpassword
- password for a given username
ignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during execution@Deprecated public static GitLabApi login(String url, String username, String password, boolean ignoreCertificateErrors) throws GitLabApiException
Logs into GitLab using provided username
and password
, and creates a new GitLabApi
instance
using returned private token using GitLab API version 4.
url
- GitLab URLusername
- user name for which private token should be obtainedpassword
- password for a given username
ignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorsGitLabApi
instance configured for a user-specific tokenGitLabApiException
- GitLabApiException if any exception occurs during execution@Deprecated public Session getSession()
If this instance was created with login(String, String, String)
this method will
return the Session instance returned by the GitLab API on login, otherwise returns null.
public GitLabApi withRequestResponseLogging()
public GitLabApi withRequestResponseLogging(Level level)
level
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)public GitLabApi withRequestResponseLogging(Logger logger, Level level)
logger
- the Logger instance to log tolevel
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)public void enableRequestResponseLogging()
public void enableRequestResponseLogging(Level level)
level
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)public void enableRequestResponseLogging(Logger logger, Level level)
logger
- the Logger instance to log tolevel
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)public void enableRequestResponseLogging(Level level, int maxEntitySize)
level
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)maxEntitySize
- maximum number of entity bytes to be logged. When logging if the maxEntitySize
is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at
the end of the log entry. If maxEntitySize is <= 0, entity logging will be disabledpublic void enableRequestResponseLogging(Logger logger, Level level, int maxEntitySize)
logger
- the Logger instance to log tolevel
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)maxEntitySize
- maximum number of entity bytes to be logged. When logging if the maxEntitySize
is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at
the end of the log entry. If maxEntitySize is <= 0, entity logging will be disabledpublic void enableRequestResponseLogging(Level level, List<String> maskedHeaderNames)
level
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)maskedHeaderNames
- a list of header names that should have the values maskedpublic void enableRequestResponseLogging(Logger logger, Level level, List<String> maskedHeaderNames)
logger
- the Logger instance to log tolevel
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)maskedHeaderNames
- a list of header names that should have the values maskedpublic void enableRequestResponseLogging(Level level, int maxEntitySize, List<String> maskedHeaderNames)
level
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)maxEntitySize
- maximum number of entity bytes to be logged. When logging if the maxEntitySize
is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at
the end of the log entry. If maxEntitySize is <= 0, entity logging will be disabledmaskedHeaderNames
- a list of header names that should have the values maskedpublic void enableRequestResponseLogging(Logger logger, Level level, int maxEntitySize, List<String> maskedHeaderNames)
logger
- the Logger instance to log tolevel
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)maxEntitySize
- maximum number of entity bytes to be logged. When logging if the maxEntitySize
is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at
the end of the log entry. If maxEntitySize is <= 0, entity logging will be disabledmaskedHeaderNames
- a list of header names that should have the values maskedpublic void sudo(String sudoAsUsername) throws GitLabApiException
sudoAsUsername
- the username to sudo as, null will turn off sudoGitLabApiException
- if any exception occurspublic void unsudo()
public void setSudoAsId(Integer sudoAsId) throws GitLabApiException
sudoAsId
- the ID of the user to sudo as, null will turn off sudoGitLabApiException
- if any exception occurspublic Integer getSudoAsId()
public String getAuthToken()
public String getSecretToken()
public Constants.TokenType getTokenType()
public GitLabApi.ApiVersion getApiVersion()
public String getGitLabServerUrl()
public int getDefaultPerPage()
public void setDefaultPerPage(int defaultPerPage)
defaultPerPage
- the new default number per page for calls that return multiple itempublic boolean getIgnoreCertificateErrors()
public void setIgnoreCertificateErrors(boolean ignoreCertificateErrors)
ignoreCertificateErrors
- if true will set up the Jersey system ignore SSL certificate errorspublic Version getVersion() throws GitLabApiException
GitLabApiException
- if any exception occurspublic ApplicationsApi getApplicationsApi()
public ApplicationSettingsApi getApplicationSettingsApi()
public AwardEmojiApi getAwardEmojiApi()
public BoardsApi getBoardsApi()
public CommitsApi getCommitsApi()
public ContainerRegistryApi getContainerRegistryApi()
public DeployKeysApi getDeployKeysApi()
public DiscussionsApi getDiscussionsApi()
public EnvironmentsApi getEnvironmentsApi()
public EpicsApi getEpicsApi()
public EventsApi getEventsApi()
public GroupApi getGroupApi()
public HealthCheckApi getHealthCheckApi()
public ImportExportApi getImportExportApi()
public IssuesApi getIssuesApi()
public JobApi getJobApi()
public LabelsApi getLabelsApi()
public LicenseApi getLicenseApi()
public LicenseTemplatesApi getLicenseTemplatesApi()
public MarkdownApi getMarkdownApi()
public MergeRequestApi getMergeRequestApi()
public MilestonesApi getMilestonesApi()
public NamespaceApi getNamespaceApi()
public NotesApi getNotesApi()
public NotificationSettingsApi getNotificationSettingsApi()
public PackagesApi getPackagesApi()
public PipelineApi getPipelineApi()
public ProjectApi getProjectApi()
public ProtectedBranchesApi getProtectedBranchesApi()
public RepositoryApi getRepositoryApi()
public RepositoryFileApi getRepositoryFileApi()
public RunnersApi getRunnersApi()
public SearchApi getSearchApi()
public ServicesApi getServicesApi()
public SessionApi getSessionApi()
public SystemHooksApi getSystemHooksApi()
public TagsApi getTagsApi()
public SnippetsApi getSnippetApi()
public TodosApi getTodosApi()
public UserApi getUserApi()
public WikisApi getWikisApi()
protected static final <T> Optional<T> createOptionalFromException(GitLabApiException glae)
T
- the type of the Optional instanceglae
- the GitLabApiException that was the result of a call to the GitLab APIpublic static final GitLabApiException getOptionalException(Optional<?> optional)
optional
- the Optional instance to get the exception forpublic static final <T> T orElseThrow(Optional<T> optional) throws GitLabApiException
T
- the type for the Optional parameteroptional
- the Optional instance to get the value forGitLabApiException
- if there was an exception associated with the Optional instanceCopyright © 2019. All rights reserved.