26 lines
538 B
Go
26 lines
538 B
Go
package api
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
pricing "git.ego.freeddns.org/egommerce/api-entities/pricing/dto"
|
|
)
|
|
|
|
func NewPricingAPI() *PricingAPI {
|
|
return &PricingAPI{NewHttpClient()}
|
|
}
|
|
|
|
type PricingAPI struct {
|
|
httpClient *HttpClient
|
|
}
|
|
|
|
func (a *PricingAPI) GetProductPrice(productID int) (*pricing.ProductPriceResponseDTO, error) {
|
|
url := fmt.Sprintf("/api/v1/product/%d", productID)
|
|
res := new(pricing.ProductPriceResponseDTO)
|
|
if err := a.httpClient.SendGet("pricing-svc", url, nil, res); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return res, nil
|
|
}
|