|
| 1 | +asyncapi: 3.0.0 |
| 2 | +id: 'urn:example:com:smartylighting:streetlights:server' |
| 3 | +info: |
| 4 | + title: AsyncAPI App |
| 5 | + version: 1.0.1 |
| 6 | + description: This is a sample app. |
| 7 | + termsOfService: 'https://asyncapi.com/terms/' |
| 8 | + contact: |
| 9 | + name: API Support |
| 10 | + url: 'https://www.asyncapi.com/support' |
| 11 | + email: support@asyncapi.org |
| 12 | + license: |
| 13 | + name: Apache 2.0 |
| 14 | + url: 'https://www.apache.org/licenses/LICENSE-2.0.html' |
| 15 | + tags: |
| 16 | + - name: e-commerce |
| 17 | + - name: another-tag |
| 18 | + description: Description... |
| 19 | + externalDocs: |
| 20 | + description: Find more info here |
| 21 | + url: 'https://www.asyncapi.com' |
| 22 | +defaultContentType: application/json |
| 23 | +servers: |
| 24 | + default: |
| 25 | + host: 'api.streetlights.smartylighting.com:{port}' |
| 26 | + protocol: mqtt |
| 27 | + description: Test broker |
| 28 | + variables: |
| 29 | + port: |
| 30 | + description: Secure connection (TLS) is available through port 8883. |
| 31 | + default: '8883' |
| 32 | + enum: |
| 33 | + - '1883' |
| 34 | + - '8883' |
| 35 | + security: |
| 36 | + - $ref: '#/components/securitySchemes/apiKey' |
| 37 | + - type: oauth2 |
| 38 | + flows: |
| 39 | + implicit: |
| 40 | + authorizationUrl: 'https://example.com/api/oauth/dialog' |
| 41 | + availableScopes: |
| 42 | + 'write:pets': modify pets in your account |
| 43 | + 'read:pets': read your pets |
| 44 | + scopes: |
| 45 | + - 'write:pets' |
| 46 | + - type: openIdConnect |
| 47 | + openIdConnectUrl: https://example.com/api |
| 48 | + scopes: |
| 49 | + - 'some:scope:1' |
| 50 | + - 'some:scope:2' |
| 51 | + production: |
| 52 | + host: 'api.streetlights.smartylighting.com:{port}' |
| 53 | + pathname: /some/path-name |
| 54 | + protocol: mqtt |
| 55 | + description: Test broker |
| 56 | + variables: |
| 57 | + port: |
| 58 | + description: Secure connection (TLS) is available through port 8883. |
| 59 | + default: '1883' |
| 60 | + enum: |
| 61 | + - '1883' |
| 62 | + - '8883' |
| 63 | + security: |
| 64 | + - $ref: '#/components/securitySchemes/apiKey' |
| 65 | + withProtocol: |
| 66 | + host: 'api.streetlights.smartylighting.com:{port}' |
| 67 | + pathname: /some/path |
| 68 | + protocol: mqtt |
| 69 | + description: Test broker |
| 70 | + variables: |
| 71 | + port: |
| 72 | + description: Secure connection (TLS) is available through port 8883. |
| 73 | + default: '1883' |
| 74 | + enum: |
| 75 | + - '1883' |
| 76 | + - '8883' |
| 77 | + security: |
| 78 | + - $ref: '#/components/securitySchemes/apiKey' |
| 79 | +channels: |
| 80 | + 'lightingMeasured': |
| 81 | + address: 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured' |
| 82 | + messages: |
| 83 | + lightMeasured: |
| 84 | + payload: |
| 85 | + type: object |
| 86 | + servers: |
| 87 | + - $ref: '#/servers/production' |
| 88 | + parameters: |
| 89 | + streetlightId: |
| 90 | + $ref: '#/components/parameters/streetlightId' |
| 91 | + 'turnOn': |
| 92 | + address: 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on' |
| 93 | + messages: |
| 94 | + lightMeasured: |
| 95 | + $ref: '#/components/messages/lightMeasured' |
| 96 | + subscribe.message.0: |
| 97 | + $ref: '#/components/messages/turnOnOff' |
| 98 | + customMessageId: |
| 99 | + payload: |
| 100 | + type: object |
| 101 | + subscribe.message.2: |
| 102 | + payload: |
| 103 | + type: object |
| 104 | + servers: |
| 105 | + - $ref: '#/servers/default' |
| 106 | + - $ref: '#/servers/production' |
| 107 | + parameters: |
| 108 | + streetlightId: |
| 109 | + $ref: '#/components/parameters/streetlightId' |
| 110 | + customChannelId: |
| 111 | + address: 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off' |
| 112 | + messages: |
| 113 | + turnOnOff: |
| 114 | + $ref: '#/components/messages/turnOnOff' |
| 115 | + parameters: |
| 116 | + streetlightId: |
| 117 | + $ref: '#/components/parameters/streetlightId' |
| 118 | + x-channelId: customChannelId |
| 119 | + 'dim': |
| 120 | + address: 'smartylighting/streetlights/1/0/action/{streetlightId}/dim' |
| 121 | + messages: |
| 122 | + dimLight: |
| 123 | + $ref: '#/components/messages/dimLight' |
| 124 | + parameters: |
| 125 | + streetlightId: |
| 126 | + $ref: '#/components/parameters/streetlightId' |
| 127 | +operations: |
| 128 | + receiveLightMeasured: |
| 129 | + action: receive |
| 130 | + channel: |
| 131 | + $ref: '#/channels/lightingMeasured' |
| 132 | + messages: |
| 133 | + - $ref: '#/channels/lightingMeasured/messages/lightMeasured' |
| 134 | + 'receiveTurnOn': |
| 135 | + action: receive |
| 136 | + channel: |
| 137 | + $ref: '#/channels/turnOn' |
| 138 | + messages: |
| 139 | + - $ref: '#/channels/turnOn/messages/lightMeasured' |
| 140 | + 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on.subscribe': |
| 141 | + action: send |
| 142 | + channel: |
| 143 | + $ref: '#/channels/turnOn' |
| 144 | + messages: |
| 145 | + - $ref: '#/channels/turnOn/messages/customMessageId' |
| 146 | + - $ref: '#/channels/turnOn/messages/subscribe.message.2' |
| 147 | + turnOnOff: |
| 148 | + action: send |
| 149 | + channel: |
| 150 | + $ref: '#/channels/customChannelId' |
| 151 | + messages: |
| 152 | + - $ref: '#/channels/customChannelId/messages/turnOnOff' |
| 153 | + dimLight: |
| 154 | + action: send |
| 155 | + channel: |
| 156 | + $ref: '#/channels/dim' |
| 157 | + security: |
| 158 | + - type: oauth2 |
| 159 | + flows: |
| 160 | + implicit: |
| 161 | + authorizationUrl: 'https://example.com/api/oauth/dialog' |
| 162 | + availableScopes: |
| 163 | + 'write:pets': modify pets in your account |
| 164 | + 'read:pets': read your pets |
| 165 | + scopes: |
| 166 | + - 'write:pets' |
| 167 | + messages: |
| 168 | + - $ref: '#/channels/dim/messages/dimLight' |
| 169 | +components: |
| 170 | + messages: |
| 171 | + lightMeasured: |
| 172 | + summary: >- |
| 173 | + Inform about environmental lighting conditions for a particular |
| 174 | + streetlight. |
| 175 | + payload: |
| 176 | + $ref: '#/components/schemas/lightMeasuredPayload' |
| 177 | + turnOnOff: |
| 178 | + summary: Command a particular streetlight to turn the lights on or off. |
| 179 | + payload: |
| 180 | + $ref: '#/components/schemas/turnOnOffPayload' |
| 181 | + dimLight: |
| 182 | + summary: Command a particular streetlight to dim the lights. |
| 183 | + payload: |
| 184 | + $ref: '#/components/schemas/dimLightPayload' |
| 185 | + schemas: |
| 186 | + lightMeasuredPayload: |
| 187 | + type: object |
| 188 | + properties: |
| 189 | + lumens: |
| 190 | + type: integer |
| 191 | + minimum: 0 |
| 192 | + description: Light intensity measured in lumens. |
| 193 | + sentAt: |
| 194 | + $ref: '#/components/schemas/sentAt' |
| 195 | + turnOnOffPayload: |
| 196 | + type: object |
| 197 | + properties: |
| 198 | + command: |
| 199 | + type: string |
| 200 | + enum: |
| 201 | + - 'on' |
| 202 | + - 'off' |
| 203 | + description: Whether to turn on or off the light. |
| 204 | + sentAt: |
| 205 | + $ref: '#/components/schemas/sentAt' |
| 206 | + dimLightPayload: |
| 207 | + type: object |
| 208 | + properties: |
| 209 | + percentage: |
| 210 | + type: integer |
| 211 | + description: Percentage to which the light should be dimmed to. |
| 212 | + minimum: 0 |
| 213 | + maximum: 100 |
| 214 | + sentAt: |
| 215 | + $ref: '#/components/schemas/sentAt' |
| 216 | + sentAt: |
| 217 | + type: string |
| 218 | + format: date-time |
| 219 | + description: Date and time when the message was sent. |
| 220 | + securitySchemes: |
| 221 | + apiKey: |
| 222 | + type: apiKey |
| 223 | + in: user |
| 224 | + description: Provide your API key as the user and leave the password empty. |
| 225 | + flows: |
| 226 | + type: oauth2 |
| 227 | + flows: |
| 228 | + implicit: |
| 229 | + authorizationUrl: 'https://example.com/api/oauth/dialog' |
| 230 | + availableScopes: |
| 231 | + 'write:pets': modify pets in your account |
| 232 | + 'read:pets': read your pets |
| 233 | + openIdConnect: |
| 234 | + type: openIdConnect |
| 235 | + openIdConnectUrl: https://example.com/api |
| 236 | + scopes: |
| 237 | + - 'some:scope:1' |
| 238 | + - 'some:scope:2' |
| 239 | + unusedFlows: |
| 240 | + type: oauth2 |
| 241 | + flows: |
| 242 | + implicit: |
| 243 | + authorizationUrl: 'https://example.com/api/oauth/dialog' |
| 244 | + availableScopes: |
| 245 | + 'write:pets': modify pets in your account |
| 246 | + 'read:pets': read your pets |
| 247 | + parameters: |
| 248 | + streetlightId: |
| 249 | + description: The ID of the streetlight. |
0 commit comments