mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 07:34:23 +01:00
@@ -53,9 +53,10 @@ type CreateGroupRequest struct {
|
||||
}
|
||||
|
||||
type UpdateGroupRequest struct {
|
||||
Base64Avatar *string `json:"base64_avatar"`
|
||||
Description *string `json:"description"`
|
||||
Name *string `json:"name"`
|
||||
Base64Avatar *string `json:"base64_avatar"`
|
||||
Description *string `json:"description"`
|
||||
Name *string `json:"name"`
|
||||
ExpirationTime *int `json:"expiration_time"`
|
||||
}
|
||||
|
||||
type ChangeGroupMembersRequest struct {
|
||||
@@ -1477,7 +1478,7 @@ func (a *Api) UpdateGroup(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = a.signalClient.UpdateGroup(number, internalGroupId, req.Base64Avatar, req.Description, req.Name)
|
||||
err = a.signalClient.UpdateGroup(number, internalGroupId, req.Base64Avatar, req.Description, req.Name, req.ExpirationTime)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
|
||||
@@ -1594,7 +1594,7 @@ func (s *SignalClient) QuitGroup(number string, groupId string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string, groupName *string) error {
|
||||
func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *string, groupDescription *string, groupName *string, expirationTime *int) error {
|
||||
var err error
|
||||
var avatarTmpPath string = ""
|
||||
if base64Avatar != nil {
|
||||
@@ -1638,6 +1638,7 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
|
||||
Avatar string `json:"avatar,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Expiration int `json:"expiration,omitempty"`
|
||||
}
|
||||
request := Request{GroupId: groupId}
|
||||
|
||||
@@ -1648,6 +1649,10 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
|
||||
request.Description = groupDescription
|
||||
request.Name = groupName
|
||||
|
||||
if expirationTime != nil {
|
||||
request.Expiration = *expirationTime
|
||||
}
|
||||
|
||||
jsonRpc2Client, err := s.getJsonRpc2Client()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -1667,6 +1672,10 @@ func (s *SignalClient) UpdateGroup(number string, groupId string, base64Avatar *
|
||||
cmd = append(cmd, []string{"-n", *groupName}...)
|
||||
}
|
||||
|
||||
if expirationTime != nil {
|
||||
cmd = append(cmd, []string{"--expiration", strconv.Itoa(*expirationTime)}...)
|
||||
}
|
||||
|
||||
_, err = s.cliClient.Execute(true, cmd, "")
|
||||
}
|
||||
|
||||
|
||||
@@ -2455,6 +2455,9 @@ const docTemplate = `{
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"expiration_time": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -2712,8 +2715,6 @@ var SwaggerInfo = &swag.Spec{
|
||||
Description: "This is the Signal Cli REST API documentation.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -2452,6 +2452,9 @@
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"expiration_time": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@@ -266,6 +266,8 @@ definitions:
|
||||
type: string
|
||||
description:
|
||||
type: string
|
||||
expiration_time:
|
||||
type: integer
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
|
||||
Reference in New Issue
Block a user