public class GitLabApi
extends java.lang.Object
implements java.lang.AutoCloseable
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,
java.lang.String hostUrl,
Constants.TokenType tokenType,
java.lang.String authToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
java.lang.String hostUrl,
Constants.TokenType tokenType,
java.lang.String authToken,
java.lang.String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
java.lang.String hostUrl,
Constants.TokenType tokenType,
java.lang.String authToken,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server specified by GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
java.lang.String hostUrl,
java.lang.String personalAccessToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
java.lang.String hostUrl,
java.lang.String personalAccessToken,
java.lang.String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using the specified GitLab API version.
|
GitLabApi(GitLabApi.ApiVersion apiVersion,
java.lang.String hostUrl,
java.lang.String personalAccessToken,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server specified by GitLab API version.
|
GitLabApi(java.lang.String hostUrl,
Constants.TokenType tokenType,
java.lang.String authToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(java.lang.String hostUrl,
Constants.TokenType tokenType,
java.lang.String authToken,
java.lang.String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(java.lang.String hostUrl,
Constants.TokenType tokenType,
java.lang.String authToken,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(java.lang.String hostUrl,
java.lang.String personalAccessToken)
Constructs a GitLabApi instance set up to interact with the GitLab server
using GitLab API version 4.
|
GitLabApi(java.lang.String hostUrl,
java.lang.String personalAccessToken,
java.util.Map<java.lang.String,java.lang.Object> clientConfigProperties)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(java.lang.String hostUrl,
java.lang.String personalAccessToken,
java.lang.String secretToken)
Constructs a GitLabApi instance set up to interact with the GitLab server using GitLab API version 4.
|
GitLabApi(java.lang.String hostUrl,
java.lang.String personalAccessToken,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.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 |
---|---|
void |
close()
Close the underlying
Client and its associated resources. |
protected static <T> java.util.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 of 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(java.util.logging.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(java.util.logging.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(java.util.logging.Level level,
int maxEntitySize,
java.util.List<java.lang.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(java.util.logging.Level level,
java.util.List<java.lang.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(java.util.logging.Logger logger,
java.util.logging.Level level)
Enable the logging of the requests to and the responses from the GitLab server API using the
specified logger.
|
void |
enableRequestResponseLogging(java.util.logging.Logger logger,
java.util.logging.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(java.util.logging.Logger logger,
java.util.logging.Level level,
int maxEntitySize,
java.util.List<java.lang.String> maskedHeaderNames)
Enable the logging of the requests to and the responses from the GitLab server API using the
specified logger.
|
void |
enableRequestResponseLogging(java.util.logging.Logger logger,
java.util.logging.Level level,
java.util.List<java.lang.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.
|
AuditEventApi |
getAuditEventApi()
Gets the AuditEventApi instance owned by this GitLabApi instance.
|
java.lang.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.
|
DeploymentsApi |
getDeploymentsApi()
Gets the DeployKeysApi instance owned by this GitLabApi instance.
|
DeployTokensApi |
getDeployTokensApi()
Gets the DeployTokensApi 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.
|
ExternalStatusCheckApi |
getExternalStatusCheckApi()
Gets the ExternalStatusCheckApi instance owned by this GitLabApi instance.
|
GitLabCiYamlApi |
getGitLabCiYamlApi()
Gets the GitLabCiYamlApi instance owned by this GitLabApi instance.
|
java.lang.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.
|
KeysApi |
getKeysAPI()
Gets the KeysApi 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 java.util.logging.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.
|
MetadataApi |
getMetadataApi()
Gets the MetadataApi 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(java.util.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.
|
ReleaseLinksApi |
getReleaseLinksApi()
Gets the ReleaseLinksApi instance owned by this GitLabApi instance.
|
ReleasesApi |
getReleasesApi()
Gets the ReleasesApi 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.
|
ResourceLabelEventsApi |
getResourceLabelEventsApi()
Gets the ResourceLabelEventsApi instance owned by this GitLabApi instance.
|
ResourceStateEventsApi |
getResourceStateEventsApi()
Gets the ResourceStateEventsApi 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.
|
java.lang.String |
getSecretToken()
Get the secret token.
|
ServicesApi |
getServicesApi()
Gets the ServicesApi instance owned by this GitLabApi instance.
|
SnippetsApi |
getSnippetApi()
Gets the SnippetsApi instance owned by this GitLabApi instance.
|
java.lang.Long |
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.
|
TopicsApi |
getTopicsApi()
Gets the TagsApi instance owned by this GitLabApi instance.
|
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 |
oauth2Login(GitLabApi.ApiVersion apiVersion,
java.lang.String url,
java.lang.String username,
char[] password,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.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,
java.lang.String url,
java.lang.String username,
java.lang.CharSequence password,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.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(java.lang.String url,
java.lang.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(java.lang.String url,
java.lang.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(java.lang.String url,
java.lang.String username,
char[] password,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.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(java.lang.String url,
java.lang.String username,
java.lang.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(java.lang.String url,
java.lang.String username,
java.lang.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(java.lang.String url,
java.lang.String username,
java.lang.CharSequence password,
java.lang.String secretToken,
java.util.Map<java.lang.String,java.lang.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(java.util.Optional<T> optional)
Return the Optional instances contained value, if present, otherwise throw the exception that is
associated with the Optional instance.
|
void |
setAuthTokenSupplier(java.util.function.Supplier<java.lang.String> authTokenSupplier)
Set auth token supplier for gitlab api client.
|
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 |
setRequestTimeout(java.lang.Integer connectTimeout,
java.lang.Integer readTimeout)
Sets the per request connect and read timeout.
|
void |
setSudoAsId(java.lang.Long sudoAsId)
Sets up all future calls to the GitLab API to be done as another user specified by provided user ID.
|
void |
sudo(java.lang.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(java.util.logging.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(java.util.logging.Logger logger,
java.util.logging.Level level)
Enable the logging of the requests to and the responses from the GitLab server API.
|
GitLabApi |
withRequestTimeout(java.lang.Integer connectTimeout,
java.lang.Integer readTimeout)
Fluent method that sets the per request connect and read timeout.
|
public static final int DEFAULT_PER_PAGE
public GitLabApi(java.lang.String hostUrl, java.lang.String personalAccessToken)
hostUrl
- the URL of the GitLab serverpersonalAccessToken
- the private token to use for access to the APIpublic GitLabApi(java.lang.String hostUrl, java.lang.String personalAccessToken, java.lang.String secretToken)
hostUrl
- the URL of the GitLab serverpersonalAccessToken
- the private token to use for access to the APIsecretToken
- use this token to validate received payloadspublic GitLabApi(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, java.lang.String personalAccessToken)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab serverpersonalAccessToken
- the private token to use for access to the APIpublic GitLabApi(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, java.lang.String personalAccessToken, java.lang.String secretToken)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab serverpersonalAccessToken
- the private token to use for access to the APIsecretToken
- use this token to validate received payloadspublic GitLabApi(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.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(java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.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(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken, java.lang.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(java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken, java.lang.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(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, java.lang.String personalAccessToken, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.Object> clientConfigProperties)
apiVersion
- the ApiVersion specifying which version of the API to usehostUrl
- the URL of the GitLab serverpersonalAccessToken
- 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(java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.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(java.lang.String hostUrl, java.lang.String personalAccessToken, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.Object> clientConfigProperties)
hostUrl
- the URL of the GitLab serverpersonalAccessToken
- the 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(java.lang.String hostUrl, java.lang.String personalAccessToken, java.util.Map<java.lang.String,java.lang.Object> clientConfigProperties)
hostUrl
- the URL of the GitLab serverpersonalAccessToken
- the private token to use for access to the APIclientConfigProperties
- Map instance with additional properties for the Jersey client connectionpublic GitLabApi(GitLabApi.ApiVersion apiVersion, java.lang.String hostUrl, Constants.TokenType tokenType, java.lang.String authToken, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.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 java.util.logging.Logger getLogger()
public static GitLabApi oauth2Login(java.lang.String url, java.lang.String username, java.lang.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(java.lang.String url, java.lang.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(java.lang.String url, java.lang.String username, java.lang.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(java.lang.String url, java.lang.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(java.lang.String url, java.lang.String username, java.lang.CharSequence password, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.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(java.lang.String url, java.lang.String username, char[] password, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.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, java.lang.String url, java.lang.String username, char[] password, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.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, java.lang.String url, java.lang.String username, java.lang.CharSequence password, java.lang.String secretToken, java.util.Map<java.lang.String,java.lang.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 executionpublic final GitLabApi duplicate()
public void close()
Client
and its associated resources.close
in interface java.lang.AutoCloseable
public void setRequestTimeout(java.lang.Integer connectTimeout, java.lang.Integer readTimeout)
connectTimeout
- the per request connect timeout in milliseconds, can be null to use defaultreadTimeout
- the per request read timeout in milliseconds, can be null to use defaultpublic GitLabApi withRequestTimeout(java.lang.Integer connectTimeout, java.lang.Integer readTimeout)
connectTimeout
- the per request connect timeout in milliseconds, can be null to use defaultreadTimeout
- the per request read timeout in milliseconds, can be null to use defaultpublic GitLabApi withRequestResponseLogging()
public GitLabApi withRequestResponseLogging(java.util.logging.Level level)
level
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)public GitLabApi withRequestResponseLogging(java.util.logging.Logger logger, java.util.logging.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(java.util.logging.Level level)
level
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)public void enableRequestResponseLogging(java.util.logging.Logger logger, java.util.logging.Level level)
logger
- the Logger instance to log tolevel
- the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)public void enableRequestResponseLogging(java.util.logging.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(java.util.logging.Logger logger, java.util.logging.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(java.util.logging.Level level, java.util.List<java.lang.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(java.util.logging.Logger logger, java.util.logging.Level level, java.util.List<java.lang.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(java.util.logging.Level level, int maxEntitySize, java.util.List<java.lang.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(java.util.logging.Logger logger, java.util.logging.Level level, int maxEntitySize, java.util.List<java.lang.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(java.lang.String sudoAsUsername) throws GitLabApiException
sudoAsUsername
- the username to sudo as, null will turn off sudoGitLabApiException
- if any exception occurspublic void unsudo()
public void setSudoAsId(java.lang.Long sudoAsId) throws GitLabApiException
sudoAsId
- the ID of the user to sudo as, null will turn off sudoGitLabApiException
- if any exception occurspublic java.lang.Long getSudoAsId()
public java.lang.String getAuthToken()
public void setAuthTokenSupplier(java.util.function.Supplier<java.lang.String> authTokenSupplier)
authTokenSupplier
- - supplier which provide actual auth tokenpublic java.lang.String getSecretToken()
public Constants.TokenType getTokenType()
public GitLabApi.ApiVersion getApiVersion()
public java.lang.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 AuditEventApi getAuditEventApi()
public AwardEmojiApi getAwardEmojiApi()
public BoardsApi getBoardsApi()
public CommitsApi getCommitsApi()
public ContainerRegistryApi getContainerRegistryApi()
public DeployKeysApi getDeployKeysApi()
public DeploymentsApi getDeploymentsApi()
public DeployTokensApi getDeployTokensApi()
public DiscussionsApi getDiscussionsApi()
public EnvironmentsApi getEnvironmentsApi()
public EpicsApi getEpicsApi()
public EventsApi getEventsApi()
public ExternalStatusCheckApi getExternalStatusCheckApi()
public GitLabCiYamlApi getGitLabCiYamlApi()
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 ReleaseLinksApi getReleaseLinksApi()
public ReleasesApi getReleasesApi()
public RepositoryApi getRepositoryApi()
public RepositoryFileApi getRepositoryFileApi()
public ResourceLabelEventsApi getResourceLabelEventsApi()
public ResourceStateEventsApi getResourceStateEventsApi()
public RunnersApi getRunnersApi()
public SearchApi getSearchApi()
public ServicesApi getServicesApi()
public SystemHooksApi getSystemHooksApi()
public TagsApi getTagsApi()
public TopicsApi getTopicsApi()
public SnippetsApi getSnippetApi()
public TodosApi getTodosApi()
public UserApi getUserApi()
public WikisApi getWikisApi()
public KeysApi getKeysAPI()
public MetadataApi getMetadataApi()
protected static final <T> java.util.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(java.util.Optional<?> optional)
optional
- the Optional instance to get the exception forpublic static final <T> T orElseThrow(java.util.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 instance