-
Notifications
You must be signed in to change notification settings - Fork 10
/
client.go
68 lines (57 loc) · 1.94 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
58
59
60
61
62
63
64
65
66
67
68
package gcdn
import (
"github.com/G-Core/gcorelabscdn-go/gcore"
"github.com/G-Core/gcorelabscdn-go/origingroups"
"github.com/G-Core/gcorelabscdn-go/originshielding"
"github.com/G-Core/gcorelabscdn-go/presets"
"github.com/G-Core/gcorelabscdn-go/resources"
"github.com/G-Core/gcorelabscdn-go/rules"
"github.com/G-Core/gcorelabscdn-go/sslcerts"
)
type ClientService interface {
Resources() resources.ResourceService
Rules() rules.RulesService
OriginGroups() origingroups.OriginGroupService
OriginShielding() originshielding.OriginShieldingService
SSLCerts() sslcerts.SSLCertService
Presets() presets.PresetsService
}
var _ ClientService = (*Service)(nil)
type Service struct {
r gcore.Requester
resourcesService resources.ResourceService
rulesService rules.RulesService
originGroupsService origingroups.OriginGroupService
originShieldingService originshielding.OriginShieldingService
sslCertsService sslcerts.SSLCertService
presetsService presets.PresetsService
}
func NewService(r gcore.Requester) *Service {
return &Service{
r: r,
resourcesService: resources.NewService(r),
rulesService: rules.NewService(r),
originGroupsService: origingroups.NewService(r),
originShieldingService: originshielding.NewService(r),
sslCertsService: sslcerts.NewService(r),
presetsService: presets.NewService(r),
}
}
func (s *Service) Resources() resources.ResourceService {
return s.resourcesService
}
func (s *Service) Rules() rules.RulesService {
return s.rulesService
}
func (s *Service) OriginGroups() origingroups.OriginGroupService {
return s.originGroupsService
}
func (s *Service) OriginShielding() originshielding.OriginShieldingService {
return s.originShieldingService
}
func (s *Service) SSLCerts() sslcerts.SSLCertService {
return s.sslCertsService
}
func (s *Service) Presets() presets.PresetsService {
return s.presetsService
}