Added list management commands, board filtering by project name, and enhanced skill documentation with bootstrap workflow and error handling patterns. Also added plumbing in to "pcli" binary for status syncing with Planka

This commit is contained in:
Steve Cliff
2026-02-18 20:06:56 +00:00
parent ad384fe749
commit 46b03e1a22
21 changed files with 1074 additions and 124 deletions
+81
View File
@@ -0,0 +1,81 @@
package client
import (
"context"
"encoding/json"
"fmt"
"git.franklin.lab/steve.cliff/pcli/model"
)
// ListCreateFields represents the fields required to create a list
type ListCreateFields struct {
Name string `json:"name"`
Position float64 `json:"position"`
Type string `json:"type"`
}
// ListUpdateFields represents the fields that can be updated for a list
type ListUpdateFields struct {
Name *string `json:"name,omitempty"`
Position *float64 `json:"position,omitempty"`
Type *string `json:"type,omitempty"`
Color *string `json:"color,omitempty"`
BoardID *string `json:"boardId,omitempty"`
}
func (c *Client) CreateList(ctx context.Context, boardId string, fields ListCreateFields) (*model.List, error) {
data, err := c.Do(ctx, "POST", fmt.Sprintf("/api/boards/%s/lists", boardId), fields)
if err != nil {
return nil, err
}
var response struct {
Item model.List `json:"item"`
}
if err := json.Unmarshal(data, &response); err != nil {
return nil, fmt.Errorf("failed to unmarshal list response: %w", err)
}
return &response.Item, nil
}
func (c *Client) GetList(ctx context.Context, id string) (*model.List, error) {
data, err := c.DoNoBody(ctx, "GET", fmt.Sprintf("/api/lists/%s", id))
if err != nil {
return nil, err
}
var response struct {
Item model.List `json:"item"`
}
if err := json.Unmarshal(data, &response); err != nil {
return nil, fmt.Errorf("failed to unmarshal list response: %w", err)
}
return &response.Item, nil
}
func (c *Client) UpdateList(ctx context.Context, id string, fields ListUpdateFields) (*model.List, error) {
data, err := c.Do(ctx, "PATCH", fmt.Sprintf("/api/lists/%s", id), fields)
if err != nil {
return nil, err
}
var response struct {
Item model.List `json:"item"`
}
if err := json.Unmarshal(data, &response); err != nil {
return nil, fmt.Errorf("failed to unmarshal list response: %w", err)
}
return &response.Item, nil
}
func (c *Client) DeleteList(ctx context.Context, id string) error {
_, err := c.DoNoBody(ctx, "DELETE", fmt.Sprintf("/api/lists/%s", id))
return err
}