Skip to content

Commit

Permalink
Add API endpoint for filtering messages in the message store (#101)
Browse files Browse the repository at this point in the history
* Replace /events endpoint with query params on /messages

* Remove requirement for logIndex and txIndex query params

* Fix return type of message filtering endpoint

* add txhash to filter parameters for the messages endpoint
  • Loading branch information
ermyas authored Feb 20, 2022
1 parent aa3b604 commit 65ed6a0
Showing 1 changed file with 85 additions and 54 deletions.
139 changes: 85 additions & 54 deletions docs/spec/message-store-service-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,103 @@ tags:
description: >-
Represents blockchain events in the canonical data format used by
Relayers.
- name: events
description: Represents raw blockchain events emitted by a network.
schemes:
- https
paths:
/messages:
get:
tags:
- messages
summary: Retrieve messages that match the provided filter criteria.
description: >-
Returns message that match the filter criteria passed as query
parameters.
produces:
- application/json
parameters:
- name: networkId
in: query
description: ID of network in which the event was generated
required: true
type: string
- name: blockNumber
in: query
description: The block number that contains this event
required: true
type: string
- name: txIndex
in: query
description: >-
The index number of the transaction that generated the
event, within the block it was mined in.
type: string
- name: txHash
in: query
description: >-
The hash of the transaction that generated the
event.
type: string
- name: logIndex
in: query
description: >-
The index number of the event, within the block it was mined in.
type: string
responses:
'200':
description: Successful retrieval of message
schema:
type: array
items:
$ref: '#/definitions/Message'
'400':
description: Invalid ID supplied
'404':
description: Message not found
security:
- api_key: []
put:
tags:
- messages
summary: Adds or updates a Relayer message that represents a blockchain event.
description: >-
The endpoint is used to submit (and create) a message if it does not
already exist in the store. If it does, the existing message is updated
to include the additional proof data of the submitting Relayer. Only
Relayers can add or update messages.This endpoint is semantically
equivalent to the /messages/{id}, where the id of the message is parsed
from the message body instead of the path parameter.
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: body
description: Message object to add to the store
required: true
schema:
$ref: '#/definitions/Message'
responses:
'200':
description: Exising message updated successfully
'201':
description: New message created successfully
'400':
description: Invalid input
'401':
description: Caller is not authorised to perform this operation
security:
- api_key: []
'/messages/{id}':
put:
tags:
- messages
summary: Adds or updates a Relayer message representing a blockchain event.
summary: Adds or updates a Relayer message that represents a blockchain event.
description: >-
The endpoint is used to submit (and create) a message if it does not
already exist in the store. If it does, the existing message is updated
to include the additional proof data of the submitting Relayer. Only
Relayers can add or update messages.
operationId: addOrUpdateMessage
consumes:
- application/json
produces:
Expand Down Expand Up @@ -61,7 +142,6 @@ paths:
description: >-
Returns the message object associated with the given ID, if it exists in
the store.
operationId: getMessageById
produces:
- application/json
parameters:
Expand Down Expand Up @@ -91,7 +171,6 @@ paths:
description: >-
Returns all proofs (e.g. attestations) that have been recorded for the
message with the given ID.
operationId: getProofs
produces:
- application/json
parameters:
Expand All @@ -118,7 +197,6 @@ paths:
- messages
summary: Record a new proof for message.
description: Records a new proof for the message with a given ID.
operationId: addProof
consumes:
- application/json
produces:
Expand Down Expand Up @@ -152,53 +230,6 @@ paths:
description: Validation of attestation failed
security:
- api_key: []
'/events/{networkId}/{blockNumber}/{txIndex}/{logIndex}':
get:
tags:
- events
summary: >-
Retrieve's a message that represents the blockchain event identified
with the given path parameters.
description: >-
Returns a message that represents the identified blockchain event, if
one exists. This endpoint offers a convinient way for clients that only
know identifying details of an event (and not the associated Relayer
message), to interact with messages in the store.
operationId: getEvent
produces:
- application/json
parameters:
- name: networkId
in: path
description: ID of network in which the event was generated
required: true
type: string
- name: blockNumber
in: path
description: Block number that contains this event
required: true
type: string
- name: txIndex
in: path
description: Index number within the block for the transaction that generates the event
required: true
type: string
- name: logIndex
in: path
description: Index number of the event within the block
required: true
type: string
responses:
'200':
description: Successful retrieval of associated message
schema:
$ref: '#/definitions/Message'
'400':
description: One or more invalid path parameters provided
'404':
description: Message not found
security:
- api_key: []
securityDefinitions:
api_key:
type: apiKey
Expand Down

0 comments on commit 65ed6a0

Please sign in to comment.