Compare commits

..

No commits in common. "main" and "v1.0.0" have entirely different histories.
main ... v1.0.0

10 changed files with 202 additions and 353 deletions

View File

@ -1,21 +0,0 @@
Лицензия MIT (MIT)
Авторские права (c) 2024 Павел Синицин
Настоящим предоставляется бесплатное разрешение любому лицу, получившему копию
этого программного обеспечения и сопутствующей документации (в дальнейшем "Программное обеспечение"), использовать
Программное обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, слияние,
публикацию, распространение, сублицензирование и/или продажу копий
Программного обеспечения, а также лицам, которым предоставляется данное Программное обеспечение, при соблюдении
следующих условий:
Указанное выше уведомление об авторских правах и данное разрешение должны быть включены во все
копии или значительные части этого Программного обеспечения.
Программное обеспечение предоставляется "КАК ЕСТЬ", без каких-либо гарантий, явных или
подразумеваемых, включая, но не ограничиваясь, гарантии товарной пригодности, пригодности
для конкретной цели и ненарушения прав. Ни в коем случае авторы или
владельцы авторских прав не несут ответственности за любые претензии, убытки или другие обязательства, будь то в иске по
договору, деликту или ином,
возникающем из, связанного с Программным обеспечением или использования Программного обеспечения или других действий с
Программным обеспечением.

133
README.md
View File

@ -1,133 +0,0 @@
# API клиент бизнес-платформы IEK
## Содержание
- [Начало работы](#начало-работы)
- [Установка](#установка)
- [Использование](#использование)
- [Доступные методы](#доступные-методы)
- [Используемые инструменты](#используемые-инструменты)
- [Авторы](#авторы)
- [Лицензия](#лицензия)
## Начало работы
Эти инструкции помогут вам запустить копию проекта на вашем локальном компьютере для целей разработки и тестирования.
#### Установка Go
Убедитесь, что у вас установлена последняя версия Go. Инструкции по установке можно найти на официальном
сайте [Go](https://golang.org/doc/install).
Пример:
```sh
go version go1.23.1
```
### Установка
Пошаговая инструкция по созданию окружения.
1. Установите проект с помощью `go get`
```sh
go get -u gitea.24example.ru/spavelit/bpiek
```
2. Установите зависимости
```sh
go mod tidy
```
### Использование
Инструкции по использованию вашего проекта.
#### Запуск приложения
Пример:
```sh
go run main.go
```
#### Пример использования
Примечание:
Добавьте пример кода, чтобы пользователи могли быстро начать работу с вашим проектом.
```go
package main
import (
"encoding/json"
"fmt"
bpiek "gitea.24example.ru/spavelit/bpiek/api"
)
func main() {
credentials := bpiek.Credentials{
Username: "mail@example.ru",
Password: "password",
}
api := bpiek.NewApi(credentials)
result, err := api.GetRemainsAndPlanresidues()
if err != nil {
panic(err)
}
b, _ := json.MarshalIndent(result[1], "", " ")
fmt.Print(string(b))
}
```
### Доступные методы
В данном разделе приведены основные методы, доступные в API клиенте для бизнес-платформы IEK:
1. `NewApi(credentials bpiek.Credentials)`
- Создает новый экземпляр API клиента с предоставленными учетными данными.
2. `GetParentCategories() ([]model.Category, error)`
- Возвращает массив категорий каталога 1-ого уровня.
3. `GetCategories() ([]model.Category, error)`
- Возвращает массив с категориями.
4. `GetTreeCategories() ([]model.TreeCategories, error)`
- Возвращает дерево категорий.
5. `GetProducts() ([]model.Product, error)`
- Возвращает массив с продукцией.
6. `GetProductByArticle(article string) (model.Product, error)`
- Возвращает товар по артикулу.
7. `GetRemainsAndPlanresidues() ([]model.ShortProduct, error)`
- Возвращает массив, в котором содержатся актуальные цены
и остатки товаров.
Эти методы могут использоваться для взаимодействия с бизнес-платформой IEK в рамках вашего проекта. Подробная
документация каждого метода доступна в исходниках или официальной документации БП IEK.
## Используемые инструменты
Список инструментов и библиотек, которые использовались при создании проекта.
* [GoLang](https://golang.org/) - Язык программирования.
* [Resty](https://github.com/go-resty/resty) - Simple HTTP and REST client library for Go.
## Авторы
* **Павел Синицин** - *Rosar-L* - [Gitea](https://gitea.24example.ru/spavelit/)
## Лицензия
Этот проект лицензирован под лицензией MIT - подробности смотрите в файле [LICENSE.md](LICENSE.md).

View File

@ -5,27 +5,22 @@ import (
"gitea.24example.ru/spavelit/bpiek/model" "gitea.24example.ru/spavelit/bpiek/model"
) )
type ( type Api struct {
Api struct { Client *client.Client
Client *client.Client }
}
Credentials struct {
Username string
Password string
}
Method interface { type Method interface {
GetParentCategories() ([]model.Category, error) // Возвращает массив категорий каталога 1-ого уровня. GetParentCategories() ([]model.Category, error)
GetCategories() ([]model.Category, error) // Возвращает массив с категориями GetCategories() ([]model.Category, error)
GetTreeCategories() ([]model.TreeCategories, error) // Возвращает дерево категорий GetTreeCategories() ([]model.TreeCategories, error)
GetProducts() ([]model.Product, error) // Возвращает массив с продукцией
GetProductByArticle(article string) (model.Product, error) // Возвращает товар по артикул
GetRemainsAndPlanresidues() ([]model.ShortProduct, error) // Возвращает массив, в котором содержатся актуальные цены и остатки товаров.
}
)
func NewApi(credentials Credentials) Method { GetProducts() ([]model.Product, error)
GetProductByArticle(article string) (model.Product, error)
GetRemainsAndPlanresidues() ([]model.ShortProduct, error)
}
func NewApi(credentials client.Credentials) Method {
return &Api{ return &Api{
Client: client.NewClient(credentials.Username, credentials.Password), Client: client.NewClient(credentials),
} }
} }

View File

@ -6,13 +6,13 @@ import (
"gitea.24example.ru/spavelit/bpiek/utils" "gitea.24example.ru/spavelit/bpiek/utils"
) )
var _categories []model.Category var categories []model.Category
var _parentCategories []model.Category var parentCategories []model.Category
var _treeCategories []model.TreeCategories var treeCategories []model.TreeCategories
func (a *Api) GetCategories() ([]model.Category, error) { func (a *Api) GetCategories() ([]model.Category, error) {
if len(_categories) > 0 { if len(categories) > 0 {
return _categories, nil return categories, nil
} }
parentCategories, err := a.GetParentCategories() parentCategories, err := a.GetParentCategories()
@ -22,26 +22,23 @@ func (a *Api) GetCategories() ([]model.Category, error) {
} }
for _, category := range parentCategories { for _, category := range parentCategories {
_categories = append(_categories, category)
categoriesAndProduct, err := a.GetCategoriesAndProductsBySlugParentCategory(category.Slug) categoriesAndProduct, err := a.GetCategoriesAndProductsBySlugParentCategory(category.Slug)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if len(categoriesAndProduct.Categories) != 0 { if len(categoriesAndProduct.Categories) != 0 {
_categories = append(_categories, categoriesAndProduct.Categories...) categories = append(categories, categoriesAndProduct.Categories...)
} }
} }
return _categories, nil return categories, nil
} }
func (a *Api) GetParentCategories() ([]model.Category, error) { func (a *Api) GetParentCategories() ([]model.Category, error) {
if len(_parentCategories) > 0 { if len(parentCategories) > 0 {
return _parentCategories, nil return parentCategories, nil
} }
apiResponse, err := a.Client.HTTPClient.R().SetResult(&model.CategoryResponse{}).Get("client/catalog") apiResponse, err := a.Client.HTTPClient.R().SetResult(&model.CategoryResponse{}).Get("client/catalog")
@ -59,9 +56,9 @@ func (a *Api) GetParentCategories() ([]model.Category, error) {
return nil, errors.New("no categories found") return nil, errors.New("no categories found")
} }
_parentCategories = result parentCategories = result
return _parentCategories, nil return parentCategories, nil
} }
func (a *Api) GetCategoriesAndProductsBySlugParentCategory(slug string) (*model.CategoriesAndProductsBySlugParentCategoryResponse, error) { func (a *Api) GetCategoriesAndProductsBySlugParentCategory(slug string) (*model.CategoriesAndProductsBySlugParentCategoryResponse, error) {
@ -81,20 +78,34 @@ func (a *Api) GetCategoriesAndProductsBySlugParentCategory(slug string) (*model.
} }
func (a *Api) GetTreeCategories() ([]model.TreeCategories, error) { func (a *Api) GetTreeCategories() ([]model.TreeCategories, error) {
if len(_treeCategories) > 0 { if len(treeCategories) > 0 {
return _treeCategories, nil return treeCategories, nil
} }
tree := map[string]interface{}{} tree := map[string]interface{}{}
categories, err := a.GetCategories() parentCategories, err := a.GetParentCategories()
if err != nil { if err != nil {
return nil, err return nil, err
} }
utils.ConvertListToNestedDict(categories, tree) for _, parent := range parentCategories {
tree[parent.Slug] = map[string]interface{}{
"name": parent.Name,
"slug": parent.Slug,
"url": parent.Url,
"children": map[string]interface{}{},
}
_treeCategories = utils.ConvertToNestedList(tree) categoriesAndProduct, err := a.GetCategoriesAndProductsBySlugParentCategory(parent.Slug)
if err != nil {
return nil, err
}
return _treeCategories, nil utils.ConvertListToNestedDict(categoriesAndProduct.Categories, tree)
}
treeCategories = utils.ConvertToNestedList(tree)
return treeCategories, nil
} }

View File

@ -49,12 +49,7 @@ func (a *Api) GetProductByArticle(article string) (model.Product, error) {
"error getting product by article: " + article) "error getting product by article: " + article)
} }
product, ok := apiResponse.Result().(*model.Product) return apiResponse.Result().(model.Product), nil
if !ok {
return model.Product{}, errors.New("failed to parse product from response")
}
return *product, nil
} }
func (a *Api) GetRemainsAndPlanresidues() ([]model.ShortProduct, error) { func (a *Api) GetRemainsAndPlanresidues() ([]model.ShortProduct, error) {
@ -82,7 +77,7 @@ func (a *Api) GetRemainsAndPlanresidues() ([]model.ShortProduct, error) {
return nil, errors.New("file remains and planresidues not found") return nil, errors.New("file remains and planresidues not found")
} }
result := apiResponse.Result().(*model.RemainsAndPlanresiduesResponse) result := apiResponse.Result().(model.RemainsAndPlanresiduesResponse)
if len(result.Products) != 0 { if len(result.Products) != 0 {
remainsAndPlanresidues = append(remainsAndPlanresidues, result.Products...) remainsAndPlanresidues = append(remainsAndPlanresidues, result.Products...)

View File

@ -1,12 +1,15 @@
package client package client
import ( import "github.com/go-resty/resty/v2"
"github.com/go-resty/resty/v2"
) // import (
// "net/http"
// "net/url"
// )
const ( const (
AuthApiUrl = "https://bp.iek.ru/oauth/login" AUTH_API_URL = "https://bp.iek.ru/oauth/login"
BaseApiUrl = "https://bp.iek.ru/api/catalog/v1/" BASE_API_URL = "https://bp.iek.ru/api/catalog/v1/"
) )
type ( type (
@ -24,18 +27,18 @@ type (
} }
) )
func NewClient(username string, password string) *Client { func NewClient(credentials Credentials) *Client {
authSuccess := &AuthSuccess{} authSuccess := &AuthSuccess{}
client := resty.New() client := resty.New()
client.SetBaseURL(BaseApiUrl) client.SetBaseURL(BASE_API_URL)
response, err := client.R(). response, err := client.R().
SetFormData(map[string]string{ SetFormData(map[string]string{
"username": username, "username": credentials.GetUsername(),
"password": password, "password": credentials.GetPassword(),
}). }).
SetResult(&authSuccess). SetResult(&authSuccess).
Post(AuthApiUrl) Post(AUTH_API_URL)
if err != nil { if err != nil {
panic(err) panic(err)
@ -46,7 +49,7 @@ func NewClient(username string, password string) *Client {
} }
client.SetHeader("Content-Type", "application/json") client.SetHeader("Content-Type", "application/json")
client.SetHeader("Authorization", authSuccess.TokenType+" "+authSuccess.AccessToken) client.SetHeader("Authorization", "Bearer "+authSuccess.AccessToken)
return &Client{ return &Client{
HTTPClient: client, HTTPClient: client,

17
client/credential.go Normal file
View File

@ -0,0 +1,17 @@
package client
type (
// Credentials provides constant credential values.
Credentials struct {
Username string `json:"username"`
Password string `json:"password"`
}
)
func (c *Credentials) GetUsername() string {
return c.Username
}
func (c *Credentials) GetPassword() string {
return c.Password
}

View File

@ -1,15 +1,15 @@
package model package model
type Category struct { type Category struct {
Slug string `json:"slug"` // Слаг категории Slug string `json:"slug"`
Name string `json:"name"` // Название категории Name string `json:"name"`
Url string `json:"url"` // Ссылка на скачивание файла с содержимым категории Url string `json:"url"`
ApiUrl string `json:"apiUrl"` // Относительный адрес категории ApiUrl string `json:"apiUrl"`
} }
type TreeCategories struct { type TreeCategories struct {
Slug string `json:"slug"` // Слаг категории Slug string `json:"slug"`
Name string `json:"name"` // Название категории Name string `json:"name"`
Url string `json:"url"` // Относительный адрес категории Url string `json:"url"`
Children []TreeCategories `json:"children"` // Children nested categories in TreeCategories Children []TreeCategories `json:"children"`
} }

View File

@ -2,168 +2,150 @@ package model
type ( type (
ImageVariant struct { ImageVariant struct {
Url string `json:"url"` // Ссылка Url string `json:"url"`
Ext string `json:"ext"` // Расширение Ext string `json:"ext"`
Width int `json:"width"` // Ширина Width int `json:"width"`
} }
Complects struct { Complects struct {
Article string `json:"article"` // Артикул Article string `json:"article"`
Name string `json:"name"` // Наименование Name string `json:"name"`
Quantity int `json:"quantity"` // Количество Quantity int `json:"quantity"`
} }
LeftPeriod struct { LeftPeriod struct {
Name string `json:"name"` // Название характеристики Name string `json:"name"`
Value string `json:"value"` // Значение характеристики Value string `json:"value"`
} }
LeftPeriodRaw struct { LeftPeriodRaw struct {
Lifespan struct { Lifespan interface{} `json:"lifespan"`
Limit string `json:"limit"` // Предельное значение Warranty interface{} `json:"warranty"`
Value string `json:"value"` // Значение
Units string `json:"units"` // Единицы измерения
} `json:"lifespan"` // Срок службы
Warranty struct {
Value string `json:"value"` // Значение
Units string `json:"units"` // Единицы измерения
} `json:"warranty"` // Гарантийный срок
} }
DesignFeatures struct { DesignFeatures struct {
ImageUrl string `json:"imageUrl"` // Ссылка на изображение ImageUrl string `json:"imageUrl"`
Description string `json:"description"` // Описание Description string `json:"description"`
} }
Video struct { Video struct {
Name string `json:"name"` // Наименование Name string `json:"name"`
Description string `json:"description"` // Описание Description string `json:"description"`
Url string `json:"url"` // Ссылка Url string `json:"url"`
Type string `json:"type"` // Тип (ссылка на видео-хостинг или прямая ссылка на скачивание); Enum: "url" "file" Type string `json:"type"`
} }
Software struct { Software struct {
Name string `json:"name"` // Наименование Name string `json:"name"`
Description string `json:"description"` // Описание Description string `json:"description"`
Url string `json:"url"` // Ссылка Url string `json:"url"`
Size int `json:"size"` // Размер Size int `json:"size"`
} }
Analog struct { Analog struct {
Article string `json:"article"` // Артикул товара Article string `json:"article"`
Name string `json:"name"` // Полное название товара Name string `json:"name"`
ShortName string `json:"shortName"` // Краткое название ShortName string `json:"shortName"`
Description string `json:"description"` // Описание Description string `json:"description"`
ImageUrl string `json:"imageUrl"` // Фото товара (основное) ImageUrl string `json:"imageUrl"`
ImageUrls []string `json:"imageUrls"` // Все фото товара ImageUrls []string `json:"imageUrls"`
ImageVariants []ImageVariant `json:"imageVariants"` // Вариации изображений ImageVariants []ImageVariant `json:"imageVariants"`
IsArchived bool `json:"isArchived"` // Архивный или нет IsArchived bool `json:"isArchived"`
Tm string `json:"tm"` // Торговая марка Tm string `json:"tm"`
} }
WarehouseData struct { WarehouseData struct {
WarehouseId string `json:"warehouseId"` // Идентификатор склада WarehouseId string `json:"warehouseId"`
WarehouseName string `json:"warehouseName"` // Наименование склада WarehouseName string `json:"warehouseName"`
AvailableAmount int `json:"availableAmount"` // Доступное количество AvailableAmount int `json:"availableAmount"`
Incoming []struct { Incoming []struct {
DateBegan string `json:"dateBegan"` // Дата начала периода поступления на склад DateBegan string `json:"dateBegan"`
DateEnd string `json:"dateEnd"` // Дата окончания периода поступления на склад DateEnd string `json:"dateEnd"`
Amount int `json:"amount"` // Ожидаемое количество Amount int `json:"amount"`
Type string `json:"type"` // Тип поступления, production - поступление после производства, shipping - доставка на склад Type string `json:"type"`
} // Ближайшие поступления }
} }
Etim struct { Etim struct {
Features []struct { Features []struct {
Id string `json:"id"` // Id string `json:"id"`
Name string `json:"name"` // Название свойства Name string `json:"name"`
Sort int `json:"sort"` // Порядок сортировки по умолчанию Sort int `json:"sort"`
Unit string `json:"unit"` // Единицы измерения Unit string `json:"unit"`
Value string `json:"value"` // Значение свойства Value string `json:"value"`
ValueUnion string `json:"value_union"` // Код значения } `json:"features"`
} `json:"features"` // Features represents a list of product features with detailed information.
Class struct { Class struct {
Id string `json:"id"` // Id string `json:"id"`
Name string `json:"name"` // Название класса Name string `json:"name"`
} `json:"class"` // ETIM-класс товара } `json:"class"`
} }
LogisticParams struct { LogisticParams struct {
Name string `json:"name"` // Название параметра Name string `json:"name"`
NameOrig string `json:"nameOrig"` // Название характеристики (исходное) NameOrig string `json:"nameOrig"`
Value struct { Value struct {
Group string `json:"group"` // Значение для группового варианта Group string `json:"group"`
Individual string `json:"individual"` // Значение для индивидуального варианта Individual string `json:"individual"`
Transport string `json:"transport"` // Значение для транспортного варианта Transport string `json:"transport"`
} `json:"value"` // Value represents group, individual, and transport logistics values in JSON format. } `json:"value"`
} }
LogisticParamsData struct { LogisticParamsData struct {
SinglePackage struct { SinglePackage struct {
Multiplicity int `json:"multiplicity"` // Кратность Multiplicity int `json:"multiplicity"`
Unit string `json:"unit"` // Единицы измерения Unit string `json:"unit"`
} `json:"singlePackage"` // Для индивидуальной упаковки } `json:"singlePackage"`
} }
ShortProduct struct { ShortProduct struct {
Article string `json:"article"` // Артикул товара Article string `json:"article"`
Name string `json:"name"` // Полное наименование товара Name string `json:"name"`
Multiplicity int `json:"multiplicity"` // Кратность продажи Multiplicity int `json:"multiplicity"`
PriceBase float64 `json:"priceBase"` // Базовая цена с НДС PriceBase int `json:"priceBase"`
PriceRrc float64 `json:"priceRrc"` // Рекомендованная розничная цена (РРЦ) с НДС PriceRrc int `json:"priceRrc"`
Available float64 `json:"available"` // Значение остатка Available int `json:"available"`
Units string `json:"units"` // Единицы измерения Units string `json:"units"`
WarehouseData []WarehouseData `json:"warehouseData"` // Информация по складам WarehouseData []WarehouseData `json:"warehouseData"`
} }
Product struct { Product struct {
Article string `json:"article"` // Артикул товара ShortName string `json:"shortName"`
Name string `json:"name"` // Полное наименование товара Description string `json:"description"`
ShortName string `json:"shortName"` // Краткое название CategoryName string `json:"categoryName"`
Description string `json:"description"` // Описание Category string `json:"category"`
CategoryName string `json:"categoryName"` // Название категории Slug string `json:"slug"`
Category string `json:"category"` // Относительный путь до категории в каталоге Tm string `json:"tm"`
Slug string `json:"slug"` // Слаг товара Url string `json:"url"`
Tm string `json:"tm"` // Торговая марка IsArchived bool `json:"isArchived"`
Url string `json:"url"` // Ссылка на товар ImageUrl string `json:"imageUrl"`
IsArchived bool `json:"isArchived"` // Архивный или нет ImageUrls []string `json:"imageUrls"`
ImageUrl string `json:"imageUrl"` // Фото товара (основное) ImageVariants []ImageVariant `json:"imageVariants"`
ImageUrls []string `json:"imageUrls"` // Все фото товара Advantages string `json:"advantages"`
ImageVariants []ImageVariant `json:"imageVariants"` // Вариации изображений Etim Etim `json:"etim"`
ImageUrlsVariants []interface{} `json:"imageUrlsVariants"` // Все вариации изображений Complects []Complects `json:"complects"`
Advantages string `json:"advantages"` // Преимущества Complectations string `json:"complectations"`
Etim Etim `json:"etim"` // ETIM характеристики товара Files []interface{} `json:"files"`
Complects []Complects `json:"complects"` // Комплектация и сопутствующие товары LeftPeriod []LeftPeriod `json:"leftPeriod"`
Complectations string `json:"complectations"` // Комплектация LeftPeriodRaw LeftPeriodRaw `json:"leftPeriodRaw"`
Files []interface{} `json:"files"` // Список файлов, относящихся к товару (ГЧ, КД, CAD-модели и т.д.) LogisticParams []LogisticParams `json:"logisticParams"`
LeftPeriod []LeftPeriod `json:"leftPeriod"` // Характеристики срока службы LogisticParamsData LogisticParamsData `json:"logisticParamsData"`
LeftPeriodRaw LeftPeriodRaw `json:"leftPeriodRaw"` // Гарантийные показатели Novelty bool `json:"novelty"`
LogisticParams []LogisticParams `json:"logisticParams"` // Логистические характеристики DesignFeatures []DesignFeatures `json:"designFeatures"`
LogisticParamsData LogisticParamsData `json:"logisticParamsData"` // Подробные логистические характеристики Videos []Video `json:"videos"`
Novelty bool `json:"novelty"` // Новинка или нет Software []Software `json:"software"`
DesignFeatures []DesignFeatures `json:"designFeatures"` // Отличительные особенности Banner string `json:"banner"`
Videos []Video `json:"videos"` // Видео по товару LastModified string `json:"lastModified"`
Software []Software `json:"software"` // ПО по товару CountryOfProduction string `json:"countryOfProduction"`
Banner string `json:"banner"` // Текст баннера FirstSaleDate string `json:"firstSaleDate"`
LastModified string `json:"lastModified"` // Дата последнего изменения Feacn string `json:"feacn"`
CountryOfProduction string `json:"countryOfProduction"` // Страна производства Family string `json:"family"`
FirstSaleDate string `json:"firstSaleDate"` // Дата начала продаж Series string `json:"series"`
Feacn string `json:"feacn"` // Код ТН ВЭД IndPacking []string `json:"indPacking"`
Multiplicity int `json:"multiplicity"` // Кратность продажи Analogs []Analog `json:"analogs"`
PriceBase float64 `json:"priceBase"` // Базовая цена с НДС Related []Analog `json:"related"`
PriceRrc float64 `json:"priceRrc"` // Персональная цена с НДС QrCode string `json:"qrCode"`
PricePersonal float64 `json:"pricePersonal"` // Рекомендованная розничная цена (РРЦ) с НДС IsOutOfAssortment bool `json:"isOutOfAssortment"`
Available int `json:"available"` // Значение остатка IsOutOfProduction bool `json:"isOutOfProduction"`
Units string `json:"units"` // Единицы измерения
Family string `json:"family"` // Family specifies the family category of the product.
Series string `json:"series"` // Series is the series of the product.
IndPacking []string `json:"indPacking"` // Ссылки на фото упаковки
Analogs []Analog `json:"analogs"` // Аналоги
Related []Analog `json:"related"` // Совместно применяемые изделия
QrCode string `json:"qrCode"` // QR код со ссылкой на товар в Бизнес платформе
IsOutOfAssortment bool `json:"isOutOfAssortment"` // Выведенный из ассортимента
IsOutOfProduction bool `json:"isOutOfProduction"` // Выводимый из ассортимента
WarehouseData []WarehouseData `json:"warehouseData"` // Информация по складам
} }
) )

View File

@ -1,32 +1,32 @@
package model package model
type CategoryResponse struct { type CategoryResponse struct {
Categories []Category `json:"categories"` // Массив категорий 1-го уровня Categories []Category `json:"categories"`
} }
type CategoriesAndProductsBySlugParentCategoryResponse struct { type CategoriesAndProductsBySlugParentCategoryResponse struct {
Date string `json:"date"` // Дата формирования файла Date string `json:"date"`
Slug string `json:"slug"` // Слаг категории 1-го уровня Slug string `json:"slug"`
Name string `json:"name"` // Название категории 1-го уровня Name string `json:"name"`
Url string `json:"url"` // Относительный адрес категории 1-го уровня Url string `json:"url"`
Categories []Category `json:"categories"` // Массив всех входящих категорий Categories []Category `json:"categories"`
Products []Product `json:"products"` // Массив всех входящих товаров Products []Product `json:"products"`
} }
type NewProductsResponse struct { type NewProductsResponse struct {
Data struct { Data struct {
Products []Product `json:"products"` // Список новинок Products []Product `json:"products"`
} `json:"data"` // Список новинок } `json:"data"`
Meta struct { Meta struct {
Page int `json:"page"` // Текущая страница Page int `json:"page"`
TotalPages int `json:"totalPages"` // Всего страниц TotalPages int `json:"totalPages"`
TotalCount int `json:"totalCount"` // Всего элементов TotalCount int `json:"totalCount"`
PageSize int `json:"pageSize"` // Размер страницы PageSize int `json:"pageSize"`
} `json:"_meta"` // Параметры пагинации } `json:"_meta"`
} }
type RemainsAndPlanresiduesResponse struct { type RemainsAndPlanresiduesResponse struct {
Date string `json:"date"` // Дата создания файла Date string `json:"date"`
Products []ShortProduct `json:"products"` // Массив остатков по товарам Products []ShortProduct `json:"products"`
} }