Merge pull request #1461 from turt2live/travis/s2s/transactions
Improve documentation on how Transactions work
This commit is contained in:
commit
d48f1e1713
3 changed files with 58 additions and 46 deletions
|
@ -25,11 +25,13 @@ properties:
|
|||
origin_server_ts:
|
||||
type: integer
|
||||
format: int64
|
||||
description: Timestamp in milliseconds on originating homeserver when this transaction started.
|
||||
example: 1234567890
|
||||
description: |-
|
||||
POSIX timestamp in milliseconds on originating homeserver when this
|
||||
transaction started.
|
||||
example: 1532991320875
|
||||
pdus:
|
||||
type: array
|
||||
description: List of persistent updates to rooms.
|
||||
items:
|
||||
$ref: "pdu.yaml"
|
||||
required: ['origin', 'origin_server_ts', 'pdus']
|
||||
required: ['origin', 'origin_server_ts', 'pdus']
|
||||
|
|
|
@ -30,16 +30,18 @@ paths:
|
|||
Push messages representing live activity to another server. The destination name
|
||||
will be set to that of the receiving server itself. Each embedded PDU in the
|
||||
transaction body will be processed.
|
||||
|
||||
The sending server must wait and retry for a 200 OK response before sending a
|
||||
transaction with a different ``txnId`` to the receiving server.
|
||||
operationId: sendTransaction
|
||||
parameters:
|
||||
- in: path
|
||||
name: txnId
|
||||
type: string
|
||||
# TODO: "Overrides any ID given in the JSON body" - What does this mean?
|
||||
description: |-
|
||||
The transaction ID. Overrides any ID given in the JSON body.
|
||||
The transaction ID.
|
||||
required: true
|
||||
x-example: TODO # No examples in the spec so far
|
||||
x-example: S0meTransacti0nId
|
||||
- in: body
|
||||
name: body
|
||||
type: object
|
||||
|
@ -51,7 +53,9 @@ paths:
|
|||
properties:
|
||||
edus:
|
||||
type: array
|
||||
description: List of ephemeral messages. May be omitted if there are no ephemeral messages to be sent.
|
||||
description: |-
|
||||
List of ephemeral messages. May be omitted if there are no ephemeral
|
||||
messages to be sent.
|
||||
items:
|
||||
$ref: "definitions/edu.yaml"
|
||||
example: {
|
||||
|
@ -60,5 +64,47 @@ paths:
|
|||
}
|
||||
responses:
|
||||
200:
|
||||
# TODO: Spec this (and figure out what it is)
|
||||
description: TODO
|
||||
description: |-
|
||||
The result of processing the transaction. The server is to use this response even in
|
||||
the event of one or more PDUs failing to be processed.
|
||||
schema:
|
||||
type: array
|
||||
minItems: 2
|
||||
maxItems: 2
|
||||
items:
|
||||
- type: integer
|
||||
description: The value ``200``.
|
||||
example: 200
|
||||
- type: object
|
||||
title: PDU Processing Results
|
||||
description: The results for the processing of each PDU in the transaction.
|
||||
properties:
|
||||
pdus:
|
||||
type: object
|
||||
description: |-
|
||||
The PDUs from the original transaction. The string key represents the ID of the
|
||||
PDU (event) that was processed.
|
||||
additionalProperties:
|
||||
type: object
|
||||
title: PDU Processing Result
|
||||
description: Information about how the PDU was handled.
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: |-
|
||||
A human readable description about what went wrong in processing this PDU.
|
||||
If no error is present, the PDU can be considered successfully handled.
|
||||
example: "You are not allowed to send a message to this room."
|
||||
required: ['pdus']
|
||||
examples:
|
||||
application/json: [
|
||||
200,
|
||||
{
|
||||
"pdus": {
|
||||
"$successful_event:domain.com": {},
|
||||
"$failed_event:example.org": {
|
||||
"error": "You are not allowed to send a message to this room."
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue