Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateCmd = &cobra.Command{ Use: "create <mailbox-resource-id>", Short: "Create webhook", Long: "Create a webhook. The response includes the one-time `secret` — store it securely as it is never returned again.", Args: cobra.MatchAll(cobra.ExactArgs(1)), Run: func(cmd *cobra.Command, args []string) { utils.EnumCheck(cmd, "status", []string{"active", "paused", "disabled"}) payload, err := json.Marshal(createBody(cmd)) if err != nil { log.Fatal(err) } r, err := api.Request().CreateWebhookWithBodyWithResponse(context.TODO(), args[0], "application/json", bytes.NewReader(payload)) if err != nil { log.Fatal(err) } output.Format(cmd, r.Body, r.StatusCode()) }, }
View Source
var DeleteCmd = &cobra.Command{ Use: "delete <mailbox-resource-id> <webhook>", Short: "Delete webhook", Long: "Delete a webhook.", Args: cobra.MatchAll(cobra.ExactArgs(2)), Run: func(cmd *cobra.Command, args []string) { r, err := api.Request().DeleteWebhookWithResponse(context.TODO(), args[0], uuid.MustParse(args[1])) if err != nil { log.Fatal(err) } output.Format(cmd, r.Body, r.StatusCode()) }, }
View Source
var GetCmd = &cobra.Command{ Use: "get <mailbox-resource-id> <webhook>", Short: "Get webhook", Long: "Retrieve a single webhook by id.", Args: cobra.MatchAll(cobra.ExactArgs(2)), Run: func(cmd *cobra.Command, args []string) { r, err := api.Request().GetWebhookWithResponse(context.TODO(), args[0], uuid.MustParse(args[1])) if err != nil { log.Fatal(err) } output.Format(cmd, r.Body, r.StatusCode()) }, }
View Source
var GroupCmd = &cobra.Command{
Use: "webhooks",
Short: "Webhooks commands",
}
View Source
var ListCmd = &cobra.Command{ Use: "list <mailbox-resource-id>", Short: "List webhooks", Long: "List webhooks for a mailbox.", Args: cobra.MatchAll(cobra.ExactArgs(1)), Run: func(cmd *cobra.Command, args []string) { utils.EnumCheck(cmd, "status", []string{"active", "paused", "disabled"}) r, err := api.Request().ListWebhooksWithResponse(context.TODO(), args[0], listParams(cmd)) if err != nil { log.Fatal(err) } output.Format(cmd, r.Body, r.StatusCode()) }, }
View Source
var RegenerateSecretCmd = &cobra.Command{ Use: "regenerate-secret <mailbox-resource-id> <webhook>", Short: "Regenerate webhook secret", Long: "Regenerate the webhook secret. The previous secret is immediately invalidated. The new secret is returned once.", Args: cobra.MatchAll(cobra.ExactArgs(2)), Run: func(cmd *cobra.Command, args []string) { r, err := api.Request().RegenerateWebhookSecretWithResponse(context.TODO(), args[0], uuid.MustParse(args[1])) if err != nil { log.Fatal(err) } output.Format(cmd, r.Body, r.StatusCode()) }, }
View Source
var TestCmd = &cobra.Command{ Use: "test <mailbox-resource-id> <webhook>", Short: "Test webhook", Long: "Send a test delivery to the webhook URL and return the upstream response.", Args: cobra.MatchAll(cobra.ExactArgs(2)), Run: func(cmd *cobra.Command, args []string) { r, err := api.Request().TestWebhookWithResponse(context.TODO(), args[0], uuid.MustParse(args[1])) if err != nil { log.Fatal(err) } output.Format(cmd, r.Body, r.StatusCode()) }, }
View Source
var UpdateCmd = &cobra.Command{ Use: "update <mailbox-resource-id> <webhook>", Short: "Update webhook", Long: "Partially update a webhook.", Args: cobra.MatchAll(cobra.ExactArgs(2)), Run: func(cmd *cobra.Command, args []string) { utils.EnumCheck(cmd, "status", []string{"active", "paused", "disabled"}) payload, err := json.Marshal(updateBody(cmd)) if err != nil { log.Fatal(err) } r, err := api.Request().UpdateWebhookWithBodyWithResponse(context.TODO(), args[0], uuid.MustParse(args[1]), "application/json", bytes.NewReader(payload)) if err != nil { log.Fatal(err) } output.Format(cmd, r.Body, r.StatusCode()) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.