mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
@@ -48,6 +48,7 @@ type CreateGroupRequest struct {
|
||||
Description string `json:"description"`
|
||||
Permissions GroupPermissions `json:"permissions"`
|
||||
GroupLinkState string `json:"group_link" enums:"disabled,enabled,enabled-with-approval"`
|
||||
ExpirationTime *int `json:"expiration_time"`
|
||||
}
|
||||
|
||||
type UpdateGroupRequest struct {
|
||||
@@ -668,7 +669,7 @@ func (a *Api) CreateGroup(c *gin.Context) {
|
||||
groupLinkState = groupLinkState.FromString(req.GroupLinkState)
|
||||
}
|
||||
|
||||
groupId, err := a.signalClient.CreateGroup(number, req.Name, req.Members, req.Description, editGroupPermission, addMembersPermission, groupLinkState)
|
||||
groupId, err := a.signalClient.CreateGroup(number, req.Name, req.Members, req.Description, editGroupPermission, addMembersPermission, groupLinkState, req.ExpirationTime)
|
||||
if err != nil {
|
||||
c.JSON(400, Error{Msg: err.Error()})
|
||||
return
|
||||
|
||||
@@ -868,7 +868,7 @@ func (s *SignalClient) RemoveReceiveChannel(channelUuid string) {
|
||||
jsonRpc2Client.RemoveReceiveChannel(channelUuid)
|
||||
}
|
||||
|
||||
func (s *SignalClient) CreateGroup(number string, name string, members []string, description string, editGroupPermission GroupPermission, addMembersPermission GroupPermission, groupLinkState GroupLinkState) (string, error) {
|
||||
func (s *SignalClient) CreateGroup(number string, name string, members []string, description string, editGroupPermission GroupPermission, addMembersPermission GroupPermission, groupLinkState GroupLinkState, expirationTime *int) (string, error) {
|
||||
var internalGroupId string
|
||||
if s.signalCliMode == JsonRpc {
|
||||
type Request struct {
|
||||
@@ -878,6 +878,7 @@ func (s *SignalClient) CreateGroup(number string, name string, members []string,
|
||||
Description string `json:"description,omitempty"`
|
||||
EditGroupPermissions string `json:"setPermissionEditDetails,omitempty"`
|
||||
AddMembersPermissions string `json:"setPermissionAddMember,omitempty"`
|
||||
Expiration int `json:"expiration,omitempty"`
|
||||
}
|
||||
request := Request{Name: name, Members: members}
|
||||
|
||||
@@ -897,6 +898,10 @@ func (s *SignalClient) CreateGroup(number string, name string, members []string,
|
||||
request.AddMembersPermissions = addMembersPermission.String()
|
||||
}
|
||||
|
||||
if expirationTime != nil {
|
||||
request.Expiration = *expirationTime
|
||||
}
|
||||
|
||||
jsonRpc2Client, err := s.getJsonRpc2Client()
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -936,6 +941,10 @@ func (s *SignalClient) CreateGroup(number string, name string, members []string,
|
||||
cmd = append(cmd, []string{"--description", description}...)
|
||||
}
|
||||
|
||||
if expirationTime != nil {
|
||||
cmd = append(cmd, []string{"--expiration", strconv.Itoa(*expirationTime)}...)
|
||||
}
|
||||
|
||||
rawData, err := s.cliClient.Execute(true, cmd, "")
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), signalCliV2GroupError) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated by swaggo/swag. DO NOT EDIT
|
||||
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
@@ -2090,6 +2090,9 @@ const docTemplate = `{
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"expiration_time": {
|
||||
"type": "integer"
|
||||
},
|
||||
"group_link": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -2275,69 +2278,7 @@ const docTemplate = `{
|
||||
}
|
||||
},
|
||||
"api.SendMessageV2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"base64_attachments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"example": [
|
||||
"\u003cBASE64 ENCODED DATA\u003e",
|
||||
"data:\u003cMIME-TYPE\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e",
|
||||
"data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e"
|
||||
]
|
||||
},
|
||||
"edit_timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mentions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/data.MessageMention"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"notify_self": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"number": {
|
||||
"type": "string"
|
||||
},
|
||||
"quote_author": {
|
||||
"type": "string"
|
||||
},
|
||||
"quote_mentions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/data.MessageMention"
|
||||
}
|
||||
},
|
||||
"quote_message": {
|
||||
"type": "string"
|
||||
},
|
||||
"quote_timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"recipients": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"sticker": {
|
||||
"type": "string"
|
||||
},
|
||||
"text_mode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"normal",
|
||||
"styled"
|
||||
]
|
||||
}
|
||||
}
|
||||
"type": "object"
|
||||
},
|
||||
"api.SetUsernameRequest": {
|
||||
"type": "object",
|
||||
@@ -2607,20 +2548,6 @@ const docTemplate = `{
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"data.MessageMention": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"author": {
|
||||
"type": "string"
|
||||
},
|
||||
"length": {
|
||||
"type": "integer"
|
||||
},
|
||||
"start": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
@@ -2685,6 +2612,8 @@ var SwaggerInfo = &swag.Spec{
|
||||
Description: "This is the Signal Cli REST API documentation.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -2083,6 +2083,9 @@
|
||||
"description": {
|
||||
"type": "string"
|
||||
},
|
||||
"expiration_time": {
|
||||
"type": "integer"
|
||||
},
|
||||
"group_link": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -2268,69 +2271,7 @@
|
||||
}
|
||||
},
|
||||
"api.SendMessageV2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"base64_attachments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"example": [
|
||||
"\u003cBASE64 ENCODED DATA\u003e",
|
||||
"data:\u003cMIME-TYPE\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e",
|
||||
"data:\u003cMIME-TYPE\u003e;filename=\u003cFILENAME\u003e;base64\u003ccomma\u003e\u003cBASE64 ENCODED DATA\u003e"
|
||||
]
|
||||
},
|
||||
"edit_timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mentions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/data.MessageMention"
|
||||
}
|
||||
},
|
||||
"message": {
|
||||
"type": "string"
|
||||
},
|
||||
"notify_self": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"number": {
|
||||
"type": "string"
|
||||
},
|
||||
"quote_author": {
|
||||
"type": "string"
|
||||
},
|
||||
"quote_mentions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/data.MessageMention"
|
||||
}
|
||||
},
|
||||
"quote_message": {
|
||||
"type": "string"
|
||||
},
|
||||
"quote_timestamp": {
|
||||
"type": "integer"
|
||||
},
|
||||
"recipients": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"sticker": {
|
||||
"type": "string"
|
||||
},
|
||||
"text_mode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"normal",
|
||||
"styled"
|
||||
]
|
||||
}
|
||||
}
|
||||
"type": "object"
|
||||
},
|
||||
"api.SetUsernameRequest": {
|
||||
"type": "object",
|
||||
@@ -2600,20 +2541,6 @@
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"data.MessageMention": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"author": {
|
||||
"type": "string"
|
||||
},
|
||||
"length": {
|
||||
"type": "integer"
|
||||
},
|
||||
"start": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
|
||||
@@ -37,6 +37,8 @@ definitions:
|
||||
properties:
|
||||
description:
|
||||
type: string
|
||||
expiration_time:
|
||||
type: integer
|
||||
group_link:
|
||||
enum:
|
||||
- disabled
|
||||
@@ -161,48 +163,6 @@ definitions:
|
||||
type: array
|
||||
type: object
|
||||
api.SendMessageV2:
|
||||
properties:
|
||||
base64_attachments:
|
||||
example:
|
||||
- <BASE64 ENCODED DATA>
|
||||
- data:<MIME-TYPE>;base64<comma><BASE64 ENCODED DATA>
|
||||
- data:<MIME-TYPE>;filename=<FILENAME>;base64<comma><BASE64 ENCODED DATA>
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
edit_timestamp:
|
||||
type: integer
|
||||
mentions:
|
||||
items:
|
||||
$ref: '#/definitions/data.MessageMention'
|
||||
type: array
|
||||
message:
|
||||
type: string
|
||||
notify_self:
|
||||
type: boolean
|
||||
number:
|
||||
type: string
|
||||
quote_author:
|
||||
type: string
|
||||
quote_mentions:
|
||||
items:
|
||||
$ref: '#/definitions/data.MessageMention'
|
||||
type: array
|
||||
quote_message:
|
||||
type: string
|
||||
quote_timestamp:
|
||||
type: integer
|
||||
recipients:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
sticker:
|
||||
type: string
|
||||
text_mode:
|
||||
enum:
|
||||
- normal
|
||||
- styled
|
||||
type: string
|
||||
type: object
|
||||
api.SetUsernameRequest:
|
||||
properties:
|
||||
@@ -379,15 +339,6 @@ definitions:
|
||||
username_link:
|
||||
type: string
|
||||
type: object
|
||||
data.MessageMention:
|
||||
properties:
|
||||
author:
|
||||
type: string
|
||||
length:
|
||||
type: integer
|
||||
start:
|
||||
type: integer
|
||||
type: object
|
||||
info:
|
||||
contact: {}
|
||||
description: This is the Signal Cli REST API documentation.
|
||||
|
||||
Reference in New Issue
Block a user