-
Notifications
You must be signed in to change notification settings - Fork 3
/
ProductOption.go
55 lines (42 loc) · 1.63 KB
/
ProductOption.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package HologramGo
import (
"fmt"
"os"
)
// ProductOption implements the product option returned from the response.
type ProductOption map[string]interface{}
// ProductOptions is just a list of ProductOption(s)
type ProductOptions []interface{}
// GetProductOptions returns product options.
func GetProductOptions() ProductOptions {
req := createGetRequest("/products/options/")
resp, err := sendRequest(req)
if err != nil {
fmt.Printf("Could not send request: %v\n", err)
os.Exit(1)
}
return unmarshallIntoArrayObject(resp)
}
///////////////////////////////////////////////////
// PRODUCT OPTION GETTER FUNCTIONS
///////////////////////////////////////////////////
// GetProductIdFromOption returns the product id.
func (productOption ProductOption) GetProductIdFromOption() float64 {
return productOption["productid"].(float64)
}
// GetProductOptionAppendSku returns the sku of the product option.
func (productOption ProductOption) GetProductOptionAppendSku() string {
return productOption["appendsku"].(string)
}
// GetProductOptionPriceChang returns the price change of the product option.
func (productOption ProductOption) GetProductOptionPriceChange() string {
return productOption["pricechange"].(string)
}
// GetProductOptionDescription returns the description of the product option.
func (productOption ProductOption) GetProductOptionDescription() string {
return productOption["description"].(string)
}
// GetProductOptionInvoiceDescription returns the invoice description of the product option.
func (productOption ProductOption) GetProductOptionInvoiceDescription() string {
return productOption["invoice_description"].(string)
}