Skip to content

Commit

Permalink
Update CheckResultAuthorized constant to be lowercase and add new Che…
Browse files Browse the repository at this point in the history
…ckResultNotAuthorized constant
  • Loading branch information
kkajla12 committed Jul 22, 2024
1 parent 9c2f667 commit 496472d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
8 changes: 4 additions & 4 deletions pkg/fga/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ type Order string

// Constants that enumerate the available orders.
const (
CheckResultAuthorized = "Authorized"
Asc Order = "asc"
Desc Order = "desc"
CheckResultAuthorized = "authorized"
CheckResultNotAuthorized = "not_authorized"
Asc Order = "asc"
Desc Order = "desc"
)

// Client represents a client that performs FGA requests to the WorkOS API.
Expand Down Expand Up @@ -316,7 +317,6 @@ type CheckBatchOpts struct {
}

type CheckResponse struct {
Code int64 `json:"code"`
Result string `json:"result"`
IsImplicit bool `json:"is_implicit"`
DebugInfo DebugInfo `json:"debug_info,omitempty"`
Expand Down
18 changes: 6 additions & 12 deletions pkg/fga/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,7 @@ func TestCheck(t *testing.T) {
},
},
expected: CheckResponse{
Code: 200,
Result: "Authorized",
Result: CheckResultAuthorized,
IsImplicit: false,
},
},
Expand Down Expand Up @@ -1085,8 +1084,7 @@ func checkTestHandler(w http.ResponseWriter, r *http.Request) {

body, err := json.Marshal(
CheckResponse{
Code: 200,
Result: "Authorized",
Result: CheckResultAuthorized,
IsImplicit: false,
})

Expand Down Expand Up @@ -1141,13 +1139,11 @@ func TestCheckBatch(t *testing.T) {
},
expected: []CheckResponse{
{
Code: 200,
Result: "Authorized",
Result: CheckResultAuthorized,
IsImplicit: false,
},
{
Code: 403,
Result: "Not Authorized",
Result: CheckResultNotAuthorized,
IsImplicit: false,
},
},
Expand Down Expand Up @@ -1189,13 +1185,11 @@ func checkBatchTestHandler(w http.ResponseWriter, r *http.Request) {
body, err := json.Marshal(
[]CheckResponse{
{
Code: 200,
Result: "Authorized",
Result: CheckResultAuthorized,
IsImplicit: false,
},
{
Code: 403,
Result: "Not Authorized",
Result: CheckResultNotAuthorized,
IsImplicit: false,
},
})
Expand Down

0 comments on commit 496472d

Please sign in to comment.