Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/folder/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ func runFolderDelete(cmd *cobra.Command, args []string) error {

response = strings.TrimSpace(strings.ToLower(response))
if response != "yes" {
fmt.Println("Deletion cancelled.")
return nil
return fmt.Errorf("deletion cancelled")
}
}

Expand Down
117 changes: 0 additions & 117 deletions cmd/routine/delete.go

This file was deleted.

2 changes: 0 additions & 2 deletions cmd/routine/routine.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Examples:
hevycli routine get <id> # Get routine details
hevycli routine create --file r.json # Create from JSON
hevycli routine update <id> --file r.json # Update routine
hevycli routine delete <id> # Delete routine
hevycli routine builder # Interactive routine builder`,
}

Expand All @@ -22,5 +21,4 @@ func init() {
Cmd.AddCommand(getCmd)
Cmd.AddCommand(createCmd)
Cmd.AddCommand(updateCmd)
// deleteCmd is added in delete.go's init()
}
3 changes: 1 addition & 2 deletions cmd/workout/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ func runDelete(cmd *cobra.Command, args []string) error {

response = strings.TrimSpace(strings.ToLower(response))
if response != "yes" {
fmt.Println("Deletion cancelled.")
return nil
return fmt.Errorf("deletion cancelled")
}
}

Expand Down
15 changes: 0 additions & 15 deletions internal/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
type Client struct {
baseURL string
apiKey string
httpClient *resty.Client

Check failure on line 26 in internal/api/client.go

View workflow job for this annotation

GitHub Actions / lint

undefined: resty (typecheck)
}

// ClientOption is a function that configures the client
Expand All @@ -40,7 +40,7 @@
opt(c)
}

c.httpClient = resty.New().

Check failure on line 43 in internal/api/client.go

View workflow job for this annotation

GitHub Actions / lint

undefined: resty (typecheck)
SetBaseURL(c.baseURL).
SetHeader("api-key", c.apiKey).
SetHeader("User-Agent", UserAgent).
Expand Down Expand Up @@ -254,7 +254,7 @@
}

// handleResponse checks for API errors based on HTTP status code
func (c *Client) handleResponse(resp *resty.Response) error {

Check failure on line 257 in internal/api/client.go

View workflow job for this annotation

GitHub Actions / lint

undefined: resty (typecheck)
switch resp.StatusCode() {
case http.StatusOK, http.StatusCreated, http.StatusNoContent:
return nil
Expand Down Expand Up @@ -530,21 +530,6 @@
return &result, nil
}

// DeleteRoutine deletes a routine by ID
func (c *Client) DeleteRoutine(id string) error {
resp, err := c.httpClient.R().
Delete("/routines/" + id)

if err != nil {
return &APIError{
ErrorCode: "NETWORK_ERROR",
ErrorMessage: fmt.Sprintf("failed to delete routine: %v", err),
}
}

return c.handleResponse(resp)
}

// UpdateRoutineFolder updates an existing routine folder
func (c *Client) UpdateRoutineFolder(id int, req *UpdateRoutineFolderRequest) (*RoutineFolder, error) {
var result RoutineFolderResponse
Expand Down
Loading