Client for the pixeldrain API. Used by pixeldrain itself for tranferring data between the web UI and API server. And for rendering JSON responses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
798 B

package pixelapi
import (
"net/url"
"fornaxian.tech/pixeldrain_server/api/restapi/apitype"
)
// AdminGetGlobals returns the global API settings
func (p *PixelAPI) AdminGetGlobals() (resp []apitype.AdminGlobal, err error) {
return resp, p.jsonRequest("GET", "admin/globals", &resp)
}
// AdminSetGlobals sets a global API setting
func (p *PixelAPI) AdminSetGlobals(key, value string) (err error) {
return p.form("POST", "admin/globals", url.Values{"key": {key}, "value": {value}}, nil)
}
// AdminBlockFiles blocks files from being downloaded
func (p *PixelAPI) AdminBlockFiles(text, abuseType, reporter string) (bl apitype.AdminBlockFiles, err error) {
return bl, p.form(
"POST", "admin/block_files",
url.Values{"text": {text}, "type": {abuseType}, "reporter": {reporter}},
&bl,
)
}