Skip to content

Commit

Permalink
fix: OrganizationRepository.ExternalSlug uses json.RawMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
jianyuan committed Nov 24, 2024
1 parent 4fab489 commit 02f386d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion sentry/organization_repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sentry

import (
"context"
"encoding/json"
"fmt"
"time"
)
Expand All @@ -22,7 +23,8 @@ type OrganizationRepository struct {
Status string `json:"status"`
DateCreated time.Time `json:"dateCreated"`
IntegrationId string `json:"integrationId"`
ExternalSlug string `json:"externalSlug"`
ExternalSlug json.RawMessage `json:"externalSlug"`
ExternalId string `json:"externalId"`
}

// OrganizationRepositoriesService provides methods for accessing Sentry organization repositories API endpoints.
Expand Down
19 changes: 13 additions & 6 deletions sentry/organization_repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sentry

import (
"context"
"encoding/json"
"fmt"
"net/http"
"testing"
Expand Down Expand Up @@ -29,7 +30,8 @@ func TestOrganizationRepositoriesService_List(t *testing.T) {
"status": "active",
"dateCreated": "2022-08-15T06:31:49.817916Z",
"integrationId": "123456",
"externalSlug": "aht4davchml6srhh6mvthluoscl2lzmi"
"externalSlug": "aht4davchml6srhh6mvthluoscl2lzmi",
"externalId": "123456"
}
]`)
})
Expand All @@ -54,7 +56,8 @@ func TestOrganizationRepositoriesService_List(t *testing.T) {
Status: "active",
DateCreated: mustParseTime("2022-08-15T06:31:49.817916Z"),
IntegrationId: "123456",
ExternalSlug: "aht4davchml6srhh6mvthluoscl2lzmi",
ExternalSlug: json.RawMessage(`"aht4davchml6srhh6mvthluoscl2lzmi"`),
ExternalId: "123456",
},
}
assert.Equal(t, expected, repos)
Expand All @@ -79,7 +82,8 @@ func TestOrganizationRepositoriesService_Create(t *testing.T) {
"status": "active",
"dateCreated": "2022-08-15T06:31:49.817916Z",
"integrationId": "123456",
"externalSlug": "aht4davchml6srhh6mvthluoscl2lzmi"
"externalSlug": "aht4davchml6srhh6mvthluoscl2lzmi",
"externalId": "123456"
}`)
})

Expand All @@ -102,7 +106,8 @@ func TestOrganizationRepositoriesService_Create(t *testing.T) {
Status: "active",
DateCreated: mustParseTime("2022-08-15T06:31:49.817916Z"),
IntegrationId: "123456",
ExternalSlug: "aht4davchml6srhh6mvthluoscl2lzmi",
ExternalSlug: json.RawMessage(`"aht4davchml6srhh6mvthluoscl2lzmi"`),
ExternalId: "123456",
}
assert.Equal(t, expected, repo)
}
Expand All @@ -128,7 +133,8 @@ func TestOrganizationRepositoriesService_Delete(t *testing.T) {
"status": "pending_deletion",
"dateCreated": "2022-08-15T06:31:49.817916Z",
"integrationId": "123456",
"externalSlug": "aht4davchml6srhh6mvthluoscl2lzmi"
"externalSlug": "aht4davchml6srhh6mvthluoscl2lzmi",
"externalId": "123456"
}`)
})

Expand All @@ -146,7 +152,8 @@ func TestOrganizationRepositoriesService_Delete(t *testing.T) {
Status: "pending_deletion",
DateCreated: mustParseTime("2022-08-15T06:31:49.817916Z"),
IntegrationId: "123456",
ExternalSlug: "aht4davchml6srhh6mvthluoscl2lzmi",
ExternalSlug: json.RawMessage(`"aht4davchml6srhh6mvthluoscl2lzmi"`),
ExternalId: "123456",
}
assert.Equal(t, expected, repo)
}

0 comments on commit 02f386d

Please sign in to comment.