forked from ewarehousing-solutions/bigcommerce-api-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
93 lines (82 loc) · 2.7 KB
/
types.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
82
83
84
85
86
87
88
89
90
91
92
93
package bigcommerce
// AuthTokenRequest is sent to BigCommerce to get AuthContext
type AuthTokenRequest struct {
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret"`
Code string `json:"code"`
Scope string `json:"scope"`
GrantType string `json:"grant_type"`
RedirectURI string `json:"redirect_uri"`
Context string `json:"context"`
}
// BCUser is a BigCommerce shorthand object type that's in many other responses
type BCUser struct {
ID int64 `json:"id"`
Username string `json:"username"`
Email string `json:"email"`
}
// LoadContext is a BigCommerce load context object
type LoadContext struct {
User BCUser `json:"user"`
Owner BCUser `json:"owner"`
Context string `json:"context"`
StoreHash string `json:"store_hash"`
Timestamp float64 `json:"timestamp"`
URL string `json:"url"`
}
// AuthContext is a BigCommerce auth context object
type AuthContext struct {
AccessToken string `json:"access_token"` // used later as X-Auth-Token header
Scope string `json:"scope"`
User BCUser `json:"user"`
Context string `json:"context"`
URL string `json:"url"`
Error string `json:"error"`
}
// UserPart is a BigCommerce user shorthand object type that's in many other responses
type UserPart struct {
ID int64 `json:"id"`
Email string `json:"email"`
}
// ClientRequest is a BigCommerce client request object that comes with most App callbacks
// in the GET request signed_payload parameter
type ClientRequest struct {
User UserPart `json:"user"`
Owner UserPart `json:"owner"`
Context string `json:"context"`
StoreHash string `json:"store_hash"`
}
type InventoryEntry struct {
ProductID int64 `json:"product_id"`
Method string `json:"method"`
Value float64 `json:"value"`
VariantID int64 `json:"variant_id"`
}
type CartCoupon struct {
Code string `json:"code"`
ID interface{} `json:"id"`
CouponType string `json:"coupon_type"`
DiscountedAmount float64 `json:"discounted_amount"`
}
type Discount struct {
ID interface{} `json:"id"`
DiscountedAmount float64 `json:"discounted_amount"`
}
type ErrorResult struct {
Status int `json:"status"`
Title string `json:"title"`
Type string `json:"type"`
Errors map[string]string `json:"errors"`
}
type Pagination struct {
Count int `json:"count"`
CurrentPage int `json:"current_page"`
Links struct {
Current string `json:"current"`
Next string `json:"next"`
Previous string `json:"previous"`
} `json:"links"`
PerPage int `json:"per_page"`
Total int `json:"total"`
TotalPages int `json:"total_pages"`
}