fizzy-cli 0.8.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.golangci.yml +56 -0
- package/IMPLEMENTATION_PLAN.md +58 -0
- package/docs/API.md +89 -0
- package/package.json +2 -1
- package/.env +0 -1
- package/.github/workflows/release.yml +0 -29
- package/.github/workflows/tests.yml +0 -24
- package/AGENTS.md +0 -33
- package/CHANGELOG.md +0 -194
- package/Makefile +0 -43
- package/bin/fizzy +0 -0
- package/cmd/account.go +0 -14
- package/cmd/account_list.go +0 -44
- package/cmd/account_list_test.go +0 -118
- package/cmd/board.go +0 -49
- package/cmd/board_create.go +0 -59
- package/cmd/board_create_test.go +0 -141
- package/cmd/board_delete.go +0 -40
- package/cmd/board_delete_test.go +0 -121
- package/cmd/board_list.go +0 -44
- package/cmd/board_list_test.go +0 -115
- package/cmd/board_show.go +0 -40
- package/cmd/board_show_test.go +0 -113
- package/cmd/board_test.go +0 -92
- package/cmd/board_update.go +0 -72
- package/cmd/board_update_test.go +0 -233
- package/cmd/card.go +0 -24
- package/cmd/card_assign.go +0 -55
- package/cmd/card_assign_test.go +0 -130
- package/cmd/card_close.go +0 -46
- package/cmd/card_close_test.go +0 -92
- package/cmd/card_create.go +0 -72
- package/cmd/card_create_test.go +0 -186
- package/cmd/card_delete.go +0 -46
- package/cmd/card_delete_test.go +0 -92
- package/cmd/card_golden.go +0 -46
- package/cmd/card_golden_test.go +0 -92
- package/cmd/card_list.go +0 -114
- package/cmd/card_list_test.go +0 -373
- package/cmd/card_not_now.go +0 -46
- package/cmd/card_not_now_test.go +0 -92
- package/cmd/card_reaction.go +0 -13
- package/cmd/card_reaction_create.go +0 -46
- package/cmd/card_reaction_create_test.go +0 -148
- package/cmd/card_reaction_delete.go +0 -46
- package/cmd/card_reaction_delete_test.go +0 -112
- package/cmd/card_reaction_list.go +0 -51
- package/cmd/card_reaction_list_test.go +0 -127
- package/cmd/card_reopen.go +0 -46
- package/cmd/card_reopen_test.go +0 -92
- package/cmd/card_show.go +0 -46
- package/cmd/card_show_test.go +0 -92
- package/cmd/card_tag.go +0 -51
- package/cmd/card_tag_test.go +0 -112
- package/cmd/card_triage.go +0 -46
- package/cmd/card_ungolden.go +0 -46
- package/cmd/card_ungolden_test.go +0 -92
- package/cmd/card_untriage.go +0 -46
- package/cmd/card_untriage_test.go +0 -92
- package/cmd/card_unwatch.go +0 -46
- package/cmd/card_unwatch_test.go +0 -92
- package/cmd/card_update.go +0 -82
- package/cmd/card_update_test.go +0 -149
- package/cmd/card_watch.go +0 -46
- package/cmd/card_watch_test.go +0 -92
- package/cmd/column.go +0 -14
- package/cmd/column_create.go +0 -79
- package/cmd/column_create_test.go +0 -178
- package/cmd/column_delete.go +0 -40
- package/cmd/column_delete_test.go +0 -121
- package/cmd/column_list.go +0 -44
- package/cmd/column_list_test.go +0 -138
- package/cmd/column_show.go +0 -40
- package/cmd/column_show_test.go +0 -111
- package/cmd/column_update.go +0 -67
- package/cmd/column_update_test.go +0 -198
- package/cmd/comment.go +0 -14
- package/cmd/comment_create.go +0 -51
- package/cmd/comment_create_test.go +0 -129
- package/cmd/comment_delete.go +0 -46
- package/cmd/comment_delete_test.go +0 -92
- package/cmd/comment_list.go +0 -51
- package/cmd/comment_list_test.go +0 -132
- package/cmd/comment_show.go +0 -46
- package/cmd/comment_show_test.go +0 -104
- package/cmd/comment_update.go +0 -51
- package/cmd/comment_update_test.go +0 -130
- package/cmd/login.go +0 -81
- package/cmd/login_test.go +0 -98
- package/cmd/notification.go +0 -14
- package/cmd/notification_list.go +0 -69
- package/cmd/notification_list_test.go +0 -288
- package/cmd/notification_read.go +0 -51
- package/cmd/notification_read_all.go +0 -38
- package/cmd/notification_read_all_test.go +0 -75
- package/cmd/notification_read_test.go +0 -138
- package/cmd/notification_unread.go +0 -44
- package/cmd/notification_unread_test.go +0 -99
- package/cmd/reaction.go +0 -13
- package/cmd/reaction_create.go +0 -46
- package/cmd/reaction_create_test.go +0 -113
- package/cmd/reaction_delete.go +0 -46
- package/cmd/reaction_delete_test.go +0 -92
- package/cmd/reaction_list.go +0 -51
- package/cmd/reaction_list_test.go +0 -125
- package/cmd/root.go +0 -38
- package/cmd/step.go +0 -14
- package/cmd/step_create.go +0 -53
- package/cmd/step_create_test.go +0 -171
- package/cmd/step_delete.go +0 -46
- package/cmd/step_delete_test.go +0 -92
- package/cmd/step_update.go +0 -66
- package/cmd/step_update_test.go +0 -190
- package/cmd/tag.go +0 -15
- package/cmd/tag_list.go +0 -47
- package/cmd/tag_list_test.go +0 -109
- package/cmd/use.go +0 -85
- package/cmd/use_test.go +0 -186
- package/cmd/user.go +0 -22
- package/cmd/user_deactivate.go +0 -40
- package/cmd/user_deactivate_test.go +0 -121
- package/cmd/user_list.go +0 -44
- package/cmd/user_list_test.go +0 -126
- package/cmd/user_show.go +0 -40
- package/cmd/user_show_test.go +0 -110
- package/cmd/user_update.go +0 -71
- package/cmd/user_update_test.go +0 -177
- package/go.mod +0 -31
- package/go.sum +0 -53
- package/internal/api/boards.go +0 -93
- package/internal/api/cards.go +0 -322
- package/internal/api/client.go +0 -99
- package/internal/api/columns.go +0 -113
- package/internal/api/comments.go +0 -108
- package/internal/api/identity.go +0 -24
- package/internal/api/notifications.go +0 -89
- package/internal/api/reactions.go +0 -130
- package/internal/api/steps.go +0 -101
- package/internal/api/tags.go +0 -24
- package/internal/api/types.go +0 -195
- package/internal/api/users.go +0 -75
- package/internal/app/app.go +0 -49
- package/internal/colors/colors.go +0 -32
- package/internal/config/config.go +0 -70
- package/internal/testutil/client.go +0 -26
- package/internal/ui/account_list.go +0 -14
- package/internal/ui/account_selector.go +0 -63
- package/internal/ui/board_list.go +0 -14
- package/internal/ui/board_show.go +0 -17
- package/internal/ui/card_list.go +0 -14
- package/internal/ui/card_show.go +0 -23
- package/internal/ui/column_list.go +0 -28
- package/internal/ui/column_show.go +0 -16
- package/internal/ui/comment_list.go +0 -25
- package/internal/ui/format.go +0 -27
- package/internal/ui/notification_list.go +0 -27
- package/internal/ui/reaction_list.go +0 -14
- package/internal/ui/user_list.go +0 -19
- package/internal/ui/user_show.go +0 -23
package/internal/api/comments.go
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"io"
|
|
7
|
-
"net/http"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func (c *Client) GetCardComments(ctx context.Context, cardNumber int) ([]Comment, error) {
|
|
11
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments", c.AccountBaseURL, cardNumber)
|
|
12
|
-
|
|
13
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
14
|
-
if err != nil {
|
|
15
|
-
return nil, fmt.Errorf("failed to create get card comments request: %w", err)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var response []Comment
|
|
19
|
-
_, err = c.decodeResponse(req, &response)
|
|
20
|
-
if err != nil {
|
|
21
|
-
return nil, err
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return response, nil
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
func (c *Client) GetCardComment(ctx context.Context, cardNumber int, commentID string) (*Comment, error) {
|
|
28
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments/%s", c.AccountBaseURL, cardNumber, commentID)
|
|
29
|
-
|
|
30
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
31
|
-
if err != nil {
|
|
32
|
-
return nil, fmt.Errorf("failed to create get card comment request: %w", err)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var response Comment
|
|
36
|
-
_, err = c.decodeResponse(req, &response)
|
|
37
|
-
if err != nil {
|
|
38
|
-
return nil, err
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return &response, nil
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
func (c *Client) PostCardComment(ctx context.Context, cardNumber int, body string) (*Comment, error) {
|
|
45
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments", c.AccountBaseURL, cardNumber)
|
|
46
|
-
|
|
47
|
-
payload := map[string]map[string]string{
|
|
48
|
-
"comment": {"body": body},
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
req, err := c.newRequest(ctx, http.MethodPost, endpointURL, payload)
|
|
52
|
-
if err != nil {
|
|
53
|
-
return nil, fmt.Errorf("failed to create post card comment request: %w", err)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
res, err := c.HTTPClient.Do(req)
|
|
57
|
-
if err != nil {
|
|
58
|
-
return nil, fmt.Errorf("failed to make request: %w", err)
|
|
59
|
-
}
|
|
60
|
-
defer res.Body.Close()
|
|
61
|
-
|
|
62
|
-
if res.StatusCode != http.StatusCreated {
|
|
63
|
-
body, _ := io.ReadAll(res.Body)
|
|
64
|
-
return nil, fmt.Errorf("unexpected status code %d: %s", res.StatusCode, string(body))
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// API returns 201 Created with Location header, not a response body
|
|
68
|
-
// Return a minimal Comment object with empty fields
|
|
69
|
-
// The comment ID would be in the Location header but we'll use it to fetch full details
|
|
70
|
-
return &Comment{}, nil
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
func (c *Client) PutCardComment(ctx context.Context, cardNumber int, commentID string, body string) (*Comment, error) {
|
|
74
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments/%s", c.AccountBaseURL, cardNumber, commentID)
|
|
75
|
-
|
|
76
|
-
payload := map[string]map[string]string{
|
|
77
|
-
"comment": {"body": body},
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
req, err := c.newRequest(ctx, http.MethodPut, endpointURL, payload)
|
|
81
|
-
if err != nil {
|
|
82
|
-
return nil, fmt.Errorf("failed to create put card comment request: %w", err)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
var response Comment
|
|
86
|
-
_, err = c.decodeResponse(req, &response)
|
|
87
|
-
if err != nil {
|
|
88
|
-
return nil, err
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return &response, nil
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
func (c *Client) DeleteCardComment(ctx context.Context, cardNumber int, commentID string) (bool, error) {
|
|
95
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments/%s", c.AccountBaseURL, cardNumber, commentID)
|
|
96
|
-
|
|
97
|
-
req, err := c.newRequest(ctx, http.MethodDelete, endpointURL, nil)
|
|
98
|
-
if err != nil {
|
|
99
|
-
return false, fmt.Errorf("failed to create delete card comment request: %w", err)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
103
|
-
if err != nil {
|
|
104
|
-
return false, err
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return true, nil
|
|
108
|
-
}
|
package/internal/api/identity.go
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"net/http"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func (c *Client) GetMyIdentity(ctx context.Context) (*GetMyIdentityResponse, error) {
|
|
10
|
-
endpointURL := c.BaseURL + "/my/identity"
|
|
11
|
-
|
|
12
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
13
|
-
if err != nil {
|
|
14
|
-
return nil, fmt.Errorf("failed to create request: %w", err)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var response GetMyIdentityResponse
|
|
18
|
-
_, err = c.decodeResponse(req, &response)
|
|
19
|
-
if err != nil {
|
|
20
|
-
return nil, err
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return &response, nil
|
|
24
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"net/http"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func (c *Client) GetNotifications(ctx context.Context) ([]Notification, error) {
|
|
10
|
-
endpointURL := c.AccountBaseURL + "/notifications"
|
|
11
|
-
|
|
12
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
13
|
-
if err != nil {
|
|
14
|
-
return nil, fmt.Errorf("failed to create get notifications request: %w", err)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var response []Notification
|
|
18
|
-
_, err = c.decodeResponse(req, &response)
|
|
19
|
-
if err != nil {
|
|
20
|
-
return nil, err
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return response, nil
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
func (c *Client) GetNotification(ctx context.Context, notificationID string) (*Notification, error) {
|
|
27
|
-
endpointURL := fmt.Sprintf("%s/notifications/%s", c.AccountBaseURL, notificationID)
|
|
28
|
-
|
|
29
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
30
|
-
if err != nil {
|
|
31
|
-
return nil, fmt.Errorf("failed to create get notification request: %w", err)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var response Notification
|
|
35
|
-
_, err = c.decodeResponse(req, &response)
|
|
36
|
-
if err != nil {
|
|
37
|
-
return nil, err
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return &response, nil
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
func (c *Client) PostNotificationReading(ctx context.Context, notificationID string) (bool, error) {
|
|
44
|
-
endpointURL := fmt.Sprintf("%s/notifications/%s/reading", c.AccountBaseURL, notificationID)
|
|
45
|
-
|
|
46
|
-
req, err := c.newRequest(ctx, http.MethodPost, endpointURL, nil)
|
|
47
|
-
if err != nil {
|
|
48
|
-
return false, fmt.Errorf("failed to create mark notification as read request: %w", err)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
52
|
-
if err != nil {
|
|
53
|
-
return false, err
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return true, nil
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
func (c *Client) DeleteNotificationReading(ctx context.Context, notificationID string) (bool, error) {
|
|
60
|
-
endpointURL := fmt.Sprintf("%s/notifications/%s/reading", c.AccountBaseURL, notificationID)
|
|
61
|
-
|
|
62
|
-
req, err := c.newRequest(ctx, http.MethodDelete, endpointURL, nil)
|
|
63
|
-
if err != nil {
|
|
64
|
-
return false, fmt.Errorf("failed to create delete notification request: %w", err)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
68
|
-
if err != nil {
|
|
69
|
-
return false, err
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return true, nil
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
func (c *Client) PostBulkNotificationsReading(ctx context.Context) (bool, error) {
|
|
76
|
-
endpointURL := c.AccountBaseURL + "/notifications/bulk_reading"
|
|
77
|
-
|
|
78
|
-
req, err := c.newRequest(ctx, http.MethodPost, endpointURL, nil)
|
|
79
|
-
if err != nil {
|
|
80
|
-
return false, fmt.Errorf("failed to create bulk notifications reading request: %w", err)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
84
|
-
if err != nil {
|
|
85
|
-
return false, err
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return true, nil
|
|
89
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"io"
|
|
7
|
-
"net/http"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func (c *Client) GetCommentReactions(ctx context.Context, cardNumber int, commentID string) ([]Reaction, error) {
|
|
11
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments/%s/reactions", c.AccountBaseURL, cardNumber, commentID)
|
|
12
|
-
|
|
13
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
14
|
-
if err != nil {
|
|
15
|
-
return nil, fmt.Errorf("failed to create get comment reactions request: %w", err)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var response []Reaction
|
|
19
|
-
_, err = c.decodeResponse(req, &response)
|
|
20
|
-
if err != nil {
|
|
21
|
-
return nil, err
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return response, nil
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
func (c *Client) PostCommentReaction(ctx context.Context, cardNumber int, commentID string, content string) (*Reaction, error) {
|
|
28
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments/%s/reactions", c.AccountBaseURL, cardNumber, commentID)
|
|
29
|
-
|
|
30
|
-
payload := map[string]map[string]string{
|
|
31
|
-
"reaction": {"content": content},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
req, err := c.newRequest(ctx, http.MethodPost, endpointURL, payload)
|
|
35
|
-
if err != nil {
|
|
36
|
-
return nil, fmt.Errorf("failed to create post comment reaction request: %w", err)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
res, err := c.HTTPClient.Do(req)
|
|
40
|
-
if err != nil {
|
|
41
|
-
return nil, fmt.Errorf("failed to make request: %w", err)
|
|
42
|
-
}
|
|
43
|
-
defer res.Body.Close()
|
|
44
|
-
|
|
45
|
-
if res.StatusCode != http.StatusCreated {
|
|
46
|
-
body, _ := io.ReadAll(res.Body)
|
|
47
|
-
return nil, fmt.Errorf("unexpected status code %d: %s", res.StatusCode, string(body))
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// API returns 201 Created with Location header, not a response body
|
|
51
|
-
// Return a Reaction object with the content field set for reference
|
|
52
|
-
return &Reaction{Content: content}, nil
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
func (c *Client) DeleteCommentReaction(ctx context.Context, cardNumber int, commentID string, reactionID string) (bool, error) {
|
|
56
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/comments/%s/reactions/%s", c.AccountBaseURL, cardNumber, commentID, reactionID)
|
|
57
|
-
|
|
58
|
-
req, err := c.newRequest(ctx, http.MethodDelete, endpointURL, nil)
|
|
59
|
-
if err != nil {
|
|
60
|
-
return false, fmt.Errorf("failed to create delete comment reaction request: %w", err)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
64
|
-
if err != nil {
|
|
65
|
-
return false, err
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return true, nil
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
func (c *Client) GetCardReactions(ctx context.Context, cardNumber int) ([]Reaction, error) {
|
|
72
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/reactions", c.AccountBaseURL, cardNumber)
|
|
73
|
-
|
|
74
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
75
|
-
if err != nil {
|
|
76
|
-
return nil, fmt.Errorf("failed to create get card reactions request: %w", err)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
var response []Reaction
|
|
80
|
-
_, err = c.decodeResponse(req, &response)
|
|
81
|
-
if err != nil {
|
|
82
|
-
return nil, err
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return response, nil
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
func (c *Client) PostCardReaction(ctx context.Context, cardNumber int, content string) (*Reaction, error) {
|
|
89
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/reactions", c.AccountBaseURL, cardNumber)
|
|
90
|
-
|
|
91
|
-
payload := map[string]map[string]string{
|
|
92
|
-
"reaction": {"content": content},
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
req, err := c.newRequest(ctx, http.MethodPost, endpointURL, payload)
|
|
96
|
-
if err != nil {
|
|
97
|
-
return nil, fmt.Errorf("failed to create post card reaction request: %w", err)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
res, err := c.HTTPClient.Do(req)
|
|
101
|
-
if err != nil {
|
|
102
|
-
return nil, fmt.Errorf("failed to make request: %w", err)
|
|
103
|
-
}
|
|
104
|
-
defer res.Body.Close()
|
|
105
|
-
|
|
106
|
-
if res.StatusCode != http.StatusCreated {
|
|
107
|
-
body, _ := io.ReadAll(res.Body)
|
|
108
|
-
return nil, fmt.Errorf("unexpected status code %d: %s", res.StatusCode, string(body))
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// API returns 201 Created with Location header, not a response body
|
|
112
|
-
// Return a Reaction object with the content field set for reference
|
|
113
|
-
return &Reaction{Content: content}, nil
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
func (c *Client) DeleteCardReaction(ctx context.Context, cardNumber int, reactionID string) (bool, error) {
|
|
117
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/reactions/%s", c.AccountBaseURL, cardNumber, reactionID)
|
|
118
|
-
|
|
119
|
-
req, err := c.newRequest(ctx, http.MethodDelete, endpointURL, nil)
|
|
120
|
-
if err != nil {
|
|
121
|
-
return false, fmt.Errorf("failed to create delete card reaction request: %w", err)
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
125
|
-
if err != nil {
|
|
126
|
-
return false, err
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return true, nil
|
|
130
|
-
}
|
package/internal/api/steps.go
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"io"
|
|
7
|
-
"net/http"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
func (c *Client) GetCardStep(ctx context.Context, cardNumber int, stepID string) (*Step, error) {
|
|
11
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/steps/%s", c.AccountBaseURL, cardNumber, stepID)
|
|
12
|
-
|
|
13
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
14
|
-
if err != nil {
|
|
15
|
-
return nil, fmt.Errorf("failed to create get card step request: %w", err)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
var response Step
|
|
19
|
-
_, err = c.decodeResponse(req, &response)
|
|
20
|
-
if err != nil {
|
|
21
|
-
return nil, err
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return &response, nil
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
func (c *Client) PostCardStep(ctx context.Context, cardNumber int, content string, completed bool) (*Step, error) {
|
|
28
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/steps", c.AccountBaseURL, cardNumber)
|
|
29
|
-
|
|
30
|
-
payload := map[string]map[string]any{
|
|
31
|
-
"step": {
|
|
32
|
-
"content": content,
|
|
33
|
-
"completed": completed,
|
|
34
|
-
},
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
req, err := c.newRequest(ctx, http.MethodPost, endpointURL, payload)
|
|
38
|
-
if err != nil {
|
|
39
|
-
return nil, fmt.Errorf("failed to create post card step request: %w", err)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
res, err := c.HTTPClient.Do(req)
|
|
43
|
-
if err != nil {
|
|
44
|
-
return nil, fmt.Errorf("failed to make request: %w", err)
|
|
45
|
-
}
|
|
46
|
-
defer res.Body.Close()
|
|
47
|
-
|
|
48
|
-
if res.StatusCode != http.StatusCreated {
|
|
49
|
-
body, _ := io.ReadAll(res.Body)
|
|
50
|
-
return nil, fmt.Errorf("unexpected status code %d: %s", res.StatusCode, string(body))
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// API returns 201 Created with Location header, not a response body
|
|
54
|
-
// Return a Step object with the content field set for reference
|
|
55
|
-
return &Step{Content: content, Completed: completed}, nil
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
func (c *Client) PutCardStep(ctx context.Context, cardNumber int, stepID string, content *string, completed *bool) (*Step, error) {
|
|
59
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/steps/%s", c.AccountBaseURL, cardNumber, stepID)
|
|
60
|
-
|
|
61
|
-
stepPayload := make(map[string]any)
|
|
62
|
-
if content != nil {
|
|
63
|
-
stepPayload["content"] = *content
|
|
64
|
-
}
|
|
65
|
-
if completed != nil {
|
|
66
|
-
stepPayload["completed"] = *completed
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
payload := map[string]map[string]any{
|
|
70
|
-
"step": stepPayload,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
req, err := c.newRequest(ctx, http.MethodPut, endpointURL, payload)
|
|
74
|
-
if err != nil {
|
|
75
|
-
return nil, fmt.Errorf("failed to create put card step request: %w", err)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
var response Step
|
|
79
|
-
_, err = c.decodeResponse(req, &response)
|
|
80
|
-
if err != nil {
|
|
81
|
-
return nil, err
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return &response, nil
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
func (c *Client) DeleteCardStep(ctx context.Context, cardNumber int, stepID string) (bool, error) {
|
|
88
|
-
endpointURL := fmt.Sprintf("%s/cards/%d/steps/%s", c.AccountBaseURL, cardNumber, stepID)
|
|
89
|
-
|
|
90
|
-
req, err := c.newRequest(ctx, http.MethodDelete, endpointURL, nil)
|
|
91
|
-
if err != nil {
|
|
92
|
-
return false, fmt.Errorf("failed to create delete card step request: %w", err)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
_, err = c.decodeResponse(req, nil, http.StatusNoContent)
|
|
96
|
-
if err != nil {
|
|
97
|
-
return false, err
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return true, nil
|
|
101
|
-
}
|
package/internal/api/tags.go
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"context"
|
|
5
|
-
"fmt"
|
|
6
|
-
"net/http"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func (c *Client) GetTags(ctx context.Context) ([]Tag, error) {
|
|
10
|
-
endpointURL := c.AccountBaseURL + "/tags"
|
|
11
|
-
|
|
12
|
-
req, err := c.newRequest(ctx, http.MethodGet, endpointURL, nil)
|
|
13
|
-
if err != nil {
|
|
14
|
-
return nil, fmt.Errorf("failed to create get tags request: %w", err)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var response []Tag
|
|
18
|
-
_, err = c.decodeResponse(req, &response)
|
|
19
|
-
if err != nil {
|
|
20
|
-
return nil, err
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return response, nil
|
|
24
|
-
}
|
package/internal/api/types.go
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
package api
|
|
2
|
-
|
|
3
|
-
import "github.com/rogeriopvl/fizzy/internal/colors"
|
|
4
|
-
|
|
5
|
-
type Board struct {
|
|
6
|
-
ID string `json:"id"`
|
|
7
|
-
Name string `json:"name"`
|
|
8
|
-
AllAccess bool `json:"all_access"`
|
|
9
|
-
CreatedAt string `json:"created_at"`
|
|
10
|
-
URL string `json:"url"`
|
|
11
|
-
Creator User `json:"creator"`
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
type CreateBoardPayload struct {
|
|
15
|
-
Name string `json:"name"`
|
|
16
|
-
AllAccess bool `json:"all_access"`
|
|
17
|
-
AutoPostponePeriod int `json:"auto_postpone_period"`
|
|
18
|
-
PublicDescription string `json:"public_description"`
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type UpdateBoardPayload struct {
|
|
22
|
-
Name string `json:"name,omitempty"`
|
|
23
|
-
AllAccess *bool `json:"all_access,omitempty"`
|
|
24
|
-
AutoPostponePeriod *int `json:"auto_postpone_period,omitempty"`
|
|
25
|
-
PublicDescription string `json:"public_description,omitempty"`
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
type Column struct {
|
|
29
|
-
ID string `json:"id"`
|
|
30
|
-
Name string `json:"name"`
|
|
31
|
-
Color ColorObject `json:"color"`
|
|
32
|
-
CreatedAt string `json:"created_at"`
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type ColorObject struct {
|
|
36
|
-
Name string `json:"name"`
|
|
37
|
-
Value Color `json:"value"`
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type CreateColumnPayload struct {
|
|
41
|
-
Name string `json:"name"`
|
|
42
|
-
Color *Color `json:"color,omitempty"`
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
type UpdateColumnPayload struct {
|
|
46
|
-
Name string `json:"name,omitempty"`
|
|
47
|
-
Color *Color `json:"color,omitempty"`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
type Card struct {
|
|
51
|
-
ID string `json:"id"`
|
|
52
|
-
Number int `json:"number"`
|
|
53
|
-
Title string `json:"title"`
|
|
54
|
-
Status string `json:"status"`
|
|
55
|
-
Description string `json:"description"`
|
|
56
|
-
DescriptionHTML string `json:"description_html"`
|
|
57
|
-
ImageURL string `json:"image_url"`
|
|
58
|
-
Tags []string `json:"tags"`
|
|
59
|
-
Golden bool `json:"golden"`
|
|
60
|
-
LastActiveAt string `json:"last_active_at"`
|
|
61
|
-
CreatedAt string `json:"created_at"`
|
|
62
|
-
URL string `json:"url"`
|
|
63
|
-
Board Board `json:"board"`
|
|
64
|
-
Creator User `json:"creator"`
|
|
65
|
-
CommentsURL string `json:"comments_url"`
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
type CardFilters struct {
|
|
69
|
-
BoardIDs []string
|
|
70
|
-
TagIDs []string
|
|
71
|
-
AssigneeIDs []string
|
|
72
|
-
CreatorIDs []string
|
|
73
|
-
CloserIDs []string
|
|
74
|
-
CardIDs []string
|
|
75
|
-
IndexedBy string
|
|
76
|
-
SortedBy string
|
|
77
|
-
AssignmentStatus string
|
|
78
|
-
CreationStatus string
|
|
79
|
-
ClosureStatus string
|
|
80
|
-
Terms []string
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
type CreateCardPayload struct {
|
|
84
|
-
Title string `json:"title"`
|
|
85
|
-
Description string `json:"description,omitempty"`
|
|
86
|
-
Status string `json:"status,omitempty"`
|
|
87
|
-
ImageURL string `json:"image_url,omitempty"`
|
|
88
|
-
TagIDS []string `json:"tag_ids,omitempty"`
|
|
89
|
-
CreatedAt string `json:"created_at,omitempty"`
|
|
90
|
-
LastActiveAt string `json:"last_active_at,omitempty"`
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// UpdateCardPayload image not included because we don't support files yet
|
|
94
|
-
type UpdateCardPayload struct {
|
|
95
|
-
Title string `json:"title,omitempty"`
|
|
96
|
-
Description string `json:"description,omitempty"`
|
|
97
|
-
Status string `json:"status,omitempty"`
|
|
98
|
-
TagIDS []string `json:"tag_ids,omitempty"`
|
|
99
|
-
LastActiveAt string `json:"last_active_at,omitempty"`
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
type GetMyIdentityResponse struct {
|
|
103
|
-
Accounts []Account `json:"accounts"`
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
type Account struct {
|
|
107
|
-
ID string `json:"id"`
|
|
108
|
-
Name string `json:"name"`
|
|
109
|
-
User User `json:"user"`
|
|
110
|
-
Slug string `json:"slug"`
|
|
111
|
-
CreatedAt string `json:"created_at"`
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
type User struct {
|
|
115
|
-
ID string `json:"id"`
|
|
116
|
-
Email string `json:"email_address"`
|
|
117
|
-
Role string `json:"role"`
|
|
118
|
-
Active bool `json:"active"`
|
|
119
|
-
Name string `json:"name"`
|
|
120
|
-
CreatedAt string `json:"created_at"`
|
|
121
|
-
URL string `json:"url"`
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
type UpdateUserPayload struct {
|
|
125
|
-
Name string `json:"name,omitempty"`
|
|
126
|
-
Avatar string `json:"avatar,omitempty"`
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
type Notification struct {
|
|
130
|
-
ID string `json:"id"`
|
|
131
|
-
Read bool `json:"read"`
|
|
132
|
-
ReadAt string `json:"read_at"`
|
|
133
|
-
CreatedAt string `json:"created_at"`
|
|
134
|
-
Title string `json:"title"`
|
|
135
|
-
Body string `json:"body"`
|
|
136
|
-
Creator User `json:"creator"`
|
|
137
|
-
Card CardReference `json:"card"`
|
|
138
|
-
URL string `json:"url"`
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
type CardReference struct {
|
|
142
|
-
ID string `json:"id"`
|
|
143
|
-
Title string `json:"title"`
|
|
144
|
-
Status string `json:"status"`
|
|
145
|
-
URL string `json:"url"`
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
type Tag struct {
|
|
149
|
-
ID string `json:"id"`
|
|
150
|
-
Title string `json:"title"`
|
|
151
|
-
CreatedAt string `json:"created_at"`
|
|
152
|
-
URL string `json:"url"`
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
type Comment struct {
|
|
156
|
-
ID string `json:"id"`
|
|
157
|
-
CreatedAt string `json:"created_at"`
|
|
158
|
-
UpdatedAt string `json:"updated_at"`
|
|
159
|
-
Body struct {
|
|
160
|
-
PlainText string `json:"plain_text"`
|
|
161
|
-
HTML string `json:"html"`
|
|
162
|
-
} `json:"body"`
|
|
163
|
-
Creator User `json:"creator"`
|
|
164
|
-
Card CardReference `json:"card"`
|
|
165
|
-
ReactionsURL string `json:"reactions_url"`
|
|
166
|
-
URL string `json:"url"`
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
type Reaction struct {
|
|
170
|
-
ID string `json:"id"`
|
|
171
|
-
Content string `json:"content"`
|
|
172
|
-
Reacter User `json:"reacter"`
|
|
173
|
-
URL string `json:"url"`
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
type Step struct {
|
|
177
|
-
ID string `json:"id"`
|
|
178
|
-
Content string `json:"content"`
|
|
179
|
-
Completed bool `json:"completed"`
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
type Color string
|
|
183
|
-
|
|
184
|
-
// Color constants using centralized definitions
|
|
185
|
-
var (
|
|
186
|
-
Blue Color = Color(colors.Blue.CSSValue)
|
|
187
|
-
Gray Color = Color(colors.Gray.CSSValue)
|
|
188
|
-
Tan Color = Color(colors.Tan.CSSValue)
|
|
189
|
-
Yellow Color = Color(colors.Yellow.CSSValue)
|
|
190
|
-
Lime Color = Color(colors.Lime.CSSValue)
|
|
191
|
-
Aqua Color = Color(colors.Aqua.CSSValue)
|
|
192
|
-
Violet Color = Color(colors.Violet.CSSValue)
|
|
193
|
-
Purple Color = Color(colors.Purple.CSSValue)
|
|
194
|
-
Pink Color = Color(colors.Pink.CSSValue)
|
|
195
|
-
)
|