MCPcopy Index your code
hub / github.com/WebThingsIO/webthing-node / getActionDescriptions

Method getActionDescriptions

lib/thing.ts:265–283  ·  view source on GitHub ↗

* Get the thing's actions as an array. * * @param {String?} actionName Optional action name to get descriptions for * * @returns {Object} Action descriptions.

(
    actionName?: string|null
  )

Source from the content-addressed store, hash-verified

263 * @returns {Object} Action descriptions.
264 */
265 getActionDescriptions(
266 actionName?: string|null
267 ): Action.ActionDescription[] {
268 const descriptions: Action.ActionDescription[] = [];
269
270 if (!actionName) {
271 for (const name in this.actions) {
272 for (const action of this.actions[name]) {
273 descriptions.push(action.asActionDescription());
274 }
275 }
276 } else if (this.actions.hasOwnProperty(actionName)) {
277 for (const action of this.actions[actionName]) {
278 descriptions.push(action.asActionDescription());
279 }
280 }
281
282 return descriptions;
283 }
284
285 /**
286 * Get the thing's events as an array.

Callers 2

getMethod · 0.80
getMethod · 0.80

Calls 1

asActionDescriptionMethod · 0.80

Tested by

no test coverage detected