Post-Migrator/main.go

33 lines
813 B
Go
Raw Normal View History

2024-05-07 22:03:15 +00:00
package main
import (
"federated.computer/wp-sync-slowtwitch/services/wordpress"
"fmt"
)
const baseUrl = "https://go-api-playground.local/wp-json/wp/v2/"
2024-05-08 00:52:47 +00:00
const wordpressKey = "admin"
const wordpressSecret = "S34E keY1 A1uX 6ncs Rx4T f21W"
2024-05-07 22:03:15 +00:00
var appCache AppCache
func main() {
//Get category and cache
//Get single category from cache by name
//Get tag and cache
//Get single tag from cache by name
//Get photo and cache with URL
//Create Category (with parent) + add to cache
//Create Tag + add to cache
//Upload Photo + add to cache
//Use cached data to correctly build post form submissions
2024-05-08 01:23:21 +00:00
tag, ok := wordpress.GetTag("golang-tag", baseUrl, wordpressKey, wordpressSecret)
2024-05-08 00:52:47 +00:00
if ok {
2024-05-08 01:23:21 +00:00
appCache.SetTag(tag)
fmt.Println("Found tag:", tag.Name)
2024-05-08 00:52:47 +00:00
} else {
2024-05-08 01:23:21 +00:00
fmt.Println("Could not find tag.")
2024-05-07 22:03:15 +00:00
}
}