Skip to content

Commit

Permalink
Fix type of ExpiresAt field
Browse files Browse the repository at this point in the history
  • Loading branch information
dieterdemeyer committed Apr 3, 2024
1 parent be6bc9f commit f0156f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion group_serviceaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (s *GroupsService) CreateServiceAccount(gid interface{}, options ...Request
type CreateServiceAccountPersonalAccessTokenOptions struct {
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"`
ExpiresAt *ISOTime `url:"expires_at,omitempty" json:"expires_at,omitempty"`
}

// CreateServiceAccountPersonalAccessToken add a new Personal Access Token for a
Expand Down
7 changes: 6 additions & 1 deletion group_serviceaccounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package gitlab

import (
"fmt"
"github.com/stretchr/testify/require"
"net/http"
"reflect"
"testing"
Expand Down Expand Up @@ -72,10 +73,14 @@ func TestCreateServiceAccountPersonalAccessToken(t *testing.T) {
"token":"random_token"
}`)
})

expireTime, err := ParseISOTime("2024-06-12")
require.NoError(t, err)

options := &CreateServiceAccountPersonalAccessTokenOptions{
Scopes: Ptr([]string{"api"}),
Name: Ptr("service_account_token"),
ExpiresAt: Ptr("2024-06-12"),
ExpiresAt: Ptr(expireTime),
}
pat, _, err := client.Groups.CreateServiceAccountPersonalAccessToken(1, 57, options)
if err != nil {
Expand Down

0 comments on commit f0156f0

Please sign in to comment.