Pavel Sinitsin
05b8245f11
Renamed category variables to use underscores for better clarity and consistency. Updated client authentication method to accept username and password directly instead of using a Credentials struct.
32 lines
1.2 KiB
Go
32 lines
1.2 KiB
Go
package api
|
||
|
||
import (
|
||
"gitea.24example.ru/spavelit/bpiek/client"
|
||
"gitea.24example.ru/spavelit/bpiek/model"
|
||
)
|
||
|
||
type (
|
||
Api struct {
|
||
Client *client.Client
|
||
}
|
||
Credentials struct {
|
||
Username string
|
||
Password string
|
||
}
|
||
|
||
Method interface {
|
||
GetParentCategories() ([]model.Category, error) // Возвращает массив категорий каталога 1-ого уровня.
|
||
GetCategories() ([]model.Category, error) // Возвращает массив с категориями
|
||
GetTreeCategories() ([]model.TreeCategories, error) // Возвращает дерево категорий
|
||
GetProducts() ([]model.Product, error) // Возвращает массив с продукцией
|
||
GetProductByArticle(article string) (model.Product, error) // Возвращает товар по артикул
|
||
GetRemainsAndPlanresidues() ([]model.ShortProduct, error) // Возвращает массив, в котором содержатся актуальные цены и остатки товаров.
|
||
}
|
||
)
|
||
|
||
func NewApi(credentials Credentials) Method {
|
||
return &Api{
|
||
Client: client.NewClient(credentials.Username, credentials.Password),
|
||
}
|
||
}
|