user list listing
This commit is contained in:
@@ -13,15 +13,14 @@ func (p *PixelAPI) GetFile(id string) (io.ReadCloser, error) {
|
||||
|
||||
// FileInfo File information object from the pixeldrain API
|
||||
type FileInfo struct {
|
||||
Success bool `json:"success"`
|
||||
ID string `json:"id"`
|
||||
FileName string `json:"file_name"`
|
||||
DateUpload time.Time `json:"date_upload"`
|
||||
DateLastview time.Time `json:"date_last_view"`
|
||||
DaysValid uint16 `json:"days_valid"`
|
||||
FileSize uint64 `json:"file_size"`
|
||||
Views uint `json:"views"`
|
||||
MimeType string `json:"mime_type"`
|
||||
Description string `json:"description"`
|
||||
MimeImage string `json:"mime_image"`
|
||||
ThumbnailHREF string `json:"thumbnail_href"`
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package pixelapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
@@ -40,7 +41,7 @@ type UserInfo struct {
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
// UserInfo returns information about the logged in user. Required an API key
|
||||
// UserInfo returns information about the logged in user. Requires an API key
|
||||
func (p *PixelAPI) UserInfo() (resp *UserInfo, err *Error) {
|
||||
resp = &UserInfo{}
|
||||
err = p.jsonRequest("GET", p.apiEndpoint+"/user", resp)
|
||||
@@ -60,3 +61,21 @@ func (p *PixelAPI) UserSessionDestroy(key string) (resp *SuccessResponse, err *E
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
type UserFiles struct {
|
||||
Success bool `json:"success"`
|
||||
Files []FileInfo `json:"files"`
|
||||
}
|
||||
|
||||
func (p *PixelAPI) UserFiles(page, limit int) (resp *UserFiles, err *Error) {
|
||||
resp = &UserFiles{Files: make([]FileInfo, 0)}
|
||||
err = p.jsonRequest(
|
||||
"GET",
|
||||
fmt.Sprintf("%s/user/files?page=%d&limit=%d", p.apiEndpoint, page, limit),
|
||||
resp,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user