bpiek/api/api.go
Pavel Sinitsin 8c3541a892
Add tree structure to categories API
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.
2024-09-07 21:18:36 +03:00

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),
}
}