Skip to content

Add State to ListProjectAccessTokensOptions

Created by: elchenberg

GitLab 17.2 added the state attribute to the ListProjectAccessTokens API: https://docs.gitlab.com/ee/api/project_access_tokens.html#list-project-access-tokens

I am not very experienced with Go but since it seems to be a small change I might give it a try and open a pull request if it is okay with you:

diff --git a/project_access_tokens.go b/project_access_tokens.go
index 2d6057e..4191a2d 100644
--- a/project_access_tokens.go
+++ b/project_access_tokens.go
@@ -56,7 +56,11 @@ func (v ProjectAccessToken) String() string {
 //
 // GitLab API docs:
 // https://docs.gitlab.com/ee/api/project_access_tokens.html#list-project-access-tokens
-type ListProjectAccessTokensOptions ListOptions
+type ListProjectAccessTokensOptions struct {
+       ListOptions
+       // Limit results to tokens with specified state. Valid values are active and inactive. By default both states are returned.
+       State *string `url:"state,omitempty" json:"state,omitempty"`
+}
 
 // ListProjectAccessTokens gets a list of all project access tokens in a
 // project.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information