API Basket update
This commit is contained in:
parent
8394feaec7
commit
f130eaedd7
@ -3,7 +3,8 @@ package api
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
def "git.pbiernat.io/egommerce/api-entities/http"
|
"git.ego.cloudns.be/egommerce/api-entities/basket"
|
||||||
|
basket "git.ego.cloudns.be/egommerce/api-entities/basket/dto"
|
||||||
"github.com/go-redis/redis/v8"
|
"github.com/go-redis/redis/v8"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,9 +16,9 @@ type BasketAPI struct {
|
|||||||
httpClient *HttpClient
|
httpClient *HttpClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *BasketAPI) GetBasket(basketID string) (*def.GetBasketResponse, error) {
|
func (a *BasketAPI) GetBasket(basketID string) (*basket.GetBasketResponseDTO, error) {
|
||||||
req := &def.GetBasketRequest{BasketID: basketID}
|
req := &basket.GetBasketRequestDTO{BasketID: basketID}
|
||||||
res := new(def.GetBasketResponse)
|
res := new(basket.GetBasketResponse)
|
||||||
if err := a.httpClient.SendGet("basket-svc", "/api/v1/basket", req, res); err != nil {
|
if err := a.httpClient.SendGet("basket-svc", "/api/v1/basket", req, res); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -25,9 +26,9 @@ func (a *BasketAPI) GetBasket(basketID string) (*def.GetBasketResponse, error) {
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *BasketAPI) GetBasketItems(basketID string) ([]*def.GetBasketItemsResponse, error) {
|
func (a *BasketAPI) GetBasketItems(basketID string) ([]*basket.GetBasketItemsResponseDTO, error) {
|
||||||
url := fmt.Sprintf("/api/v1/basket/%s/items", basketID)
|
url := fmt.Sprintf("/api/v1/basket/%s/items", basketID)
|
||||||
var res []*def.GetBasketItemsResponse
|
var res []*basket.GetBasketItemsResponseDTO
|
||||||
if err := a.httpClient.SendGet("basket-svc", url, nil, &res); err != nil {
|
if err := a.httpClient.SendGet("basket-svc", url, nil, &res); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user