Skip to content

Commit

Permalink
Add support for setting token expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
dieterdemeyer committed Apr 2, 2024
1 parent f7ec87b commit be6bc9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions group_serviceaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ func (s *GroupsService) CreateServiceAccount(gid interface{}, options ...Request
// GitLab API docs:
// https://docs.gitlab.com/ee/api/groups.html#create-personal-access-token-for-service-account-user
type CreateServiceAccountPersonalAccessTokenOptions struct {
Scopes *[]string `url:"scopes,omitempty" json:"scopes,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
Scopes *[]string `url:"scopes,omitempty" json:"scopes,omitempty"`
Name *string `url:"name,omitempty" json:"name,omitempty"`
ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at,omitempty"`
}

// CreateServiceAccountPersonalAccessToken add a new Personal Access Token for a
Expand Down
5 changes: 3 additions & 2 deletions group_serviceaccounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ func TestCreateServiceAccountPersonalAccessToken(t *testing.T) {
}`)
})
options := &CreateServiceAccountPersonalAccessTokenOptions{
Scopes: Ptr([]string{"api"}),
Name: Ptr("service_account_token"),
Scopes: Ptr([]string{"api"}),
Name: Ptr("service_account_token"),
ExpiresAt: Ptr("2024-06-12"),
}
pat, _, err := client.Groups.CreateServiceAccountPersonalAccessToken(1, 57, options)
if err != nil {
Expand Down

0 comments on commit be6bc9f

Please sign in to comment.