Restructured - new game changer

This commit is contained in:
PB
2025-10-26 19:20:59 +01:00
parent 2ac68aed86
commit 65105d6982
9 changed files with 49 additions and 61 deletions

26
api/rest/pricing.go Normal file
View File

@@ -0,0 +1,26 @@
package api
import (
"fmt"
def "git.pbiernat.io/egommerce/api-entities/http"
"github.com/go-redis/redis/v8"
)
func NewPricingAPI(ua string, redis *redis.Client) *PricingAPI {
return &PricingAPI{NewHttpClient(ua, redis)}
}
type PricingAPI struct {
httpClient *HttpClient
}
func (a *PricingAPI) GetProductPrice(productID int) (*def.ProductPriceResponse, error) {
url := fmt.Sprintf("/api/v1/product/%d", productID)
res := new(def.ProductPriceResponse)
if err := a.httpClient.SendGet("pricing-svc", url, nil, res); err != nil {
return nil, err
}
return res, nil
}