Browse Source

Removing soapbox follow exporter as this feature is built into soapbox now

master
grumbulon 7 months ago
parent
commit
a82e4e0579
  1. 3
      go.mod
  2. 83
      soapboxFollowExporter/main.go

3
go.mod

@ -1,3 +0,0 @@
module git.freecumextremist.com/grumbulon/pleroma-tools
go 1.17

83
soapboxFollowExporter/main.go

@ -1,83 +0,0 @@
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
)
type accountsAPI []struct {
Fqn string `json:"fqn"`
ID string `json:"id"`
}
func main() {
instanceName := flag.String("i", "", "The instance the account is on")
accountName := flag.String("n", "", "The name of the account on the instance")
flag.Parse()
if len(*instanceName) != 0 && len(*accountName) != 0 {
getID(instanceName, accountName)
}
}
func getID(instanceName *string, accountName *string) {
client := &http.Client{}
urlBuilder := fmt.Sprintf("https://%v/api/v1/accounts/%v", *instanceName, *accountName)
req, err := http.NewRequest("GET", urlBuilder, nil)
if err != nil {
log.Fatalln(err)
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatalln(err)
}
defer resp.Body.Close()
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
var responseObject accountsAPI
json.Unmarshal(bodyBytes, &responseObject)
fmt.Println(responseObject)
}
func callAPI(instanceName *string, accountName *string) {
fmt.Println("Querying API...")
client := &http.Client{}
urlBuilder := fmt.Sprintf("https://%p/api/v1/account/%p", instanceName, accountName)
fmt.Println(urlBuilder)
req, err := http.NewRequest("GET", urlBuilder, nil)
if err != nil {
log.Fatalln(err)
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
log.Fatalln(err)
}
defer resp.Body.Close()
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
log.Fatalln(err)
}
var responseObject accountsAPI
json.Unmarshal(bodyBytes, &responseObject)
fmt.Println(responseObject)
}
Loading…
Cancel
Save