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

@ -75,11 +75,11 @@ func (c *Client) CreateTag(ctx context.Context, projectID int, name, colorID str
params["color_id"] = colorID
}
var result int
var result IntOrFalse
if err := c.call(ctx, "createTag", params, &result); err != nil {
return 0, fmt.Errorf("createTag: %w", err)
}
return result, nil
return int(result), nil
}
// UpdateTag updates an existing tag's name and/or color.