Skip to content

Commit

Permalink
feat: add role_name field for organization invitation and membership (#…
Browse files Browse the repository at this point in the history
…338)

* feat: add role_name field for organization invitation and membership

* test: add role_name to test respone
  • Loading branch information
NicolasLopes7 authored Oct 14, 2024
1 parent ad53b31 commit 1c70b6d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions organization_invitation.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type OrganizationInvitation struct {
ID string `json:"id"`
EmailAddress string `json:"email_address"`
Role string `json:"role"`
RoleName string `json:"role_name"`
OrganizationID string `json:"organization_id"`
PublicOrganizationData *PublicOrganizationData `json:"public_organization_data,omitempty"`
Status string `json:"status"`
Expand Down
1 change: 1 addition & 0 deletions organization_membership.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type OrganizationMembership struct {
PublicMetadata json.RawMessage `json:"public_metadata"`
PrivateMetadata json.RawMessage `json:"private_metadata"`
Role string `json:"role"`
RoleName string `json:"role_name"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
PublicUserData *OrganizationMembershipPublicUserData `json:"public_user_data,omitempty"`
Expand Down
4 changes: 3 additions & 1 deletion organizationinvitation/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestOrganizationInvitationClientGet(t *testing.T) {
config.HTTPClient = &http.Client{
Transport: &clerktest.RoundTripper{
T: t,
Out: json.RawMessage(fmt.Sprintf(`{"id":"%s","object":"organization_invitation","email_address":"string","role":"string","organization_id":"%s","status":"string","public_metadata":{},"private_metadata":{},"created_at":0,"updated_at":0}`, id, organizationID)),
Out: json.RawMessage(fmt.Sprintf(`{"id":"%s","object":"organization_invitation","email_address":"string","role":"string","role_name":"string","organization_id":"%s","status":"string","public_metadata":{},"private_metadata":{},"created_at":0,"updated_at":0}`, id, organizationID)),
Method: http.MethodGet,
Path: "/v1/organizations/" + organizationID + "/invitations/" + id,
},
Expand All @@ -144,6 +144,8 @@ func TestOrganizationInvitationClientGet(t *testing.T) {
require.NoError(t, err)
require.Equal(t, id, response.ID)
require.Equal(t, organizationID, response.OrganizationID)
require.Equal(t, "string", response.RoleName)
require.Equal(t, "string", response.Role)
}

func TestOrganizationInvitationClientGet_Error(t *testing.T) {
Expand Down
6 changes: 5 additions & 1 deletion organizationmembership/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ func TestOrganizationMembershipClientList(t *testing.T) {
"data": [{
"id":"%s",
"organization":{"id":"%s"},
"public_user_data":{"user_id":"%s"}
"public_user_data":{"user_id":"%s"},
"role": "string",
"role_name": "string"
}],
"total_count": 1
}`,
Expand Down Expand Up @@ -204,4 +206,6 @@ func TestOrganizationMembershipClientList(t *testing.T) {
require.Equal(t, id, list.OrganizationMemberships[0].ID)
require.Equal(t, organizationID, list.OrganizationMemberships[0].Organization.ID)
require.Equal(t, userID, list.OrganizationMemberships[0].PublicUserData.UserID)
require.Equal(t, "string", list.OrganizationMemberships[0].RoleName)
require.Equal(t, "string", list.OrganizationMemberships[0].Role)
}

0 comments on commit 1c70b6d

Please sign in to comment.