func (u *UserProfile) initOrdersMeta(limit int) error {
	u.ordersMeta = &customerOrders{}
	return u.customerEndpoint(
		u.cli, "order",
		Params{"limit": limit, "lang": DefaultLang},
		&u.ordersMeta,
	)
}
Orders returns a variety of meta-data on the user's previous and saved orders.
package dawg
import (
	"errors"
	"fmt"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"time"
)
func SignIn(username, password string) (*UserProfile, error) {
	err := authorize(orderClient.Client, username, password)
	if err != nil {
		return nil, err
	}
	return login(orderClient)
}
type UserProfile struct {
	FirstName string
	LastName  string
	Phone     string
	Type string
	ID string `json:"CustomerID"`
	Identifiers []string `json:"CustomerIdentifiers"`
	AgreedToTermsOfUse bool `json:"AgreeToTermsOfUse"`
	Gender string
	Addresses []*UserAddress
	Email string
	EmailOptIn bool
	EmailOptInTime string
	SmsPhone string
	SmsOptIn bool
	SmsOptInTime string
	UpdateTime string
	ServiceMethod string `json:"-"`  
	ordersMeta  *customerOrders
	cli         *client
	store       *Store
	loyaltyData *CustomerLoyalty
}
func (u *UserProfile) AddAddress(a Address) {
	u.Addresses = append(u.Addresses, UserAddressFromAddress(a))
}
var (
	errNoServiceMethod     = errors.New("no service method given")
	errUserNoServiceMethod = errors.New("User has no ServiceMethod set")
)
func (u *UserProfile) StoresNearMe() ([]*Store, error) {
	if u.ServiceMethod == "" {
		return nil, errUserNoServiceMethod
	}
	if err := u.addressCheck(); err != nil {
		return nil, err
	}
	return asyncNearbyStores(u.cli, u.DefaultAddress(), u.ServiceMethod)
}
func (u *UserProfile) NearestStore(service string) (*Store, error) {
	var err error
	if u.store != nil {
		return u.store, nil
	}
	c := &client{host: orderHost, Client: u.cli.Client}
	if err = u.addressCheck(); err != nil {
		return nil, err
	}
	u.store, err = getNearestStore(c, u.DefaultAddress(), service)
	return u.store, err
}
func (u *UserProfile) DefaultAddress() *UserAddress {
	if len(u.Addresses) == 0 || u.Addresses == nil {
		return nil
	}
	for _, a := range u.Addresses {
		if a.IsDefault {
			return a
		}
	}
	return u.Addresses[0]
}
func (u *UserProfile) SetServiceMethod(service string) error {
	if !(service == Delivery || service == Carryout) {
		return ErrBadService
	}
	u.ServiceMethod = service
	return nil
}
func (u *UserProfile) SetStore(store *Store) error {
	if store == nil {
		return errors.New("cannot set UserProfile store to a nil value")
	}
	if store.ID == "" {
		return errors.New("UserProfile.SetStore: store is uninitialized")
	}
	u.store = store
	return nil
}
func (u *UserProfile) Cards() ([]*UserCard, error) {
	cards := make([]*UserCard, 0)
	return cards, u.customerEndpoint(u.cli, "card", nil, &cards)
}
func (u *UserProfile) Loyalty() (*CustomerLoyalty, error) {
	u.loyaltyData = new(CustomerLoyalty)
	return u.loyaltyData, u.customerEndpoint(u.cli, "loyalty", nil, u.loyaltyData)
}
func (u *UserProfile) getLoyalty() (*CustomerLoyalty, error) {
	if u.loyaltyData != nil {
		return u.loyaltyData, nil
	}
	return u.Loyalty()
}
func (u *UserProfile) PreviousOrders(n int) ([]*EasyOrder, error) {
	return u.ordersMeta.CustomerOrders, u.initOrdersMeta(n)
}
func (u *UserProfile) GetEasyOrder() (*EasyOrder, error) {
	var err error
	if u.ordersMeta == nil {
		if err = u.initOrdersMeta(3); err != nil {
			return nil, err
		}
	}
	return u.ordersMeta.EasyOrder, nil
}