Merge pull request #405 from greysonp/add-group-refresh

Add the ability to refresh a group.
This commit is contained in:
Bernhard B
2023-09-19 22:42:15 +02:00
committed by GitHub
4 changed files with 52 additions and 0 deletions

View File

@@ -1241,6 +1241,38 @@ func (a *Api) QuitGroup(c *gin.Context) {
c.Status(http.StatusNoContent)
}
// @Summary Update the state of a Signal Group.
// @Tags Groups
// @Description Update the state of a Signal Group.
// @Accept json
// @Produce json
// @Success 204 {string} OK
// @Failure 400 {object} Error
// @Param number path string true "Registered Phone Number"
// @Param groupid path string true "Group ID"
// @Router /v1/groups/{number}/{groupid} [put]
func (a *Api) UpdateGroup(c *gin.Context) {
number := c.Param("number")
if number == "" {
c.JSON(400, Error{Msg: "Couldn't process request - number missing"})
return
}
groupId := c.Param("groupid")
internalGroupId, err := client.ConvertGroupIdToInternalGroupId(groupId)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})
return
}
err = a.signalClient.UpdateGroup(number, internalGroupId)
if err != nil {
c.JSON(400, Error{Msg: err.Error()})
return
}
c.Status(http.StatusNoContent)
}
// @Summary Send a reaction.
// @Tags Reactions
// @Description React to a message