mirror of
https://github.com/makayabou/asg-server.git
synced 2026-05-02 17:43:36 +02:00
[docs] update API docs
This commit is contained in:
parent
cefb6fa7bb
commit
63b93fbe01
@ -26,6 +26,22 @@ func NewMobileController(sseService *sse.Service, validator *validator.Validate,
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary Get events
|
||||
// @Description Returns events stream for a device
|
||||
// @Security MobileToken
|
||||
// @Tags Device, Events
|
||||
// @x-sse true
|
||||
// @Produce text/event-stream
|
||||
// @Header 200 {string} Content-Type "text/event-stream"
|
||||
// @Header 200 {string} Transfer-Encoding "chunked"
|
||||
// @Header 200 {string} Connection "keep-alive"
|
||||
// @Header 200 {string} Cache-Control "no-cache"
|
||||
// @Success 200 {string} string "Event"
|
||||
// @Failure 401 {object} smsgateway.ErrorResponse "Unauthorized"
|
||||
// @Failure 500 {object} smsgateway.ErrorResponse "Internal server error"
|
||||
// @Router /mobile/v1/events [get]
|
||||
//
|
||||
// Get events
|
||||
func (h *MobileController) get(device models.Device, c *fiber.Ctx) error {
|
||||
return h.sseSvc.Handler(device.ID, c)
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ func (h *mobileHandler) getMessage(device models.Device, c *fiber.Ctx) error {
|
||||
// @Tags Device, Messages
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param request body smsgateway.MobilePatchMessageRequest true "New message state"
|
||||
// @Param request body smsgateway.MobilePatchMessageRequest true "List of message state updates"
|
||||
// @Success 204 {object} nil "Successfully updated"
|
||||
// @Failure 400 {object} smsgateway.ErrorResponse "Invalid request"
|
||||
// @Failure 500 {object} smsgateway.ErrorResponse "Internal server error"
|
||||
|
||||
@ -837,6 +837,45 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/mobile/v1/events": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"MobileToken": []
|
||||
}
|
||||
],
|
||||
"description": "Returns events stream for a device",
|
||||
"produces": [
|
||||
"text/event-stream"
|
||||
],
|
||||
"tags": [
|
||||
"Device",
|
||||
"Events"
|
||||
],
|
||||
"summary": "Get events",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Event",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/smsgateway.ErrorResponse"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/smsgateway.ErrorResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-sse": true
|
||||
}
|
||||
},
|
||||
"/mobile/v1/message": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -894,50 +933,14 @@
|
||||
"summary": "Update message state",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "New message state",
|
||||
"description": "List of message state updates",
|
||||
"name": "request",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"recipients",
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Message ID",
|
||||
"type": "string",
|
||||
"maxLength": 36,
|
||||
"example": "PyDmBQZZXYmyxMwED8Fzy"
|
||||
},
|
||||
"recipients": {
|
||||
"description": "Recipients states",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "#/definitions/smsgateway.RecipientState"
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"description": "State",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/smsgateway.ProcessingState"
|
||||
}
|
||||
],
|
||||
"example": "Pending"
|
||||
},
|
||||
"states": {
|
||||
"description": "History of states",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
"$ref": "#/definitions/smsgateway.MobilePatchMessageItem"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1307,6 +1310,7 @@
|
||||
"type": "object",
|
||||
"required": [
|
||||
"deviceId",
|
||||
"id",
|
||||
"recipients",
|
||||
"state"
|
||||
],
|
||||
@ -1770,6 +1774,46 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"smsgateway.MobilePatchMessageItem": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"recipients",
|
||||
"state"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"description": "Message ID",
|
||||
"type": "string",
|
||||
"maxLength": 36,
|
||||
"example": "PyDmBQZZXYmyxMwED8Fzy"
|
||||
},
|
||||
"recipients": {
|
||||
"description": "Recipients states",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"$ref": "#/definitions/smsgateway.RecipientState"
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"description": "State",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/smsgateway.ProcessingState"
|
||||
}
|
||||
],
|
||||
"example": "Pending"
|
||||
},
|
||||
"states": {
|
||||
"description": "History of states",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"smsgateway.MobileRegisterRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@ -118,6 +118,7 @@ definitions:
|
||||
type: object
|
||||
required:
|
||||
- deviceId
|
||||
- id
|
||||
- recipients
|
||||
- state
|
||||
type: object
|
||||
@ -428,6 +429,34 @@ definitions:
|
||||
required:
|
||||
- phoneNumbers
|
||||
type: object
|
||||
smsgateway.MobilePatchMessageItem:
|
||||
properties:
|
||||
id:
|
||||
description: Message ID
|
||||
example: PyDmBQZZXYmyxMwED8Fzy
|
||||
maxLength: 36
|
||||
type: string
|
||||
recipients:
|
||||
description: Recipients states
|
||||
items:
|
||||
$ref: '#/definitions/smsgateway.RecipientState'
|
||||
minItems: 1
|
||||
type: array
|
||||
state:
|
||||
allOf:
|
||||
- $ref: '#/definitions/smsgateway.ProcessingState'
|
||||
description: State
|
||||
example: Pending
|
||||
states:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: History of states
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- recipients
|
||||
- state
|
||||
type: object
|
||||
smsgateway.MobileRegisterRequest:
|
||||
properties:
|
||||
name:
|
||||
@ -1258,6 +1287,31 @@ paths:
|
||||
summary: Register device
|
||||
tags:
|
||||
- Device
|
||||
/mobile/v1/events:
|
||||
get:
|
||||
description: Returns events stream for a device
|
||||
produces:
|
||||
- text/event-stream
|
||||
responses:
|
||||
"200":
|
||||
description: Event
|
||||
schema:
|
||||
type: string
|
||||
"401":
|
||||
description: Unauthorized
|
||||
schema:
|
||||
$ref: '#/definitions/smsgateway.ErrorResponse'
|
||||
"500":
|
||||
description: Internal server error
|
||||
schema:
|
||||
$ref: '#/definitions/smsgateway.ErrorResponse'
|
||||
security:
|
||||
- MobileToken: []
|
||||
summary: Get events
|
||||
tags:
|
||||
- Device
|
||||
- Events
|
||||
x-sse: true
|
||||
/mobile/v1/message:
|
||||
get:
|
||||
consumes:
|
||||
@ -1287,38 +1341,13 @@ paths:
|
||||
- application/json
|
||||
description: Updates message state
|
||||
parameters:
|
||||
- description: New message state
|
||||
- description: List of message state updates
|
||||
in: body
|
||||
name: request
|
||||
required: true
|
||||
schema:
|
||||
items:
|
||||
properties:
|
||||
id:
|
||||
description: Message ID
|
||||
example: PyDmBQZZXYmyxMwED8Fzy
|
||||
maxLength: 36
|
||||
type: string
|
||||
recipients:
|
||||
description: Recipients states
|
||||
items:
|
||||
$ref: '#/definitions/smsgateway.RecipientState'
|
||||
minItems: 1
|
||||
type: array
|
||||
state:
|
||||
allOf:
|
||||
- $ref: '#/definitions/smsgateway.ProcessingState'
|
||||
description: State
|
||||
example: Pending
|
||||
states:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: History of states
|
||||
type: object
|
||||
required:
|
||||
- recipients
|
||||
- state
|
||||
type: object
|
||||
$ref: '#/definitions/smsgateway.MobilePatchMessageItem'
|
||||
type: array
|
||||
produces:
|
||||
- application/json
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user