TaskByIdentifier fetches and returns a task by an identifier, which may be either a UUID, a name (for a task owned by the current user), or a "user/task" combination, where user is either a username or UUID. Since there is no TaskByOwnerAndName endpoint yet, this function uses the list endpoint wit
(ctx context.Context, identifier string)
| 264 | // Since there is no TaskByOwnerAndName endpoint yet, this function uses the |
| 265 | // list endpoint with filtering when a name is provided. |
| 266 | func (c *Client) TaskByIdentifier(ctx context.Context, identifier string) (Task, error) { |
| 267 | identifier = strings.TrimSpace(identifier) |
| 268 | |
| 269 | // Try parsing as UUID first. |
| 270 | if taskID, err := uuid.Parse(identifier); err == nil { |
| 271 | return c.TaskByID(ctx, taskID) |
| 272 | } |
| 273 | |
| 274 | // Not a UUID, treat as identifier. |
| 275 | owner, taskName, err := splitTaskIdentifier(identifier) |
| 276 | if err != nil { |
| 277 | return Task{}, err |
| 278 | } |
| 279 | |
| 280 | return c.TaskByOwnerAndName(ctx, owner, taskName) |
| 281 | } |
| 282 | |
| 283 | // DeleteTask deletes a task by its ID. |
| 284 | func (c *Client) DeleteTask(ctx context.Context, user string, id uuid.UUID) error { |