Pavel Sinitsin
8c3541a892
Introduced a new method `GetTreeCategories` to provide a hierarchical structure for categories. Fixed typos in variable names and integrated utility functions for converting flat lists to nested dictionaries and vice versa. Added `TreeCategories` model for representing nested category structures.
24 lines
481 B
Go
24 lines
481 B
Go
package api
|
|
|
|
import (
|
|
"gitea.24example.ru/spavelit/bpiek/client"
|
|
"gitea.24example.ru/spavelit/bpiek/model"
|
|
)
|
|
|
|
type Api struct {
|
|
Client *client.Client
|
|
}
|
|
|
|
type Method interface {
|
|
GetParentCategories() ([]model.Category, error)
|
|
GetCategories() ([]model.Category, error)
|
|
GetTreeCategories() ([]model.TreeCategories, error)
|
|
GetProducts() ([]model.Product, error)
|
|
}
|
|
|
|
func NewApi(credentials client.Credentials) Method {
|
|
return &Api{
|
|
Client: client.NewClient(credentials),
|
|
}
|
|
}
|