mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 23:54:22 +01:00
Merge pull request #432 from kxait/update_group_name
Allow updating group name
This commit is contained in:
@@ -50,7 +50,8 @@ type CreateGroupRequest struct {
|
|||||||
|
|
||||||
type UpdateGroupRequest struct {
|
type UpdateGroupRequest struct {
|
||||||
Base64Avatar *string `json:"base64_avatar"`
|
Base64Avatar *string `json:"base64_avatar"`
|
||||||
Description *string `json:"description"`
|
Description *string `json:"description"`
|
||||||
|
Name *string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChangeGroupMembersRequest struct {
|
type ChangeGroupMembersRequest struct {
|
||||||
@@ -1288,7 +1289,7 @@ func (a *Api) UpdateGroup(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = a.signalClient.UpdateGroup(number, internalGroupId, req.Base64Avatar, req.Description)
|
err = a.signalClient.UpdateGroup(number, internalGroupId, req.Base64Avatar, req.Description, req.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.JSON(400, Error{Msg: err.Error()})
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1299,7 +1299,7 @@ func (s *SignalClient) QuitGroup(number string, groupId string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string) error {
|
func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string, groupName *string) error {
|
||||||
var err error
|
var err error
|
||||||
var avatarTmpPath string = ""
|
var avatarTmpPath string = ""
|
||||||
if base64Avatar != nil {
|
if base64Avatar != nil {
|
||||||
@@ -1342,6 +1342,7 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
|
|||||||
GroupId string `json:"groupId"`
|
GroupId string `json:"groupId"`
|
||||||
Avatar string `json:"avatar,omitempty"`
|
Avatar string `json:"avatar,omitempty"`
|
||||||
Description *string `json:"description,omitempty"`
|
Description *string `json:"description,omitempty"`
|
||||||
|
Name *string `json:"name,omitempty"`
|
||||||
}
|
}
|
||||||
request := Request{GroupId: groupId}
|
request := Request{GroupId: groupId}
|
||||||
|
|
||||||
@@ -1350,6 +1351,7 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
|
|||||||
}
|
}
|
||||||
|
|
||||||
request.Description = groupDescription
|
request.Description = groupDescription
|
||||||
|
request.Name = groupName
|
||||||
|
|
||||||
|
|
||||||
jsonRpc2Client, err := s.getJsonRpc2Client(number)
|
jsonRpc2Client, err := s.getJsonRpc2Client(number)
|
||||||
@@ -1366,6 +1368,11 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
|
|||||||
if groupDescription != nil {
|
if groupDescription != nil {
|
||||||
cmd = append(cmd, []string{"-d", *groupDescription}...)
|
cmd = append(cmd, []string{"-d", *groupDescription}...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if groupName != nil {
|
||||||
|
cmd = append(cmd, []string{"-n", *groupName}...)
|
||||||
|
}
|
||||||
|
|
||||||
_, err = s.cliClient.Execute(true, cmd, "")
|
_, err = s.cliClient.Execute(true, cmd, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,8 @@ definitions:
|
|||||||
type: string
|
type: string
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
type: object
|
type: object
|
||||||
api.UpdateProfileRequest:
|
api.UpdateProfileRequest:
|
||||||
properties:
|
properties:
|
||||||
|
|||||||
Reference in New Issue
Block a user