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 |
---|---|
static GitLabApi |
create(String url,
String username,
String password)
Deprecated.
As of release 4.2.0, replaced by
login(String, String, String) |
GitLabApi.ApiVersion |
getApiVersion()
Return the GitLab API version that this instance is using.
|
CommitsApi |
getCommitsApi()
Gets the CommitsApi 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.
|
EventsApi |
getEventsApi()
Gets the EventsApi instance owned by this GitLabApi instance.
|
GroupApi |
getGroupApi()
Gets the GroupApi instance owned by this GitLabApi instance.
|
boolean |
getIgnoreCertificateErrors()
Returns true if the API is setup to ignore SSL certificate errors, otherwise returns false.
|
IssuesApi |
getIssuesApi()
Gets the IssuesApi instance owned by this GitLabApi instance.
|
JobApi |
getJobApi()
Gets the JobApi instance owned by this GitLabApi instance.
|
MergeRequestApi |
getMergeRequestApi()
Gets the MergeRequestApi 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.
|
PipelineApi |
getPipelineApi()
Gets the PipelineApi instance owned by this GitLabApi instance.
|
ProjectApi |
getProjectApi()
Gets the ProjectApi 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.
|
ServicesApi |
getServicesApi()
Gets the ServicesApi instance owned by this GitLabApi instance.
|
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. |
SessionApi |
getSessionApi()
Gets the SessionApi instance owned by this GitLabApi instance.
|
Integer |
getSudoAsId()
Get the current sudo as ID, will return null if not in sudo mode.
|
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.
|
static GitLabApi |
login(GitLabApi.ApiVersion apiVersion,
String url,
String username,
String password)
Logs into GitLab using provided
username and password , and creates a new GitLabApi instance
using returned private token and the specified GitLab API version. |
static GitLabApi |
login(String url,
String username,
String password)
Logs into GitLab using provided
username and password , and creates a new GitLabApi instance
using returned private token using GitLab API version 4. |
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 |
setNamespaceApi(NamespaceApi namespaceApi) |
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.
|
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 GitLabApi login(GitLabApi.ApiVersion apiVersion, String url, String username, String password) throws GitLabApiException
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 executionpublic static GitLabApi login(String url, String username, String password) throws GitLabApiException
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 create(String url, String username, String password) throws GitLabApiException
login(String, String, String)
username
and password
, and creates a new GitLabApi
instance
using returned private token and specified GitLab API version.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 executionpublic Session getSession()
login(String, String, String)
this method will
return the Session instance returned by the GitLab API on login, otherwise returns null.public 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 GitLabApi.ApiVersion getApiVersion()
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 CommitsApi getCommitsApi()
public DeployKeysApi getDeployKeysApi()
public EventsApi getEventsApi()
public GroupApi getGroupApi()
public IssuesApi getIssuesApi()
public JobApi getJobApi()
public MergeRequestApi getMergeRequestApi()
public NamespaceApi getNamespaceApi()
public void setNamespaceApi(NamespaceApi namespaceApi)
public NotesApi getNotesApi()
public PipelineApi getPipelineApi()
public ProjectApi getProjectApi()
public RepositoryApi getRepositoryApi()
public RepositoryFileApi getRepositoryFileApi()
public ServicesApi getServicesApi()
public SessionApi getSessionApi()
public UserApi getUserApi()
Copyright © 2017. All rights reserved.