REST API client update
This commit is contained in:
@@ -3,7 +3,6 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.ego.freeddns.org/egommerce/api-entities/basket"
|
||||
basket "git.ego.freeddns.org/egommerce/api-entities/basket/dto"
|
||||
)
|
||||
|
||||
|
||||
25
api/rest/identity.go
Normal file
25
api/rest/identity.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
identity "git.ego.freeddns.org/egommerce/api-entities/identity/dto"
|
||||
)
|
||||
|
||||
type IdentityAPI struct {
|
||||
httpClient *HttpClient
|
||||
}
|
||||
|
||||
func NewIdentityAPI() *IdentityAPI {
|
||||
return &IdentityAPI{NewHttpClient()}
|
||||
}
|
||||
|
||||
func (a *IdentityAPI) CheckAccess(url, srv string) (*identity.CheckAccessResponseDTO, error) {
|
||||
req := &identity.CheckAccessRequestDTO{URL: url, Service: srv}
|
||||
res := new(identity.CheckAccessResponseDTO)
|
||||
|
||||
// targetURL := fmt.Sprintf("/v1/access?url=%s&srv=%s", url, srv)
|
||||
if err := a.httpClient.SendGet("identity-svc", "/v1/access", req, res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
def "git.pbiernat.io/egommerce/api-entities/http"
|
||||
pricing "git.ego.freeddns.org/egommerce/api-entities/pricing/dto"
|
||||
)
|
||||
|
||||
func NewPricingAPI() *PricingAPI {
|
||||
@@ -14,9 +14,9 @@ type PricingAPI struct {
|
||||
httpClient *HttpClient
|
||||
}
|
||||
|
||||
func (a *PricingAPI) GetProductPrice(productID int) (*def.ProductPriceResponse, error) {
|
||||
func (a *PricingAPI) GetProductPrice(productID int) (*pricing.ProductPriceResponseDTO, error) {
|
||||
url := fmt.Sprintf("/api/v1/product/%d", productID)
|
||||
res := new(def.ProductPriceResponse)
|
||||
res := new(pricing.ProductPriceResponseDTO)
|
||||
if err := a.httpClient.SendGet("pricing-svc", url, nil, res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user