|
|
|
@ -93,66 +93,3 @@ func (c *Client) GetBoardsPublic(ctx context.Context, options *GetBoardsPublicOp |
|
|
|
|
return &res, nil |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type GetBoardsGlobalmanageOptions struct { |
|
|
|
|
Search string `json:"search"` |
|
|
|
|
Sort string `json:"sort"` |
|
|
|
|
SortDirection string `json:"direction"` |
|
|
|
|
Page int `json:"page"` |
|
|
|
|
FilterUnlisted bool `json:"filter_unlisted"` |
|
|
|
|
FilterSfw bool `json:"filter_sfw"` |
|
|
|
|
FilterAbandoned bool `json:"filter_abandoned"` |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (c *Client) GetBoardsGlobalmanage(ctx context.Context, options *GetBoardsGlobalmanageOptions) (*GetBoardsResponse, error) { |
|
|
|
|
|
|
|
|
|
page := 1 |
|
|
|
|
search := "" |
|
|
|
|
sort := "popularity" |
|
|
|
|
direction := "desc" |
|
|
|
|
filter_unlisted := false |
|
|
|
|
filter_sfw := false |
|
|
|
|
filter_abandoned := false |
|
|
|
|
if options != nil { |
|
|
|
|
search = options.Search |
|
|
|
|
sort = options.Sort |
|
|
|
|
direction = options.SortDirection |
|
|
|
|
filter_unlisted = options.FilterUnlisted |
|
|
|
|
filter_sfw = options.FilterSfw |
|
|
|
|
filter_abandoned = options.FilterAbandoned |
|
|
|
|
page = options.Page |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
query := url.Values{} |
|
|
|
|
query.Set("search", search) |
|
|
|
|
query.Set("page", fmt.Sprintf("%d", page)) |
|
|
|
|
query.Set("sort", sort) |
|
|
|
|
query.Set("direction", direction) |
|
|
|
|
if filter_unlisted { |
|
|
|
|
query.Set("filter_unlisted", "true") |
|
|
|
|
} |
|
|
|
|
if filter_sfw { |
|
|
|
|
query.Set("filter_sfw", "true") |
|
|
|
|
} |
|
|
|
|
if filter_abandoned { |
|
|
|
|
query.Set("filter_abandoned", "true") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
url := fmt.Sprintf("%s/boards.json?%s", c.BaseURL, query.Encode()) |
|
|
|
|
|
|
|
|
|
req, err := http.NewRequest(http.MethodGet, url, nil) |
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
req = req.WithContext(ctx) |
|
|
|
|
|
|
|
|
|
res := GetBoardsResponse{} |
|
|
|
|
if err := c.sendRequest(req, &res, nil); err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return &res, nil |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|