( ctx context.Context, scope toolspkg.Scope, req toolspkg.CallRequest, )
| 1720 | } |
| 1721 | |
| 1722 | func (n *daemonNativeTools) networkSubscriptions( |
| 1723 | ctx context.Context, |
| 1724 | scope toolspkg.Scope, |
| 1725 | req toolspkg.CallRequest, |
| 1726 | ) (toolspkg.ToolResult, error) { |
| 1727 | var input networkSubscriptionsInput |
| 1728 | if err := decodeNativeInput(req, &input); err != nil { |
| 1729 | return toolspkg.ToolResult{}, err |
| 1730 | } |
| 1731 | channel, err := nativeNetworkChannel(req.ToolID, input.Channel) |
| 1732 | if err != nil { |
| 1733 | return toolspkg.ToolResult{}, err |
| 1734 | } |
| 1735 | workspaceID, err := n.nativeNetworkWorkspaceID(ctx, req.ToolID, input.WorkspaceID, scope) |
| 1736 | if err != nil { |
| 1737 | return toolspkg.ToolResult{}, err |
| 1738 | } |
| 1739 | query := store.NetworkSubscriptionQuery{ |
| 1740 | WorkspaceID: workspaceID, |
| 1741 | Channel: channel, |
| 1742 | ThreadID: strings.TrimSpace(input.ThreadID), |
| 1743 | PeerID: strings.TrimSpace(input.PeerID), |
| 1744 | Limit: input.Limit, |
| 1745 | } |
| 1746 | if query.Limit == 0 { |
| 1747 | query.Limit = 100 |
| 1748 | } |
| 1749 | if err := query.Validate(); err != nil { |
| 1750 | return toolspkg.ToolResult{}, nativeNetworkInputError(req.ToolID, err) |
| 1751 | } |
| 1752 | subscriptions, err := n.deps.NetworkStore.ListNetworkSubscriptions(ctx, query) |
| 1753 | if err != nil { |
| 1754 | return toolspkg.ToolResult{}, nativeNetworkInputError(req.ToolID, err) |
| 1755 | } |
| 1756 | payload := core.NetworkSubscriptionPayloadsFromStore(subscriptions) |
| 1757 | return structuredNetworkResult( |
| 1758 | map[string]any{"subscriptions": payload}, |
| 1759 | fmt.Sprintf("%d subscriptions", len(payload)), |
| 1760 | ) |
| 1761 | } |
| 1762 | |
| 1763 | func (n *daemonNativeTools) networkSubscribe( |
| 1764 | ctx context.Context, |
nothing calls this directly
no test coverage detected