Skip to content

Commit 3da49d3

Browse files
CDI-468: fix get shielding locations method
1 parent 996001c commit 3da49d3

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

originshielding/originshielding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
type OriginShieldingService interface {
88
Update(ctx context.Context, id int64, req *UpdateRequest) (*OriginShieldingData, error)
99
Get(ctx context.Context, id int64) (*OriginShieldingData, error)
10-
GetLocations(ctx context.Context) (*OriginShieldingLocations, error)
10+
GetLocations(ctx context.Context) ([]OriginShieldingLocations, error)
1111
}
1212

1313
type OriginShieldingData struct {

originshielding/service.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,28 @@ func NewService(r gcore.Requester) *Service {
1818
}
1919

2020
func (s *Service) Update(ctx context.Context, id int64, req *UpdateRequest) (*OriginShieldingData, error) {
21-
var origin_shielding OriginShieldingData
22-
if err := s.r.Request(ctx, http.MethodPut, fmt.Sprintf("/cdn/resources/%d/shielding_v2", id), req, &origin_shielding); err != nil {
21+
var originShielding OriginShieldingData
22+
if err := s.r.Request(ctx, http.MethodPut, fmt.Sprintf("/cdn/resources/%d/shielding_v2", id), req, &originShielding); err != nil {
2323
return nil, fmt.Errorf("request: %w", err)
2424
}
25-
return &origin_shielding, nil
25+
return &originShielding, nil
2626
}
2727

2828
func (s *Service) Get(ctx context.Context, id int64) (*OriginShieldingData, error) {
29-
var origin_shielding OriginShieldingData
30-
if err := s.r.Request(ctx, http.MethodGet, fmt.Sprintf("/cdn/resources/%d/shielding_v2", id), nil, &origin_shielding); err != nil {
29+
var originShielding OriginShieldingData
30+
if err := s.r.Request(ctx, http.MethodGet, fmt.Sprintf("/cdn/resources/%d/shielding_v2", id), nil, &originShielding); err != nil {
3131
return nil, fmt.Errorf("request: %w", err)
3232
}
3333

34-
return &origin_shielding, nil
34+
return &originShielding, nil
3535

3636
}
3737

38-
func (s *Service) GetLocations(ctx context.Context) (*OriginShieldingLocations, error) {
39-
var origin_shielding_locations OriginShieldingLocations
40-
if err := s.r.Request(ctx, http.MethodGet, "/cdn/shieldingpop_v2", nil, &origin_shielding_locations); err != nil {
38+
func (s *Service) GetLocations(ctx context.Context) ([]OriginShieldingLocations, error) {
39+
var originShieldingLocations []OriginShieldingLocations
40+
if err := s.r.Request(ctx, http.MethodGet, "/cdn/shieldingpop_v2", nil, originShieldingLocations); err != nil {
4141
return nil, fmt.Errorf("request: %w", err)
4242
}
4343

44-
return &origin_shielding_locations, nil
44+
return originShieldingLocations, nil
4545
}

0 commit comments

Comments
 (0)