Add IntOrFalse type to handle polymorphic API responses

Kanboard API returns int (ID) on success and false (bool) on failure
for create operations. Add IntOrFalse type that handles both cases
and update CreateTask, CreateComment, CreateTag, CreateTaskFile, and
CreateTaskLink to use it.
This commit is contained in:
Oliver Jakoubek 2026-01-15 20:23:53 +01:00
commit a34a40cb12
7 changed files with 63 additions and 10 deletions

View file

@ -42,7 +42,7 @@ func (c *Client) CreateComment(ctx context.Context, taskID, userID int, content
"content": content,
}
var commentID int
var commentID IntOrFalse
if err := c.call(ctx, "createComment", params, &commentID); err != nil {
return nil, fmt.Errorf("createComment: %w", err)
}
@ -52,7 +52,7 @@ func (c *Client) CreateComment(ctx context.Context, taskID, userID int, content
}
// Fetch the created comment to return full details
return c.GetComment(ctx, commentID)
return c.GetComment(ctx, int(commentID))
}
// UpdateComment updates the content of a comment.