Skip to content

Commit 128a1be

Browse files
authored
feat(api): improve handling of brackets (#153)
1 parent ac28ae0 commit 128a1be

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

api/bracket.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
package api
22

3-
type GetBracketsParams struct{}
3+
import "fmt"
4+
5+
type GetBracketsParams struct {
6+
Name *string `schema:"name,omitempty"`
7+
Description *string `schema:"description,omitempty"`
8+
Type *string `schema:"type,omitempty"`
9+
Q *string `schema:"q,omitempty"`
10+
}
411

512
func (client *Client) GetBrackets(params *GetBracketsParams, opts ...Option) ([]*Bracket, error) {
613
bks := []*Bracket{}
@@ -24,3 +31,17 @@ func (client *Client) PostBrackets(params *PostBracketsParams, opts ...Option) (
2431
}
2532
return bk, nil
2633
}
34+
35+
type PatchBracketsParams struct {
36+
Name *string `json:"name,omitempty"`
37+
Description *string `json:"description,omitempty"`
38+
Type *string `json:"type,omitempty"`
39+
}
40+
41+
func (client *Client) PatchBrackets(id int, params *PatchBracketsParams, opts ...Option) (*Bracket, error) {
42+
bk := &Bracket{}
43+
if err := client.Patch(fmt.Sprintf("/brackets/%d", id), params, bk, opts...); err != nil {
44+
return nil, err
45+
}
46+
return bk, nil
47+
}

0 commit comments

Comments
 (0)