diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index cbf21a3..08d613b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -149,6 +149,7 @@ jobs: cp downstream-templates/python/README.md generated/python/README.md cp downstream-templates/python/setup.py generated/python/setup.py cp downstream-templates/python/utils.py generated/python/iot_api_client/utils.py + cp downstream-templates/python/gitignore-py generated/python/.gitignore - name: Copy shared assets run: | diff --git a/downstream-templates/python/gitignore-py b/downstream-templates/python/gitignore-py new file mode 100644 index 0000000..5e959ff --- /dev/null +++ b/downstream-templates/python/gitignore-py @@ -0,0 +1,68 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints + +pyproject.toml diff --git a/openapi/components/footer.yaml b/openapi/components/footer.yaml index 4fcefb2..f71a901 100644 --- a/openapi/components/footer.yaml +++ b/openapi/components/footer.yaml @@ -7,4 +7,4 @@ components: tokenUrl: https://api2.arduino.cc/iot/v1/clients/token scopes: iot:devices: Read and write my devices - iot:things: Read and write my things + iot:things: Read and write my things \ No newline at end of file diff --git a/openapi/components/iotapi-openapi.yaml b/openapi/components/iotapi-openapi.yaml index d74ec91..5bce2bd 100644 --- a/openapi/components/iotapi-openapi.yaml +++ b/openapi/components/iotapi-openapi.yaml @@ -13,6 +13,79 @@ components: OK: description: OK schemas: + ArduinoAction: + description: ArduinoAction media type (default view) + properties: + created_by: + description: Id of the user who created the action + format: uuid + type: string + description: + description: The description of the action + type: string + email: + $ref: '#/components/schemas/email_action' + id: + description: The id of the action + format: uuid + type: string + kind: + description: The kind of the action + enum: + - NOTIFY-EMAIL + - NOTIFY-PUSH + example: NOTIFY-EMAIL + type: string + name: + description: The name of the action + type: string + organization_id: + description: Id of the organization the trigger belongs to + format: uuid + type: string + push_notification: + $ref: '#/components/schemas/push_action' + trigger_id: + description: Id of the trigger the action is associated to + format: uuid + type: string + title: 'Mediatype identifier: application/vnd.arduino.action+json; view=default' + type: object + ArduinoAction_template: + description: ArduinoAction_template media type (default view) + properties: + description: + description: The description of the action + type: string + email: + $ref: '#/components/schemas/email_action' + kind: + description: The kind of the action + enum: + - NOTIFY-EMAIL + - NOTIFY-PUSH + example: NOTIFY-EMAIL + type: string + name: + description: The name of the action + type: string + organization_id: + description: Id of the organization the trigger belongs to + format: uuid + type: string + push_notification: + $ref: '#/components/schemas/push_action' + title: 'Mediatype identifier: application/vnd.arduino.action_template+json; + view=default' + type: object + ArduinoActionCollection: + description: ArduinoActionCollection is the media type for an array of ArduinoAction + (default view) + items: + $ref: '#/components/schemas/ArduinoAction' + title: 'Mediatype identifier: application/vnd.arduino.action+json; type=collection; + view=default' + type: array ArduinoCompressedv2: description: compressed contains the info from which to generate the certificate (default view) @@ -198,6 +271,10 @@ components: description: Creation date of the device format: date-time type: string + deleted_at: + description: Deletion date of the trigger + format: date-time + type: string device_status: description: The connection status of the device enum: @@ -264,6 +341,10 @@ components: type: description: The type of the device type: string + updated_at: + description: Update date of the trigger + format: date-time + type: string user_id: description: The id of the user format: uuid @@ -613,6 +694,68 @@ components: title: 'Mediatype identifier: application/vnd.arduino.devicev2templatedevice+json; view=default' type: object + ArduinoLinked_device: + description: ArduinoLinked_device media type (default view) + properties: + device: + $ref: '#/components/schemas/ArduinoDevicev2' + status: + description: The status of the linked device + enum: + - OK + - DELETED + example: OK + type: string + required: + - status + - device + title: 'Mediatype identifier: application/vnd.arduino.linked_device+json; view=default' + type: object + ArduinoLinked_device_template: + description: ArduinoLinked_device_template media type (default view) + properties: + thing_id: + description: The thing the device is associated to + type: string + required: + - thing_id + title: 'Mediatype identifier: application/vnd.arduino.linked_device_template+json; + view=default' + type: object + ArduinoLinked_property: + description: ArduinoLinked_property media type (default view) + properties: + property: + $ref: '#/components/schemas/ArduinoProperty' + status: + description: The status of the linked property + enum: + - OK + - WRONG_TYPE + - DELETED + example: OK + type: string + required: + - status + - property + title: 'Mediatype identifier: application/vnd.arduino.linked_property+json; + view=default' + type: object + ArduinoLinked_property_template: + description: ArduinoLinked_property_template media type (default view) + properties: + property_id: + description: The property the trigger is associated to + type: string + thing_id: + description: The thing the trigger is associated to + type: string + required: + - thing_id + - property_id + title: 'Mediatype identifier: application/vnd.arduino.linked_property_template+json; + view=default' + type: object ArduinoLinkedvariable: description: ArduinoLinkedvariable media type (default view) properties: @@ -1524,6 +1667,155 @@ components: - until title: 'Mediatype identifier: application/vnd.arduino.timezone+json; view=default' type: object + ArduinoTrigger: + description: ArduinoTrigger media type (default view) + properties: + actions: + description: A list of actions associated with the trigger + items: + $ref: '#/components/schemas/ArduinoAction' + type: array + active: + description: Is true if the trigger is enabled + type: boolean + created_at: + description: Creation date of the trigger + format: date-time + type: string + created_by: + description: Id of the user who last updated the trigger + format: uuid + type: string + deleted_at: + description: Deletion date of the trigger + format: date-time + type: string + description: + description: The description of the trigger + type: string + device_status_source: + $ref: '#/components/schemas/device_status_source' + id: + description: The id of the trigger + format: uuid + type: string + name: + description: The name of the trigger + type: string + organization_id: + description: Id of the organization the trigger belongs to + format: uuid + type: string + property_id: + description: Id of the property the trigger is associated to (mutually exclusive + with 'device_status_source') + format: uuid + type: string + updated_at: + description: Update date of the trigger + format: date-time + type: string + required: + - name + title: 'Mediatype identifier: application/vnd.arduino.trigger+json; view=default' + type: object + ArduinoTrigger_template: + description: ArduinoTrigger_template media type (default view) + properties: + actions: + description: A list of actions associated with the trigger + items: + $ref: '#/components/schemas/ArduinoAction_template' + type: array + active: + description: Is true if the trigger is enabled + type: boolean + criteria: + description: The criteria of the trigger, could be INCLUDE or EXCLUDE + type: string + description: + description: The description of the trigger + type: string + grace_period_offline: + description: The amount of seconds the trigger will wait before considering + a matching device as offline + format: int64 + type: integer + grace_period_online: + description: The amount of seconds the trigger will wait before considering + a matching device as online + format: int64 + type: integer + id: + description: The id of the trigger + type: string + linked_devices: + description: A list of devices the trigger is associated to + items: + $ref: '#/components/schemas/ArduinoLinked_device_template' + type: array + linked_property: + $ref: '#/components/schemas/ArduinoLinked_property_template' + name: + description: The name of the trigger + type: string + organization_id: + description: Id of the organization the trigger belongs to + format: uuid + type: string + required: + - id + - name + title: 'Mediatype identifier: application/vnd.arduino.trigger_template+json; + view=default' + type: object + ArduinoTrigger_with_linked_entities: + description: ArduinoTrigger_with_linked_entities media type (default view) + properties: + actions: + description: A list of actions associated with the trigger + items: + $ref: '#/components/schemas/ArduinoAction' + type: array + active: + description: Is true if the trigger is enabled + type: boolean + created_by: + description: Id of the user who last updated the trigger + format: uuid + type: string + description: + description: The description of the trigger + type: string + device_status_source: + $ref: '#/components/schemas/Device_status_source_with_linked_devices' + id: + description: The id of the trigger + format: uuid + type: string + linked_property: + $ref: '#/components/schemas/ArduinoLinked_property' + name: + description: The name of the trigger + type: string + organization_id: + description: Id of the organization the trigger belongs to + format: uuid + type: string + required: + - id + - name + title: 'Mediatype identifier: application/vnd.arduino.trigger_with_linked_entities+json; + view=default' + type: object + ArduinoTriggerCollection: + description: ArduinoTriggerCollection is the media type for an array of ArduinoTrigger + (default view) + items: + $ref: '#/components/schemas/ArduinoTrigger' + title: 'Mediatype identifier: application/vnd.arduino.trigger+json; type=collection; + view=default' + type: array ArduinoVariableslinks: description: ArduinoVariableslinks media type (default view) properties: @@ -1883,6 +2175,18 @@ components: - password title: CheckDevicesV2PassPayload type: object + Clone: + description: Add overrides used when performing a clone of a dashboard + properties: + overrides: + description: 'The overrides to apply to the cloned dashboard. An override + is a tuple of ids: the id of the thing to override and the id of the new + thing to link' + items: + $ref: '#/components/schemas/Override' + type: array + title: Clone + type: object CreateDevicesV2CertsPayload: properties: ca: @@ -1931,6 +2235,10 @@ components: maxLength: 64 pattern: '[a-zA-Z0-9_.@-]+' type: string + soft_deleted: + default: false + description: If false, restore the thing from the soft deletion + type: boolean type: description: The type of the device enum: @@ -2023,6 +2331,57 @@ components: - type title: CreateLoraDevicesV1Payload type: object + Dashboardv2: + description: Describes a dashboard + properties: + cover_image: + description: The cover image of the dashboard + maxLength: 1024 + type: string + name: + description: The friendly name of the dashboard + maxLength: 64 + pattern: '[a-zA-Z0-9_.@-]+' + type: string + soft_deleted: + default: false + description: If false, restore the thing from the soft deletion + type: boolean + widgets: + description: Widgets attached to this dashboard + items: + $ref: '#/components/schemas/Widget' + type: array + title: Dashboardv2 + type: object + Device_status_source_with_linked_devices: + description: Device_status_source_with_linked_devices media type (default view) + properties: + criteria: + description: The criteria of the trigger, could be INCLUDE or EXCLUDE + type: string + grace_period_offline: + description: The amount of seconds the trigger will wait before considering + a matching device as offline + maximum: 1209600 + minimum: 0 + type: integer + grace_period_online: + description: The amount of seconds the trigger will wait before considering + a matching device as online + maximum: 1209600 + minimum: 0 + type: integer + linked_devices: + description: A list of devices the trigger is associated to + items: + $ref: '#/components/schemas/ArduinoLinked_device' + type: array + required: + - criteria + title: 'Mediatype identifier: application/vnd.device_status_source_with_linked_devices+json; + view=default' + type: object HistoricDataRequest: properties: from: @@ -2046,6 +2405,28 @@ components: - to title: HistoricDataRequest type: object + Override: + properties: + new_thing_id: + description: The id of the new thing to link + format: uuid + type: string + old_thing_id: + description: The id of the thing to override + format: uuid + type: string + required: + - old_thing_id + - new_thing_id + title: Override + type: object + Sharerequest: + properties: + message: + description: The message the user want to send to the dashboard owner + type: string + title: Sharerequest + type: object ThingClone: description: Payload to clone a new thing from an existing one properties: @@ -2124,47 +2505,160 @@ components: - value title: TimeseriesDataPoint type: object - clone: - properties: - overrides: - description: 'The overrides to apply to the cloned dashboard. An override - is a tuple of ids: the id of the thing to override and the id of the new - thing to link' - items: - $ref: '#/components/schemas/override' - type: array - title: clone - type: object - dashboardshare: + Widget: + description: Widget describes a dashboard widget properties: - user_id: - description: The userID of the user you want to share the dashboard with + height: + description: Widget current height for desktop + format: int64 + type: integer + height_mobile: + description: Widget current height for mobile + format: int64 + type: integer + id: + description: The UUID of the widget, set by client format: uuid type: string - username: - description: The username of the user you want to share the dashboard with - type: string - title: dashboardshare - type: object - dashboardv2: - description: DashboardV2Payload describes a dashboard - properties: - cover_image: - description: The cover image of the dashboard - maxLength: 1024 - type: string name: - description: The friendly name of the dashboard - maxLength: 64 - pattern: '[a-zA-Z0-9_.@-]+' + description: The name of the widget type: string - widgets: - description: Widgets attached to this dashboard + options: + additionalProperties: true + description: Widget options + type: object + type: + description: The type of the widget + type: string + variables: items: - $ref: '#/components/schemas/widget' + format: uuid + type: string type: array - title: dashboardv2 - type: object + width: + description: Widget current width for desktop + format: int64 + type: integer + width_mobile: + description: Widget current width for mobile + format: int64 + type: integer + x: + description: Widget x position for desktop + format: int64 + type: integer + x_mobile: + description: Widget x position for mobile + format: int64 + type: integer + "y": + description: Widget y position for desktop + format: int64 + type: integer + y_mobile: + description: Widget y position for mobile + format: int64 + type: integer + required: + - id + - type + - width + - height + - x + - "y" + - options + title: Widget + type: object + body_expression: + properties: + expression: + description: Content of the body of a message, variables are allowed + maxLength: 1000 + type: string + variables: + description: Variables used by the expression + items: + $ref: '#/components/schemas/variable' + type: array + required: + - expression + title: body_expression + type: object + create-action: + properties: + description: + description: The description of the trigger + type: string + email: + $ref: '#/components/schemas/email_action' + kind: + description: The kind of the action + enum: + - NOTIFY-EMAIL + - NOTIFY-PUSH + example: NOTIFY-EMAIL + type: string + name: + description: The name of the action + type: string + organization_id: + description: Id of the organization the trigger belongs to + format: uuid + type: string + push_notification: + $ref: '#/components/schemas/push_action' + trigger_id: + description: Id of the trigger the action is associated to + format: uuid + type: string + required: + - kind + - name + title: create-action + type: object + dashboardshare: + properties: + user_id: + description: The userID of the user you want to share the dashboard with + format: uuid + type: string + username: + description: The username of the user you want to share the dashboard with + type: string + title: dashboardshare + type: object + device_status_source: + properties: + criteria: + description: The matching criteria of the trigger, this allows to interpret + device_ids as an inclusion or exclusion list + enum: + - INCLUDE + - EXCLUDE + type: string + device_ids: + description: A list of device IDs to be included in or excluded from the + trigger (see criteria). Mutually exclusive with property_id. + items: + format: uuid + type: string + type: array + grace_period_offline: + description: Amount of seconds the trigger will wait before the device will + be considered disconnected (requires 'device_id') + maximum: 1209600 + minimum: 0 + type: integer + grace_period_online: + description: Amount of seconds the trigger will wait before the device will + be considered connected (requires 'device_id') + maximum: 1209600 + minimum: 0 + type: integer + required: + - criteria + title: device_status_source + type: object devicev2: description: DeviceV2 describes a device. properties: @@ -2194,6 +2688,10 @@ components: maxLength: 64 pattern: '[a-zA-Z0-9_.@-]+' type: string + soft_deleted: + default: false + description: If false, restore the thing from the soft deletion + type: boolean type: description: The type of the device enum: @@ -2286,6 +2784,42 @@ components: type: string title: devicev2.pass type: object + email_action: + properties: + body: + $ref: '#/components/schemas/body_expression' + delivery: + $ref: '#/components/schemas/email_delivery_opts' + subject: + $ref: '#/components/schemas/title_expression' + required: + - delivery + - subject + - body + title: email_action + type: object + email_delivery_opts: + properties: + bcc: + description: The "bcc:" field of an e-mail + items: + $ref: '#/components/schemas/user_recipient' + type: array + cc: + description: The "cc:" field of an e-mail + items: + $ref: '#/components/schemas/user_recipient' + type: array + to: + description: The "to:" field of an e-mail + items: + $ref: '#/components/schemas/user_recipient' + minItems: 1 + type: array + required: + - to + title: email_delivery_opts + type: object error: description: Error response media type (default view) properties: @@ -2316,21 +2850,6 @@ components: type: integer title: 'Mediatype identifier: application/vnd.goa.error+json; view=default' type: object - override: - properties: - new_thing_id: - description: The id of the new thing to link - format: uuid - type: string - old_thing_id: - description: The id of the thing to override - format: uuid - type: string - required: - - old_thing_id - - new_thing_id - title: override - type: object propertiesValue: properties: name: @@ -2567,12 +3086,31 @@ components: - value title: propertyValue type: object - sharerequest: + push_action: properties: - message: - description: The message the user want to send to the dashboard owner - type: string - title: sharerequest + body: + $ref: '#/components/schemas/body_expression' + delivery: + $ref: '#/components/schemas/push_delivery_opts' + title: + $ref: '#/components/schemas/title_expression' + required: + - delivery + - title + - body + title: push_action + type: object + push_delivery_opts: + properties: + to: + description: The recipient of a push notification + items: + $ref: '#/components/schemas/user_recipient' + minItems: 1 + type: array + required: + - to + title: push_delivery_opts type: object tag: properties: @@ -2654,6 +3192,10 @@ components: items: $ref: '#/components/schemas/property' type: array + soft_deleted: + default: false + description: If false, restore the thing from the soft deletion + type: boolean timezone: description: |- A time zone name. @@ -2667,6 +3209,73 @@ components: type: string title: thingUpdate type: object + title_expression: + properties: + expression: + description: Content of the title (or subject) of a message, variables are + allowed + maxLength: 100 + type: string + variables: + description: Variables used by the expression + items: + $ref: '#/components/schemas/variable' + type: array + required: + - expression + title: title_expression + type: object + trigger: + properties: + actions: + description: A list of actions to be associated with the trigger + items: + $ref: '#/components/schemas/create-action' + type: array + active: + description: Is true if the trigger is enabled + type: boolean + description: + description: The description of the trigger + type: string + device_status_source: + $ref: '#/components/schemas/device_status_source' + id: + description: The id of the trigger + format: uuid + type: string + name: + description: The name of the trigger + type: string + property_id: + description: Id of the property the trigger is associated to (mutually exclusive + with 'device_status_source') + format: uuid + type: string + soft_deleted: + default: false + description: If false, restore the thing from the soft deletion + type: boolean + title: trigger + type: object + update-action: + properties: + description: + description: The description of the trigger + type: string + email: + $ref: '#/components/schemas/email_action' + name: + description: The name of the action + type: string + push_notification: + $ref: '#/components/schemas/push_action' + trigger_id: + description: Id of the trigger the action is associated to + format: uuid + type: string + title: update-action + type: object updateSketch: properties: sketch_version: @@ -2677,69 +3286,66 @@ components: type: string title: updateSketch type: object - widget: - description: Widget describes a dashboard widget + user_recipient: properties: - height: - description: Widget current height for desktop - format: int64 - type: integer - height_mobile: - description: Widget current height for mobile - format: int64 - type: integer + email: + description: The email address of the user + type: string id: - description: The UUID of the widget, set by client + description: The id of the user format: uuid type: string - name: - description: The name of the widget - type: string - options: - additionalProperties: true - description: Widget options - type: object - type: - description: The type of the widget + username: + description: The username of the user type: string - variables: - items: - format: uuid - type: string - type: array - width: - description: Widget current width for desktop - format: int64 - type: integer - width_mobile: - description: Widget current width for mobile - format: int64 - type: integer - x: - description: Widget x position for desktop - format: int64 - type: integer - x_mobile: - description: Widget x position for mobile - format: int64 - type: integer - "y": - description: Widget y position for desktop - format: int64 - type: integer - y_mobile: - description: Widget y position for mobile - format: int64 - type: integer required: - id - - type - - width - - height - - x - - "y" - - options - title: widget + title: user_recipient + type: object + variable: + properties: + attribute: + description: The template expression that extracts the value from the respective + entity + enum: + - ID + - NAME + - VALUE + - TIMESTAMP + - USERNAME + - EMAIL + - STATUS + example: PROPERTY + type: string + entity: + description: Type of the entity being referenced + enum: + - RECIPIENT + - USER + - DEVICE + - THING + - PROPERTY + - TRIGGERING_DEVICE + example: PROPERTY + type: string + id: + description: The ID of the referenced entity + format: uuid + type: string + placeholder: + description: Name of the variable as referenced by the expression + type: string + property_id: + description: The ID of the property referenced entity + type: string + thing_id: + description: The ID of the thing referenced entity + type: string + required: + - placeholder + - entity + - attribute + title: variable type: object widgetlink: properties: @@ -2764,127 +3370,823 @@ info: version: "2.0" openapi: 3.0.3 paths: - /v1/lora-devices/: - put: - description: Create a new lora device. Its info are saved on our database, and - on the lora provider network. Creates a device_v2 automatically - operationId: lora_devices_v1#create + /v1/actions: + get: + description: Returns the list of actions + operationId: actions_v1#list parameters: - in: header name: X-Organization schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/CreateLoraDevicesV1Payload' - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/CreateLoraDevicesV1Payload' - required: true - x-originalParamName: payload - responses: - "201": - content: - application/vnd.arduino.loradevicev1+json: - schema: - $ref: '#/components/schemas/ArduinoLoradevicev1' - description: Created - summary: create lora_devices_v1 - tags: - - lora_devices_v1 - /v1/lora-freq-plans/: - get: - description: List the lora frequency plans supported - operationId: lora_freq_plan_v1#list responses: "200": content: - application/vnd.arduino.lorafreqplansv1+json: + application/vnd.arduino.action+json; type=collection: schema: - $ref: '#/components/schemas/ArduinoLorafreqplansv1' + $ref: '#/components/schemas/ArduinoActionCollection' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoActionCollection' + description: OK + "401": + content: + application/vnd.arduino.action+json; type=collection: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + content: + application/vnd.arduino.action+json; type=collection: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Not Found + "500": + content: + application/vnd.arduino.action+json; type=collection: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: list actions_v1 + tags: + - triggers_v1 + post: + description: Creates a new action + operationId: actions_v1#create + parameters: + - in: header + name: X-Organization + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/create-action' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/create-action' + required: true + x-originalParamName: payload + responses: + "201": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/ArduinoAction' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoAction' + description: Created + "400": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + description: Not Found + "412": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Precondition Failed + "500": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: create actions_v1 + tags: + - triggers_v1 + /v1/actions/{id}: + delete: + description: Removes an action + operationId: actions_v1#delete + parameters: + - description: The id of the action + in: path + name: id + required: true + schema: + type: string + - in: header + name: X-Organization + schema: + type: string + responses: + "200": + description: OK + "401": + content: + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + text/plain: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + description: Not Found + "500": + content: + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + text/plain: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: delete actions_v1 + tags: + - triggers_v1 + get: + description: Returns an action + operationId: actions_v1#show + parameters: + - description: The id of the action + in: path + name: id + required: true + schema: + type: string + - in: header + name: X-Organization + schema: + type: string + responses: + "200": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/ArduinoAction' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoAction' + description: OK + "401": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Not Found + "500": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: show actions_v1 + tags: + - triggers_v1 + put: + description: Updates an action + operationId: actions_v1#update + parameters: + - description: The id of the action + in: path + name: id + required: true + schema: + type: string + - in: header + name: X-Organization + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/update-action' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/update-action' + required: true + x-originalParamName: payload + responses: + "200": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/ArduinoAction' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoAction' + description: OK + "400": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Not Found + "500": + content: + application/vnd.arduino.action+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: update actions_v1 + tags: + - triggers_v1 + /v1/lora-devices/: + put: + description: Create a new lora device. Its info are saved on our database, and + on the lora provider network. Creates a device_v2 automatically + operationId: lora_devices_v1#create + parameters: + - description: Organization space identifer (optional) + in: header + name: X-Organization + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateLoraDevicesV1Payload' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/CreateLoraDevicesV1Payload' + required: true + x-originalParamName: payload + responses: + "201": + content: + application/vnd.arduino.loradevicev1+json: + schema: + $ref: '#/components/schemas/ArduinoLoradevicev1' + description: Created + summary: create lora_devices_v1 + tags: + - lora_devices_v1 + /v1/lora-freq-plans/: + get: + description: List the lora frequency plans supported + operationId: lora_freq_plan_v1#list + responses: + "200": + content: + application/vnd.arduino.lorafreqplansv1+json: + schema: + $ref: '#/components/schemas/ArduinoLorafreqplansv1' application/vnd.goa.error+json: schema: $ref: '#/components/schemas/ArduinoLorafreqplansv1' description: OK "401": content: - application/vnd.arduino.lorafreqplansv1+json: + application/vnd.arduino.lorafreqplansv1+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "500": + content: + application/vnd.arduino.lorafreqplansv1+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + summary: list lora_freq_plan_v1 + tags: + - lora_freq_plan_v1 + /v1/network_credentials/{type}: + get: + description: Show required network credentials depending on device type + operationId: network_credentials_v1#show + parameters: + - description: Connection used by the device + in: query + name: connection + schema: + enum: + - wifi + - eth + - wifiandsecret + - gsm + - nb + - lora + - catm1 + - cellular + type: string + - description: Device type + in: path + name: type + required: true + schema: + enum: + - mkrwifi1010 + - mkr1000 + - nano_33_iot + - mkrgsm1400 + - mkrwan1310 + - mkrwan1300 + - mkrnb1500 + - lora-device + - login_and_secretkey_wifi + - envie_m7 + - nanorp2040connect + - nicla_vision + - opta + - giga + - portenta_c33 + - unor4wifi + - nano_nora + type: string + responses: + "200": + content: + application/vnd.arduino.credentialsv1+json; type=collection: + schema: + $ref: '#/components/schemas/ArduinoCredentialsv1Collection' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoCredentialsv1Collection' + description: OK + "401": + content: + application/vnd.arduino.credentialsv1+json; type=collection: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + description: Not Found + summary: show network_credentials_v1 + tags: + - network_credentials_v1 + /v1/network_credentials/{type}/connections: + get: + description: Show available connection types depending on device type + operationId: network_credentials_v1#showByDevice + parameters: + - description: Device type + in: path + name: type + required: true + schema: + enum: + - mkrwifi1010 + - mkr1000 + - nano_33_iot + - mkrgsm1400 + - mkrwan1310 + - mkrwan1300 + - mkrnb1500 + - lora-device + - login_and_secretkey_wifi + - envie_m7 + - nanorp2040connect + - nicla_vision + - opta + - giga + - portenta_c33 + - unor4wifi + - nano_nora + type: string + responses: + "200": + description: OK + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + description: Not Found + summary: showByDevice network_credentials_v1 + tags: + - network_credentials_v1 + /v1/property_types: + get: + description: Returns the list of available property types + operationId: property_types_v1#listTypes + responses: + "200": + content: + application/vnd.arduino.propertytype+json; type=collection: + schema: + $ref: '#/components/schemas/ArduinoPropertytypeCollection' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoPropertytypeCollection' + description: OK + "500": + content: + application/vnd.arduino.propertytype+json; type=collection: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: listTypes property_types_v1 + tags: + - property_types_v1 + /v1/templates: + put: + description: Apply an existing cloud template and generate all the needed resources + operationId: templates#apply + parameters: + - description: Organization space identifer (optional) + in: header + name: X-Organization + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/template' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/template' + description: TemplatePayload describes the needed attribute to apply a template + required: true + x-originalParamName: payload + responses: + "200": + content: + application/vnd.arduino.template+json: + schema: + $ref: '#/components/schemas/ArduinoTemplate' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoTemplate' + description: OK + "400": + content: + application/vnd.arduino.template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + content: + application/vnd.arduino.template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + content: + application/vnd.arduino.template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Not Found + "409": + content: + application/vnd.arduino.template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Conflict + "500": + content: + application/vnd.arduino.template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + summary: apply templates + tags: + - templates + /v1/triggers: + get: + description: Returns the list of triggers + operationId: triggers_v1#list + parameters: + - description: The id of the device associated with the triggers (mutually exclusive + with 'property_id') + in: query + name: device_id + schema: + type: string + - description: The id of the property associated with the triggers (mutually + exclusive with 'device_id') + in: query + name: property_id + schema: + type: string + - description: If true, shows the soft deleted triggers + in: query + name: show_deleted + schema: + default: false + type: boolean + - description: The source type of the trigger, could be PROPERTY, DEVICE_INCLUDE + or DEVICE_EXCLUDE + in: query + name: source_type + schema: + enum: + - PROPERTY + - DEVICE_INCLUDE + - DEVICE_EXCLUDE + type: string + - in: header + name: X-Organization + schema: + type: string + responses: + "200": + content: + application/vnd.arduino.trigger+json; type=collection: + schema: + $ref: '#/components/schemas/ArduinoTriggerCollection' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoTriggerCollection' + description: OK + "400": + content: + application/vnd.arduino.trigger+json; type=collection: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + content: + application/vnd.arduino.trigger+json; type=collection: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Unauthorized + "404": + content: + application/vnd.arduino.trigger+json; type=collection: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Not Found "500": content: - application/vnd.arduino.lorafreqplansv1+json: + application/vnd.arduino.trigger+json; type=collection: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Internal Server Error - summary: list lora_freq_plan_v1 + security: + - oauth2: [] + summary: list triggers_v1 tags: - - lora_freq_plan_v1 - /v1/network_credentials/{type}: - get: - description: Show required network credentials depending on device type - operationId: network_credentials_v1#show + - triggers_v1 + put: + description: Creates a new trigger + operationId: triggers_v1#create parameters: - - description: Connection used by the device + - in: header + name: X-Organization + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/trigger' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/trigger' + required: true + x-originalParamName: payload + responses: + "201": + content: + application/vnd.arduino.trigger+json: + schema: + $ref: '#/components/schemas/ArduinoTrigger' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoTrigger' + description: Created + "400": + content: + application/vnd.arduino.trigger+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + content: + application/vnd.arduino.trigger+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + description: Not Found + "412": + content: + application/vnd.arduino.trigger+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Precondition Failed + "500": + content: + application/vnd.arduino.trigger+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: create triggers_v1 + tags: + - triggers_v1 + /v1/triggers/{id}: + delete: + description: Removes a trigger + operationId: triggers_v1#delete + parameters: + - description: If true, hard delete the trigger in: query - name: connection + name: force + schema: + default: false + type: boolean + - description: The id of the trigger + in: path + name: id + required: true schema: - enum: - - wifi - - eth - - wifiandsecret - - gsm - - nb - - lora - - catm1 - - cellular type: string - - description: Device type + - in: header + name: X-Organization + schema: + type: string + responses: + "200": + description: OK + "401": + content: + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + text/plain: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + description: Not Found + "500": + content: + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + text/plain: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: delete triggers_v1 + tags: + - triggers_v1 + get: + description: Returns a trigger + operationId: triggers_v1#show + parameters: + - description: The id of the trigger in: path - name: type + name: id required: true schema: - enum: - - mkrwifi1010 - - mkr1000 - - nano_33_iot - - mkrgsm1400 - - mkrwan1310 - - mkrwan1300 - - mkrnb1500 - - lora-device - - login_and_secretkey_wifi - - envie_m7 - - nanorp2040connect - - nicla_vision - - opta - - giga - - portenta_c33 - - unor4wifi - - nano_nora + type: string + - in: header + name: X-Organization + schema: type: string responses: "200": content: - application/vnd.arduino.credentialsv1+json; type=collection: + application/vnd.arduino.trigger_with_linked_entities+json: schema: - $ref: '#/components/schemas/ArduinoCredentialsv1Collection' + $ref: '#/components/schemas/ArduinoTrigger_with_linked_entities' application/vnd.goa.error+json: schema: - $ref: '#/components/schemas/ArduinoCredentialsv1Collection' + $ref: '#/components/schemas/ArduinoTrigger_with_linked_entities' description: OK "401": content: - application/vnd.arduino.credentialsv1+json; type=collection: + application/vnd.arduino.trigger_with_linked_entities+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: @@ -2892,45 +4194,74 @@ paths: $ref: '#/components/schemas/error' description: Unauthorized "404": + content: + application/vnd.arduino.trigger_with_linked_entities+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' description: Not Found - summary: show network_credentials_v1 + "500": + content: + application/vnd.arduino.trigger_with_linked_entities+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: show triggers_v1 tags: - - network_credentials_v1 - /v1/network_credentials/{type}/connections: - get: - description: Show available connection types depending on device type - operationId: network_credentials_v1#showByDevice + - triggers_v1 + patch: + description: Patch a trigger + operationId: triggers_v1#patch parameters: - - description: Device type + - description: The id of the trigger in: path - name: type + name: id required: true schema: - enum: - - mkrwifi1010 - - mkr1000 - - nano_33_iot - - mkrgsm1400 - - mkrwan1310 - - mkrwan1300 - - mkrnb1500 - - lora-device - - login_and_secretkey_wifi - - envie_m7 - - nanorp2040connect - - nicla_vision - - opta - - giga - - portenta_c33 - - unor4wifi - - nano_nora type: string + - in: header + name: X-Organization + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/trigger' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/trigger' + required: true + x-originalParamName: payload responses: "200": + content: + application/vnd.arduino.trigger+json: + schema: + $ref: '#/components/schemas/ArduinoTrigger' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoTrigger' description: OK + "400": + content: + application/vnd.arduino.trigger+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request "401": content: - application/json: + application/vnd.arduino.trigger+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: @@ -2938,27 +4269,17 @@ paths: $ref: '#/components/schemas/error' description: Unauthorized "404": - description: Not Found - summary: showByDevice network_credentials_v1 - tags: - - network_credentials_v1 - /v1/property_types: - get: - description: Returns the list of available property types - operationId: property_types_v1#listTypes - responses: - "200": content: - application/vnd.arduino.propertytype+json; type=collection: + application/vnd.arduino.trigger+json: schema: - $ref: '#/components/schemas/ArduinoPropertytypeCollection' + $ref: '#/components/schemas/error' application/vnd.goa.error+json: schema: - $ref: '#/components/schemas/ArduinoPropertytypeCollection' - description: OK + $ref: '#/components/schemas/error' + description: Not Found "500": content: - application/vnd.arduino.propertytype+json; type=collection: + application/vnd.arduino.trigger+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: @@ -2967,14 +4288,19 @@ paths: description: Internal Server Error security: - oauth2: [] - summary: listTypes property_types_v1 + summary: patch triggers_v1 tags: - - property_types_v1 - /v1/templates: - put: - description: Apply an existing cloud template and generate all the needed resources - operationId: templates#apply + - triggers_v1 + post: + description: Updates a trigger + operationId: triggers_v1#update parameters: + - description: The id of the trigger + in: path + name: id + required: true + schema: + type: string - in: header name: X-Organization schema: @@ -2983,26 +4309,25 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/template' + $ref: '#/components/schemas/trigger' application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/template' - description: TemplatePayload describes the needed attribute to apply a template + $ref: '#/components/schemas/trigger' required: true x-originalParamName: payload responses: "200": content: - application/vnd.arduino.template+json: + application/vnd.arduino.trigger+json: schema: - $ref: '#/components/schemas/ArduinoTemplate' + $ref: '#/components/schemas/ArduinoTrigger' application/vnd.goa.error+json: schema: - $ref: '#/components/schemas/ArduinoTemplate' + $ref: '#/components/schemas/ArduinoTrigger' description: OK "400": content: - application/vnd.arduino.template+json: + application/vnd.arduino.trigger+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: @@ -3011,7 +4336,7 @@ paths: description: Bad Request "401": content: - application/vnd.arduino.template+json: + application/vnd.arduino.trigger+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: @@ -3020,52 +4345,112 @@ paths: description: Unauthorized "404": content: - application/vnd.arduino.template+json: + application/vnd.arduino.trigger+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Not Found - "409": + "500": content: - application/vnd.arduino.template+json: + application/vnd.arduino.trigger+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' - description: Conflict + description: Internal Server Error + security: + - oauth2: [] + summary: update triggers_v1 + tags: + - triggers_v1 + /v1/triggers/{id}/template: + get: + description: Extract template from the given trigger + operationId: triggers_v1#template + parameters: + - description: The id of the trigger + in: path + name: id + required: true + schema: + type: string + - in: header + name: X-Organization + schema: + type: string + responses: + "200": + content: + application/vnd.arduino.trigger_template+json: + schema: + $ref: '#/components/schemas/ArduinoTrigger_template' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoTrigger_template' + description: OK + "400": + content: + application/vnd.arduino.trigger_template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + content: + application/vnd.arduino.trigger_template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "404": + content: + application/vnd.arduino.trigger_template+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Not Found "500": content: - application/vnd.arduino.template+json: + application/vnd.arduino.trigger_template+json: schema: $ref: '#/components/schemas/error' application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Internal Server Error - summary: apply templates + security: + - oauth2: [] + summary: template triggers_v1 tags: - - templates + - triggers_v1 /v2/dashboards: get: description: Returns the list of dashboards operationId: dashboards_v2#list parameters: - - description: The name of the dashboard + - description: Filter by name of the dashboard. It support like matching. in: query name: name schema: maxLength: 64 pattern: '[a-zA-Z0-9_.@-]+' type: string - - description: The user_id of the dashboard's owner + - description: Filter by user_id of the dashboard's owner in: query name: user_id schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3124,7 +4509,8 @@ paths: description: Create a new dashboard operationId: dashboards_v2#create parameters: - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3132,11 +4518,11 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/dashboardv2' + $ref: '#/components/schemas/Dashboardv2' application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/dashboardv2' - description: DashboardV2Payload describes a dashboard + $ref: '#/components/schemas/Dashboardv2' + description: Describes a dashboard required: true x-originalParamName: payload responses: @@ -3195,13 +4581,20 @@ paths: description: Delete a dashboard operationId: dashboards_v2#delete parameters: + - description: If true, hard delete the thing + in: query + name: force + schema: + default: false + type: boolean - description: The id of the dashboard in: path name: id required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3252,7 +4645,7 @@ paths: tags: - dashboards_v2 get: - description: Show a dashboard + description: Show a dashboard by id operationId: dashboards_v2#show parameters: - description: The id of the dashboard @@ -3261,7 +4654,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3309,6 +4703,86 @@ paths: summary: show dashboards_v2 tags: - dashboards_v2 + patch: + description: Updates an existing dashboard field without overwriting the existing + data + operationId: dashboards_v2#patch + parameters: + - description: The id of the dashboard + in: path + name: id + required: true + schema: + type: string + - description: Organization space identifer (optional) + in: header + name: X-Organization + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Dashboardv2' + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/Dashboardv2' + description: Describes a dashboard + required: true + x-originalParamName: payload + responses: + "200": + content: + application/vnd.arduino.dashboardv2+json: + schema: + $ref: '#/components/schemas/ArduinoDashboardv2' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/ArduinoDashboardv2' + description: OK + "400": + content: + application/vnd.arduino.dashboardv2+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Bad Request + "401": + content: + application/vnd.arduino.dashboardv2+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Unauthorized + "403": + content: + application/vnd.arduino.dashboardv2+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Forbidden + "404": + description: Not Found + "500": + content: + application/vnd.arduino.dashboardv2+json: + schema: + $ref: '#/components/schemas/error' + application/vnd.goa.error+json: + schema: + $ref: '#/components/schemas/error' + description: Internal Server Error + security: + - oauth2: [] + summary: patch dashboards_v2 + tags: + - dashboards_v2 put: description: Updates an existing dashboard operationId: dashboards_v2#update @@ -3319,7 +4793,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3327,11 +4802,11 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/dashboardv2' + $ref: '#/components/schemas/Dashboardv2' application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/dashboardv2' - description: DashboardV2Payload describes a dashboard + $ref: '#/components/schemas/Dashboardv2' + description: Describes a dashboard required: true x-originalParamName: payload responses: @@ -3398,7 +4873,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3406,10 +4882,11 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/clone' + $ref: '#/components/schemas/Clone' application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/clone' + $ref: '#/components/schemas/Clone' + description: Add overrides used when performing a clone of a dashboard required: true x-originalParamName: payload responses: @@ -3476,7 +4953,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3484,10 +4962,10 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/sharerequest' + $ref: '#/components/schemas/Sharerequest' application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/sharerequest' + $ref: '#/components/schemas/Sharerequest' required: true x-originalParamName: payload responses: @@ -3547,7 +5025,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3614,7 +5093,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3691,7 +5171,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3752,7 +5233,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3826,7 +5308,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3909,6 +5392,12 @@ paths: name: serial schema: type: string + - description: If true, shows the soft deleted devices + in: query + name: show_deleted + schema: + default: false + type: boolean - description: Filter by tags in: query name: tags @@ -3918,7 +5407,8 @@ paths: pattern: ^[a-zA-Z0-9_.@-]+:[a-zA-Z0-9_.@-]+$ type: string type: array - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -3977,7 +5467,8 @@ paths: description: Creates a new device associated to the user. operationId: devices_v2#create parameters: - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -4048,13 +5539,20 @@ paths: description: Removes a device associated to the user operationId: devices_v2#delete parameters: + - description: If true, hard delete the device + in: query + name: force + schema: + default: false + type: boolean - description: The id of the device in: path name: id required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -4105,7 +5603,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -4163,7 +5662,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -4530,7 +6030,8 @@ paths: name: start schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -4617,8 +6118,6 @@ paths: ota_file: description: OTA file format: binary - required: - - ota_file type: string x-formData-name: ota_file required: @@ -5102,7 +6601,8 @@ paths: schema: default: false type: boolean - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5160,7 +6660,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5238,7 +6739,8 @@ paths: name: start schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5317,7 +6819,8 @@ paths: name: start schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5541,7 +7044,8 @@ paths: description: Returns the batch of time-series aggregated samples operationId: series_v2#batch_query parameters: - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5615,7 +7119,8 @@ paths: description: Returns the batch of time-series raw samples operationId: series_v2#batch_query_raw parameters: - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5689,7 +7194,8 @@ paths: description: Returns the batch of time-series data raw operationId: series_v2#batch_query_raw_last_value parameters: - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5756,7 +7262,8 @@ paths: complex types.' operationId: series_v2#batch_query_sampling parameters: - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5830,7 +7337,8 @@ paths: description: Request sending of historical data of properties by email operationId: series_v2#historic_data parameters: - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5922,7 +7430,8 @@ paths: pattern: ^[a-zA-Z0-9_.@-]+:[a-zA-Z0-9_.@-]+$ type: string type: array - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -5988,7 +7497,8 @@ paths: schema: default: false type: boolean - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -6089,7 +7599,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -6155,7 +7666,8 @@ paths: schema: default: false type: boolean - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -6220,7 +7732,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -6317,7 +7830,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -6402,7 +7916,7 @@ paths: schema: default: false type: boolean - - description: The id of the organization + - description: Organization space identifer (optional) in: header name: X-Organization schema: @@ -6459,7 +7973,7 @@ paths: required: true schema: type: string - - description: The id of the organization + - description: Organization space identifer (optional) in: header name: X-Organization schema: @@ -6552,7 +8066,7 @@ paths: required: true schema: type: string - - description: The id of the organization + - description: Organization space identifer (optional) in: header name: X-Organization schema: @@ -6607,7 +8121,7 @@ paths: schema: default: false type: boolean - - description: The id of the organization + - description: Organization space identifer (optional) in: header name: X-Organization schema: @@ -6670,7 +8184,7 @@ paths: required: true schema: type: string - - description: The id of the organization + - description: Organization space identifer (optional) in: header name: X-Organization schema: @@ -6755,7 +8269,7 @@ paths: required: true schema: type: string - - description: The id of the organization + - description: Organization space identifer (optional) in: header name: X-Organization schema: @@ -6870,7 +8384,7 @@ paths: name: to schema: type: string - - description: The id of the organization + - description: Organization space identifer (optional) in: header name: X-Organization schema: @@ -6929,7 +8443,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -6987,7 +8502,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -7081,7 +8597,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string @@ -7359,7 +8876,8 @@ paths: required: true schema: type: string - - in: header + - description: Organization space identifer (optional) + in: header name: X-Organization schema: type: string diff --git a/openapi/compose/compose.go b/openapi/compose/compose.go index 3ead844..3f7c30b 100644 --- a/openapi/compose/compose.go +++ b/openapi/compose/compose.go @@ -31,6 +31,19 @@ type blacklist struct { Blacklist []string `json:"blacklist"` } +// Sanitize path, removing application/x-www-form-urlencoded from request bodies and adding oauth2 security requirement +func sanitizeRequestBody(op *openapi3.Operation) { + // Remove application/x-www-form-urlencoded from request bodies + if op.RequestBody != nil && op.RequestBody.Value != nil { + delete(op.RequestBody.Value.Content, "application/x-www-form-urlencoded") + } + + // Add bearer token security requirement + sec := &openapi3.SecurityRequirements{} + sec = sec.With(openapi3.NewSecurityRequirement().Authenticate("oauth2")) + op.Security = sec +} + func main() { // Load blacklist var bl blacklist @@ -51,6 +64,21 @@ func main() { continue } pathItem := masterOpenapi.Paths.Find(path) + if pathItem.Post != nil { + sanitizeRequestBody(pathItem.Post) + } + if pathItem.Put != nil { + sanitizeRequestBody(pathItem.Put) + } + if pathItem.Patch != nil { + sanitizeRequestBody(pathItem.Patch) + } + if pathItem.Options != nil { + sanitizeRequestBody(pathItem.Options) + } + if pathItem.Get != nil { + sanitizeRequestBody(pathItem.Get) + } mergedPaths = append(mergedPaths, openapi3.WithPath(fmt.Sprintf("/iot%s", path), pathItem)) }