**WORK IN PROGRESS** golang API client for interacting with the jschan imageboard API.
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.
 
 

78 lines
2.2 KiB

package jschan
import (
"context"
"fmt"
// "jschan/app/models"
"net/http"
"time"
)
type GetManageRecentOptions struct {
Board string
Global bool
}
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
func (c *Client) GetManageRecent(ctx context.Context, options *GetManageRecentOptions) (GetManageRecentResponse, error) {
url := fmt.Sprintf("%s/%s/manage/recent.json", c.BaseURL, options.Board)
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
res := GetManageRecentResponse{}
if err := c.sendRequest(req, &res, nil); err != nil {
return nil, err
}
return res, nil
}