( deps commandDeps, workspaceRef *string, use string, mode string, short string, )
| 1022 | } |
| 1023 | |
| 1024 | func newNetworkSubscriptionModeCommand( |
| 1025 | deps commandDeps, |
| 1026 | workspaceRef *string, |
| 1027 | use string, |
| 1028 | mode string, |
| 1029 | short string, |
| 1030 | ) *cobra.Command { |
| 1031 | var flags networkSubscriptionFlags |
| 1032 | cmd := &cobra.Command{ |
| 1033 | Use: use, |
| 1034 | Short: short, |
| 1035 | RunE: func(cmd *cobra.Command, _ []string) error { |
| 1036 | client, err := clientFromDeps(deps) |
| 1037 | if err != nil { |
| 1038 | return err |
| 1039 | } |
| 1040 | workspace, err := resolveNetworkWorkspaceRef(cmd, deps, client, workspaceRef) |
| 1041 | if err != nil { |
| 1042 | return err |
| 1043 | } |
| 1044 | subscription, err := client.SetNetworkSubscription( |
| 1045 | cmd.Context(), |
| 1046 | workspace, |
| 1047 | strings.TrimSpace(flags.channel), |
| 1048 | NetworkSubscriptionRequest{ |
| 1049 | ThreadID: strings.TrimSpace(flags.threadID), |
| 1050 | PeerID: strings.TrimSpace(flags.peerID), |
| 1051 | Mode: mode, |
| 1052 | KeywordFilters: trimSpawnAtoms(flags.keywordFilters), |
| 1053 | }, |
| 1054 | ) |
| 1055 | if err != nil { |
| 1056 | return err |
| 1057 | } |
| 1058 | return writeCommandOutput(cmd, networkSubscriptionBundle(subscription)) |
| 1059 | }, |
| 1060 | } |
| 1061 | registerNetworkSubscriptionMutationFlags(cmd, &flags, true) |
| 1062 | return cmd |
| 1063 | } |
| 1064 | |
| 1065 | func newNetworkUnmuteCommand(deps commandDeps, workspaceRef *string) *cobra.Command { |
| 1066 | var flags networkSubscriptionFlags |
no test coverage detected