Pavel Sinitsin
25e131269d
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.
23 lines
424 B
Go
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),
|
|
}
|
|
}
|