diff --git a/src/api/api.go b/src/api/api.go index 8722a6f..4ac3419 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -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 diff --git a/src/client/client.go b/src/client/client.go index 7767b31..a904727 100644 --- a/src/client/client.go +++ b/src/client/client.go @@ -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, "") } diff --git a/src/docs/docs.go b/src/docs/docs.go index f743b6e..eb01da6 100644 --- a/src/docs/docs.go +++ b/src/docs/docs.go @@ -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() { diff --git a/src/docs/swagger.json b/src/docs/swagger.json index c42cd1f..cc79997 100644 --- a/src/docs/swagger.json +++ b/src/docs/swagger.json @@ -2452,6 +2452,9 @@ "description": { "type": "string" }, + "expiration_time": { + "type": "integer" + }, "name": { "type": "string" } diff --git a/src/docs/swagger.yaml b/src/docs/swagger.yaml index 6375112..34fefb8 100644 --- a/src/docs/swagger.yaml +++ b/src/docs/swagger.yaml @@ -266,6 +266,8 @@ definitions: type: string description: type: string + expiration_time: + type: integer name: type: string type: object