Add types
This commit is contained in:
@@ -2,12 +2,33 @@ package pixelapi
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
|
||||
"fornaxian.tech/pixeldrain_server/api/restapi/apitype"
|
||||
"time"
|
||||
)
|
||||
|
||||
// AdminGlobal is a global setting in pixeldrain's back-end
|
||||
type AdminGlobal struct {
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// AdminBlockFiles is an array of files which were blocked
|
||||
type AdminBlockFiles struct {
|
||||
FilesBlocked []string `json:"files_blocked"`
|
||||
}
|
||||
|
||||
// AdminAbuseReporter is an e-mail address which is allowed to send abuse
|
||||
// reports to abuse@pixeldrain.com
|
||||
type AdminAbuseReporter struct {
|
||||
Email string `json:"email"`
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Created time.Time `json:"created"`
|
||||
FilesBlocked int `json:"files_blocked"`
|
||||
LastUsed time.Time `json:"last_used"`
|
||||
}
|
||||
|
||||
// AdminGetGlobals returns the global API settings
|
||||
func (p *PixelAPI) AdminGetGlobals() (resp []apitype.AdminGlobal, err error) {
|
||||
func (p *PixelAPI) AdminGetGlobals() (resp []AdminGlobal, err error) {
|
||||
return resp, p.jsonRequest("GET", "admin/globals", &resp)
|
||||
}
|
||||
|
||||
@@ -17,7 +38,7 @@ func (p *PixelAPI) AdminSetGlobals(key, value string) (err error) {
|
||||
}
|
||||
|
||||
// AdminBlockFiles blocks files from being downloaded
|
||||
func (p *PixelAPI) AdminBlockFiles(text, abuseType, reporter string) (bl apitype.AdminBlockFiles, err error) {
|
||||
func (p *PixelAPI) AdminBlockFiles(text, abuseType, reporter string) (bl AdminBlockFiles, err error) {
|
||||
return bl, p.form(
|
||||
"POST", "admin/block_files",
|
||||
url.Values{"text": {text}, "type": {abuseType}, "reporter": {reporter}},
|
||||
|
||||
Reference in New Issue
Block a user