Skip to content

Commit

Permalink
Merge pull request #2 from rapthead/main
Browse files Browse the repository at this point in the history
Fix deprecated api urls
  • Loading branch information
shubinmi authored Nov 3, 2021
2 parents b4ac8b2 + 4d85639 commit 681bae1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions resources/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func NewService(r gcore.Requester) *Service {

func (s *Service) Create(ctx context.Context, req *CreateRequest) (*Resource, error) {
var resource Resource
if err := s.r.Request(ctx, http.MethodPost, "/resources", req, &resource); err != nil {
if err := s.r.Request(ctx, http.MethodPost, "/cdn/resources", req, &resource); err != nil {
return nil, fmt.Errorf("request: %w", err)
}

Expand All @@ -29,7 +29,7 @@ func (s *Service) Create(ctx context.Context, req *CreateRequest) (*Resource, er

func (s *Service) Get(ctx context.Context, id int64) (*Resource, error) {
var resource Resource
if err := s.r.Request(ctx, http.MethodGet, fmt.Sprintf("/resources/%d", id), nil, &resource); err != nil {
if err := s.r.Request(ctx, http.MethodGet, fmt.Sprintf("/cdn/resources/%d", id), nil, &resource); err != nil {
return nil, fmt.Errorf("request: %w", err)
}

Expand All @@ -38,7 +38,7 @@ func (s *Service) Get(ctx context.Context, id int64) (*Resource, error) {

func (s *Service) Update(ctx context.Context, id int64, req *UpdateRequest) (*Resource, error) {
var resource Resource
if err := s.r.Request(ctx, http.MethodPut, fmt.Sprintf("/resources/%d", id), req, &resource); err != nil {
if err := s.r.Request(ctx, http.MethodPut, fmt.Sprintf("/cdn/resources/%d", id), req, &resource); err != nil {
return nil, fmt.Errorf("request: %w", err)
}

Expand Down
8 changes: 4 additions & 4 deletions rules/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func NewService(r gcore.Requester) *Service {
func (s *Service) Create(ctx context.Context, resourceID int64, req *CreateRequest) (*Rule, error) {
var rule Rule

path := fmt.Sprintf("/resources/%d/rules", resourceID)
path := fmt.Sprintf("/cdn/resources/%d/rules", resourceID)
if err := s.r.Request(ctx, http.MethodPost, path, req, &rule); err != nil {
return nil, fmt.Errorf("request: %w", err)
}
Expand All @@ -32,7 +32,7 @@ func (s *Service) Create(ctx context.Context, resourceID int64, req *CreateReque
func (s *Service) Get(ctx context.Context, resourceID, ruleID int64) (*Rule, error) {
var rule Rule

path := fmt.Sprintf("/resources/%d/rules/%d", resourceID, ruleID)
path := fmt.Sprintf("/cdn/resources/%d/rules/%d", resourceID, ruleID)
if err := s.r.Request(ctx, http.MethodGet, path, nil, &rule); err != nil {
return nil, fmt.Errorf("request: %w", err)
}
Expand All @@ -43,7 +43,7 @@ func (s *Service) Get(ctx context.Context, resourceID, ruleID int64) (*Rule, err
func (s *Service) Update(ctx context.Context, resourceID, ruleID int64, req *UpdateRequest) (*Rule, error) {
var rule Rule

path := fmt.Sprintf("/resources/%d/rules/%d", resourceID, ruleID)
path := fmt.Sprintf("/cdn/resources/%d/rules/%d", resourceID, ruleID)
if err := s.r.Request(ctx, http.MethodPut, path, req, &rule); err != nil {
return nil, fmt.Errorf("request: %w", err)
}
Expand All @@ -52,7 +52,7 @@ func (s *Service) Update(ctx context.Context, resourceID, ruleID int64, req *Upd
}

func (s *Service) Delete(ctx context.Context, resourceID, ruleID int64) error {
path := fmt.Sprintf("/resources/%d/rules/%d", resourceID, ruleID)
path := fmt.Sprintf("/cdn/resources/%d/rules/%d", resourceID, ruleID)
if err := s.r.Request(ctx, http.MethodDelete, path, nil, nil); err != nil {
return fmt.Errorf("request: %w", err)
}
Expand Down

0 comments on commit 681bae1

Please sign in to comment.