|
| 1 | +asyncapi: 2.0.0 |
| 2 | +info: |
| 3 | + title: Streetlights 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: api.streetlights.smartylighting.com:{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 | + subscribe: |
| 46 | + summary: Receive information about environmental lighting conditions of a particular streetlight. |
| 47 | + operationId: receiveLightMeasurement |
| 48 | + traits: |
| 49 | + - $ref: '#/components/operationTraits/kafka' |
| 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 | + publish: |
| 58 | + operationId: turnOn |
| 59 | + traits: |
| 60 | + - $ref: '#/components/operationTraits/kafka' |
| 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 | + publish: |
| 69 | + operationId: turnOff |
| 70 | + traits: |
| 71 | + - $ref: '#/components/operationTraits/kafka' |
| 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 | + publish: |
| 80 | + operationId: dimLight |
| 81 | + traits: |
| 82 | + - $ref: '#/components/operationTraits/kafka' |
| 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 for 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 | + kafka: |
| 207 | + bindings: |
| 208 | + kafka: |
| 209 | + groupId: |
| 210 | + type: string |
| 211 | + enum: ['myGroupId'] |
| 212 | + clientId: |
| 213 | + type: string |
| 214 | + enum: ['myClientId'] |
| 215 | + bindingVersion: '0.1.0' |
0 commit comments