diff --git a/app/boardlist.go b/app/boardlist.go index d6e4b8a..273056e 100644 --- a/app/boardlist.go +++ b/app/boardlist.go @@ -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 - -} diff --git a/app/manage.go b/app/manage.go index 4c436d2..25bca1c 100644 --- a/app/manage.go +++ b/app/manage.go @@ -86,3 +86,66 @@ func (c *Client) GetManageReports(ctx context.Context, options *GetManageReports return &res, nil } + +type GetManageBoardsOptions 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) GetManageBoards(ctx context.Context, options *GetManageBoardsOptions) (*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 + +}