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.
|
// UpdateUserCustomStatus sets a user's custom status based on the provided user id string.
|
||||||
func (c *Client4) UpdateUserCustomStatus(userId string, userCustomStatus *CustomStatus) (*CustomStatus, *Response) {
|
func (c *Client4) UpdateUserCustomStatus(userId string, userCustomStatus *CustomStatus) (*CustomStatus, *Response, error) {
|
||||||
r, err := c.DoApiPut(c.GetUserStatusRoute(userId)+"/custom", userCustomStatus.ToJson())
|
buf, err := json.Marshal(userCustomStatus)
|
||||||
if err != nil {
|
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)
|
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.
|
// RemoveUserCustomStatus remove a user's custom status based on the provided user id string.
|
||||||
func (c *Client4) RemoveUserCustomStatus(userId string) (bool, *Response) {
|
func (c *Client4) RemoveUserCustomStatus(userId string) (*Response, error) {
|
||||||
r, err := c.DoApiDelete(c.GetUserStatusRoute(userId) + "/custom")
|
r, err := c.DoAPIDelete(c.userStatusRoute(userId) + "/custom")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, BuildErrorResponse(r, err)
|
return BuildResponse(r), err
|
||||||
}
|
}
|
||||||
defer closeBody(r)
|
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.
|
// RemoveRecentUserCustomStatus remove a recent user's custom status based on the provided user id string.
|
||||||
func (c *Client4) RemoveRecentUserCustomStatus(userId string) (bool, *Response) {
|
func (c *Client4) RemoveRecentUserCustomStatus(userId string) (*Response, error) {
|
||||||
r, err := c.DoApiDelete(c.GetUserStatusRoute(userId) + "/custom/recent")
|
r, err := c.DoAPIDelete(c.userStatusRoute(userId) + "/custom/recent")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, BuildErrorResponse(r, err)
|
return BuildResponse(r), err
|
||||||
}
|
}
|
||||||
defer closeBody(r)
|
defer closeBody(r)
|
||||||
return CheckStatusOK(r), BuildResponse(r)
|
return BuildResponse(r), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Emoji Section
|
// Emoji Section
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user