package main import ( "federated.computer/wp-sync-slowtwitch/services/wordpress" "fmt" ) const baseUrl = "https://go-api-playground.local/wp-json/wp/v2/" const wordpressKey = "admin" const wordpressSecret = "S34E keY1 A1uX 6ncs Rx4T f21W" var appCache AppCache func main() { // TODO Create Category with or without parent + add to cache // TODO Use cached data to correctly build post form submissions categoryNames := []string{"testcat", "testcat3", "you wont find me"} for _, categoryName := range categoryNames { categoryData, ok := wordpress.GetCategory(categoryName, baseUrl, wordpressKey, wordpressSecret) if ok { appCache.SetCategory(categoryData) fmt.Println(categoryData.Name, categoryData.Id, categoryData.ParentId) } else { fmt.Println("not found on website: ", categoryName) } } for _, categoryName := range categoryNames { category, ok := appCache.GetCategory(categoryName) if ok { fmt.Println("Found single in cache: ", category.Name) } else { fmt.Println("Not found in cache:", categoryName) } } for _, category := range appCache.CategoryCache { fmt.Println("From Cache: ", category.Name) } }