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

Function newNetworkSubscriptionsListCommand

internal/cli/network.go:989–1022  ·  view source on GitHub ↗
(deps commandDeps, workspaceRef *string)

Source from the content-addressed store, hash-verified

987}
988
989func newNetworkSubscriptionsListCommand(deps commandDeps, workspaceRef *string) *cobra.Command {
990 var flags networkSubscriptionFlags
991 cmd := &cobra.Command{
992 Use: networkListKey,
993 Short: "List network delivery preferences",
994 RunE: func(cmd *cobra.Command, _ []string) error {
995 client, err := clientFromDeps(deps)
996 if err != nil {
997 return err
998 }
999 workspace, err := resolveNetworkWorkspaceRef(cmd, deps, client, workspaceRef)
1000 if err != nil {
1001 return err
1002 }
1003 subscriptions, err := client.ListNetworkSubscriptions(cmd.Context(), NetworkSubscriptionsQuery{
1004 WorkspaceRef: workspace,
1005 Channel: strings.TrimSpace(flags.channel),
1006 ThreadID: strings.TrimSpace(flags.threadID),
1007 PeerID: strings.TrimSpace(flags.peerID),
1008 Limit: flags.limit,
1009 })
1010 if err != nil {
1011 return err
1012 }
1013 return writeCommandOutputWithJSONL(cmd, networkSubscriptionsBundle(subscriptions), subscriptions)
1014 },
1015 }
1016 cmd.Flags().StringVar(&flags.channel, networkChannelKey, "", "Target channel")
1017 cmd.Flags().StringVar(&flags.threadID, networkSurfaceThread, "", "Optional thread id")
1018 cmd.Flags().StringVar(&flags.peerID, "peer", "", "Optional peer id filter")
1019 cmd.Flags().IntVar(&flags.limit, "limit", 0, "Maximum number of preferences to return")
1020 mustMarkFlagRequired(cmd, networkChannelKey)
1021 return cmd
1022}
1023
1024func newNetworkSubscriptionModeCommand(
1025 deps commandDeps,

Callers 1

Calls 6

clientFromDepsFunction · 0.85
mustMarkFlagRequiredFunction · 0.85

Tested by

no test coverage detected