Skip to content

Commit

Permalink
feat: Add provision device to a specific project route (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
paigen11 authored Sep 28, 2023
2 parents 4c1571b + 18c67be commit d5d6761
Show file tree
Hide file tree
Showing 93 changed files with 612 additions and 94 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"licenseName": "MIT",
"moduleName": "NotehubJs",
"npmRepository": "https://registry.npmjs.org",
"projectVersion": "1.0.17",
"projectVersion": "1.0.18",
"sourceFolder": "src",
"usePromises": true
}
37 changes: 37 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,43 @@ paths:
default:
$ref: '#/components/responses/ErrorResponse'

/v1/projects/{projectUID}/devices/{deviceUID}/provision:
post:
tags: ["project", "devices"]
operationId: postProvisionProjectDevice
description: Provision Device for a Project
security:
- api_key: []
parameters:
- $ref: '#/components/parameters/projectUIDParam'
- $ref: '#/components/parameters/deviceUIDParam'
requestBody:
description: Provision a device to a specific ProductUID
required: true
content:
application/json:
schema:
type: object
properties:
product_uid:
type: string
description: The ProductUID that the device should use.
device_sn:
type: string
description: The serial number to assign to the device.
required:
- product_uid
responses:
"200":
description: Successful operation
content:
application/json:
schema:
type: object
default: {}
default:
$ref: '#/components/responses/ErrorResponse'

/v1/projects/{projectUID}/fleets/{fleetUID}/devices:
get:
tags: ["project", "fleet", "devices"]
Expand Down
2 changes: 2 additions & 0 deletions src/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ docs/LoginRequest.md
docs/Mqtt.md
docs/Note.md
docs/NotesApi.md
docs/PostProvisionProjectDeviceRequest.md
docs/Product.md
docs/ProductApi.md
docs/Project.md
Expand Down Expand Up @@ -156,6 +157,7 @@ src/model/Login200Response.js
src/model/LoginRequest.js
src/model/Mqtt.js
src/model/Note.js
src/model/PostProvisionProjectDeviceRequest.js
src/model/Product.js
src/model/Project.js
src/model/ProjectMember.js
Expand Down
5 changes: 4 additions & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The OpenAPI definition for the Notehub.io API.
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.0.0
- Package version: 1.0.17
- Package version: 1.0.18
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
For more information, please visit [https://dev.blues.io/support/](https://dev.blues.io/support/)

Expand Down Expand Up @@ -146,6 +146,7 @@ All URIs are relative to *https://api.notefile.net*
| _NotehubJs.DevicesApi_ | [**getProjectDevicePublicKeys**](docs/DevicesApi.md#getProjectDevicePublicKeys) | **GET** /v1/projects/{projectUID}/devices/public-keys |
| _NotehubJs.DevicesApi_ | [**getProjectDevices**](docs/DevicesApi.md#getProjectDevices) | **GET** /v1/projects/{projectUID}/devices |
| _NotehubJs.DevicesApi_ | [**getProjectFleetDevices**](docs/DevicesApi.md#getProjectFleetDevices) | **GET** /v1/projects/{projectUID}/fleets/{fleetUID}/devices |
| _NotehubJs.DevicesApi_ | [**postProvisionProjectDevice**](docs/DevicesApi.md#postProvisionProjectDevice) | **POST** /v1/projects/{projectUID}/devices/{deviceUID}/provision |
| _NotehubJs.EnvironmentVariablesApi_ | [**deleteDeviceEnvironmentVariable**](docs/EnvironmentVariablesApi.md#deleteDeviceEnvironmentVariable) | **DELETE** /v1/projects/{projectUID}/devices/{deviceUID}/environment_variables/{key} |
| _NotehubJs.EnvironmentVariablesApi_ | [**deleteFleetEnvironmentVariable**](docs/EnvironmentVariablesApi.md#deleteFleetEnvironmentVariable) | **DELETE** /v1/projects/{projectUID}/fleets/{fleetUID}/environment_variables/{key} |
| _NotehubJs.EnvironmentVariablesApi_ | [**deleteProjectEnvironmentVariable**](docs/EnvironmentVariablesApi.md#deleteProjectEnvironmentVariable) | **DELETE** /v1/projects/{projectUID}/environment_variables/{key} |
Expand Down Expand Up @@ -203,6 +204,7 @@ All URIs are relative to *https://api.notefile.net*
| _NotehubJs.ProjectApi_ | [**getProjectMembers**](docs/ProjectApi.md#getProjectMembers) | **GET** /v1/projects/{projectUID}/members |
| _NotehubJs.ProjectApi_ | [**getProjectProducts**](docs/ProjectApi.md#getProjectProducts) | **GET** /v1/projects/{projectUID}/products |
| _NotehubJs.ProjectApi_ | [**getProjects**](docs/ProjectApi.md#getProjects) | **GET** /v1/projects |
| _NotehubJs.ProjectApi_ | [**postProvisionProjectDevice**](docs/ProjectApi.md#postProvisionProjectDevice) | **POST** /v1/projects/{projectUID}/devices/{deviceUID}/provision |
| _NotehubJs.ProjectApi_ | [**putProjectEnvironmentVariables**](docs/ProjectApi.md#putProjectEnvironmentVariables) | **PUT** /v1/projects/{projectUID}/environment_variables |
| _NotehubJs.ProjectApi_ | [**setGlobalTransformation**](docs/ProjectApi.md#setGlobalTransformation) | **POST** /v1/projects/{projectUID}/global-transformation |
| _NotehubJs.RouteApi_ | [**createRoute**](docs/RouteApi.md#createRoute) | **POST** /v1/projects/{projectUID}/routes |
Expand Down Expand Up @@ -268,6 +270,7 @@ All URIs are relative to *https://api.notefile.net*
- [NotehubJs.LoginRequest](docs/LoginRequest.md)
- [NotehubJs.Mqtt](docs/Mqtt.md)
- [NotehubJs.Note](docs/Note.md)
- [NotehubJs.PostProvisionProjectDeviceRequest](docs/PostProvisionProjectDeviceRequest.md)
- [NotehubJs.Product](docs/Product.md)
- [NotehubJs.Project](docs/Project.md)
- [NotehubJs.ProjectMember](docs/ProjectMember.md)
Expand Down
63 changes: 56 additions & 7 deletions src/docs/DevicesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

All URIs are relative to *https://api.notefile.net*

| Method | HTTP request | Description |
| -------------------------------------------------------------------------- | ----------------------------------------------------------- | ----------- |
| [**deleteProjectDevice**](DevicesApi.md#deleteProjectDevice) | **DELETE** /v1/projects/{projectUID}/devices/{deviceUID} |
| [**getDevice**](DevicesApi.md#getDevice) | **GET** /v1/projects/{projectUID}/devices/{deviceUID} |
| [**getProjectDevicePublicKeys**](DevicesApi.md#getProjectDevicePublicKeys) | **GET** /v1/projects/{projectUID}/devices/public-keys |
| [**getProjectDevices**](DevicesApi.md#getProjectDevices) | **GET** /v1/projects/{projectUID}/devices |
| [**getProjectFleetDevices**](DevicesApi.md#getProjectFleetDevices) | **GET** /v1/projects/{projectUID}/fleets/{fleetUID}/devices |
| Method | HTTP request | Description |
| -------------------------------------------------------------------------- | ---------------------------------------------------------------- | ----------- |
| [**deleteProjectDevice**](DevicesApi.md#deleteProjectDevice) | **DELETE** /v1/projects/{projectUID}/devices/{deviceUID} |
| [**getDevice**](DevicesApi.md#getDevice) | **GET** /v1/projects/{projectUID}/devices/{deviceUID} |
| [**getProjectDevicePublicKeys**](DevicesApi.md#getProjectDevicePublicKeys) | **GET** /v1/projects/{projectUID}/devices/public-keys |
| [**getProjectDevices**](DevicesApi.md#getProjectDevices) | **GET** /v1/projects/{projectUID}/devices |
| [**getProjectFleetDevices**](DevicesApi.md#getProjectFleetDevices) | **GET** /v1/projects/{projectUID}/fleets/{fleetUID}/devices |
| [**postProvisionProjectDevice**](DevicesApi.md#postProvisionProjectDevice) | **POST** /v1/projects/{projectUID}/devices/{deviceUID}/provision |

## deleteProjectDevice

Expand Down Expand Up @@ -255,3 +256,51 @@ apiInstance.getProjectFleetDevices(projectUID, fleetUID, opts).then((data) => {

- **Content-Type**: Not defined
- **Accept**: application/json

## postProvisionProjectDevice

> Object postProvisionProjectDevice(projectUID, deviceUID, postProvisionProjectDeviceRequest)
Provision Device for a Project

### Example

```javascript
import * as NotehubJs from '@blues-inc/notehub-js';
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';

let apiInstance = new NotehubJs.DevicesApi();
let projectUID = app:2606f411-dea6-44a0-9743-1130f57d77d8; // String |
let deviceUID = "deviceUID_example"; // String |
let postProvisionProjectDeviceRequest = new NotehubJs.PostProvisionProjectDeviceRequest(); // PostProvisionProjectDeviceRequest | Provision a device to a specific ProductUID
apiInstance.postProvisionProjectDevice(projectUID, deviceUID, postProvisionProjectDeviceRequest).then((data) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, (error) => {
console.error(error);
});

```

### Parameters

| Name | Type | Description | Notes |
| ------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------- | ----- |
| **projectUID** | **String** | |
| **deviceUID** | **String** | |
| **postProvisionProjectDeviceRequest** | [**PostProvisionProjectDeviceRequest**](PostProvisionProjectDeviceRequest.md) | Provision a device to a specific ProductUID |

### Return type

**Object**

### Authorization

[api_key](../README.md#api_key)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json
8 changes: 8 additions & 0 deletions src/docs/PostProvisionProjectDeviceRequest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# NotehubJs.PostProvisionProjectDeviceRequest

## Properties

| Name | Type | Description | Notes |
| -------------- | ---------- | ------------------------------------------ | ---------- |
| **productUid** | **String** | The ProductUID that the device should use. |
| **deviceSn** | **String** | The serial number to assign to the device. | [optional] |
49 changes: 49 additions & 0 deletions src/docs/ProjectApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All URIs are relative to *https://api.notefile.net*
| [**getProjectMembers**](ProjectApi.md#getProjectMembers) | **GET** /v1/projects/{projectUID}/members |
| [**getProjectProducts**](ProjectApi.md#getProjectProducts) | **GET** /v1/projects/{projectUID}/products |
| [**getProjects**](ProjectApi.md#getProjects) | **GET** /v1/projects |
| [**postProvisionProjectDevice**](ProjectApi.md#postProvisionProjectDevice) | **POST** /v1/projects/{projectUID}/devices/{deviceUID}/provision |
| [**putProjectEnvironmentVariables**](ProjectApi.md#putProjectEnvironmentVariables) | **PUT** /v1/projects/{projectUID}/environment_variables |
| [**setGlobalTransformation**](ProjectApi.md#setGlobalTransformation) | **POST** /v1/projects/{projectUID}/global-transformation |

Expand Down Expand Up @@ -849,6 +850,54 @@ This endpoint does not need any parameter.
- **Content-Type**: Not defined
- **Accept**: application/json

## postProvisionProjectDevice

> Object postProvisionProjectDevice(projectUID, deviceUID, postProvisionProjectDeviceRequest)
Provision Device for a Project

### Example

```javascript
import * as NotehubJs from '@blues-inc/notehub-js';
let defaultClient = NotehubJs.ApiClient.instance;
// Configure API key authorization: api_key
let api_key = defaultClient.authentications['api_key'];
api_key.apiKey = 'YOUR API KEY';

let apiInstance = new NotehubJs.ProjectApi();
let projectUID = app:2606f411-dea6-44a0-9743-1130f57d77d8; // String |
let deviceUID = "deviceUID_example"; // String |
let postProvisionProjectDeviceRequest = new NotehubJs.PostProvisionProjectDeviceRequest(); // PostProvisionProjectDeviceRequest | Provision a device to a specific ProductUID
apiInstance.postProvisionProjectDevice(projectUID, deviceUID, postProvisionProjectDeviceRequest).then((data) => {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, (error) => {
console.error(error);
});

```

### Parameters

| Name | Type | Description | Notes |
| ------------------------------------- | ----------------------------------------------------------------------------- | ------------------------------------------- | ----- |
| **projectUID** | **String** | |
| **deviceUID** | **String** | |
| **postProvisionProjectDeviceRequest** | [**PostProvisionProjectDeviceRequest**](PostProvisionProjectDeviceRequest.md) | Provision a device to a specific ProductUID |

### Return type

**Object**

### Authorization

[api_key](../README.md#api_key)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

## putProjectEnvironmentVariables

> EnvironmentVariables putProjectEnvironmentVariables(projectUID, opts)
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@blues-inc/notehub-js",
"version": "1.0.17",
"version": "1.0.18",
"description": "The OpenAPI definition for the Notehub.io API. ",
"license": "MIT",
"main": "dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/src/ApiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import querystring from "querystring";

/**
* @module ApiClient
* @version 1.0.17
* @version 1.0.18
*/

/**
Expand Down Expand Up @@ -55,7 +55,7 @@ class ApiClient {
* @default {}
*/
this.defaultHeaders = {
"User-Agent": "OpenAPI-Generator/1.0.17/Javascript",
"User-Agent": "OpenAPI-Generator/1.0.18/Javascript",
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/src/api/AuthorizationApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import LoginRequest from "../model/LoginRequest";
/**
* Authorization service.
* @module api/AuthorizationApi
* @version 1.0.17
* @version 1.0.18
*/
export default class AuthorizationApi {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/src/api/BillingAccountApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import GetBillingAccounts200Response from "../model/GetBillingAccounts200Respons
/**
* BillingAccount service.
* @module api/BillingAccountApi
* @version 1.0.17
* @version 1.0.18
*/
export default class BillingAccountApi {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/src/api/DeviceApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import PutDeviceFleetsRequest from "../model/PutDeviceFleetsRequest";
/**
* Device service.
* @module api/DeviceApi
* @version 1.0.17
* @version 1.0.18
*/
export default class DeviceApi {
/**
Expand Down
Loading

0 comments on commit d5d6761

Please sign in to comment.