mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-19 15:44:28 +01:00
addd API endpoints to join/quit/block Signal Groups
This commit is contained in:
118
src/api/api.go
118
src/api/api.go
@@ -116,6 +116,16 @@ func convertInternalGroupIdToGroupId(internalId string) string {
|
|||||||
return groupPrefix + base64.StdEncoding.EncodeToString([]byte(internalId))
|
return groupPrefix + base64.StdEncoding.EncodeToString([]byte(internalId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func convertGroupIdToInternalGroupId(id string) (string, error) {
|
||||||
|
groupIdWithoutPrefix := strings.TrimPrefix(id, groupPrefix)
|
||||||
|
internalGroupId, err := base64.StdEncoding.DecodeString(groupIdWithoutPrefix)
|
||||||
|
if err != nil {
|
||||||
|
return "", errors.New("Invalid group id")
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(internalGroupId), err
|
||||||
|
}
|
||||||
|
|
||||||
func getStringInBetween(str string, start string, end string) (result string) {
|
func getStringInBetween(str string, start string, end string) (result string) {
|
||||||
i := strings.Index(str, start)
|
i := strings.Index(str, start)
|
||||||
if i == -1 {
|
if i == -1 {
|
||||||
@@ -667,6 +677,16 @@ func (a *Api) GetGroups(c *gin.Context) {
|
|||||||
c.JSON(200, groups)
|
c.JSON(200, groups)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary List a Signal Group.
|
||||||
|
// @Tags Groups
|
||||||
|
// @Description List a specific Signal Group.
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {object} GroupEntry
|
||||||
|
// @Failure 400 {object} Error
|
||||||
|
// @Param number path string true "Registered Phone Number"
|
||||||
|
// @Param groupid path string true "Group ID"
|
||||||
|
// @Router /v1/groups/{number}/{groupid} [get]
|
||||||
func (a *Api) GetGroup(c *gin.Context) {
|
func (a *Api) GetGroup(c *gin.Context) {
|
||||||
number := c.Param("number")
|
number := c.Param("number")
|
||||||
groupId := c.Param("groupid")
|
groupId := c.Param("groupid")
|
||||||
@@ -689,7 +709,7 @@ func (a *Api) GetGroup(c *gin.Context) {
|
|||||||
|
|
||||||
// @Summary Delete a Signal Group.
|
// @Summary Delete a Signal Group.
|
||||||
// @Tags Groups
|
// @Tags Groups
|
||||||
// @Description Delete a Signal Group.
|
// @Description Delete the specified Signal Group.
|
||||||
// @Accept json
|
// @Accept json
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {string} string "OK"
|
// @Success 200 {string} string "OK"
|
||||||
@@ -1094,3 +1114,99 @@ func (a *Api) GetConfiguration(c *gin.Context) {
|
|||||||
configuration := Configuration{Logging: LoggingConfiguration{Level: logLevel}}
|
configuration := Configuration{Logging: LoggingConfiguration{Level: logLevel}}
|
||||||
c.JSON(200, configuration)
|
c.JSON(200, configuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary Block a Signal Group.
|
||||||
|
// @Tags Groups
|
||||||
|
// @Description Block the specified Signal Group.
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {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}/block [post]
|
||||||
|
func (a *Api) BlockGroup(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 := convertGroupIdToInternalGroupId(groupId)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = runSignalCli(true, []string{"--config", a.signalCliConfig, "-u", number, "block", "-g", internalGroupId}, "")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Summary Join a Signal Group.
|
||||||
|
// @Tags Groups
|
||||||
|
// @Description Join the specified Signal Group.
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {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}/join [post]
|
||||||
|
func (a *Api) JoinGroup(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 := convertGroupIdToInternalGroupId(groupId)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = runSignalCli(true, []string{"--config", a.signalCliConfig, "-u", number, "updateGroup", "-g", internalGroupId}, "")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Summary Quit a Signal Group.
|
||||||
|
// @Tags Groups
|
||||||
|
// @Description Quit the specified Signal Group.
|
||||||
|
// @Accept json
|
||||||
|
// @Produce json
|
||||||
|
// @Success 200 {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}/quit [post]
|
||||||
|
func (a *Api) QuitGroup(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 := convertGroupIdToInternalGroupId(groupId)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = runSignalCli(true, []string{"--config", a.signalCliConfig, "-u", number, "quitGroup", "-g", internalGroupId}, "")
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(400, Error{Msg: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.Status(http.StatusNoContent)
|
||||||
|
}
|
||||||
|
|||||||
182
src/docs/docs.go
182
src/docs/docs.go
@@ -287,8 +287,51 @@ var doc = `{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/v1/groups/{number}/{groupid}": {
|
"/v1/groups/{number}/{groupid}": {
|
||||||
|
"get": {
|
||||||
|
"description": "List a specific Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "List a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.GroupEntry"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"description": "Delete a Signal Group.",
|
"description": "Delete the specified Signal Group.",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -331,6 +374,141 @@ var doc = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/v1/groups/{number}/{groupid}/block": {
|
||||||
|
"post": {
|
||||||
|
"description": "Block the specified Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "Block a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/groups/{number}/{groupid}/join": {
|
||||||
|
"post": {
|
||||||
|
"description": "Join the specified Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "Join a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/groups/{number}/{groupid}/quit": {
|
||||||
|
"post": {
|
||||||
|
"description": "Quit the specified Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "Quit a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/v1/health": {
|
"/v1/health": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Internally used by the docker container to perform the health check.",
|
"description": "Internally used by the docker container to perform the health check.",
|
||||||
@@ -896,7 +1074,7 @@ var doc = `{
|
|||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
"description": "List general information.",
|
"description": "Some general endpoints.",
|
||||||
"name": "General"
|
"name": "General"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -272,8 +272,51 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/v1/groups/{number}/{groupid}": {
|
"/v1/groups/{number}/{groupid}": {
|
||||||
|
"get": {
|
||||||
|
"description": "List a specific Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "List a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.GroupEntry"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"description": "Delete a Signal Group.",
|
"description": "Delete the specified Signal Group.",
|
||||||
"consumes": [
|
"consumes": [
|
||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
@@ -316,6 +359,141 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/v1/groups/{number}/{groupid}/block": {
|
||||||
|
"post": {
|
||||||
|
"description": "Block the specified Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "Block a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/groups/{number}/{groupid}/join": {
|
||||||
|
"post": {
|
||||||
|
"description": "Join the specified Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "Join a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/groups/{number}/{groupid}/quit": {
|
||||||
|
"post": {
|
||||||
|
"description": "Quit the specified Signal Group.",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"Groups"
|
||||||
|
],
|
||||||
|
"summary": "Quit a Signal Group.",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Registered Phone Number",
|
||||||
|
"name": "number",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Group ID",
|
||||||
|
"name": "groupid",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/api.Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/v1/health": {
|
"/v1/health": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Internally used by the docker container to perform the health check.",
|
"description": "Internally used by the docker container to perform the health check.",
|
||||||
@@ -881,7 +1059,7 @@
|
|||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
{
|
{
|
||||||
"description": "List general information.",
|
"description": "Some general endpoints.",
|
||||||
"name": "General"
|
"name": "General"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ paths:
|
|||||||
delete:
|
delete:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
description: Delete a Signal Group.
|
description: Delete the specified Signal Group.
|
||||||
parameters:
|
parameters:
|
||||||
- description: Registered Phone Number
|
- description: Registered Phone Number
|
||||||
in: path
|
in: path
|
||||||
@@ -325,6 +325,125 @@ paths:
|
|||||||
summary: Delete a Signal Group.
|
summary: Delete a Signal Group.
|
||||||
tags:
|
tags:
|
||||||
- Groups
|
- Groups
|
||||||
|
get:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: List a specific Signal Group.
|
||||||
|
parameters:
|
||||||
|
- description: Registered Phone Number
|
||||||
|
in: path
|
||||||
|
name: number
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Group ID
|
||||||
|
in: path
|
||||||
|
name: groupid
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/api.GroupEntry'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/api.Error'
|
||||||
|
summary: List a Signal Group.
|
||||||
|
tags:
|
||||||
|
- Groups
|
||||||
|
/v1/groups/{number}/{groupid}/block:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Block the specified Signal Group.
|
||||||
|
parameters:
|
||||||
|
- description: Registered Phone Number
|
||||||
|
in: path
|
||||||
|
name: number
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Group ID
|
||||||
|
in: path
|
||||||
|
name: groupid
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/api.Error'
|
||||||
|
summary: Block a Signal Group.
|
||||||
|
tags:
|
||||||
|
- Groups
|
||||||
|
/v1/groups/{number}/{groupid}/join:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Join the specified Signal Group.
|
||||||
|
parameters:
|
||||||
|
- description: Registered Phone Number
|
||||||
|
in: path
|
||||||
|
name: number
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Group ID
|
||||||
|
in: path
|
||||||
|
name: groupid
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/api.Error'
|
||||||
|
summary: Join a Signal Group.
|
||||||
|
tags:
|
||||||
|
- Groups
|
||||||
|
/v1/groups/{number}/{groupid}/quit:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
description: Quit the specified Signal Group.
|
||||||
|
parameters:
|
||||||
|
- description: Registered Phone Number
|
||||||
|
in: path
|
||||||
|
name: number
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: Group ID
|
||||||
|
in: path
|
||||||
|
name: groupid
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/api.Error'
|
||||||
|
summary: Quit a Signal Group.
|
||||||
|
tags:
|
||||||
|
- Groups
|
||||||
/v1/health:
|
/v1/health:
|
||||||
get:
|
get:
|
||||||
description: Internally used by the docker container to perform the health check.
|
description: Internally used by the docker container to perform the health check.
|
||||||
@@ -579,7 +698,7 @@ paths:
|
|||||||
- Messages
|
- Messages
|
||||||
swagger: "2.0"
|
swagger: "2.0"
|
||||||
tags:
|
tags:
|
||||||
- description: List general information.
|
- description: Some general endpoints.
|
||||||
name: General
|
name: General
|
||||||
- description: Register and link Devices.
|
- description: Register and link Devices.
|
||||||
name: Devices
|
name: Devices
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ func main() {
|
|||||||
groups.GET(":number", api.GetGroups)
|
groups.GET(":number", api.GetGroups)
|
||||||
groups.GET(":number/:groupid", api.GetGroup)
|
groups.GET(":number/:groupid", api.GetGroup)
|
||||||
groups.DELETE(":number/:groupid", api.DeleteGroup)
|
groups.DELETE(":number/:groupid", api.DeleteGroup)
|
||||||
|
groups.POST(":number/:groupid/block", api.BlockGroup)
|
||||||
|
groups.POST(":number/:groupid/join", api.JoinGroup)
|
||||||
|
groups.POST(":number/:groupid/quit", api.QuitGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
link := v1.Group("qrcodelink")
|
link := v1.Group("qrcodelink")
|
||||||
|
|||||||
Reference in New Issue
Block a user