Package org.gitlab4j.api
Class PersonalAccessTokenApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.PersonalAccessTokenApi
-
- All Implemented Interfaces:
org.gitlab4j.models.Constants
public class PersonalAccessTokenApi extends AbstractApi
This class provides an entry point to all the GitLab API personal access token calls.- See Also:
- Personal access token API at GitLab
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.gitlab4j.models.Constants
org.gitlab4j.models.Constants.ActionType, org.gitlab4j.models.Constants.ApplicationScope, org.gitlab4j.models.Constants.ArchiveFormat, org.gitlab4j.models.Constants.AutoCancelPendingPipelines, org.gitlab4j.models.Constants.AutoDevopsDeployStrategy, org.gitlab4j.models.Constants.BuildGitStrategy, org.gitlab4j.models.Constants.CommitBuildState, org.gitlab4j.models.Constants.ContributorOrderBy, org.gitlab4j.models.Constants.DefaultBranchProtectionLevel, org.gitlab4j.models.Constants.DeploymentOrderBy, org.gitlab4j.models.Constants.DeploymentStatus, org.gitlab4j.models.Constants.DeployTokenScope, org.gitlab4j.models.Constants.Encoding, org.gitlab4j.models.Constants.EpicOrderBy, org.gitlab4j.models.Constants.EventScope, org.gitlab4j.models.Constants.GroupOrderBy, org.gitlab4j.models.Constants.GroupSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.ImpersonationState, org.gitlab4j.models.Constants.IssueOrderBy, org.gitlab4j.models.Constants.IssueScope, org.gitlab4j.models.Constants.IssueState, org.gitlab4j.models.Constants.JobScope, org.gitlab4j.models.Constants.LineType, org.gitlab4j.models.Constants.MergeRequestOrderBy, org.gitlab4j.models.Constants.MergeRequestScope, org.gitlab4j.models.Constants.MergeRequestSearchIn, org.gitlab4j.models.Constants.MergeRequestState, org.gitlab4j.models.Constants.MilestoneState, org.gitlab4j.models.Constants.PackageOrderBy, org.gitlab4j.models.Constants.PackageStatus, org.gitlab4j.models.Constants.PipelineOrderBy, org.gitlab4j.models.Constants.PipelineScope, org.gitlab4j.models.Constants.PipelineSource, org.gitlab4j.models.Constants.ProjectAccessTokenScope, org.gitlab4j.models.Constants.ProjectCreationLevel, org.gitlab4j.models.Constants.ProjectFeatureVisibilityAccessLevel, org.gitlab4j.models.Constants.ProjectOrderBy, org.gitlab4j.models.Constants.ProjectSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SortOrder, org.gitlab4j.models.Constants.SquashOption, org.gitlab4j.models.Constants.StateEvent, org.gitlab4j.models.Constants.SubgroupCreationLevel, org.gitlab4j.models.Constants.TagOrderBy, org.gitlab4j.models.Constants.TargetType, org.gitlab4j.models.Constants.TodoAction, org.gitlab4j.models.Constants.TodoState, org.gitlab4j.models.Constants.TodoType, org.gitlab4j.models.Constants.TokenType
-
-
Field Summary
-
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
-
-
Constructor Summary
Constructors Constructor Description PersonalAccessTokenApi(GitLabApi gitLabApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.gitlab4j.api.models.PersonalAccessToken
getPersonalAccessToken()
Get information about the personal access token used in the request header.org.gitlab4j.api.models.PersonalAccessToken
getPersonalAccessToken(java.lang.String id)
Get a specific personal access token.java.util.List<org.gitlab4j.api.models.PersonalAccessToken>
getPersonalAccessTokens()
Get information about the personal access token used in the request header.void
revokePersonalAccessToken(java.lang.Long tokenId)
Revokes a personal access token.org.gitlab4j.api.models.PersonalAccessToken
rotatePersonalAccessToken()
Rotates the given personal access token.org.gitlab4j.api.models.PersonalAccessToken
rotatePersonalAccessToken(java.lang.String id, java.util.Date expiresAt)
Rotates a specific personal access token.org.gitlab4j.api.models.PersonalAccessToken
rotatePersonalAccessToken(java.util.Date expiresAt)
Rotates the personal access token used in the request header.-
Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getNamespaceIdOrPath, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
-
-
-
Constructor Detail
-
PersonalAccessTokenApi
public PersonalAccessTokenApi(GitLabApi gitLabApi)
-
-
Method Detail
-
rotatePersonalAccessToken
public org.gitlab4j.api.models.PersonalAccessToken rotatePersonalAccessToken() throws GitLabApiException
Rotates the given personal access token. The token is revoked and a new one which will expire in one week is created to replace it. Only working with GitLab 16.0 and above.GitLab Endpoint: POST /personal_access_tokens/self/rotate
- Returns:
- the newly created PersonalAccessToken.
- Throws:
GitLabApiException
- if any exception occurs
-
rotatePersonalAccessToken
public org.gitlab4j.api.models.PersonalAccessToken rotatePersonalAccessToken(java.util.Date expiresAt) throws GitLabApiException
Rotates the personal access token used in the request header. The token is revoked and a new one which will expire at the given expiresAt-date is created to replace it. Only working with GitLab 16.0 and above.GitLab Endpoint: POST /personal_access_tokens/self/rotate
- Parameters:
expiresAt
- Expiration date of the access token- Returns:
- the newly created PersonalAccessToken.
- Throws:
GitLabApiException
- if any exception occurs
-
rotatePersonalAccessToken
public org.gitlab4j.api.models.PersonalAccessToken rotatePersonalAccessToken(java.lang.String id, java.util.Date expiresAt) throws GitLabApiException
Rotates a specific personal access token. The token is revoked and a new one which will expire at the given expiresAt-date is created to replace it. Only working with GitLab 16.0 and above.GitLab Endpoint: POST /personal_access_tokens/:id/rotate
- Parameters:
id
- ID of the personal access tokenexpiresAt
- Expiration date of the access token- Returns:
- the newly created PersonalAccessToken.
- Throws:
GitLabApiException
- if any exception occurs
-
getPersonalAccessTokens
public java.util.List<org.gitlab4j.api.models.PersonalAccessToken> getPersonalAccessTokens() throws GitLabApiException
Get information about the personal access token used in the request header. Only working with GitLab 16.0 and above.GitLab Endpoint: GET /personal_access_tokens
- Returns:
- the specified PersonalAccessToken.
- Throws:
GitLabApiException
- if any exception occurs
-
getPersonalAccessToken
public org.gitlab4j.api.models.PersonalAccessToken getPersonalAccessToken() throws GitLabApiException
Get information about the personal access token used in the request header. Only working with GitLab 16.0 and above.GitLab Endpoint: GET /personal_access_tokens/self
- Returns:
- the specified PersonalAccessToken.
- Throws:
GitLabApiException
- if any exception occurs
-
getPersonalAccessToken
public org.gitlab4j.api.models.PersonalAccessToken getPersonalAccessToken(java.lang.String id) throws GitLabApiException
Get a specific personal access token. Only working with GitLab 16.0 and above.GitLab Endpoint: GET /personal_access_tokens/:id
- Parameters:
id
- ID of the personal access token- Returns:
- the specified PersonalAccessToken.
- Throws:
GitLabApiException
- if any exception occurs
-
revokePersonalAccessToken
public void revokePersonalAccessToken(java.lang.Long tokenId) throws GitLabApiException
Revokes a personal access token. Available only for admin users.GitLab Endpoint: DELETE /personal_access_tokens/:token_id
- Parameters:
tokenId
- the personal access token ID to revoke- Throws:
GitLabApiException
- if any exception occurs
-
-