segments

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a new contact segment",
	Long:  "Create a new contact segment.\n\nThis endpoint allows creating a new contact segment that can be used to organize contacts.\nThe segment can be configured with specific criteria like email, name, subscription status, etc.",
	Run: func(cmd *cobra.Command, args []string) {
		utils.EnumCheck(cmd, "logic", []string{"AND", "OR"})
		payload, err := json.Marshal(createBody(cmd))
		if err != nil {
			log.Fatal(err)
		}
		r, err := api.Request().ReachCreateANewContactSegmentV1WithBodyWithResponse(context.TODO(), "application/json", bytes.NewReader(payload))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var GetCmd = &cobra.Command{
	Use:   "get <segment-uuid>",
	Short: "Get segment details",
	Long:  "Get details of a specific segment.\n\nThis endpoint retrieves information about a single segment identified by UUID.\nSegments are used to organize and group contacts based on specific criteria.",
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().ReachGetSegmentDetailsV1WithResponse(context.TODO(), args[0])
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var GroupCmd = &cobra.Command{
	Use:   "segments",
	Short: "Segments commands",
}
View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List segments",
	Long:  "Get a list of all contact segments.\n\nThis endpoint returns a list of contact segments that can be used to organize contacts.",
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().ReachListSegmentsV1WithResponse(context.TODO())
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var ListContactsCmd = &cobra.Command{
	Use:   "list-contacts <segment-uuid>",
	Short: "List segment contacts",
	Long:  "Retrieve contacts associated with a specific segment.\n\nThis endpoint allows you to fetch and filter contacts that belong to a particular segment,\nidentified by its UUID.",
	Args:  cobra.MatchAll(cobra.ExactArgs(1)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().ReachListSegmentContactsV1WithResponse(context.TODO(), args[0], listContactsParams(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}
View Source
var ListProfileContactsCmd = &cobra.Command{
	Use:   "list-profile-contacts <profile-uuid> <segment-uuid>",
	Short: "List profile segment contacts",
	Long:  "Retrieve contacts associated with a specific segment for a given profile.\n\nThis endpoint allows you to fetch and filter contacts that belong to a particular segment,\nidentified by its UUID, scoped to a specific profile.",
	Args:  cobra.MatchAll(cobra.ExactArgs(2)),
	Run: func(cmd *cobra.Command, args []string) {
		r, err := api.Request().ReachListProfileSegmentContactsV1WithResponse(context.TODO(), args[0], args[1], listProfileContactsParams(cmd))
		if err != nil {
			log.Fatal(err)
		}

		output.Format(cmd, r.Body, r.StatusCode())
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL