Skip to content

Commit

Permalink
Merge branch 'v0.8.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernhard B committed Mar 20, 2021
2 parents d5ce00c + d9cbc9d commit 7674a9c
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG SIGNAL_CLI_VERSION=0.8.0
ARG SIGNAL_CLI_VERSION=0.8.1
ARG ZKGROUP_VERSION=0.7.0
ARG LIBSIGNAL_CLIENT_VERSION=0.2.3

Expand Down
19 changes: 10 additions & 9 deletions src/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ type GroupEntry struct {
InviteLink string `json:"invite_link"`
}

type CreateGroupRequest struct {
Name string `json:"name"`
Members []string `json:"members"`
}

type LoggingConfiguration struct {
Level string `json:"Level"`
}
Expand Down Expand Up @@ -100,7 +105,7 @@ type About struct {
BuildNr int `json:"build"`
}

type CreateGroup struct {
type CreateGroupResponse struct {
Id string `json:"id"`
}

Expand Down Expand Up @@ -632,19 +637,15 @@ func (a *Api) Receive(c *gin.Context) {
// @Description Create a new Signal Group with the specified members.
// @Accept json
// @Produce json
// @Success 201 {object} CreateGroup
// @Success 201 {object} CreateGroupResponse
// @Failure 400 {object} Error
// @Param data body CreateGroupRequest true "Input Data"
// @Param number path string true "Registered Phone Number"
// @Router /v1/groups/{number} [post]
func (a *Api) CreateGroup(c *gin.Context) {
number := c.Param("number")

type Request struct {
Name string `json:"name"`
Members []string `json:"members"`
}

var req Request
var req CreateGroupRequest
err := c.BindJSON(&req)
if err != nil {
c.JSON(400, gin.H{"error": "Couldn't process request - invalid request"})
Expand All @@ -666,7 +667,7 @@ func (a *Api) CreateGroup(c *gin.Context) {
}

internalGroupId := getStringInBetween(out, `"`, `"`)
c.JSON(201, CreateGroup{Id: convertInternalGroupIdToGroupId(internalGroupId)})
c.JSON(201, CreateGroupResponse{Id: convertInternalGroupIdToGroupId(internalGroupId)})
}

// @Summary List all Signal Groups.
Expand Down
27 changes: 25 additions & 2 deletions src/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@ var doc = `{
],
"summary": "Create a new Signal Group.",
"parameters": [
{
"description": "Input Data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.CreateGroupRequest"
}
},
{
"type": "string",
"description": "Registered Phone Number",
Expand All @@ -274,7 +283,7 @@ var doc = `{
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.CreateGroup"
"$ref": "#/definitions/api.CreateGroupResponse"
}
},
"400": {
Expand Down Expand Up @@ -932,7 +941,21 @@ var doc = `{
}
}
},
"api.CreateGroup": {
"api.CreateGroupRequest": {
"type": "object",
"properties": {
"members": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
}
}
},
"api.CreateGroupResponse": {
"type": "object",
"properties": {
"id": {
Expand Down
27 changes: 25 additions & 2 deletions src/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@
],
"summary": "Create a new Signal Group.",
"parameters": [
{
"description": "Input Data",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.CreateGroupRequest"
}
},
{
"type": "string",
"description": "Registered Phone Number",
Expand All @@ -259,7 +268,7 @@
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.CreateGroup"
"$ref": "#/definitions/api.CreateGroupResponse"
}
},
"400": {
Expand Down Expand Up @@ -917,7 +926,21 @@
}
}
},
"api.CreateGroup": {
"api.CreateGroupRequest": {
"type": "object",
"properties": {
"members": {
"type": "array",
"items": {
"type": "string"
}
},
"name": {
"type": "string"
}
}
},
"api.CreateGroupResponse": {
"type": "object",
"properties": {
"id": {
Expand Down
19 changes: 17 additions & 2 deletions src/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ definitions:
$ref: '#/definitions/api.LoggingConfiguration'
type: object
type: object
api.CreateGroup:
api.CreateGroupRequest:
properties:
members:
items:
type: string
type: array
name:
type: string
type: object
api.CreateGroupResponse:
properties:
id:
type: string
Expand Down Expand Up @@ -283,6 +292,12 @@ paths:
- application/json
description: Create a new Signal Group with the specified members.
parameters:
- description: Input Data
in: body
name: data
required: true
schema:
$ref: '#/definitions/api.CreateGroupRequest'
- description: Registered Phone Number
in: path
name: number
Expand All @@ -294,7 +309,7 @@ paths:
"201":
description: Created
schema:
$ref: '#/definitions/api.CreateGroup'
$ref: '#/definitions/api.CreateGroupResponse'
"400":
description: Bad Request
schema:
Expand Down

0 comments on commit 7674a9c

Please sign in to comment.