fizzy-cli 0.6.0 → 0.6.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.1 - 2026-01-26
4
+
5
+ ### Fixes
6
+
7
+ - Fixed API client to not parse empty responses from POST endpoints, this was
8
+ causing the create sub-command of comment, reaction and step to show an error
9
+ message, even though the resource was actually created on the API.
10
+
3
11
  ## 0.6.0 - 2026-01-25
4
12
 
5
13
  ### Features
@@ -34,12 +34,12 @@ func handleCreateComment(cmd *cobra.Command, cardNumber string) error {
34
34
 
35
35
  body, _ := cmd.Flags().GetString("body")
36
36
 
37
- comment, err := a.Client.PostCardComment(context.Background(), cardNum, body)
37
+ _, err = a.Client.PostCardComment(context.Background(), cardNum, body)
38
38
  if err != nil {
39
39
  return fmt.Errorf("creating comment: %w", err)
40
40
  }
41
41
 
42
- fmt.Printf("✓ Comment created successfully (id: %s)\n", comment.ID)
42
+ fmt.Printf("✓ Comment created successfully\n")
43
43
  return nil
44
44
  }
45
45
 
@@ -32,12 +32,12 @@ func handleCreateReaction(cmd *cobra.Command, cardNumber, commentID, emoji strin
32
32
  return fmt.Errorf("API client not available")
33
33
  }
34
34
 
35
- reaction, err := a.Client.PostCommentReaction(context.Background(), cardNum, commentID, emoji)
35
+ _, err = a.Client.PostCommentReaction(context.Background(), cardNum, commentID, emoji)
36
36
  if err != nil {
37
37
  return fmt.Errorf("creating reaction: %w", err)
38
38
  }
39
39
 
40
- fmt.Printf("✓ Reaction %s created successfully (id: %s)\n", reaction.Content, reaction.ID)
40
+ fmt.Printf("✓ Reaction %s created successfully\n", emoji)
41
41
  return nil
42
42
  }
43
43
 
@@ -35,12 +35,12 @@ func handleCreateStep(cmd *cobra.Command, cardNumber string) error {
35
35
  content, _ := cmd.Flags().GetString("content")
36
36
  completed, _ := cmd.Flags().GetBool("completed")
37
37
 
38
- step, err := a.Client.PostCardStep(context.Background(), cardNum, content, completed)
38
+ _, err = a.Client.PostCardStep(context.Background(), cardNum, content, completed)
39
39
  if err != nil {
40
40
  return fmt.Errorf("creating step: %w", err)
41
41
  }
42
42
 
43
- fmt.Printf("✓ Step created successfully (id: %s)\n", step.ID)
43
+ fmt.Printf("✓ Step created successfully\n")
44
44
  return nil
45
45
  }
46
46
 
@@ -3,6 +3,7 @@ package api
3
3
  import (
4
4
  "context"
5
5
  "fmt"
6
+ "io"
6
7
  "net/http"
7
8
  )
8
9
 
@@ -52,13 +53,21 @@ func (c *Client) PostCardComment(ctx context.Context, cardNumber int, body strin
52
53
  return nil, fmt.Errorf("failed to create post card comment request: %w", err)
53
54
  }
54
55
 
55
- var response Comment
56
- _, err = c.decodeResponse(req, &response, http.StatusCreated)
56
+ res, err := c.HTTPClient.Do(req)
57
57
  if err != nil {
58
- return nil, err
58
+ return nil, fmt.Errorf("failed to make request: %w", err)
59
59
  }
60
+ defer res.Body.Close()
60
61
 
61
- return &response, nil
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
62
71
  }
63
72
 
64
73
  func (c *Client) PutCardComment(ctx context.Context, cardNumber int, commentID string, body string) (*Comment, error) {
@@ -3,6 +3,7 @@ package api
3
3
  import (
4
4
  "context"
5
5
  "fmt"
6
+ "io"
6
7
  "net/http"
7
8
  )
8
9
 
@@ -35,13 +36,20 @@ func (c *Client) PostCommentReaction(ctx context.Context, cardNumber int, commen
35
36
  return nil, fmt.Errorf("failed to create post comment reaction request: %w", err)
36
37
  }
37
38
 
38
- var response Reaction
39
- _, err = c.decodeResponse(req, &response, http.StatusCreated)
39
+ res, err := c.HTTPClient.Do(req)
40
40
  if err != nil {
41
- return nil, err
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))
42
48
  }
43
49
 
44
- return &response, nil
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
45
53
  }
46
54
 
47
55
  func (c *Client) DeleteCommentReaction(ctx context.Context, cardNumber int, commentID string, reactionID string) (bool, error) {
@@ -3,6 +3,7 @@ package api
3
3
  import (
4
4
  "context"
5
5
  "fmt"
6
+ "io"
6
7
  "net/http"
7
8
  )
8
9
 
@@ -38,13 +39,20 @@ func (c *Client) PostCardStep(ctx context.Context, cardNumber int, content strin
38
39
  return nil, fmt.Errorf("failed to create post card step request: %w", err)
39
40
  }
40
41
 
41
- var response Step
42
- _, err = c.decodeResponse(req, &response, http.StatusCreated)
42
+ res, err := c.HTTPClient.Do(req)
43
43
  if err != nil {
44
- return nil, err
44
+ return nil, fmt.Errorf("failed to make request: %w", err)
45
45
  }
46
+ defer res.Body.Close()
46
47
 
47
- return &response, nil
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
48
56
  }
49
57
 
50
58
  func (c *Client) PutCardStep(ctx context.Context, cardNumber int, stepID string, content *string, completed *bool) (*Step, error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fizzy-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "CLI for https://fizzy.do",
5
5
  "main": "bin/fizzy",
6
6
  "type": "module",