Files
fnx_web/pixelapi/list.go

38 lines
1.0 KiB
Go
Raw Normal View History

2017-12-12 23:33:41 +01:00
package pixelapi
2018-01-30 10:29:45 +01:00
// API error constants
const (
ListNotFoundError = "list_not_found"
2017-12-12 23:33:41 +01:00
)
// List information object from the pixeldrain API
type List struct {
2018-01-30 10:29:45 +01:00
Success bool `json:"success"`
2017-12-12 23:33:41 +01:00
ID string `json:"id"`
Title string `json:"title"`
DateCreated int64 `json:"date_created"`
Files []ListFile
}
// ListFile information object from the pixeldrain API
type ListFile struct {
ID string `json:"id"`
DetailHREF string `json:"detail_href"`
FileName string `json:"file_name"`
Description string `json:"description"`
DateCreated int64 `json:"date_created"`
DateLastView int64 `json:"date_last_view"`
ListDescription string `json:"list_description"`
}
2018-01-30 10:29:45 +01:00
// GetList get a List from the pixeldrain API. Errors will be available through
// List.Error. Standard error checks apply.
func (p *PixelAPI) GetList(id string) (resp *List, err *Error) {
resp = &List{}
err = getJSON(p.apiEndpoint+"/list/"+id, resp)
2017-12-12 23:33:41 +01:00
if err != nil {
return nil, err
2017-12-12 23:33:41 +01:00
}
return resp, nil
2017-12-12 23:33:41 +01:00
}