MCPcopy Create free account
hub / github.com/compozy/agh / taskQueryFromParams

Method taskQueryFromParams

internal/extension/host_api_tasks.go:516–556  ·  view source on GitHub ↗
(
	ctx context.Context,
	params hostAPITasksParams,
)

Source from the content-addressed store, hash-verified

514}
515
516func (h *HostAPIHandler) taskQueryFromParams(
517 ctx context.Context,
518 params hostAPITasksParams,
519) (taskpkg.Query, error) {
520 query := taskpkg.Query{
521 Scope: params.Scope.Normalize(),
522 Status: params.Status.Normalize(),
523 Priority: params.Priority.Normalize(),
524 ApprovalState: params.ApprovalState.Normalize(),
525 OwnerKind: params.OwnerKind.Normalize(),
526 OwnerRef: strings.TrimSpace(params.OwnerRef),
527 ParentTaskID: strings.TrimSpace(params.ParentTaskID),
528 Search: strings.TrimSpace(params.Query),
529 Limit: params.Limit,
530 }
531 if query.Scope.Normalize() != "" {
532 if err := query.Scope.Validate("task_query.scope"); err != nil {
533 return taskpkg.Query{}, invalidParamsRPCError(err)
534 }
535 }
536 if workspaceRef := strings.TrimSpace(params.Workspace); workspaceRef != "" {
537 if query.Scope.Normalize() == taskpkg.ScopeGlobal {
538 if err := taskpkg.ValidateScopeBinding(query.Scope, workspaceRef, "task_query", "workspace"); err != nil {
539 return taskpkg.Query{}, invalidParamsRPCError(err)
540 }
541 }
542 workspaceID, err := h.resolveTaskWorkspaceID(ctx, workspaceRef)
543 if err != nil {
544 return taskpkg.Query{}, err
545 }
546 query.WorkspaceID = workspaceID
547 }
548 if err := validateTaskChannel("task_query.network_channel", params.NetworkChannel); err != nil {
549 return taskpkg.Query{}, err
550 }
551 query.NetworkChannel = strings.TrimSpace(params.NetworkChannel)
552 if err := query.Validate("task_query"); err != nil {
553 return taskpkg.Query{}, invalidParamsRPCError(err)
554 }
555 return query, nil
556}
557
558func taskTimelineQueryFromParams(params apicontract.TaskTimelineQuery) (taskpkg.TimelineQuery, error) {
559 query := taskpkg.TimelineQuery{

Calls 6

ValidateMethod · 0.95
invalidParamsRPCErrorFunction · 0.85
validateTaskChannelFunction · 0.70
ValidateMethod · 0.65
NormalizeMethod · 0.45