-
Notifications
You must be signed in to change notification settings - Fork 11
/
store.go
81 lines (76 loc) · 3.04 KB
/
store.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package bigcommerce
import (
"encoding/json"
"net/http"
)
// StoreInfo is a BigCommerce store info object
type StoreInfo struct {
ID string `json:"id"`
Domain string `json:"domain"`
SecureURL string `json:"secure_url"`
Status string `json:"status"`
Name string `json:"name"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Address string `json:"address"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
Phone string `json:"phone"`
AdminEmail string `json:"admin_email"`
OrderEmail string `json:"order_email"`
FaviconURL string `json:"favicon_url"`
Timezone struct {
Name string `json:"name"`
RawOffset int `json:"raw_offset"`
DstOffset int `json:"dst_offset"`
DstCorrection bool `json:"dst_correction"`
DateFormat struct {
Display string `json:"display"`
Export string `json:"export"`
ExtendedDisplay string `json:"extended_display"`
} `json:"date_format"`
} `json:"timezone"`
Language string `json:"language"`
Currency string `json:"currency"`
CurrencySymbol string `json:"currency_symbol"`
DecimalSeparator string `json:"decimal_separator"`
ThousandsSeparator string `json:"thousands_separator"`
DecimalPlaces int `json:"decimal_places"`
CurrencySymbolLocation string `json:"currency_symbol_location"`
WeightUnits string `json:"weight_units"`
DimensionUnits string `json:"dimension_units"`
DimensionDecimalPlaces int `json:"dimension_decimal_places"`
DimensionDecimalToken string `json:"dimension_decimal_token"`
DimensionThousandsToken string `json:"dimension_thousands_token"`
PlanName string `json:"plan_name"`
PlanLevel string `json:"plan_level"`
PlanIsTrial bool `json:"plan_is_trial"`
Industry string `json:"industry"`
Logo interface{} `json:"logo"`
IsPriceEnteredWithTax bool `json:"is_price_entered_with_tax"`
ActiveComparisonModules []interface{} `json:"active_comparison_modules"`
Features struct {
StencilEnabled bool `json:"stencil_enabled"`
SitewidehttpsEnabled bool `json:"sitewidehttps_enabled"`
FacebookCatalogID string `json:"facebook_catalog_id"`
CheckoutType string `json:"checkout_type"`
WishlistsEnabled bool `json:"wishlists_enabled"`
} `json:"features"`
}
// GetStoreInfo returns the store info for the current store
// page: the page number to download
func (bc *Client) GetStoreInfo() (StoreInfo, error) {
var storeInfo StoreInfo
req := bc.getAPIRequest(http.MethodGet, "/v2/store", nil)
res, err := bc.HTTPClient.Do(req)
if err != nil {
return storeInfo, err
}
defer res.Body.Close()
body, err := processBody(res)
if err != nil {
return storeInfo, err
}
err = json.Unmarshal(body, &storeInfo)
return storeInfo, err
}