Add client, integration tests for top DMs

Этот коммит содержится в:
Shivashis Padhi
2022-06-28 17:05:52 +05:30
родитель c7dc0eee22
Коммит 0936c891ff
2 изменённых файлов: 99 добавлений и 0 удалений

Просмотреть файл

@@ -6657,6 +6657,21 @@ func (c *Client4) GetTopReactionsForUserSince(teamId string, timeRange string, p
return topReactions, BuildResponse(r), nil
}
func (c *Client4) GetTopDMsForUserSince(timeRange string, page int, perPage int) (*TopDMList, *Response, error) {
query := fmt.Sprintf("?time_range=%v&page=%v&per_page=%v", timeRange, page, perPage)
r, err := c.DoAPIGet(c.usersRoute()+"/me/top/dms"+query, "")
if err != nil {
return nil, BuildResponse(r), err
}
defer closeBody(r)
var topDMs *TopDMList
if jsonErr := json.NewDecoder(r.Body).Decode(&topDMs); jsonErr != nil {
return nil, nil, NewAppError("GetTopReactionsForUserSince", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
}
return topDMs, BuildResponse(r), nil
}
// Timezone Section
// GetSupportedTimezone returns a page of supported timezones on the system.