From fe1151d9c95fd59bbcd58ed554b7e3a83b1cca59 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Tue, 2 Jun 2026 12:05:46 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20bump=20go-flashduty=20=E2=80=94=20drop?= =?UTF-8?q?=20notify-rule=20commands=20+=20omitempty=20responses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps go-flashduty to main (b12fb6a): #6 omitempty request/response split + #7 sync that drops the stale /channel/notify/rule/* endpoints. Regenerated via cligen: 254→248 commands; the 6 ChannelNotifyRule commands drop from zz_generated_channels.go (their SDK methods no longer exist — they 404'd anyway). The omitempty split flows through the SDK dependency at runtime (response false/0/[]/{} now survive --json/--toon); no CLI codegen delta from it. build/vet/test green. No release. --- go.mod | 2 +- go.sum | 4 +- internal/cli/zz_generated_channels.go | 222 -------------------------- internal/cli/zz_generated_manifest.go | 6 - 4 files changed, 3 insertions(+), 231 deletions(-) diff --git a/go.mod b/go.mod index 1c17412..f1508f0 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/flashcatcloud/flashduty-cli go 1.25.1 require ( - github.com/flashcatcloud/go-flashduty v0.5.3-0.20260602031007-62b37649b2f0 + github.com/flashcatcloud/go-flashduty v0.5.3-0.20260602040240-b12fb6a1ddb2 github.com/mattn/go-runewidth v0.0.23 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 diff --git a/go.sum b/go.sum index a5b9db3..aaf70ea 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/flashcatcloud/go-flashduty v0.5.3-0.20260602031007-62b37649b2f0 h1:mk9ryHQVssVA3qqyH4ryqeWa6sW0tYdww3JWalN3ZH0= -github.com/flashcatcloud/go-flashduty v0.5.3-0.20260602031007-62b37649b2f0/go.mod h1:aA0RtZEs0AYOwwdNKdtVeD8YMOdnmVY1zAlVD+9Ovx8= +github.com/flashcatcloud/go-flashduty v0.5.3-0.20260602040240-b12fb6a1ddb2 h1:Tr563N4JAbclxnC9dWmwyPC39SCc/bifW0eVvCcnSyk= +github.com/flashcatcloud/go-flashduty v0.5.3-0.20260602040240-b12fb6a1ddb2/go.mod h1:aA0RtZEs0AYOwwdNKdtVeD8YMOdnmVY1zAlVD+9Ovx8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw= diff --git a/internal/cli/zz_generated_channels.go b/internal/cli/zz_generated_channels.go index ad83e1b..babad25 100644 --- a/internal/cli/zz_generated_channels.go +++ b/internal/cli/zz_generated_channels.go @@ -1505,222 +1505,6 @@ Response fields ('data' envelope is unwrapped — rows are nested under items[]; return cmd } -func genChannelsChannelNotifyRuleCreateCmd() *cobra.Command { - var dataJSON string - cmd := &cobra.Command{ - Use: "notify-rule-create", - Short: "Create channel notification rule", - Long: `Create channel notification rule. - -Create a notification rule for a channel. - -API: POST /channel/notify/rule/create (channelNotifyRuleCreate) -`, - Example: ` flashduty channel notify-rule-create --data '{}'`, - RunE: func(cmd *cobra.Command, args []string) error { - return runCommand(cmd, args, func(ctx *RunContext) error { - body, err := genAssembleBody(dataJSON, func(body map[string]any) { - }) - if err != nil { - return err - } - _ = body - resp, err := ctx.Client.Channels.ChannelNotifyRuleCreate(cmdContext(ctx.Cmd)) - if err != nil { - return err - } - if resp != nil && len(resp.Raw) > 0 { - return ctx.WriteRaw(resp.Raw) - } - ctx.WriteResult("OK: POST /channel/notify/rule/create") - return nil - }) - }, - } - cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; typed flags override its fields") - return cmd -} - -func genChannelsChannelNotifyRuleDeleteCmd() *cobra.Command { - var dataJSON string - cmd := &cobra.Command{ - Use: "notify-rule-delete", - Short: "Delete channel notification rule", - Long: `Delete channel notification rule. - -Delete a channel notification rule. - -API: POST /channel/notify/rule/delete (channelNotifyRuleDelete) -`, - Example: ` flashduty channel notify-rule-delete --data '{}'`, - RunE: func(cmd *cobra.Command, args []string) error { - return runCommand(cmd, args, func(ctx *RunContext) error { - body, err := genAssembleBody(dataJSON, func(body map[string]any) { - }) - if err != nil { - return err - } - _ = body - resp, err := ctx.Client.Channels.ChannelNotifyRuleDelete(cmdContext(ctx.Cmd)) - if err != nil { - return err - } - if resp != nil && len(resp.Raw) > 0 { - return ctx.WriteRaw(resp.Raw) - } - ctx.WriteResult("OK: POST /channel/notify/rule/delete") - return nil - }) - }, - } - cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; typed flags override its fields") - return cmd -} - -func genChannelsChannelNotifyRuleDisableCmd() *cobra.Command { - var dataJSON string - cmd := &cobra.Command{ - Use: "notify-rule-disable", - Short: "Disable channel notification rule", - Long: `Disable channel notification rule. - -Disable a channel notification rule without deleting it. - -API: POST /channel/notify/rule/disable (channelNotifyRuleDisable) -`, - Example: ` flashduty channel notify-rule-disable --data '{}'`, - RunE: func(cmd *cobra.Command, args []string) error { - return runCommand(cmd, args, func(ctx *RunContext) error { - body, err := genAssembleBody(dataJSON, func(body map[string]any) { - }) - if err != nil { - return err - } - _ = body - resp, err := ctx.Client.Channels.ChannelNotifyRuleDisable(cmdContext(ctx.Cmd)) - if err != nil { - return err - } - if resp != nil && len(resp.Raw) > 0 { - return ctx.WriteRaw(resp.Raw) - } - ctx.WriteResult("OK: POST /channel/notify/rule/disable") - return nil - }) - }, - } - cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; typed flags override its fields") - return cmd -} - -func genChannelsChannelNotifyRuleEnableCmd() *cobra.Command { - var dataJSON string - cmd := &cobra.Command{ - Use: "notify-rule-enable", - Short: "Enable channel notification rule", - Long: `Enable channel notification rule. - -Enable a disabled channel notification rule. - -API: POST /channel/notify/rule/enable (channelNotifyRuleEnable) -`, - Example: ` flashduty channel notify-rule-enable --data '{}'`, - RunE: func(cmd *cobra.Command, args []string) error { - return runCommand(cmd, args, func(ctx *RunContext) error { - body, err := genAssembleBody(dataJSON, func(body map[string]any) { - }) - if err != nil { - return err - } - _ = body - resp, err := ctx.Client.Channels.ChannelNotifyRuleEnable(cmdContext(ctx.Cmd)) - if err != nil { - return err - } - if resp != nil && len(resp.Raw) > 0 { - return ctx.WriteRaw(resp.Raw) - } - ctx.WriteResult("OK: POST /channel/notify/rule/enable") - return nil - }) - }, - } - cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; typed flags override its fields") - return cmd -} - -func genChannelsChannelNotifyRuleListCmd() *cobra.Command { - var dataJSON string - cmd := &cobra.Command{ - Use: "notify-rule-list", - Short: "List channel notification rules", - Long: `List channel notification rules. - -List all notification rules configured for a channel. - -API: POST /channel/notify/rule/list (channelNotifyRuleList) -`, - Example: ` flashduty channel notify-rule-list --data '{}'`, - RunE: func(cmd *cobra.Command, args []string) error { - return runCommand(cmd, args, func(ctx *RunContext) error { - body, err := genAssembleBody(dataJSON, func(body map[string]any) { - }) - if err != nil { - return err - } - _ = body - resp, err := ctx.Client.Channels.ChannelNotifyRuleList(cmdContext(ctx.Cmd)) - if err != nil { - return err - } - if resp != nil && len(resp.Raw) > 0 { - return ctx.WriteRaw(resp.Raw) - } - ctx.WriteResult("OK: POST /channel/notify/rule/list") - return nil - }) - }, - } - cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; typed flags override its fields") - return cmd -} - -func genChannelsChannelNotifyRuleUpdateCmd() *cobra.Command { - var dataJSON string - cmd := &cobra.Command{ - Use: "notify-rule-update", - Short: "Update channel notification rule", - Long: `Update channel notification rule. - -Update an existing channel notification rule. - -API: POST /channel/notify/rule/update (channelNotifyRuleUpdate) -`, - Example: ` flashduty channel notify-rule-update --data '{}'`, - RunE: func(cmd *cobra.Command, args []string) error { - return runCommand(cmd, args, func(ctx *RunContext) error { - body, err := genAssembleBody(dataJSON, func(body map[string]any) { - }) - if err != nil { - return err - } - _ = body - resp, err := ctx.Client.Channels.ChannelNotifyRuleUpdate(cmdContext(ctx.Cmd)) - if err != nil { - return err - } - if resp != nil && len(resp.Raw) > 0 { - return ctx.WriteRaw(resp.Raw) - } - ctx.WriteResult("OK: POST /channel/notify/rule/update") - return nil - }) - }, - } - cmd.Flags().StringVar(&dataJSON, "data", "", "Full request body as JSON; typed flags override its fields") - return cmd -} - func genChannelsChannelSilenceRuleCreateCmd() *cobra.Command { var dataJSON string var fChannelID int64 @@ -2838,12 +2622,6 @@ func registerGeneratedChannels(root *cobra.Command) { genAddLeaf(gChannel, genChannelsChannelInhibitRuleListCmd()) genAddLeaf(gChannel, genChannelsChannelInhibitRuleUpdateCmd()) genAddLeaf(gChannel, genChannelsChannelListCmd()) - genAddLeaf(gChannel, genChannelsChannelNotifyRuleCreateCmd()) - genAddLeaf(gChannel, genChannelsChannelNotifyRuleDeleteCmd()) - genAddLeaf(gChannel, genChannelsChannelNotifyRuleDisableCmd()) - genAddLeaf(gChannel, genChannelsChannelNotifyRuleEnableCmd()) - genAddLeaf(gChannel, genChannelsChannelNotifyRuleListCmd()) - genAddLeaf(gChannel, genChannelsChannelNotifyRuleUpdateCmd()) genAddLeaf(gChannel, genChannelsChannelSilenceRuleCreateCmd()) genAddLeaf(gChannel, genChannelsChannelSilenceRuleDeleteCmd()) genAddLeaf(gChannel, genChannelsChannelSilenceRuleDisableCmd()) diff --git a/internal/cli/zz_generated_manifest.go b/internal/cli/zz_generated_manifest.go index 546a93d..63534b1 100644 --- a/internal/cli/zz_generated_manifest.go +++ b/internal/cli/zz_generated_manifest.go @@ -47,12 +47,6 @@ var generatedOpIDs = []string{ "channelInhibitRuleList", "channelInhibitRuleUpdate", "channelList", - "channelNotifyRuleCreate", - "channelNotifyRuleDelete", - "channelNotifyRuleDisable", - "channelNotifyRuleEnable", - "channelNotifyRuleList", - "channelNotifyRuleUpdate", "channelSilenceRuleCreate", "channelSilenceRuleDelete", "channelSilenceRuleDisable",