profile

package
v0.0.0-...-f794e0e Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProfileDoesNotExistErr = errors.New("profile does not exist")
	ProfileNotAssignedErr  = errors.New("profile not assigned")
)
View Source
var (
	ProfileGroupEmptyErr        = errors.New("profile group does not contain any profiles")
	ProfileGroupDoesNotExistErr = errors.New("profile group does not exist")
)

Functions

func CreateProfile

func CreateProfile(profile *Profile) string

CreateProfile creates a new profile

func CreateProfileGroup

func CreateProfileGroup(name string) string

CreateProfileGroup creates a new profile group

func DoesProfileExist

func DoesProfileExist(id string) bool

DoesProfileExist checks if a profile exists

func DoesProfileGroupExist

func DoesProfileGroupExist(id string) bool

DoesProfileGroupExist checks if a profile group exists

func GetAllProfileGroupIds

func GetAllProfileGroupIds() []string

GetAllProfileGroupIds gets all profile group ids

func GetAllProfileIDs

func GetAllProfileIDs() []string

GetAllProfileIDs gets all profile ids

func RemoveProfile

func RemoveProfile(id string) error

RemoveProfile removes a profile

func RemoveProfileFromProfileGroup

func RemoveProfileFromProfileGroup(profileId, profileGroupId string) error

RemoveProfileFromProfileGroup removes a profile from a profile group

func RemoveProfileGroup

func RemoveProfileGroup(id string) error

RemoveProfileGroup removes a profile group

func SetProfileToProfileGroup

func SetProfileToProfileGroup(profileId, profileGroupId string) error

SetProfileToProfileGroup sets a profile to a profile group

Types

type Profile

type Profile struct {
	Name           string `json:"name"`
	ProfileGroup   string `json:"profileGroup"`
	BillingAddress struct {
		Name     string `json:"name"`
		Email    string `json:"email"`
		Phone    string `json:"phone"`
		Line1    string `json:"line1"`
		Line2    string `json:"line2"`
		Line3    string `json:"line3"`
		Postcode string `json:"postCode"`
		City     string `json:"city"`
		Country  string `json:"country"`
		State    string `json:"state"`
	} `json:"billingAddress"`
	ShippingAddress struct {
		Name     string `json:"name"`
		Email    string `json:"email"`
		Phone    string `json:"phone"`
		Line1    string `json:"line1"`
		Line2    string `json:"line2"`
		Line3    string `json:"line3"`
		Postcode string `json:"postCode"`
		City     string `json:"city"`
		Country  string `json:"country"`
		State    string `json:"state"`
	} `json:"shippingAddress"`
	PaymentDetails struct {
		NameOnCard   string `json:"nameOnCard"`
		CardType     string `json:"cardType"`
		CardNumber   string `json:"cardNumber"`
		CardExpMonth string `json:"cardExpMonth"`
		CardExpYear  string `json:"cardExpYear"`
		CardCvv      string `json:"cardCvv"`
	} `json:"paymentDetails"`
	SameBillingAndShipping bool `json:"sameBillingAndShippingAddress"`
}

func GetProfileById

func GetProfileById(id string) (*Profile, error)

GetProfileById gets a profile by id

func GetProfileFromProfileGroup

func GetProfileFromProfileGroup(id string) (*Profile, error)

GetProfileFromProfileGroup gets a profile from a profile group Gets the first profile, then moves it to the back

type ProfileGroup

type ProfileGroup struct {
	ID       string                 `json:"id"`
	Name     string                 `json:"name"`
	Profiles *orderedmap.OrderedMap `json:"profiles"` // ordered map to make sure our profile selection works
}

func GetProfileGroup

func GetProfileGroup(id string) (*ProfileGroup, error)

GetProfileGroup gets a profile group by id

Jump to

Keyboard shortcuts

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