-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bracket): add support of brackets
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package api | ||
|
||
type GetBracketsParams struct{} | ||
|
||
func (client *Client) GetBrackets(params *GetBracketsParams, opts ...Option) ([]*Bracket, error) { | ||
bks := []*Bracket{} | ||
if err := get(client, "/brackets", params, &bks, opts...); err != nil { | ||
return nil, err | ||
} | ||
return bks, nil | ||
} | ||
|
||
type PostBracketsParams struct { | ||
ID float64 `json:"id"` // XXX Why is that a float64 ?? Why is it even sent by the client as CTFd will return a new one ? | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Type string `json:"type"` | ||
} | ||
|
||
func (client *Client) PostBrackets(params *PostBracketsParams, opts ...Option) (*Bracket, error) { | ||
bk := &Bracket{} | ||
if err := post(client, "/brackets", params, bk, opts...); err != nil { | ||
return nil, err | ||
} | ||
return bk, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters