customers

package
v0.0.0-...-fad68f1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateCustomer

type CreateCustomer struct {
	// The Customer's first name.
	FirstName string `json:"first_name"`

	// The Customer's last name.
	LastName string `json:"last_name"`

	// The email of the customer.
	Email string `json:"email"`

	// The Customer's password.
	Password string `json:"password"`

	// The Customer's phone number.
	Phone string `json:"phone,omitempty"`
}

func NewCreateCustomer

func NewCreateCustomer() *CreateCustomer

func (*CreateCustomer) Create

func (c *CreateCustomer) Create(config *medusa.Config) (*CreateCustomerResponse, error)

Creates a Customer account.

func (*CreateCustomer) SetEmail

func (c *CreateCustomer) SetEmail(email string) *CreateCustomer

func (*CreateCustomer) SetFirstName

func (c *CreateCustomer) SetFirstName(firstName string) *CreateCustomer

func (*CreateCustomer) SetLastName

func (c *CreateCustomer) SetLastName(lastName string) *CreateCustomer

func (*CreateCustomer) SetPassword

func (c *CreateCustomer) SetPassword(password string) *CreateCustomer

func (*CreateCustomer) SetPhone

func (c *CreateCustomer) SetPhone(phone string) *CreateCustomer

type CreateCustomerData

type CreateCustomerData struct {
	Customer *schema.Customer `json:"customer"`
}

type CreateCustomerResponse

type CreateCustomerResponse struct {
	// Success response
	Data *CreateCustomerData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

type ListOrderData

type ListOrderData struct {
	// Array of orders
	Orders []*schema.Order `json:"orders"`

	// The total number of items available
	Count uint `json:"count"`

	// The number of items skipped before these items
	Offset uint `json:"offset"`

	// The number of items per page
	Limit uint `json:"limit"`
}

type ListOrderQuery

type ListOrderQuery struct {
	// Query used for searching orders.
	Q string `json:"q,omitempty" url:"q,omitempty"`

	// Id of the order to search for.
	Id []string `json:"id,omitempty" url:"id,omitempty"`

	// The offset in the resulting orders.
	Offset int `json:"offset" url:"offset"`

	// How many orders to return.
	Limit int `json:"limit" url:"limit"`

	// (Comma separated string) Which relations should be expanded in the resulting orders.
	Expand string `json:"expand,omitempty" url:"expand,omitempty"`

	// (Comma separated string) Which fields should be included in the resulting orders.
	Fields string `json:"fields,omitempty" url:"fields,omitempty"`

	// Status to search for.
	Status []string `json:"status,omitempty" url:"status,omitempty"`

	// Fulfillment status to search for.
	FulfillmentStatus []string `json:"fulfillment_status,omitempty" url:"fulfillment_status,omitempty"`

	// Payment status to search for.
	PaymentStatus []string `json:"payment_status,omitempty" url:"payment_status,omitempty"`

	// Display id to search for.
	DisplayId string `json:"display_id,omitempty" url:"display_id,omitempty"`

	// Cart id
	CartId string `json:"cart_id,omitempty" url:"cart_id,omitempty"`

	// Email
	Email string `json:"email,omitempty" url:"email,omitempty"`
	// Region id
	RegionId string `json:"region_id,omitempty" url:"region_id,omitempty"`

	// The 3 character ISO currency code to set prices based on.
	CurrencyCode string `json:"currency_code,omitempty" url:"currency_code,omitempty"`

	// Tax rate
	TaxRate string `json:"tax_rate,omitempty" url:"tax_rate,omitempty"`

	// Date comparison for when resulting collections were created.
	CreatedAt *common.DateComparison `json:"created_at,omitempty" url:"created_at,omitempty"`

	// Date comparison for when resulting collections were updated.
	UpdatedAt *common.DateComparison `json:"updated_at,omitempty" url:"updated_at,omitempty"`

	// Date comparison for when resulting collections were canceled.
	CanceledAt *common.DateComparison `json:"canceled_at,omitempty" url:"canceled_at,omitempty"`
}

func NewListOrderQuery

func NewListOrderQuery() *ListOrderQuery

func (*ListOrderQuery) List

func (l *ListOrderQuery) List(config *medusa.Config) (*ListOrderResponse, error)

Retrieves a list of a Customer's Orders.

func (*ListOrderQuery) SetCancledAt

func (l *ListOrderQuery) SetCancledAt(canceledAt *common.DateComparison) *ListOrderQuery

func (*ListOrderQuery) SetCartId

func (l *ListOrderQuery) SetCartId(cartId string) *ListOrderQuery

func (*ListOrderQuery) SetCreatedAt

func (l *ListOrderQuery) SetCreatedAt(createdAt *common.DateComparison) *ListOrderQuery

func (*ListOrderQuery) SetCurrencyCode

func (l *ListOrderQuery) SetCurrencyCode(currencyCode string) *ListOrderQuery

func (*ListOrderQuery) SetEmail

func (l *ListOrderQuery) SetEmail(email string) *ListOrderQuery

func (*ListOrderQuery) SetExpand

func (l *ListOrderQuery) SetExpand(expand string) *ListOrderQuery

func (*ListOrderQuery) SetFields

func (l *ListOrderQuery) SetFields(fields string) *ListOrderQuery

func (*ListOrderQuery) SetFulfillmentStatus

func (l *ListOrderQuery) SetFulfillmentStatus(fulfillmentStatus []string) *ListOrderQuery

func (*ListOrderQuery) SetId

func (l *ListOrderQuery) SetId(id []string) *ListOrderQuery

func (*ListOrderQuery) SetLimit

func (l *ListOrderQuery) SetLimit(limit int) *ListOrderQuery

func (*ListOrderQuery) SetOffset

func (l *ListOrderQuery) SetOffset(offset int) *ListOrderQuery

func (*ListOrderQuery) SetPaymentStatus

func (l *ListOrderQuery) SetPaymentStatus(paymentStatus []string) *ListOrderQuery

func (*ListOrderQuery) SetQ

func (l *ListOrderQuery) SetQ(q string) *ListOrderQuery

func (*ListOrderQuery) SetRegionId

func (l *ListOrderQuery) SetRegionId(regionId string) *ListOrderQuery

func (*ListOrderQuery) SetStatus

func (l *ListOrderQuery) SetStatus(status []string) *ListOrderQuery

func (*ListOrderQuery) SetTaxRate

func (l *ListOrderQuery) SetTaxRate(taxRate string) *ListOrderQuery

func (*ListOrderQuery) SetUpdatedAt

func (l *ListOrderQuery) SetUpdatedAt(updatedAt *common.DateComparison) *ListOrderQuery

type ListOrderResponse

type ListOrderResponse struct {
	// Success response
	Data *ListOrderData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

type RequestPasswordReset

type RequestPasswordReset struct {
	Email string `json:"email"`
}

func NewRequestPasswordReset

func NewRequestPasswordReset() *RequestPasswordReset

func (*RequestPasswordReset) RequestReset

func (*RequestPasswordReset) SetEmail

func (r *RequestPasswordReset) SetEmail(email string) *RequestPasswordReset

type RequestPasswordResetResponse

type RequestPasswordResetResponse struct {
	// Success response
	Data any

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

type ResetPassword

type ResetPassword struct {
	// The email of the customer.
	Email string `json:"email"`

	// The Customer's password.
	Password string `json:"password"`

	// The reset password token
	Token string `json:"token"`
}

func NewResetPassword

func NewResetPassword() *ResetPassword

func (*ResetPassword) Reset

func (r *ResetPassword) Reset(config *medusa.Config) (*ResetPasswordResponse, error)

Resets a Customer's password using a password token created by a previous /password-token request.

func (*ResetPassword) SetEmail

func (r *ResetPassword) SetEmail(email string) *ResetPassword

func (*ResetPassword) SetPassword

func (r *ResetPassword) SetPassword(password string) *ResetPassword

func (*ResetPassword) SetToken

func (r *ResetPassword) SetToken(token string) *ResetPassword

type ResetPasswordData

type ResetPasswordData struct {
	Customer *schema.Customer `json:"customer"`
}

type ResetPasswordResponse

type ResetPasswordResponse struct {
	// Success response
	Data *ResetPasswordData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

type RetrieveCustomerData

type RetrieveCustomerData struct {
	Customer *schema.Customer `json:"customer"`
}

type RetrieveCustomerResponse

type RetrieveCustomerResponse struct {
	// Success response
	Data *RetrieveCustomerData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

func Retrieve

func Retrieve(config *medusa.Config) (*RetrieveCustomerResponse, error)

Retrieves a Customer - the Customer must be logged in to retrieve their details.

type UpdateCustomer

type UpdateCustomer struct {
	// The email of the customer.
	Email string `json:"email,omitempty"`

	// The email of the customer.
	FirstName string `json:"first_name,omitempty"`

	// The Customer's last name.
	LastName string `json:"last_name,omitempty"`

	// The Address to be used for billing purposes.
	BillingAddress any `json:"billing_address,omitempty"`

	// The Customer's phone number.
	Phone string `json:"phone,omitempty"`

	// The Customer's password.
	Password string `json:"password,omitempty"`

	// Metadata about the customer.
	Metadata map[string]any `json:"metadata,omitempty"`
}

func NewUpdateCustomer

func NewUpdateCustomer() *UpdateCustomer

func (*UpdateCustomer) SetBillingAddress

func (u *UpdateCustomer) SetBillingAddress(billingAddr any) *UpdateCustomer

func (*UpdateCustomer) SetEmail

func (u *UpdateCustomer) SetEmail(email string) *UpdateCustomer

func (*UpdateCustomer) SetFirstName

func (u *UpdateCustomer) SetFirstName(firstName string) *UpdateCustomer

func (*UpdateCustomer) SetLastName

func (u *UpdateCustomer) SetLastName(lastName string) *UpdateCustomer

func (*UpdateCustomer) SetMetadata

func (u *UpdateCustomer) SetMetadata(metaData map[string]any) *UpdateCustomer

func (*UpdateCustomer) SetPassword

func (u *UpdateCustomer) SetPassword(password string) *UpdateCustomer

func (*UpdateCustomer) SetPhone

func (u *UpdateCustomer) SetPhone(phone string) *UpdateCustomer

func (*UpdateCustomer) Update

func (u *UpdateCustomer) Update(config *medusa.Config) (*UpdateCustomerResponse, error)

type UpdateCustomerData

type UpdateCustomerData struct {
	Customer *schema.Customer `json:"customer"`
}

type UpdateCustomerResponse

type UpdateCustomerResponse struct {
	// Success response
	Data *UpdateCustomerData

	// Error response
	Error *response.Error

	// Errors in case of multiple errors
	Errors *response.Errors
}

Jump to

Keyboard shortcuts

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