2024-05-07 22:03:15 +00:00
|
|
|
package main
|
|
|
|
|
2024-05-10 20:01:05 +00:00
|
|
|
import (
|
2024-05-15 23:37:42 +00:00
|
|
|
"federated.computer/wp-sync-slowtwitch/services/wordpress"
|
2024-05-10 20:01:05 +00:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2024-05-15 23:37:42 +00:00
|
|
|
const baseUrl = "https://go-api-playground.local/wp-json/"
|
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
|
|
|
|
2024-05-14 21:59:04 +00:00
|
|
|
const slowtwitchAdminUser = "admin"
|
|
|
|
const slowtwitchAdminPass = "yxnh93Ybbz2Nm8#mp28zCVv"
|
|
|
|
const slowtwitchDbName = "slowtwitch"
|
2024-05-15 23:37:42 +00:00
|
|
|
const migrationDbName = "slowtwitch_transfer"
|
|
|
|
const federatedDbUrl = "slowtwitch.northend.network"
|
|
|
|
const federatedDbPort = "3306"
|
2024-05-14 21:59:04 +00:00
|
|
|
|
2024-05-07 22:03:15 +00:00
|
|
|
var appCache AppCache
|
|
|
|
|
|
|
|
func main() {
|
2024-05-15 23:37:42 +00:00
|
|
|
// TODO Category migration
|
|
|
|
// TODO User migration
|
|
|
|
// TODO Article migration
|
|
|
|
//slowtwitchDB, err := migration.Connect(slowtwitchAdminUser, slowtwitchAdminPass, federatedDbUrl, federatedDbPort, slowtwitchDbName)
|
|
|
|
|
|
|
|
createRedirect := wordpress.CreateRedirect{
|
|
|
|
Url: "/gotest",
|
|
|
|
Title: "Test From Go",
|
|
|
|
MatchType: "page",
|
|
|
|
ActionType: "url",
|
|
|
|
ActionCode: 301,
|
|
|
|
GroupId: 1,
|
|
|
|
ActionData: wordpress.ActionData{
|
|
|
|
Url: "/GoTestResult",
|
|
|
|
},
|
2024-05-10 20:01:05 +00:00
|
|
|
}
|
|
|
|
|
2024-05-15 23:37:42 +00:00
|
|
|
result, err := createRedirect.Execute(baseUrl, wordpressKey, wordpressSecret)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
2024-05-14 21:59:04 +00:00
|
|
|
}
|
2024-05-15 23:37:42 +00:00
|
|
|
fmt.Println(result)
|
2024-05-10 20:01:05 +00:00
|
|
|
}
|