ListMessages()

This commit is contained in:
2022-11-20 00:19:41 +01:00
parent 0d641b727f
commit 80f3b982d2
15 changed files with 1635 additions and 115 deletions

View File

@@ -34,6 +34,13 @@ definitions:
fcm_token:
type: string
type: object
handler.CreateSubscription.body:
properties:
channel:
type: string
channelOwnerUserID:
type: integer
type: object
handler.CreateUser.body:
properties:
agent_model:
@@ -95,13 +102,45 @@ definitions:
user_key:
type: string
type: object
handler.ListClients.result:
handler.ListChannelSubscriptions.response:
properties:
subscriptions:
items:
$ref: '#/definitions/models.SubscriptionJSON'
type: array
type: object
handler.ListChannels.response:
properties:
channels:
items:
$ref: '#/definitions/models.ChannelJSON'
type: array
type: object
handler.ListClients.response:
properties:
clients:
items:
$ref: '#/definitions/models.ClientJSON'
type: array
type: object
handler.ListMessages.response:
properties:
messages:
items:
$ref: '#/definitions/models.MessageJSON'
type: array
next_page_token:
type: string
page_size:
type: integer
type: object
handler.ListUserSubscriptions.response:
properties:
subscriptions:
items:
$ref: '#/definitions/models.SubscriptionJSON'
type: array
type: object
handler.Register.response:
properties:
is_pro:
@@ -134,20 +173,47 @@ definitions:
type: object
handler.SendMessage.body:
properties:
chanKey:
type: string
channel:
type: string
message_content:
type: string
message_title:
type: string
msg_id:
type: string
priority:
type: integer
sendTimestamp:
type: integer
timestamp:
type: number
user_id:
type: string
type: integer
user_key:
type: string
userMessageID:
type: object
handler.SendMessage.response:
properties:
errhighlight:
type: integer
error:
type: integer
is_pro:
type: boolean
message:
type: string
messagecount:
type: integer
quota:
type: integer
quota_max:
type: integer
scn_msg_id:
type: integer
success:
type: boolean
suppress_send:
type: boolean
type: object
handler.Update.response:
properties:
@@ -206,6 +272,25 @@ definitions:
uri:
type: string
type: object
models.ChannelJSON:
properties:
channel_id:
type: integer
messages_sent:
type: integer
name:
type: string
owner_user_id:
type: integer
send_key:
type: string
subscribe_key:
type: string
timestamp_created:
type: string
timestamp_last_sent:
type: string
type: object
models.ClientJSON:
properties:
agent_model:
@@ -238,6 +323,31 @@ definitions:
usr_msg_id:
type: string
type: object
models.MessageJSON:
properties:
body:
type: string
channel_id:
type: integer
channel_name:
type: string
owner_user_id:
type: integer
priority:
type: integer
scn_message_id:
type: integer
sender_user_id:
type: integer
timestamp:
type: string
title:
type: string
trimmed:
type: boolean
usr_message_id:
type: string
type: object
models.ShortCompatMessage:
properties:
body:
@@ -255,6 +365,23 @@ definitions:
usr_msg_id:
type: string
type: object
models.SubscriptionJSON:
properties:
channel_id:
type: integer
channel_name:
type: string
channel_owner_user_id:
type: integer
confirmed:
type: boolean
subscriber_user_id:
type: integer
subscription_id:
type: integer
timestamp_created:
type: string
type: object
models.UserJSON:
properties:
admin_key:
@@ -263,10 +390,10 @@ definitions:
type: boolean
messages_sent:
type: integer
quota_day:
type: string
quota_today:
quota_used:
type: integer
quota_used_day:
type: string
read_key:
type: string
send_key:
@@ -291,28 +418,36 @@ info:
paths:
/:
post:
description: All parameter can be set via query-parameter or the json body.
Only UserID, UserKey and Title are required
parameters:
- in: query
name: message_content
name: chanKey
type: string
- in: query
name: message_title
name: channel
type: string
- in: query
name: content
type: string
- in: query
name: priority
type: integer
- in: query
name: sendTimestamp
type: number
- in: query
name: title
type: string
- in: query
name: userID
type: integer
- in: query
name: userKey
type: string
- in: query
name: userMessageID
type: string
- in: query
name: user_id
type: string
- in: query
name: user_key
type: string
- description: ' '
in: body
name: post_body
@@ -322,7 +457,54 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/models.ClientJSON'
$ref: '#/definitions/handler.SendMessage.response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Send a new message
/api-v2/messages:
get:
description: |-
The next_page_token is an opaque token, the special value "@start" (or empty-string) is the beginning and "@end" is the end
Simply start the pagination without a next_page_token and get the next page by calling this endpoint with the returned next_page_token of the last query
If there are no more entries the token "@end" will be returned
By default we return long messages with a trimmed body, if trimmed=false is supplied we return full messages (this reduces the max page_size)
operationId: api-messages-list
parameters:
- in: query
name: filter
type: string
- in: query
name: nextPageToken
type: string
- in: query
name: pageSize
type: integer
- in: query
name: trimmed
type: boolean
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.ListMessages.response'
"400":
description: Bad Request
schema:
@@ -339,7 +521,40 @@ paths:
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Send a new message
summary: List all (subscribed) messages
/api-v2/messages/{mid}:
patch:
description: The user must own the message and request the resource with the
ADMIN Key
operationId: api-messages-delete
parameters:
- description: SCNMessageID
in: path
name: mid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.MessageJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Delete a single message
/api-v2/users/:
post:
operationId: api-user-create
@@ -425,6 +640,109 @@ paths:
schema:
$ref: '#/definitions/ginresp.apiError'
summary: (Partially) update a user
/api-v2/users/{uid}/channels:
get:
operationId: api-channels-list
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.ListChannels.response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: List all channels of a user
/api-v2/users/{uid}/channels/{cid}:
get:
operationId: api-channels-get
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
- description: ChannelID
in: path
name: cid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.ChannelJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: List all channels of a user
/api-v2/users/{uid}/channels/{cid}/subscriptions:
get:
operationId: api-chan-subscriptions-list
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
- description: ChannelID
in: path
name: cid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.ListChannelSubscriptions.response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: List all subscriptions of a channel
/api-v2/users/{uid}/clients:
get:
operationId: api-clients-list
@@ -438,7 +756,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/handler.ListClients.result'
$ref: '#/definitions/handler.ListClients.response'
"400":
description: Bad Request
schema:
@@ -527,6 +845,181 @@ paths:
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Get a single clients
/api-v2/users/{uid}/subscriptions:
get:
operationId: api-user-subscriptions-list
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.ListUserSubscriptions.response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: List all channels of a user
post:
operationId: api-subscriptions-create
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
- in: query
name: chanSubscribeKey
type: string
- description: ' '
in: body
name: post_data
schema:
$ref: '#/definitions/handler.CreateSubscription.body'
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.SubscriptionJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Creare/Request a subscription
/api-v2/users/{uid}/subscriptions/{sid}:
delete:
operationId: api-subscriptions-delete
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
- description: SubscriptionID
in: path
name: sid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.SubscriptionJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Cancel (delete) subscription
get:
operationId: api-subscriptions-get
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
- description: SubscriptionID
in: path
name: sid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.SubscriptionJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Get a single subscription
patch:
operationId: api-subscriptions-update
parameters:
- description: UserID
in: path
name: uid
required: true
type: integer
- description: SubscriptionID
in: path
name: sid
required: true
type: integer
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.SubscriptionJSON'
"400":
description: Bad Request
schema:
$ref: '#/definitions/ginresp.apiError'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema:
$ref: '#/definitions/ginresp.apiError'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/ginresp.apiError'
summary: Update a subscription (e.g. confirm)
/api/ack.php:
get:
operationId: compat-ack
@@ -790,28 +1283,36 @@ paths:
$ref: '#/definitions/ginresp.apiError'
/send:
post:
description: All parameter can be set via query-parameter or the json body.
Only UserID, UserKey and Title are required
parameters:
- in: query
name: message_content
name: chanKey
type: string
- in: query
name: message_title
name: channel
type: string
- in: query
name: content
type: string
- in: query
name: priority
type: integer
- in: query
name: sendTimestamp
type: number
- in: query
name: title
type: string
- in: query
name: userID
type: integer
- in: query
name: userKey
type: string
- in: query
name: userMessageID
type: string
- in: query
name: user_id
type: string
- in: query
name: user_key
type: string
- description: ' '
in: body
name: post_body
@@ -821,7 +1322,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/models.ClientJSON'
$ref: '#/definitions/handler.SendMessage.response'
"400":
description: Bad Request
schema:
@@ -830,6 +1331,10 @@ paths:
description: Unauthorized
schema:
$ref: '#/definitions/ginresp.apiError'
"403":
description: Forbidden
schema:
$ref: '#/definitions/ginresp.apiError'
"404":
description: Not Found
schema: