You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
954 B
Go
41 lines
954 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"git.cheetah.cat/chee-erp/go-flink-inator/api"
|
|
)
|
|
|
|
func main() {
|
|
apiClient := api.NewAPIClient()
|
|
|
|
magdeburgHub, err := apiClient.GetHub(52.1303067, 11.6097666)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println(magdeburgHub)
|
|
|
|
categories, err := apiClient.DiscoverCategories(*magdeburgHub.Slug)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
for _, cat := range categories.Categories.Categories {
|
|
fmt.Println(*cat.Id, *cat.Slug, cat.Name)
|
|
if cat.SubCategories != nil {
|
|
productCats, err := api.NewAPIClient().DiscoverCategoriesSpecific(*magdeburgHub.Slug, *cat.Slug)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
for _, subcat := range productCats.Categories {
|
|
fmt.Println("\t", *subcat.Id, *subcat.Slug, subcat.Name)
|
|
for _, product := range *subcat.Products.Products {
|
|
|
|
fmt.Println("\t\t", *product.Id, product.Name, product.Price, product.Quantity, product.BasePrice, product.SKU, product.Thumbnail)
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|