-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient.go
44 lines (39 loc) · 1.22 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
package client
import (
"github.com/lueurxax/go-admitad-client/currencies"
"github.com/lueurxax/go-admitad-client/defaults"
"github.com/lueurxax/go-admitad-client/internal"
"github.com/lueurxax/go-admitad-client/me"
"github.com/lueurxax/go-admitad-client/news"
offlineReceipts "github.com/lueurxax/go-admitad-client/offline_receipts"
"github.com/lueurxax/go-admitad-client/tickets"
)
type AClient struct {
Statistics
news.News
currencies.Currencies
me.Me
offlineReceipts.OfflineReceipts
tickets.Ticket
bc *internal.BaseClient
}
func New(url string, logger internal.Logger, mc internal.MetricsCollector) *AClient {
if logger == nil {
logger = defaults.NewLogrus()
}
if mc == nil {
mc = &defaults.EmptyMetrics{}
}
bc := internal.NewBaseClient(url, logger, mc)
return &AClient{
Statistics: Statistics{bc},
News: news.News{BaseClient: bc},
Currencies: currencies.Currencies{BaseClient: bc},
Me: me.Me{BaseClient: bc},
OfflineReceipts: offlineReceipts.OfflineReceipts{BaseClient: bc},
Ticket: tickets.NewTicket(bc),
bc: bc}
}
func (ac *AClient) SetAuth(clientID, clientSecret, scope string) error {
return ac.bc.SetAuth(clientID, clientSecret, scope)
}