Pavel Sinitsin
e14d4b188b
This commit introduces new API and client modules that provide functionality for managing categories and products. It includes the creation of `.gitignore`, necessary data models, API endpoints, and client authentication using go-resty. This forms the foundation for further enhancements to the category and product management features.
24 lines
442 B
Go
24 lines
442 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 {
|
|
client := client.NewClient(credentials)
|
|
return &Api{
|
|
Client: client,
|
|
}
|
|
}
|