improved REST API documentation

This commit is contained in:
Bernhard B
2023-10-07 11:29:41 +02:00
parent 9e09775d94
commit b45aab70a7
4 changed files with 106 additions and 7 deletions

View File

@@ -109,7 +109,7 @@ type SendMessageV2 struct {
QuoteAuthor *string `json:"quote_author"` QuoteAuthor *string `json:"quote_author"`
QuoteMessage *string `json:"quote_message"` QuoteMessage *string `json:"quote_message"`
QuoteMentions []client.MessageMention `json:"quote_mentions"` QuoteMentions []client.MessageMention `json:"quote_mentions"`
TextMode *string `json:"text_mode"` TextMode *string `json:"text_mode" enums:"normal,styled"`
} }
type TypingIndicatorRequest struct { type TypingIndicatorRequest struct {
@@ -341,7 +341,7 @@ func (a *Api) Send(c *gin.Context) {
// @Summary Send a signal message. // @Summary Send a signal message.
// @Tags Messages // @Tags Messages
// @Description Send a signal message // @Description Send a signal message. Set the text_mode to 'styled' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.
// @Accept json // @Accept json
// @Produce json // @Produce json
// @Success 201 {object} SendMessageResponse // @Success 201 {object} SendMessageResponse

View File

@@ -333,6 +333,39 @@ var doc = `{
} }
} }
}, },
"/v1/contacts{number}/sync": {
"post": {
"description": "Send a synchronization message with the local contacts list to all linked devices. This command should only be used if this is the primary device.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Contacts"
],
"summary": "Send a synchronization message with the local contacts list to all linked devices.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/devices/{number}": { "/v1/devices/{number}": {
"post": { "post": {
"description": "Links another device to this device. Only works, if this is the master device.", "description": "Links another device to this device. Only works, if this is the master device.",
@@ -1566,7 +1599,7 @@ var doc = `{
}, },
"/v2/send": { "/v2/send": {
"post": { "post": {
"description": "Send a signal message", "description": "Send a signal message. Set the text_mode to 'styled' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@@ -1839,7 +1872,11 @@ var doc = `{
"type": "string" "type": "string"
}, },
"text_mode": { "text_mode": {
"type": "string" "type": "string",
"enum": [
"normal",
"styled"
]
} }
} }
}, },

View File

@@ -317,6 +317,39 @@
} }
} }
}, },
"/v1/contacts{number}/sync": {
"post": {
"description": "Send a synchronization message with the local contacts list to all linked devices. This command should only be used if this is the primary device.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Contacts"
],
"summary": "Send a synchronization message with the local contacts list to all linked devices.",
"parameters": [
{
"type": "string",
"description": "Registered Phone Number",
"name": "number",
"in": "path",
"required": true
}
],
"responses": {
"204": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/api.Error"
}
}
}
}
},
"/v1/devices/{number}": { "/v1/devices/{number}": {
"post": { "post": {
"description": "Links another device to this device. Only works, if this is the master device.", "description": "Links another device to this device. Only works, if this is the master device.",
@@ -1550,7 +1583,7 @@
}, },
"/v2/send": { "/v2/send": {
"post": { "post": {
"description": "Send a signal message", "description": "Send a signal message. Set the text_mode to 'styled' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.",
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
@@ -1823,7 +1856,11 @@
"type": "string" "type": "string"
}, },
"text_mode": { "text_mode": {
"type": "string" "type": "string",
"enum": [
"normal",
"styled"
]
} }
} }
}, },

View File

@@ -154,6 +154,9 @@ definitions:
sticker: sticker:
type: string type: string
text_mode: text_mode:
enum:
- normal
- styled
type: string type: string
type: object type: object
api.TrustIdentityRequest: api.TrustIdentityRequest:
@@ -497,6 +500,28 @@ paths:
summary: Updates the info associated to a number on the contact list. If the contact doesnt exist yet, it will be added. summary: Updates the info associated to a number on the contact list. If the contact doesnt exist yet, it will be added.
tags: tags:
- Contacts - Contacts
/v1/contacts{number}/sync:
post:
consumes:
- application/json
description: Send a synchronization message with the local contacts list to all linked devices. This command should only be used if this is the primary device.
parameters:
- description: Registered Phone Number
in: path
name: number
required: true
type: string
produces:
- application/json
responses:
"204": {}
"400":
description: Bad Request
schema:
$ref: '#/definitions/api.Error'
summary: Send a synchronization message with the local contacts list to all linked devices.
tags:
- Contacts
/v1/devices/{number}: /v1/devices/{number}:
post: post:
consumes: consumes:
@@ -1317,7 +1342,7 @@ paths:
post: post:
consumes: consumes:
- application/json - application/json
description: Send a signal message description: 'Send a signal message. Set the text_mode to ''styled'' in case you want to add formatting to your text message. Styling Options: *italic text*, **bold text**, ~strikethrough text~.'
parameters: parameters:
- description: Input Data - description: Input Data
in: body in: body