externalservices

package
v0.0.0-...-e1e387d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cart

type Cart struct {
	UserID    string     `json:"user_id"`
	CartItems []CartItem `json:"cart_items"`
}

type CartItem

type CartItem struct {
	ProductID int `json:"product_id"`
	Quantity  int `json:"quantity"`
}

type CartService

type CartService interface {
	GetCart(ctx context.Context, authToken string) (*Cart, error)
	ClearCart(ctx context.Context, authToken string) error
}

type HTTPCartService

type HTTPCartService struct {
	// contains filtered or unexported fields
}

func NewHTTPCartService

func NewHTTPCartService(baseURL string) *HTTPCartService

func (*HTTPCartService) ClearCart

func (s *HTTPCartService) ClearCart(ctx context.Context, authToken string) error

func (*HTTPCartService) GetCart

func (s *HTTPCartService) GetCart(ctx context.Context, authToken string) (*Cart, error)

type HTTPInventoryService

type HTTPInventoryService struct {
	// contains filtered or unexported fields
}

func NewHTTPInventoryService

func NewHTTPInventoryService(baseURL string) *HTTPInventoryService

func (*HTTPInventoryService) CheckAvailability

func (s *HTTPInventoryService) CheckAvailability(ctx context.Context, productID int, quantity int) (bool, error)

func (*HTTPInventoryService) UpdateInventory

func (s *HTTPInventoryService) UpdateInventory(ctx context.Context, descrease bool, productID int, quantity int) error

type HTTPProductService

type HTTPProductService struct {
	// contains filtered or unexported fields
}

func NewHTTPProductService

func NewHTTPProductService(baseURL string) *HTTPProductService

func (*HTTPProductService) GetProduct

func (s *HTTPProductService) GetProduct(ctx context.Context, productID int) (*Product, error)

type InventoryService

type InventoryService interface {
	CheckAvailability(ctx context.Context, productID int, quantity int) (bool, error)
	UpdateInventory(ctx context.Context, descrease bool, productID int, quantity int) error
}

type Product

type Product struct {
	ID    int     `json:"id"`
	Price float32 `json:"price"`
}

type ProductService

type ProductService interface {
	GetProduct(ctx context.Context, productID int) (*Product, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL