Skip to content

Commit

Permalink
Fix API endpoint by reading the docs
Browse files Browse the repository at this point in the history
Signed-off-by: Glenn Lewis <[email protected]>
  • Loading branch information
gmlewis committed Sep 19, 2023
1 parent bad4743 commit 9a30ff0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 46 deletions.
16 changes: 0 additions & 16 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 0 additions & 20 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions github/secret_scanning.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ type SecretScanningAlertListOptions struct {

// SecretScanningAlertUpdateOptions specifies optional parameters to the SecretScanningService.UpdateAlert method.
type SecretScanningAlertUpdateOptions struct {
// Required. Sets the state of the secret scanning alert. Can be either open or resolved.
// You must provide resolution when you set the state to resolved.
State *string `json:"state,omitempty"`
// State is required and sets the state of the secret scanning alert.
// Can be either "open" or "resolved".
// You must provide resolution when you set the state to "resolved".
State string `json:"state"`

// A comma-separated list of secret types to return. By default all secret types are returned.
SecretType *string `json:"secret_type,omitempty"`

// Required when the state is resolved. The reason for resolving the alert. Can be one of false_positive,
// wont_fix, revoked, or used_in_tests.
// Required when the state is "resolved" and represents the reason for resolving the alert.
// Can be one of: "false_positive", "wont_fix", "revoked", or "used_in_tests".
Resolution *string `json:"resolution,omitempty"`
}

Expand Down
4 changes: 2 additions & 2 deletions github/secret_scanning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) {
v := new(SecretScanningAlertUpdateOptions)
assertNilError(t, json.NewDecoder(r.Body).Decode(v))

want := &SecretScanningAlertUpdateOptions{State: String("resolved"), Resolution: String("used_in_tests")}
want := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")}

if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
Expand All @@ -381,7 +381,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) {
})

ctx := context.Background()
opts := &SecretScanningAlertUpdateOptions{State: String("resolved"), Resolution: String("used_in_tests")}
opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")}

alert, _, err := client.SecretScanning.UpdateAlert(ctx, "o", "r", 1, opts)
if err != nil {
Expand Down

0 comments on commit 9a30ff0

Please sign in to comment.