core

package
v0.0.0-...-d5453b7 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	ID           string `json:"id,omitempty"`
	Type         string `json:"type"`
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
	Name         string `json:"name"`
	PhoneNumber  int32  `json:"phone_number,omitempty"`
	Instructions string `json:"instructions,omitempty"`
	CompanyName  string `json:"company_name"`
	Line1        string `json:"line_1"`
	Line2        string `json:"line_2"`
	City         string `json:"city"`
	County       string `json:"county"`
	Postcode     string `json:"postcode"`
	Country      string `json:"country"`
}

Address represents a Moltin customer address: https://docs.moltin.com/api/orders-and-customers/addresses

func (*Address) SetType

func (a *Address) SetType()

type AdyenGateway

type AdyenGateway struct {
	Type            string `json:"type"`
	Name            string `json:"name"`
	Slug            string `json:"slug"`
	Enabled         bool   `json:"enabled"`
	Test            bool   `json:"test"`
	Username        string `json:"username"`
	Password        string `json:"password"`
	MerchantAccount string `json:"merchant_account"`
}

AdyenGateway is a Moltin AdyenGateway - https://docs.moltin.com/payments/gateways/configure-adyen

func (*AdyenGateway) SetType

func (a *AdyenGateway) SetType()

type BraintreeGateway

type BraintreeGateway struct {
	Type        string `json:"type"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Enabled     bool   `json:"enabled"`
	Environment string `json:"environment"`
	PublicKey   string `json:"public_key"`
	PrivateKey  string `json:"private_key"`
	MerchantID  string `json:"merchant_id"`
}

BraintreeGateway is a Moltin BraintreeGateway - https://docs.moltin.com/payments/gateways/configure-braintree

func (*BraintreeGateway) SetType

func (b *BraintreeGateway) SetType()

type Brand

type Brand struct {
	ID          string `json:"id,omitempty"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Status      string `json:"status"`
	Meta        *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
	Relationships *Relationships `json:"relationships,omitempty"`
}

Brand is a Moltin Brand - https://docs.moltin.com/catalog/brands

func (*Brand) SetType

func (b *Brand) SetType()

type BrandIncludes

type BrandIncludes struct {
	Products []Product `json:"products"`
}

BrandIncludes is possible includes for a Brand

type CardConnectGateway

type CardConnectGateway struct {
	Type       string `json:"type"`
	Name       string `json:"name"`
	Slug       string `json:"slug"`
	Enabled    bool   `json:"enabled"`
	Test       bool   `json:"test"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	MerchantID string `json:"merchant_id"`
}

CardConnectGateway is a Moltin CardConnectGateway - https://docs.moltin.com/payments/gateways/configure-cardconnect

func (*CardConnectGateway) SetType

func (c *CardConnectGateway) SetType()

type Cart

type Cart struct {
	ID    string    `json:"id,omitempty"`
	Type  string    `json:"type"`
	Links *Links    `json:"links,omitempty"`
	Meta  *CartMeta `json:"meta,omitempty"`
}

Cart represents a Moltin cart: https://docs.moltin.com/api/carts-and-checkout/carts

func (*Cart) SetType

func (c *Cart) SetType()

type CartItem

type CartItem struct {
	ID          string            `json:"id,omitempty"`
	Type        string            `json:"type"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Sku         string            `json:"sku"`
	Image       *CartItemImage    `json:"image,omitempty"`
	Quantity    int32             `json:"quantity"`
	UnitPrice   CartItemUnitPrice `json:"unit_price"`
	Value       CartItemValue     `json:"value"`
	Links       *Links            `json:"links,omitempty"`
	Meta        *CartItemMeta     `json:"meta,omitempty"`
}

CartItem represents a Moltin cart item: https://docs.moltin.com/api/carts-and-checkout/carts/cart-items

func (*CartItem) SetType

func (c *CartItem) SetType()

type CartItemImage

type CartItemImage struct {
	FileName string `json:"file_name"`
	MimeType string `json:"mime_type"`
	Href     string `json:"href"`
}

CartItemImage represents the image object for a Moltin cart item

type CartItemMeta

type CartItemMeta struct {
	DisplayPrice DisplayPriceWrapper `json:"display_price,omitempty"`
	Timestamps   Timestamps          `json:"timestamps,omitempty"`
}

CartItemMeta represents the Meta object for a Moltin cart item

type CartItemUnitPrice

type CartItemUnitPrice struct {
	Amount      int32  `json:"amount"`
	Currency    string `json:"currenct"`
	IncludesTax bool   `json:"includes_tax"`
}

CartItemUnitPrice represents the unit price object for a Moltin cart item

type CartItemValue

type CartItemValue struct {
	Amount      int32  `json:"amount"`
	Currency    string `json:"currenct"`
	IncludesTax bool   `json:"includes_tax"`
}

CartItemValue represents the value object for a Moltin cart item

type CartMeta

type CartMeta struct {
	DisplayPrice DisplayPriceWrapper `json:"display_price,omitempty"`
	Timestamps   Timestamps          `json:"timestamps,omitempty"`
}

CartMeta represents the Meta object for a Moltin cart

type Category

type Category struct {
	ID          string `json:"id,omitempty"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Status      string `json:"status"`
	Meta        *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
	Relationships *Relationships `json:"relationships,omitempty"`
}

Category is a Moltin Category - https://docs.moltin.com/catalog/categories

func (*Category) SetType

func (c *Category) SetType()

type CategoryIncludes

type CategoryIncludes struct {
	Products []Product `json:"products"`
}

CategoryIncludes is possible includes for a Category

type Collection

type Collection struct {
	ID          string `json:"id,omitempty"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Status      string `json:"status"`
	Meta        *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
	Relationships *Relationships `json:"relationships,omitempty"`
}

Collection is a Moltin Collection - https://docs.moltin.com/catalog/collections

func (*Collection) SetType

func (c *Collection) SetType()

type CollectionIncludes

type CollectionIncludes struct {
	Products []Product `json:"products"`
}

CollectionIncludes is possible includes for a Collection

type Currency

type Currency struct {
	ID                string  `json:"id,omitempty"`
	Type              string  `json:"type"`
	Code              string  `json:"code"`
	ExchangeRate      float64 `json:"exchange_rate"`
	Format            string  `json:"format"`
	ThousandSeparator string  `json:"thousand_separator"`
	DecimalPoint      string  `json:"decimal_point"`
	DecimalPlaces     int64   `json:"decimal_places"`
	Default           bool    `json:"default"`
	Enabled           bool    `json:"enabled"`
	Links             *Links  `json:"links"`
	Meta              *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
}

Currency is a Moltin Currency - https://docs.moltin.com/advanced/currencies

func (*Currency) SetType

func (c *Currency) SetType()

type Customer

type Customer struct {
	ID       string            `json:"id,omitempty"`
	Type     string            `json:"type"`
	Name     string            `json:"name"`
	Email    string            `json:"email"`
	Password *CustomerPassword `json:"password,omitempty"`
}

Customer represents a Moltin Customer Entity: https://docs.moltin.com/api/orders-and-customers/customers

func (*Customer) SetType

func (c *Customer) SetType()

type CustomerPassword

type CustomerPassword struct {
	IsSet    bool
	Password string
}

CustomerPassword is a customer's password when making an API request, in which case the Password field should be set, or an indicator that the password was set when reading an API response, in which case Password will be empty and IsSet is indicative.

func (CustomerPassword) MarshalJSON

func (p CustomerPassword) MarshalJSON() ([]byte, error)

MarshalJSON marshals a CustomerPassword into JSON

func (*CustomerPassword) UnmarshalJSON

func (p *CustomerPassword) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a CustomerPassword from JSON

type DisplayPrice

type DisplayPrice struct {
	Amount    int    `json:"amount"`
	Currency  string `json:"currency"`
	Formatted string `json:"formatted"`
}

DisplayPrice is the content of a price for display purposes

type DisplayPriceWrapper

type DisplayPriceWrapper struct {
	WithTax    DisplayPrice `json:"with_tax"`
	WithoutTax DisplayPrice `json:"without_tax"`
}

DisplayPriceWrapper is the format that price display responses are returned by Moltin

type Event

type Event struct {
	ID              string   `json:"id,omitempty"`
	Type            string   `json:"type"`
	Observes        []string `json:"observes"`
	Enabled         bool     `json:"enabled,omitempty"`
	IntegrationType string   `json:"integration_type"`
	Description     string   `json:"description"`
	Name            string   `json:"name"`
	Configuration   struct {
		URL       string `json:"url"`
		SecretKey string `json:"secret_key,omitempty"`
	} `json:"configuration"`
}

Event represents a Moltin event (not an event payload): https://docs.moltin.com/api/advanced/events

func (*Event) SetType

func (e *Event) SetType()

type EventPayload

type EventPayload struct {
	ID          string               `json:"id"`
	TriggeredBy string               `json:"triggered_by"`
	Integration Integration          `json:"integration"`
	Attempt     int                  `json:"attempt"`
	Resources   EventPayloadResource `json:"resources"`
}

EventPayload represents the payload delivered to a webhook URL. See https://docs.moltin.com/api/advanced/events/event-payload

Example
package main

import (
	"encoding/json"
	"io/ioutil"
	"log"
	"net/http"

	"github.com/moltin/gomo/core"
)

func main() {
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		b, err := ioutil.ReadAll(r.Body)
		defer r.Body.Close()
		if err != nil {
			log.Print(err)
			return
		}

		var payload core.EventPayload
		err = json.Unmarshal(b, &payload)
		if err != nil {
			log.Print(err)
			return
		}

		if payload.TriggeredBy != "order.created" {
			log.Printf("unexpected event: %s\n", payload.TriggeredBy)
			return
		}

		order := payload.Resources.(*core.EventPayloadOrder).Data
		log.Printf("processing new order: %s\n", order.ID)
		// process order...
	})
	log.Fatal(http.ListenAndServe(":8080", nil))
}

func (*EventPayload) UnmarshalJSON

func (ep *EventPayload) UnmarshalJSON(b []byte) error

type EventPayloadAddress

type EventPayloadAddress struct {
	Data Address `json:"address"`
}

type EventPayloadBrand

type EventPayloadBrand struct {
	Data Brand `json:"brand"`
}

type EventPayloadCart

type EventPayloadCart struct {
	Data Cart `json:"cart"`
}

type EventPayloadCategory

type EventPayloadCategory struct {
	Data Category `json:"category"`
}

type EventPayloadCollection

type EventPayloadCollection struct {
	Data Collection `json:"collection"`
}

type EventPayloadCurrency

type EventPayloadCurrency struct {
	Data Currency `json:"currency"`
}

type EventPayloadDeleted

type EventPayloadDeleted Relationship

type EventPayloadFile

type EventPayloadFile struct {
	Data File `json:"file"`
}

type EventPayloadIntegration

type EventPayloadIntegration struct {
	Data Integration `json:"integrations"`
}

type EventPayloadOrder

type EventPayloadOrder struct {
	Data Order `json:"order"`
}

type EventPayloadProduct

type EventPayloadProduct struct {
	Data Product `json:"product"`
}

type EventPayloadResource

type EventPayloadResource interface {
	// contains filtered or unexported methods
}

type EventPayloadSettings

type EventPayloadSettings struct {
	Data Settings `json:"settings"`
}

type EventPayloadStockTransaction

type EventPayloadStockTransaction struct {
	Data StockTransaction `json:"stock-transaction"`
}

type EventPayloadTransaction

type EventPayloadTransaction struct {
	Data Transaction `json:"transaction"`
}

type Field

type Field struct {
	ID              string      `json:"id,omitempty"`
	Type            string      `json:"type"`
	Name            string      `json:"name"`
	Slug            string      `json:"slug"`
	Description     string      `json:"description"`
	FieldType       string      `json:"field_type"`
	ValidationRules []fv.Rule   `json:"validation_rules,omitempty"`
	Enabled         bool        `json:"enabled"`
	Required        bool        `json:"required"`
	Order           int32       `json:"order"`
	Unique          bool        `json:"unique"`
	Default         interface{} `json:"default,omitempty"`
	OmitNull        bool        `json:"omit_null,omitempty"`
	Meta            *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
	Relationships *Relationships `json:"relationships,omitempty"`
}

Field is a Moltin Field - https://docs.moltin.com/advanced/custom-data/fields

func (Field) MarshalJSON

func (f Field) MarshalJSON() ([]byte, error)

func (*Field) SetType

func (f *Field) SetType()

func (*Field) UnmarshalJSON

func (f *Field) UnmarshalJSON(b []byte) error

type File

type File struct {
	ID       string    `json:"id,omitempty" form:"-"`
	Type     string    `json:"type" form:"-"`
	FileName string    `json:"file_name" form:"file_name,omitempty"`
	Public   bool      `json:"public" form:"public"`
	MimeType string    `json:"mime_type" form:"mime_type,omitempty"`
	FileSize int       `json:"file_size" form:"file_size,omitempty"`
	Meta     *FileMeta `json:"meta,omitempty" form:"-"`
	Link     *struct {
		Href string `json:"href"`
	} `json:"link" form:"-"`
	Links *Links     `json:"links,omitempty" form:"-"`
	File  *form.File `json:"-" form:"file"`
}

File is a Moltin File - https://docs.moltin.com/advanced/files

func (*File) SetType

func (f *File) SetType()

type FileMeta

type FileMeta struct {
	Dimensions struct {
		Width  int32 `json:"width"`
		Height int32 `json:"height"`
	} `json:"dimensions"`
	Timestamps Timestamps `json:"timestamps"`
}

FileMeta represents the meta object for a moltin file entity

type FileUploadRequest

type FileUploadRequest struct {
	File   bytes.Buffer `json:"file"`
	Public bool         `json:"public,omitempty"`
}

FileUploadRequest represents a request to upload a file to Moltin

type Flow

type Flow struct {
	ID          string `json:"id,omitempty"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Slug        string `json:"slug"`
	Description string `json:"description"`
	Enabled     bool   `json:"enabled"`
	Meta        *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
	Relationships *Relationships `json:"relationships,omitempty"`
}

Flow is a Moltin Flow - https://docs.moltin.com/advanced/custom-data/flows

func (*Flow) SetType

func (f *Flow) SetType()

type Integration

type Integration struct {
	ID              string                   `json:"id,omitempty"`
	Type            string                   `json:"type"`
	Name            string                   `json:"name"`
	Description     string                   `json:"description"`
	Enabled         bool                     `json:"enabled"`
	IntegrationType string                   `json:"integration_type"`
	Observes        []string                 `json:"observes"`
	Configuration   IntegrationConfiguration `json:"configuration"`
	Meta            *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
}

Integration is a Moltin Integration - https://docs.moltin.com/advanced/events

func (*Integration) SetType

func (i *Integration) SetType()

type IntegrationConfiguration

type IntegrationConfiguration struct {
	URL       string `json:"url"`
	SecretKey string `json:"secret_key,omitempty"`
}

IntegrationConfiguration specifies a webhook configuration object

type IntegrationLog

type IntegrationLog struct {
	ID             string              `json:"id,omitempty"`
	Type           string              `json:"type"`
	Succeeded      bool                `json:"succeeded"`
	ProcessingTime float64             `json:"processing_time"`
	Body           string              `json:"body"`
	StatusCode     int                 `json:"status_code"`
	ErrorDetail    string              `json:"error_detail"`
	Relationships  *Relationships      `json:"relationships,omitempty"`
	Meta           *IntegrationLogMeta `json:"meta,omitempty"`
}

IntegrationLog represents a single event log. See https://docs.moltin.com/api/advanced/events/logs

func (*IntegrationLog) SetType

func (i *IntegrationLog) SetType()

type IntegrationLogJobs

type IntegrationLogJobs []Relationship

IntegrationLogJobs is a list of jobs relating to an event. See https://docs.moltin.com/api/advanced/events/logs

type IntegrationLogMeta

type IntegrationLogMeta struct {
	Timestamps Timestamps `json:"timestamps,omitempty"`
}

type Inventory

type Inventory struct {
	ID        string `json:"id,omitempty"`
	Type      string `json:"type"`
	Total     int64  `json:"total"`
	Available int64  `json:"available"`
	Allocated int64  `json:"allocated"`
}

Inventory represents a product stock object in the Moltin API: https://docs.moltin.com/api/catalog/inventory

func (*Inventory) SetType

func (i *Inventory) SetType()

type Job

type Job struct {
	ID      string `json:"id,omitempty"`
	Type    string `json:"type"`
	JobType string `json:"job_type"`
	Link    *struct {
		Href string `json:"href"`
	} `json:"link,omitempty"`
	Status     string      `json:"status,omitempty"`
	Timestamps *Timestamps `json:"timestamps,omitempty"`
}

func (*Job) SetType

func (j *Job) SetType()
type Links struct {
	Self string `json:"self"`
}

Links represents the links available for a Moltin entity

type Meta

type Meta struct {
	Results MetaResults `json:"results"`
	Page    MetaPage    `json:"page"`
}

Meta is returned from many queries that support pagination

type MetaPage

type MetaPage struct {
	Limit   int `json:"limit"`
	Offset  int `json:"offset"`
	Current int `json:"current"`
	Total   int `json:"total"`
}

MetaPage contains pagination information

type MetaResults

type MetaResults struct {
	Total int `json:"total"`
	All   int `json:"all,omitempty"`
}

MetaResults contains the total number of results

type Modifier

type Modifier struct {
	ID           string        `json:"id,omitempty"`
	Type         string        `json:"type"`
	ModifierType string        `json:"modifier_type"`
	Value        ModifierValue `json:"value"`
}

Modifier represents a modifier for a variation option:

func (*Modifier) SetType

func (m *Modifier) SetType()

func (*Modifier) UnmarshalJSON

func (m *Modifier) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a Modifier from JSON

type ModifierValue

type ModifierValue interface {
	// contains filtered or unexported methods
}

ModifierValue repesents a number of possible structures depending on the modifier type

type ModifierValueBuilder

type ModifierValueBuilder struct {
	Seek string `json:"seek"`
	Set  string `json:"set"`
}

ModifierValueBuilder is used for modifier types: sku_builder, slug_builder

type ModifierValuePlain

type ModifierValuePlain struct {
	Value string
}

ModifierValuePlain is used for modifier types: description_equals, description_prepend, description_append, commoditytype, name_equals, name_prepend, name_append, slug_equals, slug_prepend, slug_append, sku_equals, sku_prepend, sku_append, status

func (*ModifierValuePlain) MarshalJSON

func (v *ModifierValuePlain) MarshalJSON() ([]byte, error)

func (*ModifierValuePlain) UnmarshalJSON

func (v *ModifierValuePlain) UnmarshalJSON(b []byte) error

type ModifierValuePrice

type ModifierValuePrice struct {
	Amount      int    `json:"amount"`
	Currency    string `json:"currency"`
	IncludesTax bool   `json:"includes_tax"`
}

ModifierValuePrice is used for modifier types: price_increment, price_decrement, price_equals

type Option

type Option struct {
	ID          string     `json:"id,omitempty"`
	Type        string     `json:"type"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Modifiers   []Modifier `json:"modifiers"`
}

Option represents an option for selection for a single Moltin product-variation: https://docs.moltin.com/api/catalog/product-variations/options

func (*Option) SetType

func (o *Option) SetType()

type Order

type Order struct {
	ID              string               `json:"id,omitempty"`
	Type            string               `json:"type"`
	Status          string               `json:"status"`
	Payment         string               `json:"payment"`
	Shipping        string               `json:"shipping"`
	Customer        OrderCustomer        `json:"customer"`
	ShippingAddress OrderShippingAddress `json:"shipping_address"`
	BillingAddress  OrderBillingAddress  `json:"billing_address"`
	Links           *Links               `json:"links"`
	Meta            *OrderMeta           `json:"meta,omitempty"`
	Relationships   *Relationships       `json:"relationships,omitempty"`
}

Order represents a Moltin order: https://docs.moltin.com/api/orders-and-customers/orders

func (*Order) SetType

func (o *Order) SetType()

type OrderBillingAddress

type OrderBillingAddress struct {
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	CompanyName string `json:"company_name"`
	Line1       string `json:"line_1"`
	Line2       string `json:"line_2"`
	City        string `json:"city"`
	PostCode    string `json:"postcode"`
	County      string `json:"county"`
	Country     string `json:"country"`
}

OrderBillingAddress represents a Moltin billing address for a Moltin order

type OrderCustomer

type OrderCustomer struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

OrderCustomer represents a Moltin customer object for a Moltin order (can be ID or Name and Email)

type OrderMeta

type OrderMeta struct {
	DisplayPrice DisplayPriceWrapper `json:"display_price"`
	Timestamps   Timestamps          `json:"timestamps,omitempty"`
}

OrderMeta represents the meta object for a Moltin order

type OrderShippingAddress

type OrderShippingAddress struct {
	FirstName    string `json:"first_name"`
	LastName     string `json:"last_name"`
	PhoneNumber  string `json:"phone_number"`
	CompanyName  string `json:"company_name"`
	Line1        string `json:"line_1"`
	Line2        string `json:"line_2"`
	City         string `json:"city"`
	PostCode     string `json:"postcode"`
	County       string `json:"county"`
	Country      string `json:"country"`
	Instructions string `json:"instructions"`
}

OrderShippingAddress represents a Moltin shipping address for a Moltin order

type Product

type Product struct {
	ID            string           `json:"id,omitempty"`
	Type          string           `json:"type"`
	Name          string           `json:"name"`
	Slug          string           `json:"slug"`
	SKU           string           `json:"sku"`
	Description   string           `json:"description"`
	ManageStock   bool             `json:"manage_stock"`
	Status        string           `json:"status"`
	CommodityType string           `json:"commodity_type"`
	Price         []ProductPrice   `json:"price"`
	Meta          *ProductMeta     `json:"meta,omitempty"`
	Relationships *Relationships   `json:"relationships,omitempty"`
	Included      *ProductIncludes `json:"included,omitempty"`
}

Product is a Moltin Product https://docs.moltin.com/catalog/products

func (*Product) SetType

func (p *Product) SetType()

type ProductIncludes

type ProductIncludes struct {
	Brands      []Brand      `json:"brands"`
	Categories  []Category   `json:"categories"`
	Collections []Collection `json:"collections"`
	Files       []File       `json:"files"`
	MainImage   File         `json:"main_image"`
	MainImages  []File       `json:"main_images"`
}

ProductIncludes is possible includes for a Product

type ProductMeta

type ProductMeta struct {
	DisplayPrice    DisplayPriceWrapper `json:"display_price"`
	Timestamps      Timestamps          `json:"timestamps,omitempty"`
	Stock           ProductStock        `json:"stock"`
	Variations      []ProductVariation  `json:"variations,omitempty"`
	VariationMatrix *VariationMatrix    `json:"variation_matrix"`
}

ProductMeta represents the meta object of a Moltin product

type ProductPrice

type ProductPrice struct {
	Amount      int    `json:"amount"`
	Currency    string `json:"currency"`
	IncludesTax bool   `json:"includes_tax"`
}

ProductPrice is a price for a Products meta

type ProductStock

type ProductStock struct {
	Level        int    `json:"level"`
	Availability string `json:"availability"`
}

ProductStock is a stock object for a Products meta

type ProductVariation

type ProductVariation struct {
	ID      string                    `json:"id"`
	Name    string                    `json:"name"`
	Options []ProductVariationOptions `json:"options"`
}

ProductVariation is a variation object for a Products Variations meta

type ProductVariationOptions

type ProductVariationOptions struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

ProductVariationOptions is a options object for a Products ProductVariation meta

type Promotion

type Promotion struct {
	ID            string          `json:"id,omitempty"`
	Type          string          `json:"type"`
	Name          string          `json:"name"`
	Description   string          `json:"description"`
	Enabled       bool            `json:"enabled"`
	PromotionType string          `json:"promotion_type"`
	Schema        PromotionSchema `json:"schema"`
	Start         string          `json:"start"`
	End           string          `json:"end"`
	Meta          *struct {
		Timestamps Timestamps `json:"timestamps,omitempty"`
	} `json:"meta,omitempty"`
}

Promotion represents a Moltin promotion: https://docs.moltin.com/api/carts-and-checkout/promotions

func (*Promotion) SetType

func (p *Promotion) SetType()

type PromotionCurrency

type PromotionCurrency struct {
	Currency   string  `json:"currency"`
	Amount     int32   `json:"amount,omitempty"`
	Percentage float32 `json:"percentage,omitempty"`
}

type PromotionSchema

type PromotionSchema struct {
	Currencies []PromotionCurrency `json:"currencies"`
}

type Relationship

type Relationship struct {
	Type string `json:"type"`
	ID   string `json:"id"`
}

Relationship is the shorthand relationship object

type RelationshipContainer

type RelationshipContainer struct {
	Relationships []Relationship
	OneToOne      bool
}

RelationshipContainer contains one-to-one or on-to-many relationships. One-to-one relationships should have exactly one Relationship and OneToOne set to true.

type Relationships

type Relationships map[string]RelationshipContainer

Relationships represents a relaionships object

func (Relationships) MarshalJSON

func (r Relationships) MarshalJSON() ([]byte, error)

MarshalJSON marshals Relationships into JSON

func (*Relationships) UnmarshalJSON

func (r *Relationships) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals Relationships from JSON

type Settings

type Settings struct {
	Type                string   `json:"type"`
	PageLength          int      `json:"page_length"`
	ListChildProducts   bool     `json:"list_child_products"`
	AdditionalLanguages []string `json:"additional_languages"`
	CalculationMethod   string   `json:"calculation_method,omitempty"`
}

Settings is a Moltin Setting Configuration - https://docs.moltin.com/advanced/settings

func (*Settings) SetType

func (s *Settings) SetType()

func (*Settings) SupportedLanguages

func (s *Settings) SupportedLanguages() []string

SupportedLanguages returns the languages that are supported on the additional_languages field

type StockTransaction

type StockTransaction struct {
	ID        string `json:"id,omitempty"`
	Type      string `json:"type"`
	Action    string `json:"action"`
	ProductID string `json:"product_id"`
	Quantity  int32  `json:"quantity"`
}

StockTransaction represents a Moltin inventory transaction: https://docs.moltin.com/api/catalog/inventory/stock-transactions

func (*StockTransaction) SetType

func (s *StockTransaction) SetType()

type StripeGateway

type StripeGateway struct {
	Type    string `json:"type"`
	Name    string `json:"name"`
	Slug    string `json:"slug"`
	Enabled bool   `json:"enabled"`
	Login   string `json:"login"`
}

StripeGateway is a Moltin StripeGateway - https://docs.moltin.com/payments/gateways/configure-stripe

func (*StripeGateway) SetType

func (s *StripeGateway) SetType()

type Timestamps

type Timestamps struct {
	CreatedAt string `json:"created_at,omitempty"`
}

Timestamps represents the timestamps from the Moltin API

type Transaction

type Transaction struct {
	ID              string         `json:"id,omitempty"`
	Type            string         `json:"type"`
	Reference       string         `json:"reference"`
	Gateway         string         `json:"gateway"`
	Amount          int32          `json:"amount"`
	Currency        string         `json:"currency"`
	TransactionType string         `json:"transaction_type"`
	Status          string         `json:"status"`
	Relationships   *Relationships `json:"relationships,omitempty"`
}

func (*Transaction) SetType

func (t *Transaction) SetType()

type Variation

type Variation struct {
	ID            string             `json:"id,omitempty"`
	Name          string             `json:"name"`
	Type          string             `json:"type"`
	Relationships *Relationships     `json:"relationships,omitempty"`
	Included      *VariationIncluded `json:"included,omitempty"`
}

Variation is a Moltin variation: https://docs.moltin.com/api/catalog/product-variations

func (*Variation) SetType

func (v *Variation) SetType()

type VariationIncluded

type VariationIncluded struct {
	Options   []VariationIncludedOption `json:"options"`
	Modifiers []Modifier                `json:"modifiers"`
}

type VariationIncludedOption

type VariationIncludedOption struct {
	ID            string         `json:"id"`
	Name          string         `json:"name"`
	Description   string         `json:"description"`
	Relationships *Relationships `json:"relationships,omitempty"`
}

type VariationMatrix

type VariationMatrix struct {
	Children map[string]*VariationMatrix
	Products map[string]string
}

func (VariationMatrix) MarshalJSON

func (m VariationMatrix) MarshalJSON() ([]byte, error)

func (*VariationMatrix) UnmarshalJSON

func (m *VariationMatrix) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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