Farhan Khan
a50916eb36
some web work lost track of what's going on and I'm not accountable to anyone...so screw it
93 lines
2.0 KiB
Go
93 lines
2.0 KiB
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
const (
|
|
NEW_INSTANCE = 0
|
|
RUNNING = 200
|
|
UNAUTHORIZED = 401
|
|
FORBIDDEN = 403
|
|
NOT_FOUND = 404
|
|
UNPROCESSABLE_ENTITY = 422
|
|
TOOMANYREQUESTS = 429
|
|
INTERNAL_ERROR = 500
|
|
CLIENT_ISSUE = 600
|
|
ONION_PROTOCOL = 601
|
|
BAD_RESPONSE = 602
|
|
BAD_NODEINFO = 604
|
|
UNSUPPORTED_INSTANCE = 605
|
|
STREAM_ENDED = 606
|
|
)
|
|
|
|
// Parsing Unmarshal JSON type
|
|
type ReportPost struct {
|
|
|
|
// Retrieved values
|
|
Id string `json:"id"`
|
|
Uri string `json:"uri"`
|
|
Account AccountType
|
|
Content string `json:"content"`
|
|
Created_at string `json:"created_at"`
|
|
|
|
// Derived values
|
|
normalized string
|
|
posthash []byte
|
|
}
|
|
|
|
type AccountType struct {
|
|
Acct string `json:"acct"`
|
|
Avatar string `json:"avatar"`
|
|
Bot bool `json:"bot"`
|
|
Created_at string `json:"created_at"`
|
|
Display_name string `json:"display_name"`
|
|
Url string `json:"url"`
|
|
}
|
|
|
|
// Instance's new min_id value
|
|
type RunningInstance struct {
|
|
Software string `json:"software"`
|
|
Status int `json:"status"`
|
|
LastRun string `json:"lastrun"`
|
|
CaptureType string `json:"capturetype"`
|
|
client *http.Client
|
|
}
|
|
|
|
type NodeInfoSoftware struct {
|
|
Name string `json:"name"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
type NodeInfo struct {
|
|
Software NodeInfoSoftware `json:"software"`
|
|
}
|
|
|
|
type CommandMap struct {
|
|
Type string `json:"Type"`
|
|
Endpoint string `json:"Endpoint"`
|
|
}
|
|
|
|
type ResponseBack struct {
|
|
Type string `json:"Type"`
|
|
Message string `json:"Message"`
|
|
RunningInstances map[string]RunningInstance `json:"RunningInstances"`
|
|
}
|
|
|
|
type Userinfo struct {
|
|
Id string `"json:id"`
|
|
Type string `"json:type"`
|
|
Following string `"json:following"`
|
|
Followers string `"json:followers"`
|
|
Inbox string `"json:inbox"`
|
|
Outbox string `"json:outbox"`
|
|
Featured string `"json:featured"`
|
|
PreferredUsername string `"json:preferredUsername"`
|
|
Name string `"json:name"`
|
|
Summary string `"json:summary"`
|
|
Url string `"json:Url"`
|
|
ManuallyApprovesFollowers string `"json:manuallyApprovesFollowers"`
|
|
Discoverable string `"json:discoverable"`
|
|
}
|
|
|