update client function to match the new format and fix bad merge (#18978)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bb5a74a42b
Коммит
19de373498
@@ -6155,33 +6155,41 @@ func (c *Client4) UpdateUserStatus(userId string, userStatus *Status) (*Status,
|
||||
}
|
||||
|
||||
// UpdateUserCustomStatus sets a user's custom status based on the provided user id string.
|
||||
func (c *Client4) UpdateUserCustomStatus(userId string, userCustomStatus *CustomStatus) (*CustomStatus, *Response) {
|
||||
r, err := c.DoApiPut(c.GetUserStatusRoute(userId)+"/custom", userCustomStatus.ToJson())
|
||||
func (c *Client4) UpdateUserCustomStatus(userId string, userCustomStatus *CustomStatus) (*CustomStatus, *Response, error) {
|
||||
buf, err := json.Marshal(userCustomStatus)
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
return nil, nil, NewAppError("UpdateUserCustomStatus", "api.marshal_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
r, err := c.DoAPIPutBytes(c.userStatusRoute(userId)+"/custom", buf)
|
||||
if err != nil {
|
||||
return nil, BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
return CustomStatusFromJson(r.Body), BuildResponse(r)
|
||||
var s CustomStatus
|
||||
if jsonErr := json.NewDecoder(r.Body).Decode(&s); jsonErr != nil {
|
||||
return nil, nil, NewAppError("UpdateUserCustomStatus", "api.unmarshal_error", nil, jsonErr.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
return &s, BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// RemoveUserCustomStatus remove a user's custom status based on the provided user id string.
|
||||
func (c *Client4) RemoveUserCustomStatus(userId string) (bool, *Response) {
|
||||
r, err := c.DoApiDelete(c.GetUserStatusRoute(userId) + "/custom")
|
||||
func (c *Client4) RemoveUserCustomStatus(userId string) (*Response, error) {
|
||||
r, err := c.DoAPIDelete(c.userStatusRoute(userId) + "/custom")
|
||||
if err != nil {
|
||||
return false, BuildErrorResponse(r, err)
|
||||
return BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
return CheckStatusOK(r), BuildResponse(r)
|
||||
return BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// RemoveRecentUserCustomStatus remove a recent user's custom status based on the provided user id string.
|
||||
func (c *Client4) RemoveRecentUserCustomStatus(userId string) (bool, *Response) {
|
||||
r, err := c.DoApiDelete(c.GetUserStatusRoute(userId) + "/custom/recent")
|
||||
func (c *Client4) RemoveRecentUserCustomStatus(userId string) (*Response, error) {
|
||||
r, err := c.DoAPIDelete(c.userStatusRoute(userId) + "/custom/recent")
|
||||
if err != nil {
|
||||
return false, BuildErrorResponse(r, err)
|
||||
return BuildResponse(r), err
|
||||
}
|
||||
defer closeBody(r)
|
||||
return CheckStatusOK(r), BuildResponse(r)
|
||||
return BuildResponse(r), nil
|
||||
}
|
||||
|
||||
// Emoji Section
|
||||
|
||||
Ссылка в новой задаче
Block a user