Documentation ¶
Overview ¶
account, model
codeswholesale
common, model for common structs for other models
order
product
util provides utility for common usage
Index ¶
- Constants
- type Account
- type CWError
- type CodesWholesale
- func (c *CodesWholesale) GetAccount() (*Account, error)
- func (c *CodesWholesale) GetEndpoint() string
- func (c *CodesWholesale) GetProductByID(cwID string) (*Product, error)
- func (c *CodesWholesale) GetProducts() ([]Product, error)
- func (c *CodesWholesale) MultipleCodeOrder(cwID string, quantity uint) (*Orders, error)
- func (c *CodesWholesale) SingleCodeOrder(cwID string) (*Order, error)
- type Image
- type Item
- type Link
- type Order
- type Orders
- type Price
- type Product
Constants ¶
const ( API_STATUS_SUCCESS = 0 API_VERSION = "v1" API_LIVE_ENDPOINT = "https://api.codeswholesale.com" API_SANDBOX_ENDPOINT = "https://sandbox.codeswholesale.com" )
API Constants
const ( MODE_LIVE cwMode = 1 MODE_SANDBOX cwMode = 0 )
API modes
const ( CODE_TEXT cwTypeCode = "CODE_TEXT" CODE_PREORDER cwTypeCode = "CODE_PREORDER" CODE_IMAGE cwTypeCode = "CODE_IMAGE" )
Order response codes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodesWholesale ¶
type CodesWholesale struct {
// contains filtered or unexported fields
}
func New ¶
func New(clientID string, clientSecret string, mode cwMode) *CodesWholesale
Creates new REST API client, to get api key: 1. Login into your account on app.codeswholesale.com 2. Locate Web API tab on the left bar 3. Generate new credentials (Keep in mind that a client secret will be visible only once)
func (*CodesWholesale) GetAccount ¶
func (c *CodesWholesale) GetAccount() (*Account, error)
Account Details provide you whole information about your account from name to actual balance with credit included.
func (*CodesWholesale) GetEndpoint ¶
func (c *CodesWholesale) GetEndpoint() string
Get endpoint based by mode: MODE_LIVE or MODE_SANDBOX It’s highly recommended to start working on your custom implementatnion on SANDBOX environment
func (*CodesWholesale) GetProductByID ¶
func (c *CodesWholesale) GetProductByID(cwID string) (*Product, error)
You can ask our API for only one product using ID. Tip: It’s good way to keep your stock and prices always updated.
func (*CodesWholesale) GetProducts ¶
func (c *CodesWholesale) GetProducts() ([]Product, error)
Here you can easily ask for all products from CodesWholesale Price List. In response you will receive important informations about each product.
func (*CodesWholesale) MultipleCodeOrder ¶
func (c *CodesWholesale) MultipleCodeOrder(cwID string, quantity uint) (*Orders, error)
Using your productID you can order games. Everything depends on quantity which you have to provide in your request. Create multiple codes order
func (*CodesWholesale) SingleCodeOrder ¶
func (c *CodesWholesale) SingleCodeOrder(cwID string) (*Order, error)
Using your before recieved productId you can order this game in our API via this CURL. Remember it is only for one code.
type Order ¶
type Order struct { CodeType cwTypeCode `json:"codeType"` Code string `json:"code"` Links []Link `json:"links,omitempty"` FileName string `json:"fileName,omitempty"` }
func (*Order) IsCodeImage ¶
func (*Order) IsCodePreorder ¶
func (*Order) IsCodeText ¶
type Product ¶
type Product struct { ProductID string `json:"productId"` Identifier string `json:"identifier"` Name string `json:"name"` Platform string `json:"platform"` Quantity uint `json:"quantity"` Images []Image `json:"images"` Regions []string `json:"regions"` Languages []string `json:"languages"` Prices []Price `json:"prices"` Links []Link `json:"links"` ReleaseDate *time.Time `json:"releaseDate"` }