-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.go
57 lines (47 loc) · 1.39 KB
/
client.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
package dusupay
import "net/http"
//Client struct
type Client struct {
transport *Transport
config *Config
}
//NewClientFromConfig Create new client from config
func NewClientFromConfig(config *Config, cl *http.Client) (*Client, error) {
err := config.IsValid()
if err != nil {
return nil, err
}
if cl == nil {
cl = &http.Client{}
}
transport := NewHttpTransport(config, cl)
return &Client{transport, config}, nil
}
//Collections resource
func (c *Client) Collections() *CollectionsResource {
return &CollectionsResource{NewResourceAbstract(c.transport, c.config)}
}
//Payouts resource
func (c *Client) Payouts() *PayoutsResource {
return &PayoutsResource{NewResourceAbstract(c.transport, c.config)}
}
//Providers resource
func (c *Client) Providers() *ProvidersResource {
return &ProvidersResource{NewResourceAbstract(c.transport, c.config)}
}
//Merchants resource
func (c *Client) Merchants() *MerchantsResource {
return &MerchantsResource{NewResourceAbstract(c.transport, c.config)}
}
//Refunds resource
func (c *Client) Refunds() *RefundsResource {
return &RefundsResource{NewResourceAbstract(c.transport, c.config)}
}
//Banks resource
func (c *Client) Banks() *BanksResource {
return &BanksResource{NewResourceAbstract(c.transport, c.config)}
}
//Webhooks resource
func (c *Client) Webhooks() *WebhooksResource {
return &WebhooksResource{NewResourceAbstract(c.transport, c.config)}
}