Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger fixes #609

Merged
merged 7 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ type CreateGroupResponse struct {
}

type UpdateProfileRequest struct {
Name string `json:"name"`
Base64Avatar string `json:"base64_avatar"`
About *string `json:"about"`
Name string `json:"name"`
Base64Avatar string `json:"base64_avatar"`
About *string `json:"about"`
}

type TrustIdentityRequest struct {
Expand Down Expand Up @@ -1416,6 +1416,7 @@ func (a *Api) UpdateGroup(c *gin.Context) {
// @Success 204 {string} OK
// @Failure 400 {object} Error
// @Param data body Reaction true "Reaction"
// @Param number path string true "Registered phone number"
// @Router /v1/reactions/{number} [post]
func (a *Api) SendReaction(c *gin.Context) {
var req Reaction
Expand Down Expand Up @@ -1464,6 +1465,7 @@ func (a *Api) SendReaction(c *gin.Context) {
// @Success 204 {string} OK
// @Failure 400 {object} Error
// @Param data body Reaction true "Reaction"
// @Param number path string true "Registered phone number"
// @Router /v1/reactions/{number} [delete]
func (a *Api) RemoveReaction(c *gin.Context) {
var req Reaction
Expand Down Expand Up @@ -1507,6 +1509,7 @@ func (a *Api) RemoveReaction(c *gin.Context) {
// @Success 204 {string} OK
// @Failure 400 {object} Error
// @Param data body Receipt true "Receipt"
// @Param number path string true "Registered phone number"
// @Router /v1/receipts/{number} [post]
func (a *Api) SendReceipt(c *gin.Context) {
var req Receipt
Expand Down
13 changes: 13 additions & 0 deletions src/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
These files are generated from the [swaggo/swag](https://github.com/swaggo/swag) tool.

To regenerate them, run in /src:

```bash
docker run --rm -v $(pwd):/code ghcr.io/swaggo/swag:latest init
```

Or, if you have `swag` installed:

```bash
swag init
```
106 changes: 27 additions & 79 deletions src/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,13 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/api.Reaction"
}
},
{
"type": "string",
"description": "Registered phone number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -1453,6 +1460,13 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/api.Reaction"
}
},
{
"type": "string",
"description": "Registered phone number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -1493,6 +1507,13 @@ const docTemplate = `{
"schema": {
"$ref": "#/definitions/api.Receipt"
}
},
{
"type": "string",
"description": "Registered phone number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -2278,69 +2299,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",
Expand Down Expand Up @@ -2442,6 +2401,9 @@ const docTemplate = `{
"api.UpdateProfileRequest": {
"type": "object",
"properties": {
"about": {
"type": "string"
},
"base64_avatar": {
"type": "string"
},
Expand Down Expand Up @@ -2610,20 +2572,6 @@ const docTemplate = `{
"type": "string"
}
}
},
"data.MessageMention": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"length": {
"type": "integer"
},
"start": {
"type": "integer"
}
}
}
},
"tags": [
Expand Down Expand Up @@ -2681,9 +2629,9 @@ const docTemplate = `{
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
Host: "localhost:8080",
BasePath: "/",
Schemes: []string{},
Schemes: []string{"http"},
Title: "Signal Cli REST API",
Description: "This is the Signal Cli REST API documentation.",
InfoInstanceName: "swagger",
Expand Down
106 changes: 29 additions & 77 deletions src/docs/swagger.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
{
"schemes": [
"http"
],
"swagger": "2.0",
"info": {
"description": "This is the Signal Cli REST API documentation.",
"title": "Signal Cli REST API",
"contact": {},
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/",
"paths": {
"/v1/about": {
Expand Down Expand Up @@ -1408,6 +1412,13 @@
"schema": {
"$ref": "#/definitions/api.Reaction"
}
},
{
"type": "string",
"description": "Registered phone number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -1446,6 +1457,13 @@
"schema": {
"$ref": "#/definitions/api.Reaction"
}
},
{
"type": "string",
"description": "Registered phone number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -1486,6 +1504,13 @@
"schema": {
"$ref": "#/definitions/api.Receipt"
}
},
{
"type": "string",
"description": "Registered phone number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -2271,69 +2296,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",
Expand Down Expand Up @@ -2435,6 +2398,9 @@
"api.UpdateProfileRequest": {
"type": "object",
"properties": {
"about": {
"type": "string"
},
"base64_avatar": {
"type": "string"
},
Expand Down Expand Up @@ -2603,20 +2569,6 @@
"type": "string"
}
}
},
"data.MessageMention": {
"type": "object",
"properties": {
"author": {
"type": "string"
},
"length": {
"type": "integer"
},
"start": {
"type": "integer"
}
}
}
},
"tags": [
Expand Down
Loading
Loading