-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpricing.go
126 lines (104 loc) · 3.94 KB
/
pricing.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
package atomicmarket
import (
"fmt"
"github.com/TheBoringDude/go-urljoin"
"github.com/google/go-querystring/query"
)
const PRICES_API = "prices"
type GetPriceSalesQuery struct {
CollectionName string `url:"collection_name,omitempty"`
SchemaName string `url:"schema_name,omitempty"`
TemplateID int64 `url:"template_id,omitempty"`
Burned bool `url:"burned,omitempty"`
Symbol string `url:"symbol,omitempty"`
}
// Gets price history for a template or schema.
func (a *AtomicMarket) GetPriceSales(options *GetPriceSalesQuery) (*PriceSalesProps, error) {
var u string
if options != nil {
v, _ := query.Values(options)
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "sales", fmt.Sprintf("?%s", v.Encode()))
} else {
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "sales")
}
var result = &PriceSalesProps{}
if err := a._requester(u, result); err != nil {
return nil, err
}
return result, nil
}
// Gets price history for a template or schema.
func (a *AtomicMarket) GetPriceSalesDays(options *GetPriceSalesQuery) (*PriceSalesDaysProps, error) {
var u string
if options != nil {
v, _ := query.Values(options)
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "sales", "days", fmt.Sprintf("?%s", v.Encode()))
} else {
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "sales", "days")
}
var result = &PriceSalesDaysProps{}
if err := a._requester(u, result); err != nil {
return nil, err
}
return result, nil
}
type GetPriceTemplatesQuery struct {
CollectionName string `url:"collection_name,omitempty"`
SchemaName string `url:"schema_name,omitempty"`
TemplateID int64 `url:"template_id,omitempty"`
Burned bool `url:"burned,omitempty"`
Symbol string `url:"symbol,omitempty"`
Page int64 `url:"page,omitempty"`
Limit int64 `url:"limit,omitempty"`
Order string `url:"order,omitempty"`
}
// Get template price stats.
func (a *AtomicMarket) GetPriceTemplates(options *GetPriceTemplatesQuery) (*PriceTemplates, error) {
var u string
if options != nil {
v, _ := query.Values(options)
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "templates", fmt.Sprintf("?%s", v.Encode()))
} else {
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "templates")
}
var result = &PriceTemplates{}
if err := a._requester(u, result); err != nil {
return nil, err
}
return result, nil
}
type GetPriceAssetsQuery struct {
CollectionName string `url:"collection_name,omitempty"`
SchemaName string `url:"schema_name,omitempty"`
TemplateID int64 `url:"template_id,omitempty"`
Burned bool `url:"burned,omitempty"`
Owner string `url:"owner,omitempty"`
Match string `url:"match,omitempty"`
Search string `url:"search,omitempty"`
MatchImmutableName string `url:"match_immutable_name,omitempty"`
MatchMutableName string `url:"match_mutable_name,omitempty"`
IsTransferable bool `url:"is_transferable,omitempty"`
IsBurnable bool `url:"is_burnable,omitempty"`
CollectionBlacklist []string `url:"collection_blacklist,omitempty" del:","`
CollectionWhitelist []string `url:"collection_whitelist,omitempty" del:","`
AuthorizedAccount bool `url:"authorized_account,omitempty"`
HideOffers bool `url:"hide_offers,omitempty"`
IDs []string `url:"ids,omitempty" del:","`
LowerBound []string `url:"lower_bound,omitempty" del:","`
UpperBound []string `url:"upper_bound,omitempty" del:","`
}
// Get price history for a template or schema.
func (a *AtomicMarket) GetPriceAssets(options *GetPriceAssetsQuery) (*PriceAssets, error) {
var u string
if options != nil {
v, _ := query.Values(options)
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "assets", fmt.Sprintf("?%s", v.Encode()))
} else {
u = urljoin.UrlJoin(a.apiUrl, PRICES_API, "assets")
}
var result = &PriceAssets{}
if err := a._requester(u, result); err != nil {
return nil, err
}
return result, nil
}