-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
in.go
72 lines (60 loc) · 1.48 KB
/
in.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
package banks
import (
"fmt"
"net/http"
"reflect"
"strings"
"github.com/go-numb/go-exchanges/api/bitflyer/v1/types"
)
const BANKINPATH = "/v1/me/getdeposits"
type RequestForIn struct {
Pagination types.Pagination `json:",inline"`
}
type ResponseForIn []Bankin
type Bankin struct {
OrderID string `json:"order_id"`
CurrencyCode string `json:"currency_code"`
Status string `json:"status"`
Amount float64 `json:"amount"`
EventDate types.ExchangeTime `json:"event_date"`
ID int `json:"id"`
}
func NewForIn() *RequestForIn {
return &RequestForIn{}
}
func (p *RequestForIn) SetPagination(count, beforeID, afterID int) *RequestForIn {
if count != 0 {
p.Pagination.Count = count
}
if beforeID != 0 {
p.Pagination.Before = beforeID
}
if afterID != 0 {
p.Pagination.After = afterID
}
return p
}
func (p *RequestForIn) Path() string {
return BANKINPATH
}
func (p *RequestForIn) Method() string {
return http.MethodGet
}
func (p *RequestForIn) Query() string {
var q string
if !reflect.DeepEqual(p.Pagination, types.Pagination{}) {
if p.Pagination.Count != 0 {
q += fmt.Sprintf("&count=%d", p.Pagination.Count)
}
if p.Pagination.Before != 0 {
q += fmt.Sprintf("&before=%d", p.Pagination.Before)
}
if p.Pagination.After != 0 {
q += fmt.Sprintf("&after=%d", p.Pagination.After)
}
}
return strings.TrimLeft(q, "&")
}
func (p *RequestForIn) Payload() []byte {
return nil
}