bpiek/api/api.go
Pavel Sinitsin 25e131269d
Refactor API client initialization and simplify types
Streamlined API client initialization within the NewApi function by directly invoking the client creation. Additionally, removed custom type declarations and constants in model/product.go, replacing them with simpler string types to reduce complexity.
2024-09-07 19:18:32 +03:00

23 lines
424 B
Go

package api
import (
"gitea.24example.ru/spavelit/bpiek/client"
"gitea.24example.ru/spavelit/bpiek/model"
)
type Api struct {
Client *client.Client
}
type IApi interface {
GetParentCategories() ([]model.Category, error)
GetCategories() ([]model.Category, error)
GetProducts() ([]model.Product, error)
}
func NewApi(credentials client.Credentials) IApi {
return &Api{
Client: client.NewClient(credentials),
}
}