@asyncapi/cli 0.8.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -47
- package/assets/examples/anyof.yml +31 -0
- package/assets/examples/application-headers.yml +83 -0
- package/assets/examples/correlation-id.yml +144 -0
- package/assets/examples/default-example.yaml +23 -0
- package/assets/examples/examples.json +58 -0
- package/assets/examples/gitter-streaming.yml +164 -0
- package/assets/examples/mercure.yml +49 -0
- package/assets/examples/not.yml +24 -0
- package/assets/examples/oneof.yml +46 -0
- package/assets/examples/rpc-client.yml +69 -0
- package/assets/examples/rpc-server.yml +66 -0
- package/assets/examples/simple.yml +23 -0
- package/assets/examples/slack-rtm.yml +884 -0
- package/assets/examples/streetlights-kafka.yml +163 -0
- package/assets/examples/streetlights-mqtt.yml +209 -0
- package/assets/examples/websocket-gemini.yml +213 -0
- package/lib/base.js +2 -1
- package/lib/commands/config/context/add.js +2 -1
- package/lib/commands/config/context/current.js +2 -1
- package/lib/commands/config/context/list.js +2 -1
- package/lib/commands/config/context/remove.js +2 -1
- package/lib/commands/config/context/use.js +2 -1
- package/lib/commands/config/context.js +2 -1
- package/lib/commands/config.js +2 -1
- package/lib/commands/new.d.ts +17 -0
- package/lib/commands/new.js +126 -0
- package/lib/commands/start/studio.d.ts +12 -0
- package/lib/commands/start/studio.js +23 -0
- package/lib/commands/validate.js +3 -2
- package/lib/errors/specification-file.d.ts +1 -1
- package/lib/errors/specification-file.js +6 -1
- package/lib/models/Context.js +8 -7
- package/lib/models/SpecificationFile.js +16 -8
- package/lib/models/Studio.d.ts +2 -0
- package/lib/models/Studio.js +110 -0
- package/oclif.manifest.json +1 -1
- package/package.json +16 -12
- package/lib/help/command.d.ts +0 -5
- package/lib/help/command.js +0 -58
- package/lib/help/index.d.ts +0 -8
- package/lib/help/index.js +0 -49
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
asyncapi: '2.2.0'
|
|
2
|
+
info:
|
|
3
|
+
title: Streetlights Kafka API
|
|
4
|
+
version: '1.0.0'
|
|
5
|
+
description: |
|
|
6
|
+
The Smartylighting Streetlights API allows you to remotely manage the city lights.
|
|
7
|
+
|
|
8
|
+
### Check out its awesome features:
|
|
9
|
+
|
|
10
|
+
* Turn a specific streetlight on/off 🌃
|
|
11
|
+
* Dim a specific streetlight 😎
|
|
12
|
+
* Receive real-time information about environmental lighting conditions 📈
|
|
13
|
+
license:
|
|
14
|
+
name: Apache 2.0
|
|
15
|
+
url: https://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
|
|
17
|
+
servers:
|
|
18
|
+
test:
|
|
19
|
+
url: test.mykafkacluster.org:8092
|
|
20
|
+
protocol: kafka-secure
|
|
21
|
+
description: Test broker
|
|
22
|
+
security:
|
|
23
|
+
- saslScram: []
|
|
24
|
+
|
|
25
|
+
defaultContentType: application/json
|
|
26
|
+
|
|
27
|
+
channels:
|
|
28
|
+
smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured:
|
|
29
|
+
description: The topic on which measured values may be produced and consumed.
|
|
30
|
+
parameters:
|
|
31
|
+
streetlightId:
|
|
32
|
+
$ref: '#/components/parameters/streetlightId'
|
|
33
|
+
publish:
|
|
34
|
+
summary: Inform about environmental lighting conditions of a particular streetlight.
|
|
35
|
+
operationId: receiveLightMeasurement
|
|
36
|
+
traits:
|
|
37
|
+
- $ref: '#/components/operationTraits/kafka'
|
|
38
|
+
message:
|
|
39
|
+
$ref: '#/components/messages/lightMeasured'
|
|
40
|
+
|
|
41
|
+
smartylighting.streetlights.1.0.action.{streetlightId}.turn.on:
|
|
42
|
+
parameters:
|
|
43
|
+
streetlightId:
|
|
44
|
+
$ref: '#/components/parameters/streetlightId'
|
|
45
|
+
subscribe:
|
|
46
|
+
operationId: turnOn
|
|
47
|
+
traits:
|
|
48
|
+
- $ref: '#/components/operationTraits/kafka'
|
|
49
|
+
message:
|
|
50
|
+
$ref: '#/components/messages/turnOnOff'
|
|
51
|
+
|
|
52
|
+
smartylighting.streetlights.1.0.action.{streetlightId}.turn.off:
|
|
53
|
+
parameters:
|
|
54
|
+
streetlightId:
|
|
55
|
+
$ref: '#/components/parameters/streetlightId'
|
|
56
|
+
subscribe:
|
|
57
|
+
operationId: turnOff
|
|
58
|
+
traits:
|
|
59
|
+
- $ref: '#/components/operationTraits/kafka'
|
|
60
|
+
message:
|
|
61
|
+
$ref: '#/components/messages/turnOnOff'
|
|
62
|
+
|
|
63
|
+
smartylighting.streetlights.1.0.action.{streetlightId}.dim:
|
|
64
|
+
parameters:
|
|
65
|
+
streetlightId:
|
|
66
|
+
$ref: '#/components/parameters/streetlightId'
|
|
67
|
+
subscribe:
|
|
68
|
+
operationId: dimLight
|
|
69
|
+
traits:
|
|
70
|
+
- $ref: '#/components/operationTraits/kafka'
|
|
71
|
+
message:
|
|
72
|
+
$ref: '#/components/messages/dimLight'
|
|
73
|
+
|
|
74
|
+
components:
|
|
75
|
+
messages:
|
|
76
|
+
lightMeasured:
|
|
77
|
+
name: lightMeasured
|
|
78
|
+
title: Light measured
|
|
79
|
+
summary: Inform about environmental lighting conditions of a particular streetlight.
|
|
80
|
+
contentType: application/json
|
|
81
|
+
traits:
|
|
82
|
+
- $ref: '#/components/messageTraits/commonHeaders'
|
|
83
|
+
payload:
|
|
84
|
+
$ref: "#/components/schemas/lightMeasuredPayload"
|
|
85
|
+
turnOnOff:
|
|
86
|
+
name: turnOnOff
|
|
87
|
+
title: Turn on/off
|
|
88
|
+
summary: Command a particular streetlight to turn the lights on or off.
|
|
89
|
+
traits:
|
|
90
|
+
- $ref: '#/components/messageTraits/commonHeaders'
|
|
91
|
+
payload:
|
|
92
|
+
$ref: "#/components/schemas/turnOnOffPayload"
|
|
93
|
+
dimLight:
|
|
94
|
+
name: dimLight
|
|
95
|
+
title: Dim light
|
|
96
|
+
summary: Command a particular streetlight to dim the lights.
|
|
97
|
+
traits:
|
|
98
|
+
- $ref: '#/components/messageTraits/commonHeaders'
|
|
99
|
+
payload:
|
|
100
|
+
$ref: "#/components/schemas/dimLightPayload"
|
|
101
|
+
|
|
102
|
+
schemas:
|
|
103
|
+
lightMeasuredPayload:
|
|
104
|
+
type: object
|
|
105
|
+
properties:
|
|
106
|
+
lumens:
|
|
107
|
+
type: integer
|
|
108
|
+
minimum: 0
|
|
109
|
+
description: Light intensity measured in lumens.
|
|
110
|
+
sentAt:
|
|
111
|
+
$ref: "#/components/schemas/sentAt"
|
|
112
|
+
turnOnOffPayload:
|
|
113
|
+
type: object
|
|
114
|
+
properties:
|
|
115
|
+
command:
|
|
116
|
+
type: string
|
|
117
|
+
enum:
|
|
118
|
+
- on
|
|
119
|
+
- off
|
|
120
|
+
description: Whether to turn on or off the light.
|
|
121
|
+
sentAt:
|
|
122
|
+
$ref: "#/components/schemas/sentAt"
|
|
123
|
+
dimLightPayload:
|
|
124
|
+
type: object
|
|
125
|
+
properties:
|
|
126
|
+
percentage:
|
|
127
|
+
type: integer
|
|
128
|
+
description: Percentage to which the light should be dimmed to.
|
|
129
|
+
minimum: 0
|
|
130
|
+
maximum: 100
|
|
131
|
+
sentAt:
|
|
132
|
+
$ref: "#/components/schemas/sentAt"
|
|
133
|
+
sentAt:
|
|
134
|
+
type: string
|
|
135
|
+
format: date-time
|
|
136
|
+
description: Date and time when the message was sent.
|
|
137
|
+
|
|
138
|
+
securitySchemes:
|
|
139
|
+
saslScram:
|
|
140
|
+
type: scramSha256
|
|
141
|
+
description: Provide your username and password for SASL/SCRAM authentication
|
|
142
|
+
|
|
143
|
+
parameters:
|
|
144
|
+
streetlightId:
|
|
145
|
+
description: The ID of the streetlight.
|
|
146
|
+
schema:
|
|
147
|
+
type: string
|
|
148
|
+
|
|
149
|
+
messageTraits:
|
|
150
|
+
commonHeaders:
|
|
151
|
+
headers:
|
|
152
|
+
type: object
|
|
153
|
+
properties:
|
|
154
|
+
my-app-header:
|
|
155
|
+
type: integer
|
|
156
|
+
minimum: 0
|
|
157
|
+
maximum: 100
|
|
158
|
+
|
|
159
|
+
operationTraits:
|
|
160
|
+
kafka:
|
|
161
|
+
bindings:
|
|
162
|
+
kafka:
|
|
163
|
+
clientId: my-app-id
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
asyncapi: '2.2.0'
|
|
2
|
+
info:
|
|
3
|
+
title: Streetlights MQTT API
|
|
4
|
+
version: '1.0.0'
|
|
5
|
+
description: |
|
|
6
|
+
The Smartylighting Streetlights API allows you to remotely manage the city lights.
|
|
7
|
+
|
|
8
|
+
### Check out its awesome features:
|
|
9
|
+
|
|
10
|
+
* Turn a specific streetlight on/off 🌃
|
|
11
|
+
* Dim a specific streetlight 😎
|
|
12
|
+
* Receive real-time information about environmental lighting conditions 📈
|
|
13
|
+
license:
|
|
14
|
+
name: Apache 2.0
|
|
15
|
+
url: https://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
|
|
17
|
+
servers:
|
|
18
|
+
production:
|
|
19
|
+
url: test.mosquitto.org:{port}
|
|
20
|
+
protocol: mqtt
|
|
21
|
+
description: Test broker
|
|
22
|
+
variables:
|
|
23
|
+
port:
|
|
24
|
+
description: Secure connection (TLS) is available through port 8883.
|
|
25
|
+
default: '1883'
|
|
26
|
+
enum:
|
|
27
|
+
- '1883'
|
|
28
|
+
- '8883'
|
|
29
|
+
security:
|
|
30
|
+
- apiKey: []
|
|
31
|
+
- supportedOauthFlows:
|
|
32
|
+
- streetlights:on
|
|
33
|
+
- streetlights:off
|
|
34
|
+
- streetlights:dim
|
|
35
|
+
- openIdConnectWellKnown: []
|
|
36
|
+
|
|
37
|
+
defaultContentType: application/json
|
|
38
|
+
|
|
39
|
+
channels:
|
|
40
|
+
smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured:
|
|
41
|
+
description: The topic on which measured values may be produced and consumed.
|
|
42
|
+
parameters:
|
|
43
|
+
streetlightId:
|
|
44
|
+
$ref: '#/components/parameters/streetlightId'
|
|
45
|
+
publish:
|
|
46
|
+
summary: Inform about environmental lighting conditions of a particular streetlight.
|
|
47
|
+
operationId: receiveLightMeasurement
|
|
48
|
+
traits:
|
|
49
|
+
- $ref: '#/components/operationTraits/mqtt'
|
|
50
|
+
message:
|
|
51
|
+
$ref: '#/components/messages/lightMeasured'
|
|
52
|
+
|
|
53
|
+
smartylighting/streetlights/1/0/action/{streetlightId}/turn/on:
|
|
54
|
+
parameters:
|
|
55
|
+
streetlightId:
|
|
56
|
+
$ref: '#/components/parameters/streetlightId'
|
|
57
|
+
subscribe:
|
|
58
|
+
operationId: turnOn
|
|
59
|
+
traits:
|
|
60
|
+
- $ref: '#/components/operationTraits/mqtt'
|
|
61
|
+
message:
|
|
62
|
+
$ref: '#/components/messages/turnOnOff'
|
|
63
|
+
|
|
64
|
+
smartylighting/streetlights/1/0/action/{streetlightId}/turn/off:
|
|
65
|
+
parameters:
|
|
66
|
+
streetlightId:
|
|
67
|
+
$ref: '#/components/parameters/streetlightId'
|
|
68
|
+
subscribe:
|
|
69
|
+
operationId: turnOff
|
|
70
|
+
traits:
|
|
71
|
+
- $ref: '#/components/operationTraits/mqtt'
|
|
72
|
+
message:
|
|
73
|
+
$ref: '#/components/messages/turnOnOff'
|
|
74
|
+
|
|
75
|
+
smartylighting/streetlights/1/0/action/{streetlightId}/dim:
|
|
76
|
+
parameters:
|
|
77
|
+
streetlightId:
|
|
78
|
+
$ref: '#/components/parameters/streetlightId'
|
|
79
|
+
subscribe:
|
|
80
|
+
operationId: dimLight
|
|
81
|
+
traits:
|
|
82
|
+
- $ref: '#/components/operationTraits/mqtt'
|
|
83
|
+
message:
|
|
84
|
+
$ref: '#/components/messages/dimLight'
|
|
85
|
+
|
|
86
|
+
components:
|
|
87
|
+
messages:
|
|
88
|
+
lightMeasured:
|
|
89
|
+
name: lightMeasured
|
|
90
|
+
title: Light measured
|
|
91
|
+
summary: Inform about environmental lighting conditions of a particular streetlight.
|
|
92
|
+
contentType: application/json
|
|
93
|
+
traits:
|
|
94
|
+
- $ref: '#/components/messageTraits/commonHeaders'
|
|
95
|
+
payload:
|
|
96
|
+
$ref: "#/components/schemas/lightMeasuredPayload"
|
|
97
|
+
turnOnOff:
|
|
98
|
+
name: turnOnOff
|
|
99
|
+
title: Turn on/off
|
|
100
|
+
summary: Command a particular streetlight to turn the lights on or off.
|
|
101
|
+
traits:
|
|
102
|
+
- $ref: '#/components/messageTraits/commonHeaders'
|
|
103
|
+
payload:
|
|
104
|
+
$ref: "#/components/schemas/turnOnOffPayload"
|
|
105
|
+
dimLight:
|
|
106
|
+
name: dimLight
|
|
107
|
+
title: Dim light
|
|
108
|
+
summary: Command a particular streetlight to dim the lights.
|
|
109
|
+
traits:
|
|
110
|
+
- $ref: '#/components/messageTraits/commonHeaders'
|
|
111
|
+
payload:
|
|
112
|
+
$ref: "#/components/schemas/dimLightPayload"
|
|
113
|
+
|
|
114
|
+
schemas:
|
|
115
|
+
lightMeasuredPayload:
|
|
116
|
+
type: object
|
|
117
|
+
properties:
|
|
118
|
+
lumens:
|
|
119
|
+
type: integer
|
|
120
|
+
minimum: 0
|
|
121
|
+
description: Light intensity measured in lumens.
|
|
122
|
+
sentAt:
|
|
123
|
+
$ref: "#/components/schemas/sentAt"
|
|
124
|
+
turnOnOffPayload:
|
|
125
|
+
type: object
|
|
126
|
+
properties:
|
|
127
|
+
command:
|
|
128
|
+
type: string
|
|
129
|
+
enum:
|
|
130
|
+
- on
|
|
131
|
+
- off
|
|
132
|
+
description: Whether to turn on or off the light.
|
|
133
|
+
sentAt:
|
|
134
|
+
$ref: "#/components/schemas/sentAt"
|
|
135
|
+
dimLightPayload:
|
|
136
|
+
type: object
|
|
137
|
+
properties:
|
|
138
|
+
percentage:
|
|
139
|
+
type: integer
|
|
140
|
+
description: Percentage to which the light should be dimmed to.
|
|
141
|
+
minimum: 0
|
|
142
|
+
maximum: 100
|
|
143
|
+
sentAt:
|
|
144
|
+
$ref: "#/components/schemas/sentAt"
|
|
145
|
+
sentAt:
|
|
146
|
+
type: string
|
|
147
|
+
format: date-time
|
|
148
|
+
description: Date and time when the message was sent.
|
|
149
|
+
|
|
150
|
+
securitySchemes:
|
|
151
|
+
apiKey:
|
|
152
|
+
type: apiKey
|
|
153
|
+
in: user
|
|
154
|
+
description: Provide your API key as the user and leave the password empty.
|
|
155
|
+
supportedOauthFlows:
|
|
156
|
+
type: oauth2
|
|
157
|
+
description: Flows to support OAuth 2.0
|
|
158
|
+
flows:
|
|
159
|
+
implicit:
|
|
160
|
+
authorizationUrl: 'https://authserver.example/auth'
|
|
161
|
+
scopes:
|
|
162
|
+
'streetlights:on': Ability to switch lights on
|
|
163
|
+
'streetlights:off': Ability to switch lights off
|
|
164
|
+
'streetlights:dim': Ability to dim the lights
|
|
165
|
+
password:
|
|
166
|
+
tokenUrl: 'https://authserver.example/token'
|
|
167
|
+
scopes:
|
|
168
|
+
'streetlights:on': Ability to switch lights on
|
|
169
|
+
'streetlights:off': Ability to switch lights off
|
|
170
|
+
'streetlights:dim': Ability to dim the lights
|
|
171
|
+
clientCredentials:
|
|
172
|
+
tokenUrl: 'https://authserver.example/token'
|
|
173
|
+
scopes:
|
|
174
|
+
'streetlights:on': Ability to switch lights on
|
|
175
|
+
'streetlights:off': Ability to switch lights off
|
|
176
|
+
'streetlights:dim': Ability to dim the lights
|
|
177
|
+
authorizationCode:
|
|
178
|
+
authorizationUrl: 'https://authserver.example/auth'
|
|
179
|
+
tokenUrl: 'https://authserver.example/token'
|
|
180
|
+
refreshUrl: 'https://authserver.example/refresh'
|
|
181
|
+
scopes:
|
|
182
|
+
'streetlights:on': Ability to switch lights on
|
|
183
|
+
'streetlights:off': Ability to switch lights off
|
|
184
|
+
'streetlights:dim': Ability to dim the lights
|
|
185
|
+
openIdConnectWellKnown:
|
|
186
|
+
type: openIdConnect
|
|
187
|
+
openIdConnectUrl: 'https://authserver.example/.well-known'
|
|
188
|
+
|
|
189
|
+
parameters:
|
|
190
|
+
streetlightId:
|
|
191
|
+
description: The ID of the streetlight.
|
|
192
|
+
schema:
|
|
193
|
+
type: string
|
|
194
|
+
|
|
195
|
+
messageTraits:
|
|
196
|
+
commonHeaders:
|
|
197
|
+
headers:
|
|
198
|
+
type: object
|
|
199
|
+
properties:
|
|
200
|
+
my-app-header:
|
|
201
|
+
type: integer
|
|
202
|
+
minimum: 0
|
|
203
|
+
maximum: 100
|
|
204
|
+
|
|
205
|
+
operationTraits:
|
|
206
|
+
mqtt:
|
|
207
|
+
bindings:
|
|
208
|
+
mqtt:
|
|
209
|
+
qos: 1
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
#
|
|
2
|
+
#
|
|
3
|
+
#
|
|
4
|
+
# 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.
|
|
5
|
+
#
|
|
6
|
+
# 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
|
|
7
|
+
#
|
|
8
|
+
# All available learning materials about AsyncAPI and WebSocket are:
|
|
9
|
+
# - WebSocket, Shrek, and AsyncAPI - An Opinionated Intro article: https://www.asyncapi.com/blog/websocket-part1
|
|
10
|
+
# - Creating AsyncAPI for WebSocket API - Step by Step article: https://www.asyncapi.com/blog/websocket-part2
|
|
11
|
+
# - From API-First to Code Generation - A WebSocket Use Case article: https://www.asyncapi.com/blog/websocket-part3
|
|
12
|
+
# - Live stream about topics mentioned in part 1 and 2 articles: https://www.youtube.com/watch?v=8tFBcf31e_c
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
asyncapi: '2.2.0'
|
|
16
|
+
|
|
17
|
+
#
|
|
18
|
+
# Overal information for users of the application
|
|
19
|
+
#
|
|
20
|
+
info:
|
|
21
|
+
title: Gemini Market Data Websocket API
|
|
22
|
+
version: '1.0.0'
|
|
23
|
+
contact:
|
|
24
|
+
name: Gemini
|
|
25
|
+
url: https://www.gemini.com/
|
|
26
|
+
description: |
|
|
27
|
+
Market data is a public API that streams all the market data on a given symbol.
|
|
28
|
+
|
|
29
|
+
You can quickly play with the API using [websocat](https://github.com/vi/websocat#installation) like this:
|
|
30
|
+
```bash
|
|
31
|
+
websocat wss://api.gemini.com/v1/marketdata/btcusd?heartbeat=true -S
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# Link to external docs
|
|
36
|
+
#
|
|
37
|
+
externalDocs:
|
|
38
|
+
url: https://docs.sandbox.gemini.com/websocket-api/#market-data
|
|
39
|
+
|
|
40
|
+
#
|
|
41
|
+
# Details on how to connect to the application
|
|
42
|
+
#
|
|
43
|
+
servers:
|
|
44
|
+
public:
|
|
45
|
+
url: wss://api.gemini.com
|
|
46
|
+
protocol: wss
|
|
47
|
+
|
|
48
|
+
#
|
|
49
|
+
# Details about all the channels that you can listen to or send to messages
|
|
50
|
+
#
|
|
51
|
+
channels:
|
|
52
|
+
/v1/marketdata/{symbol}:
|
|
53
|
+
parameters:
|
|
54
|
+
symbol:
|
|
55
|
+
description: |
|
|
56
|
+
Symbols are formatted as CCY1CCY2 where prices are in CCY2 and quantities are in CCY1. To read more click [here](https://docs.sandbox.gemini.com/websocket-api/#symbols-and-minimums).
|
|
57
|
+
schema:
|
|
58
|
+
type: string
|
|
59
|
+
enum: ['btcusd', 'ethbtc', 'ethusd', 'zecusd', 'zecbtc', 'zeceth', 'zecbch', 'zecltc', 'bchusd', 'bchbtc', 'bcheth', 'ltcusd', 'ltcbtc', 'ltceth', 'ltcbch', 'batusd', 'daiusd', 'linkusd', 'oxtusd', 'batbtc', 'linkbtc', 'oxtbtc', 'bateth', 'linketh', 'oxteth', 'ampusd', 'compusd', 'paxgusd', 'mkrusd', 'zrxusd', 'kncusd', 'manausd', 'storjusd', 'snxusd', 'crvusd', 'balusd', 'uniusd', 'renusd', 'umausd', 'yfiusd', 'btcdai', 'ethdai', 'aaveusd', 'filusd', 'btceur', 'btcgbp', 'etheur', 'ethgbp', 'btcsgd', 'ethsgd', 'sklusd', 'grtusd', 'bntusd', '1inchusd', 'enjusd', 'lrcusd', 'sandusd', 'cubeusd', 'lptusd', 'bondusd', 'maticusd', 'injusd', 'sushiusd']
|
|
60
|
+
bindings:
|
|
61
|
+
ws:
|
|
62
|
+
bindingVersion: 0.1.0
|
|
63
|
+
query:
|
|
64
|
+
type: object
|
|
65
|
+
description: |
|
|
66
|
+
The semantics of entry type filtering is:
|
|
67
|
+
|
|
68
|
+
If any entry type is specified as true or false, all of them must be explicitly flagged true to show up in the response
|
|
69
|
+
If no entry types filtering parameters are included in the url, then all entry types will appear in the response
|
|
70
|
+
|
|
71
|
+
NOTE: top_of_book has no meaning and initial book events are empty when only trades is specified
|
|
72
|
+
properties:
|
|
73
|
+
heartbeat:
|
|
74
|
+
type: boolean
|
|
75
|
+
default: false
|
|
76
|
+
description: Optionally add this parameter and set to true to receive a heartbeat every 5 seconds
|
|
77
|
+
top_of_book:
|
|
78
|
+
type: boolean
|
|
79
|
+
default: false
|
|
80
|
+
description: If absent or false, receive full order book depth; if present and true, receive top of book only. Only applies to bids and offers.
|
|
81
|
+
bids:
|
|
82
|
+
type: boolean
|
|
83
|
+
default: true
|
|
84
|
+
description: Include bids in change events
|
|
85
|
+
offers:
|
|
86
|
+
type: boolean
|
|
87
|
+
default: true
|
|
88
|
+
description: Include asks in change events
|
|
89
|
+
trades:
|
|
90
|
+
type: boolean
|
|
91
|
+
default: true
|
|
92
|
+
description: Include trade events
|
|
93
|
+
auctions:
|
|
94
|
+
type: boolean
|
|
95
|
+
default: true
|
|
96
|
+
description: Include auction events
|
|
97
|
+
subscribe:
|
|
98
|
+
summary: Receive market updates on a given symbol
|
|
99
|
+
message:
|
|
100
|
+
$ref: '#/components/messages/marketData'
|
|
101
|
+
|
|
102
|
+
#
|
|
103
|
+
# All reusable parts for readability and staying DRY
|
|
104
|
+
#
|
|
105
|
+
components:
|
|
106
|
+
messages:
|
|
107
|
+
marketData:
|
|
108
|
+
summary: Message with marked data information.
|
|
109
|
+
description: |
|
|
110
|
+
The initial response message will show the existing state of the order book. Subsequent messages will show all executed trades, as well as all other changes to the order book from orders placed or canceled.
|
|
111
|
+
payload:
|
|
112
|
+
$ref: '#/components/schemas/market'
|
|
113
|
+
examples:
|
|
114
|
+
- name: updateMessage
|
|
115
|
+
summary: Example of an update message that contains a change in price information.
|
|
116
|
+
payload:
|
|
117
|
+
type: update
|
|
118
|
+
eventId: 36902233362
|
|
119
|
+
timestamp: 1619769673
|
|
120
|
+
timestampms: 1619769673527
|
|
121
|
+
socket_sequence: 661
|
|
122
|
+
events:
|
|
123
|
+
- type: change
|
|
124
|
+
side: bid
|
|
125
|
+
price: '54350.40'
|
|
126
|
+
remaining: '0.002'
|
|
127
|
+
delta: '0.002'
|
|
128
|
+
reason: place
|
|
129
|
+
- name: heartbeatMessage
|
|
130
|
+
summary: Example of additional heartbeat message when you enable them.
|
|
131
|
+
payload:
|
|
132
|
+
type: heartbeat
|
|
133
|
+
socket_sequence: 1656
|
|
134
|
+
schemas:
|
|
135
|
+
market:
|
|
136
|
+
type: object
|
|
137
|
+
oneOf:
|
|
138
|
+
- $ref: '#/components/schemas/heartbeat'
|
|
139
|
+
- $ref: '#/components/schemas/update'
|
|
140
|
+
heartbeat:
|
|
141
|
+
allOf:
|
|
142
|
+
- properties:
|
|
143
|
+
type:
|
|
144
|
+
type: string
|
|
145
|
+
const: heartbeat
|
|
146
|
+
required:
|
|
147
|
+
- type
|
|
148
|
+
- $ref: '#/components/schemas/default'
|
|
149
|
+
update:
|
|
150
|
+
allOf:
|
|
151
|
+
- properties:
|
|
152
|
+
type:
|
|
153
|
+
type: string
|
|
154
|
+
const: update
|
|
155
|
+
eventId:
|
|
156
|
+
type: integer
|
|
157
|
+
description: A monotonically increasing sequence number indicating when this change occurred. These numbers are persistent and consistent between market data connections.
|
|
158
|
+
events:
|
|
159
|
+
$ref: '#/components/schemas/events'
|
|
160
|
+
timestamp:
|
|
161
|
+
type: string
|
|
162
|
+
format: date-time
|
|
163
|
+
description: The timestamp in seconds for this group of events (included for compatibility reasons). We recommend using the timestampms field instead.
|
|
164
|
+
timestampms:
|
|
165
|
+
type: string
|
|
166
|
+
format: time
|
|
167
|
+
description: The timestamp in milliseconds for this group of events.
|
|
168
|
+
required:
|
|
169
|
+
- type
|
|
170
|
+
- eventId
|
|
171
|
+
- events
|
|
172
|
+
- timestamp
|
|
173
|
+
- timestampms
|
|
174
|
+
- $ref: '#/components/schemas/default'
|
|
175
|
+
default:
|
|
176
|
+
type: object
|
|
177
|
+
description: This object is always part of the payload. In case of type=heartbeat, these are the only fields.
|
|
178
|
+
required:
|
|
179
|
+
- type
|
|
180
|
+
- socket_sequence
|
|
181
|
+
properties:
|
|
182
|
+
socket_sequence:
|
|
183
|
+
type: integer
|
|
184
|
+
description: zero-indexed monotonic increasing sequence number attached to each message sent - if there is a gap in this sequence, you have missed a message. If you choose to enable heartbeats, then heartbeat and update messages will share a single increasing sequence. See [Sequence Numbers](https://docs.sandbox.gemini.com/websocket-api/#sequence-numbers) for more information.
|
|
185
|
+
events:
|
|
186
|
+
type: array
|
|
187
|
+
description: Either a change to the order book, or the indication that a trade has occurred.
|
|
188
|
+
items:
|
|
189
|
+
type: object
|
|
190
|
+
additionalProperties: false
|
|
191
|
+
properties:
|
|
192
|
+
type:
|
|
193
|
+
type: string
|
|
194
|
+
enum: ['trade', 'change', 'auction, block_trade']
|
|
195
|
+
price:
|
|
196
|
+
type: number
|
|
197
|
+
multipleOf: 1.000
|
|
198
|
+
description: The price of this order book entry.
|
|
199
|
+
side:
|
|
200
|
+
type: string
|
|
201
|
+
enum: ['bid', 'side']
|
|
202
|
+
reason:
|
|
203
|
+
type: string
|
|
204
|
+
enum: ['place', 'trade', 'cancel', 'initial']
|
|
205
|
+
description: Indicates why the change has occurred. initial is for the initial response message, which will show the entire existing state of the order book.
|
|
206
|
+
remaining:
|
|
207
|
+
type: number
|
|
208
|
+
multipleOf: 1.000
|
|
209
|
+
description: The quantity remaining at that price level after this change occurred. May be zero if all orders at this price level have been filled or canceled.
|
|
210
|
+
delta:
|
|
211
|
+
type: number
|
|
212
|
+
multipleOf: 1.000
|
|
213
|
+
description: The quantity changed. May be negative, if an order is filled or canceled. For initial messages, delta will equal remaining.
|
package/lib/base.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const command_1 = tslib_1.__importDefault(require("@oclif/command"));
|
|
4
5
|
class default_1 extends command_1.default {
|
|
5
6
|
async catch(e) {
|
|
6
7
|
console.error(`${e.name}: ${e.message}`);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const base_1 = require("../../../base");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
5
6
|
const Context_1 = require("../../../models/Context");
|
|
6
7
|
class ContextAdd extends base_1.default {
|
|
7
8
|
async run() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const base_1 = require("../../../base");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
5
6
|
const Context_1 = require("../../../models/Context");
|
|
6
7
|
class ContextCurrent extends base_1.default {
|
|
7
8
|
async run() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const base_1 = require("../../../base");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
5
6
|
const Context_1 = require("../../../models/Context");
|
|
6
7
|
class ContextList extends base_1.default {
|
|
7
8
|
async run() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const base_1 = require("../../../base");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
5
6
|
const Context_1 = require("../../../models/Context");
|
|
6
7
|
class ContextRemove extends base_1.default {
|
|
7
8
|
async run() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const base_1 = require("../../../base");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../../base"));
|
|
5
6
|
const Context_1 = require("../../../models/Context");
|
|
6
7
|
class ContextUse extends base_1.default {
|
|
7
8
|
async run() {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
const command_1 = require("@oclif/command");
|
|
4
|
-
const base_1 = require("../../base");
|
|
5
|
+
const base_1 = tslib_1.__importDefault(require("../../base"));
|
|
5
6
|
class ConfigContext extends base_1.default {
|
|
6
7
|
async run() {
|
|
7
8
|
await this._help();
|
package/lib/commands/config.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Config = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const command_1 = require("@oclif/command");
|
|
5
|
-
const base_1 = require("../base");
|
|
6
|
+
const base_1 = tslib_1.__importDefault(require("../base"));
|
|
6
7
|
class Config extends base_1.default {
|
|
7
8
|
async run() {
|
|
8
9
|
await this._help();
|