fizzy-cli 0.7.0 → 0.9.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/docs/API.md +63 -2
- package/package.json +2 -1
- package/.github/workflows/release.yml +0 -29
- package/.github/workflows/tests.yml +0 -24
- package/AGENTS.md +0 -33
- package/CHANGELOG.md +0 -168
- 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 -53
- package/cmd/card_list_test.go +0 -148
- package/cmd/card_not_now.go +0 -46
- package/cmd/card_not_now_test.go +0 -92
- 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/go.mod +0 -31
- package/go.sum +0 -53
- package/internal/api/boards.go +0 -93
- package/internal/api/cards.go +0 -288
- 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 -69
- package/internal/api/steps.go +0 -101
- package/internal/api/tags.go +0 -24
- package/internal/api/types.go +0 -190
- 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
|
@@ -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,69 +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
|
-
}
|
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,190 +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 Notification struct {
|
|
125
|
-
ID string `json:"id"`
|
|
126
|
-
Read bool `json:"read"`
|
|
127
|
-
ReadAt string `json:"read_at"`
|
|
128
|
-
CreatedAt string `json:"created_at"`
|
|
129
|
-
Title string `json:"title"`
|
|
130
|
-
Body string `json:"body"`
|
|
131
|
-
Creator User `json:"creator"`
|
|
132
|
-
Card CardReference `json:"card"`
|
|
133
|
-
URL string `json:"url"`
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
type CardReference struct {
|
|
137
|
-
ID string `json:"id"`
|
|
138
|
-
Title string `json:"title"`
|
|
139
|
-
Status string `json:"status"`
|
|
140
|
-
URL string `json:"url"`
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
type Tag struct {
|
|
144
|
-
ID string `json:"id"`
|
|
145
|
-
Title string `json:"title"`
|
|
146
|
-
CreatedAt string `json:"created_at"`
|
|
147
|
-
URL string `json:"url"`
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
type Comment struct {
|
|
151
|
-
ID string `json:"id"`
|
|
152
|
-
CreatedAt string `json:"created_at"`
|
|
153
|
-
UpdatedAt string `json:"updated_at"`
|
|
154
|
-
Body struct {
|
|
155
|
-
PlainText string `json:"plain_text"`
|
|
156
|
-
HTML string `json:"html"`
|
|
157
|
-
} `json:"body"`
|
|
158
|
-
Creator User `json:"creator"`
|
|
159
|
-
Card CardReference `json:"card"`
|
|
160
|
-
ReactionsURL string `json:"reactions_url"`
|
|
161
|
-
URL string `json:"url"`
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
type Reaction struct {
|
|
165
|
-
ID string `json:"id"`
|
|
166
|
-
Content string `json:"content"`
|
|
167
|
-
Reacter User `json:"reacter"`
|
|
168
|
-
URL string `json:"url"`
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
type Step struct {
|
|
172
|
-
ID string `json:"id"`
|
|
173
|
-
Content string `json:"content"`
|
|
174
|
-
Completed bool `json:"completed"`
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
type Color string
|
|
178
|
-
|
|
179
|
-
// Color constants using centralized definitions
|
|
180
|
-
var (
|
|
181
|
-
Blue Color = Color(colors.Blue.CSSValue)
|
|
182
|
-
Gray Color = Color(colors.Gray.CSSValue)
|
|
183
|
-
Tan Color = Color(colors.Tan.CSSValue)
|
|
184
|
-
Yellow Color = Color(colors.Yellow.CSSValue)
|
|
185
|
-
Lime Color = Color(colors.Lime.CSSValue)
|
|
186
|
-
Aqua Color = Color(colors.Aqua.CSSValue)
|
|
187
|
-
Violet Color = Color(colors.Violet.CSSValue)
|
|
188
|
-
Purple Color = Color(colors.Purple.CSSValue)
|
|
189
|
-
Pink Color = Color(colors.Pink.CSSValue)
|
|
190
|
-
)
|
package/internal/app/app.go
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// Package app
|
|
2
|
-
package app
|
|
3
|
-
|
|
4
|
-
import (
|
|
5
|
-
"context"
|
|
6
|
-
"fmt"
|
|
7
|
-
"os"
|
|
8
|
-
|
|
9
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
10
|
-
"github.com/rogeriopvl/fizzy/internal/config"
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
type App struct {
|
|
14
|
-
Client *api.Client
|
|
15
|
-
Config *config.Config
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
func New() (*App, error) {
|
|
19
|
-
cfg, err := config.Load()
|
|
20
|
-
if err != nil {
|
|
21
|
-
return nil, fmt.Errorf("loading config: %w", err)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
token, isSet := os.LookupEnv("FIZZY_ACCESS_TOKEN")
|
|
25
|
-
if !isSet || token == "" {
|
|
26
|
-
return &App{Config: cfg}, nil // No token set, app will handle gracefully
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
client, err := api.NewClient(cfg.SelectedAccount, cfg.SelectedBoard)
|
|
30
|
-
if err != nil {
|
|
31
|
-
return nil, fmt.Errorf("creating API client: %w", err)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return &App{Client: client, Config: cfg}, nil
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// contextKey is a type for context keys to avoid collisions.
|
|
38
|
-
type contextKey string
|
|
39
|
-
|
|
40
|
-
const appContextKey contextKey = "app"
|
|
41
|
-
|
|
42
|
-
func FromContext(ctx context.Context) *App {
|
|
43
|
-
app, _ := ctx.Value(appContextKey).(*App)
|
|
44
|
-
return app
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
func (a *App) ToContext(ctx context.Context) context.Context {
|
|
48
|
-
return context.WithValue(ctx, appContextKey, a)
|
|
49
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
package colors
|
|
2
|
-
|
|
3
|
-
import "github.com/charmbracelet/lipgloss"
|
|
4
|
-
|
|
5
|
-
type ColorDef struct {
|
|
6
|
-
Name string
|
|
7
|
-
CSSValue string
|
|
8
|
-
TermColor lipgloss.Color
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
var (
|
|
12
|
-
Blue = ColorDef{"Blue", "var(--color-card-default)", lipgloss.Color("12")}
|
|
13
|
-
Gray = ColorDef{"Gray", "var(--color-card-1)", lipgloss.Color("8")}
|
|
14
|
-
Tan = ColorDef{"Tan", "var(--color-card-2)", lipgloss.Color("180")}
|
|
15
|
-
Yellow = ColorDef{"Yellow", "var(--color-card-3)", lipgloss.Color("11")}
|
|
16
|
-
Lime = ColorDef{"Lime", "var(--color-card-4)", lipgloss.Color("10")}
|
|
17
|
-
Aqua = ColorDef{"Aqua", "var(--color-card-5)", lipgloss.Color("14")}
|
|
18
|
-
Violet = ColorDef{"Violet", "var(--color-card-6)", lipgloss.Color("177")}
|
|
19
|
-
Purple = ColorDef{"Purple", "var(--color-card-7)", lipgloss.Color("135")}
|
|
20
|
-
Pink = ColorDef{"Pink", "var(--color-card-8)", lipgloss.Color("205")}
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
var All = []ColorDef{Blue, Gray, Tan, Yellow, Lime, Aqua, Violet, Purple, Pink}
|
|
24
|
-
|
|
25
|
-
func ByName(name string) *ColorDef {
|
|
26
|
-
for _, c := range All {
|
|
27
|
-
if c.Name == name {
|
|
28
|
-
return &c
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return nil
|
|
32
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
// Package config
|
|
2
|
-
package config
|
|
3
|
-
|
|
4
|
-
import (
|
|
5
|
-
"encoding/json"
|
|
6
|
-
"fmt"
|
|
7
|
-
"os"
|
|
8
|
-
"path/filepath"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
const (
|
|
12
|
-
configDir = ".config/fizzy-cli"
|
|
13
|
-
configFile = "config.json"
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
type Config struct {
|
|
17
|
-
SelectedAccount string `json:"selected_account"`
|
|
18
|
-
SelectedBoard string `json:"selected_board"`
|
|
19
|
-
CurrentUserID string `json:"current_user_id"`
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Load reads the config file from $HOME/.config/fizzy-cli/config.json.
|
|
23
|
-
func Load() (*Config, error) {
|
|
24
|
-
homeDir, err := os.UserHomeDir()
|
|
25
|
-
if err != nil {
|
|
26
|
-
return nil, fmt.Errorf("getting home directory: %w", err)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
configPath := filepath.Join(homeDir, configDir, configFile)
|
|
30
|
-
|
|
31
|
-
data, err := os.ReadFile(configPath)
|
|
32
|
-
if err != nil {
|
|
33
|
-
if os.IsNotExist(err) {
|
|
34
|
-
return &Config{}, nil
|
|
35
|
-
}
|
|
36
|
-
return nil, fmt.Errorf("reading config file: %w", err)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
var config Config
|
|
40
|
-
if err := json.Unmarshal(data, &config); err != nil {
|
|
41
|
-
return nil, fmt.Errorf("parsing config file: %w", err)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return &config, nil
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
func (c *Config) Save() error {
|
|
48
|
-
homeDir, err := os.UserHomeDir()
|
|
49
|
-
if err != nil {
|
|
50
|
-
return fmt.Errorf("getting home directory: %w", err)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
configDirPath := filepath.Join(homeDir, configDir)
|
|
54
|
-
if err := os.MkdirAll(configDirPath, 0o755); err != nil {
|
|
55
|
-
return fmt.Errorf("creating config directory: %w", err)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
configPath := filepath.Join(configDirPath, configFile)
|
|
59
|
-
|
|
60
|
-
data, err := json.MarshalIndent(c, "", " ")
|
|
61
|
-
if err != nil {
|
|
62
|
-
return fmt.Errorf("marshaling config: %w", err)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if err := os.WriteFile(configPath, data, 0o644); err != nil {
|
|
66
|
-
return fmt.Errorf("writing config file: %w", err)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return nil
|
|
70
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Package testutil
|
|
2
|
-
package testutil
|
|
3
|
-
|
|
4
|
-
import (
|
|
5
|
-
"net/http"
|
|
6
|
-
"time"
|
|
7
|
-
|
|
8
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
func NewTestClient(baseURL, accountSlug, boardID, accessToken string) *api.Client {
|
|
12
|
-
accountBaseURL := baseURL + accountSlug
|
|
13
|
-
|
|
14
|
-
var boardURL string
|
|
15
|
-
if boardID != "" {
|
|
16
|
-
boardURL = accountBaseURL + "/boards" + "/" + boardID
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return &api.Client{
|
|
20
|
-
BaseURL: baseURL,
|
|
21
|
-
AccountBaseURL: accountBaseURL,
|
|
22
|
-
BoardBaseURL: boardURL,
|
|
23
|
-
AccessToken: accessToken,
|
|
24
|
-
HTTPClient: &http.Client{Timeout: 30 * time.Second},
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package ui
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"fmt"
|
|
5
|
-
|
|
6
|
-
"github.com/rogeriopvl/fizzy/internal/api"
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
func DisplayAccounts(accounts []api.Account) error {
|
|
10
|
-
for _, account := range accounts {
|
|
11
|
-
fmt.Printf("%s (%s)\n", account.Name, DisplayMeta("slug", account.Slug))
|
|
12
|
-
}
|
|
13
|
-
return nil
|
|
14
|
-
}
|