Feature/oc 1316 add support for system message to single user (#1351)
* add public func to lookup a ChatClient by its clientId * add facility to send a system message directly to a user * add clientId field to UserEvent * implement simple http endpoint to send a message to a user * let mux handle new directSystemMessageToUser endpoint * add ClientId to UserEvents across the codebase * render body of system-message to client * add clientId to Chat-Message * add tests showing how url-parsing should work * add simple rest endpoint helpers for parameter-parsing and easy routing * use newly added rest-endpoint helper to rout to Client-Messaging controller * use safe "ReadRestUrlParameter" to parse ClientId * remove empty HandleFunc in router * set Header directly to prevent built-in (platform-dependent) canonicalization to kick in * fix typo in "Parameter" message * remove debug-logging of HTTP headers in REST-helpers * convert to uint32 to prevent overruns when converting to wraptype uint later on * resolve linter-ouchies * resolve linter potential nil-deref warning * document the SendSystemMessageToClient endpoint in swaggerdoc * remove clientId assignment causing potential nil dereference in userDisabledEvent-case as the clientId isn't relevant here anyway * make findClientById private, so its not accessible outside of core/chat * remove redundant string type hint * Update PR based on linter requirements Co-authored-by: Raffael Rehberger <raffael@rtrace.io> Co-authored-by: Gabe Kangas <gabek@real-ity.com>
This commit is contained in:
52
openapi.yaml
52
openapi.yaml
@@ -1398,6 +1398,58 @@ paths:
|
||||
type: string
|
||||
example: sent
|
||||
|
||||
/api/integrations/chat/system/client/{clientId}:
|
||||
post:
|
||||
summary: Send system chat message to a client, identified by its ClientId
|
||||
description: Send a chat message on behalf of the system/server to a single client.
|
||||
tags: ["Integrations"]
|
||||
security:
|
||||
- AccessToken: []
|
||||
parameters:
|
||||
- name: clientId
|
||||
in: path
|
||||
description: Client ID (a unique numeric Id, identifying the client connection)
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- "body"
|
||||
properties:
|
||||
body:
|
||||
type: string
|
||||
description: The message text that will be sent to the client.
|
||||
example: "What a beautiful day. I love it"
|
||||
responses:
|
||||
"200":
|
||||
description: Message was sent.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
success:
|
||||
type: boolean
|
||||
example: true
|
||||
messages:
|
||||
type: string
|
||||
example: sent
|
||||
"500":
|
||||
description: Message was not sent to the client
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: message explaining what went wrong sending the message to the client
|
||||
|
||||
/api/admin/accesstokens/create:
|
||||
post:
|
||||
|
||||
Reference in New Issue
Block a user