Created
October 25, 2022 06:01
-
-
Save akaegi/d9d3c9856c813a50ba51445ccc521114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# | |
# | |
# This example showcases usage of AsyncAPI for the purpose of describing a WebSocket API. It is based on a real public service maintained by company called Gemini that provides cryptocurency trading products. It uses AsyncAPI bindings. | |
# | |
# This AsyncAPI document describes their v1 of the API. The v2 is also available and changes in the way that it provides a multimessage channel, where you subscribe for messages by sending a subscription message instead of using query parameters. For example with multimessage channel check out this article https://www.asyncapi.com/blog/websocket-part2 about another real public API called Kraken | |
# | |
# All available learning materials about AsyncAPI and WebSocket are: | |
# - WebSocket, Shrek, and AsyncAPI - An Opinionated Intro article: https://www.asyncapi.com/blog/websocket-part1 | |
# - Creating AsyncAPI for WebSocket API - Step by Step article: https://www.asyncapi.com/blog/websocket-part2 | |
# - From API-First to Code Generation - A WebSocket Use Case article: https://www.asyncapi.com/blog/websocket-part3 | |
# - Live stream about topics mentioned in part 1 and 2 articles: https://www.youtube.com/watch?v=8tFBcf31e_c | |
# | |
asyncapi: '2.5.0' | |
# | |
# Overal information for users of the application | |
# | |
info: | |
title: PAL Datapoint *Client* API | |
version: '0.0.1' | |
description: PAL Datapoint API from the view-point of a client. | |
# | |
# Details on how to connect to the application | |
# | |
servers: | |
public: | |
url: wss://api.gemini.com | |
protocol: wss | |
# | |
# Details about all the channels that you can listen to or send to messages | |
# | |
channels: | |
/datapointvaluehub: | |
# A definition of the SUBSCRIBE operation, which defines the messages produced by the application and sent to the channel. | |
# (3.0.0 prelease operation action "send") | |
subscribe: | |
message: | |
oneOf: | |
- $ref: '#/components/messages/registerDatapoint' | |
- $ref: '#/components/messages/unregisterDatapoint' | |
# A definition of the PUBLISH operation, which defines the messages consumed by the application from the channel. | |
# (3.0.0 prelease operation action "receive") | |
publish: | |
message: | |
oneOf: | |
- $ref: '#/components/messages/syncDatapointValues' | |
components: | |
messages: | |
registerDatapoint: | |
summary: Register for changes on a datapoint | |
messageId: RegisterDatapoint | |
payload: | |
$ref: '#/components/schemas/DatapointId' | |
unregisterDatapoint: | |
summary: Unregister for changes on a datapoint | |
messageId: UnregisterDatapoint | |
payload: | |
$ref: '#/components/schemas/DatapointId' | |
syncDatapointValues: | |
summary: Receives a list of new datapoint values | |
messageId: SyncDatapointValues | |
payload: | |
type: array | |
items: | |
$ref: '#/components/schemas/DatapointValue' | |
schemas: | |
DatapointValue: | |
type: object | |
properties: | |
id: | |
$ref: '#/components/schemas/DatapointId' | |
value: | |
type: object | |
DatapointId: | |
type: string | |
format: uuid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment