|
|
|
@ -3,63 +3,22 @@ package jschan |
|
|
|
|
import ( |
|
|
|
|
"context" |
|
|
|
|
"fmt" |
|
|
|
|
// "jschan/app/models"
|
|
|
|
|
"jschan/app/models" |
|
|
|
|
"net/http" |
|
|
|
|
"time" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
type GetManageRecentOptions struct { |
|
|
|
|
Board string |
|
|
|
|
Global bool |
|
|
|
|
Board string |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type AutoGenerated struct { |
|
|
|
|
ID string `json:"_id"` |
|
|
|
|
Date time.Time `json:"date"` |
|
|
|
|
U int64 `json:"u"` |
|
|
|
|
Name string `json:"name"` |
|
|
|
|
Country interface{} `json:"country"` |
|
|
|
|
Board string `json:"board"` |
|
|
|
|
Tripcode interface{} `json:"tripcode"` |
|
|
|
|
Capcode interface{} `json:"capcode"` |
|
|
|
|
Subject string `json:"subject"` |
|
|
|
|
Message string `json:"message"` |
|
|
|
|
Messagehash string `json:"messagehash"` |
|
|
|
|
Nomarkup string `json:"nomarkup"` |
|
|
|
|
Thread int `json:"thread"` |
|
|
|
|
Email string `json:"email"` |
|
|
|
|
Spoiler bool `json:"spoiler"` |
|
|
|
|
Banmessage interface{} `json:"banmessage"` |
|
|
|
|
UserID string `json:"userId"` |
|
|
|
|
IP struct { |
|
|
|
|
Raw string `json:"raw"` |
|
|
|
|
Cloak string `json:"cloak"` |
|
|
|
|
Pruned bool `json:"pruned,omitempty"` |
|
|
|
|
} `json:"ip,omitempty"` |
|
|
|
|
Files []interface{} `json:"files"` |
|
|
|
|
Reports []interface{} `json:"reports"` |
|
|
|
|
Quotes []struct { |
|
|
|
|
ID string `json:"_id"` |
|
|
|
|
Thread int `json:"thread"` |
|
|
|
|
PostID int `json:"postId"` |
|
|
|
|
} `json:"quotes"` |
|
|
|
|
Crossquotes []interface{} `json:"crossquotes"` |
|
|
|
|
Backlinks []interface{} `json:"backlinks"` |
|
|
|
|
PostID int `json:"postId"` |
|
|
|
|
Bumped time.Time `json:"bumped,omitempty"` |
|
|
|
|
Replyfiles int `json:"replyfiles,omitempty"` |
|
|
|
|
Replyposts int `json:"replyposts,omitempty"` |
|
|
|
|
Sticky int `json:"sticky,omitempty"` |
|
|
|
|
Locked int `json:"locked,omitempty"` |
|
|
|
|
Bumplocked int `json:"bumplocked,omitempty"` |
|
|
|
|
Cyclic int `json:"cyclic,omitempty"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type GetManageRecentResponse []AutoGenerated |
|
|
|
|
type GetManageRecentResponse []models.Post |
|
|
|
|
|
|
|
|
|
func (c *Client) GetManageRecent(ctx context.Context, options *GetManageRecentOptions) (GetManageRecentResponse, error) { |
|
|
|
|
|
|
|
|
|
url := fmt.Sprintf("%s/%s/manage/recent.json", c.BaseURL, options.Board) |
|
|
|
|
url := "/globalmanage/recent.json" |
|
|
|
|
if options != nil && options.Board != "" { |
|
|
|
|
url = fmt.Sprintf("%s/%s/manage/recent.json", c.BaseURL, options.Board) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
req, err := http.NewRequest(http.MethodGet, url, nil) |
|
|
|
|
if err != nil { |
|
|
|
|