profile

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnsetProperties added in v0.0.4

func UnsetProperties(propertyNames ...string) updater.Profile

UnsetProperties removes a key or keys (and their values) completely from properties.

func WithAnonymousId

func WithAnonymousId(anonymousId string) updater.Profile

WithAnonymousId sets the anonymous ID for the profile.

func WithEmail

func WithEmail(email string) updater.Profile

WithEmail sets the email for the profile.

func WithExternalId

func WithExternalId(externalId string) updater.Profile

WithExternalId sets the external ID for the profile.

func WithFirstName

func WithFirstName(firstName string) updater.Profile

WithFirstName sets the first name for the profile.

func WithImage

func WithImage(image string) updater.Profile

WithImage sets the image URL for the profile.

func WithLastName

func WithLastName(lastName string) updater.Profile

WithLastName sets the last name for the profile.

func WithLocation

func WithLocation(updaters ...updater.Location) updater.Profile

WithLocation sets the location for the profile.

func WithOrganization

func WithOrganization(organization string) updater.Profile

WithOrganization sets the organization for the profile.

func WithPhoneNumber

func WithPhoneNumber(phoneNumber string) updater.Profile

WithPhoneNumber sets the phone number for the profile.

func WithProperties

func WithProperties(updaters ...updater.Properties) updater.Profile

WithProperties sets the properties for the profile.

It accepts a variable number of updaters that each set a specific property. Each updater is responsible for setting a specific key-value pair within the properties map.

func WithTitle

func WithTitle(title string) updater.Profile

WithTitle sets the title for the profile.

Types

type ExistingAttributes

type ExistingAttributes struct {
	NewAttributes
	Created       time.Time  `json:"created"`
	Updated       time.Time  `json:"updated"`
	LastEventDate *time.Time `json:"last_event_date"`
}

ExistingAttributes contains attributes for a profile that is already created, including timestamps.

type ExistingProfile

type ExistingProfile struct {
	Id         string             `json:"id"`
	Attributes ExistingAttributes `json:"attributes"`
}

ExistingProfile represents the data structure for a profile that is already created.

type Location

type Location struct {
	Address1  *string  `json:"address1"`
	Address2  *string  `json:"address2"`
	City      *string  `json:"city"`
	Country   *string  `json:"country"`
	Latitude  *float64 `json:"latitude"`
	Longitude *float64 `json:"longitude"`
	Region    *string  `json:"region"`
	Zip       *string  `json:"zip"`
	Timezone  *string  `json:"timezone"`
}

Location represents the geographical location details for a profile.

type NewAttributes

type NewAttributes struct {
	Email        string                 `json:"email"`
	PhoneNumber  *string                `json:"phone_number"`
	ExternalId   *string                `json:"external_id"`
	AnonymousId  *string                `json:"anonymous_id"`
	FirstName    *string                `json:"first_name"`
	LastName     *string                `json:"last_name"`
	Organization *string                `json:"organization"`
	Title        *string                `json:"title"`
	Image        *string                `json:"image"`
	Location     Location               `json:"location"`
	Properties   map[string]interface{} `json:"properties"`
}

NewAttributes contains common attributes for a profile.

type NewProfile

type NewProfile struct {
	Attributes NewAttributes `json:"attributes"`
}

NewProfile represents the data structure for a profile that is not yet created.

func (*NewProfile) ToUpdaters

func (p *NewProfile) ToUpdaters() []updater.Profile

ToUpdaters takes a NewProfile and transforms it into a slice of updater.Profile. This function facilitates the conversion of a profile's fields into a series of updaters, which can be used to modify a profile in a more granular manner. Importantly, it creates updaters only for the non-nil fields of the profile, ensuring that only specified fields are updated. It handles all the fields of the profile, including nested fields like Location and Properties.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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