forked from getconversio/go-shopify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shop.go
66 lines (60 loc) · 2.61 KB
/
shop.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
package goshopify
import "time"
// ShopService is an interface for interfacing with the shop endpoint of the
// Shopify API.
// See: https://help.shopify.com/api/reference/shop
type ShopService interface {
Get(options interface{}) (*Shop, error)
}
// ShopServiceOp handles communication with the shop related methods of the
// Shopify API.
type ShopServiceOp struct {
client *Client
}
// Shop represents a Shopify shop
type Shop struct {
ID int `json:"id"`
Name string `json:"name"`
ShopOwner string `json:"shop_owner"`
Email string `json:"email"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
Address1 string `json:"address1"`
City string `json:"city"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
CountryName string `json:"country_name"`
Currency string `json:"currency"`
Domain string `json:"domain"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
Phone string `json:"phone"`
Province string `json:"province"`
ProvinceCode string `json:"province_code"`
Zip string `json:"zip"`
MoneyFormat string `json:"money_format"`
MoneyWithCurrencyFormat string `json:"money_with_currency_format"`
MyshopifyDomain string `json:"myshopify_domain"`
PlanName string `json:"plan_name"`
PlanDisplayName string `json:"plan_display_name"`
PasswordEnabled bool `json:"password_enabled"`
PrimaryLocale string `json:"primary_locale"`
Timezone string `json:"timezone"`
IanaTimezone string `json:"iana_timezone"`
ForceSSL bool `json:"force_ssl"`
HasStorefront bool `json:"has_storefront"`
HasDiscounts bool `json:"has_discounts"`
HasGiftcards bool `json:"has_gift_cards"`
SetupRequire bool `json:"setup_required"`
CountyTaxes bool `json:"county_taxes"`
}
// Represents the result from the admin/shop.json endpoint
type ShopResource struct {
Shop *Shop `json:"shop"`
}
// Get shop
func (s *ShopServiceOp) Get(options interface{}) (*Shop, error) {
resource := new(ShopResource)
err := s.client.Get("admin/shop.json", resource, options)
return resource.Shop, err
}