1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-01-08 15:06:08 +02:00

wip: golang client

This commit is contained in:
Paul Esch-Laurent 2022-12-05 17:03:19 -06:00
parent 79184eb9ba
commit 8bce6820c6

View File

@ -975,3 +975,54 @@ func (c *Client) GetStatistics() (*model.BoardsStatistics, *Response) {
return stats, BuildResponse(r)
}
func (c *Client) GetAllBoards(teamID string, page, perPage int) (*model.ComplianceResponse, *Response) {
query := fmt.Sprintf("?team_id=%s&page=%d&per_page=%d", teamID, page, perPage)
r, err := c.DoAPIGet("/admin/boards"+query, "")
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
var res *model.ComplianceResponse
err = json.NewDecoder(r.Body).Decode(&res)
if err != nil {
return nil, BuildErrorResponse(r, err)
}
return res, BuildResponse(r)
}
func (c *Client) GetBoardsHistory(modifiedSince int, includeDeleted bool, teamID string, page, perPage int) (*model.ComplianceResponse, *Response) {
query := fmt.Sprintf("?modified_since=%d&include_deleted=%t&team_id=%s&page=%d&per_page=%d", modifiedSince, includeDeleted, teamID, page, perPage)
r, err := c.DoAPIGet("/admin/boards_history"+query, "")
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
var res *model.ComplianceResponse
err = json.NewDecoder(r.Body).Decode(&res)
if err != nil {
return nil, BuildErrorResponse(r, err)
}
return res, BuildResponse(r)
}
func (c *Client) GetBlocksHistory(modifiedSince int, includeDeleted bool, teamID, boardID string, page, perPage int) (*model.ComplianceResponse, *Response) {
query := fmt.Sprintf("?modified_since=%d&include_deleted=%t&team_id=%s&board_id=%s&page=%d&per_page=%d", modifiedSince, includeDeleted, teamID, boardID, page, perPage)
r, err := c.DoAPIGet("/admin/blocks_history"+query, "")
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
var res *model.ComplianceResponse
err = json.NewDecoder(r.Body).Decode(&res)
if err != nil {
return nil, BuildErrorResponse(r, err)
}
return res, BuildResponse(r)
}