Skip to content

Commit

Permalink
chore: add fleetUIDs param to provision project device req (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
paigen11 authored Nov 14, 2024
2 parents 4f0fb20 + f5b4b93 commit 92eb2c2
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 27 deletions.
43 changes: 26 additions & 17 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,12 @@ paths:
device_sn:
type: string
description: The serial number to assign to the device.
fleet_uids:
type: array
items:
type: string
description: The fleetUIDs to provision the device to.
nullable: true
required:
- product_uid
responses:
Expand Down Expand Up @@ -1202,7 +1208,7 @@ paths:
items:
type: string
- name: since
description: Deprecated.
description: Deprecated.
in: query
required: false
deprecated: true
Expand Down Expand Up @@ -1294,7 +1300,7 @@ paths:
items:
type: string
- name: since
description: Deprecated.
description: Deprecated.
in: query
required: false
deprecated: true
Expand Down Expand Up @@ -2195,7 +2201,7 @@ paths:
/v1/projects/{projectUID}/dfu/{firmwareType}/{action}:
post:
tags: ["project"]
operationId: dfuAction
operationId: dfuAction
description: Update/cancel host or notecard firmware updates
security:
- api_key: []
Expand All @@ -2213,7 +2219,7 @@ paths:
- $ref: "#/components/parameters/productUIDQueryParam"
- $ref: "#/components/parameters/skuParam"
requestBody:
description: Which firmware in the case of an update action
description: Which firmware in the case of an update action
required: false
content:
application/json:
Expand Down Expand Up @@ -2300,7 +2306,7 @@ components:
schema:
type: string
example: dev:000000000000000

firmwareTypeParam:
name: firmwareType
in: path
Expand All @@ -2310,9 +2316,9 @@ components:
enum:
- host
- notecard

dfuActionParam:
name: action
name: action
in: path
required: true
schema:
Expand Down Expand Up @@ -2453,8 +2459,8 @@ components:
type: string
default: captured
enum:
- captured
- uploaded
- captured
- uploaded
example: uploaded

cursorParam:
Expand Down Expand Up @@ -2709,6 +2715,8 @@ components:
items:
type: string



responses:
ErrorResponse:
description: The response body in case of an API error.
Expand Down Expand Up @@ -4720,24 +4728,25 @@ components:
type: object
properties:
current_firmware:
$ref: "#/components/schemas/CurrentFirmware"
$ref: '#/components/schemas/CurrentFirmware'
firmware_update:
$ref: "#/components/schemas/UserDfuStateMachine"
$ref: '#/components/schemas/UserDfuStateMachine'
nullable: true

UserDfuStateMachine:
type: object
properties:
status:
$ref: "#/components/schemas/UserDfuStateMachineStatus"
$ref: '#/components/schemas/UserDfuStateMachineStatus'
created:
type: string
format: date-time
nullable: true
from_version:
type: string
metadata:
$ref: "#/components/schemas/UploadMetadata"
$ref: '#/components/schemas/UploadMetadata'


UserDfuStateMachineStatus:
type: object
Expand All @@ -4759,7 +4768,7 @@ components:
version:
type: string
metadata:
$ref: "#/components/schemas/Firmware"
$ref: '#/components/schemas/Firmware'

UploadMetadata:
type: object
Expand Down Expand Up @@ -4789,7 +4798,7 @@ components:
notes:
type: string
firmware:
$ref: "#/components/schemas/Firmware"
$ref: '#/components/schemas/Firmware'

Firmware:
type: object
Expand Down Expand Up @@ -4974,7 +4983,7 @@ components:
type: array
items:
$ref: "#/components/schemas/DeviceDfuStateMachineNode"

DeviceDfuStateMachineNode:
type: object
description: Represents a single request to update the host or Notecard firmware
Expand All @@ -4990,4 +4999,4 @@ components:
description: RFC3339 compatible datetime of when this status update happened
description:
type: string
description: Additional information
description: Additional information
9 changes: 5 additions & 4 deletions src/docs/PostProvisionProjectDeviceRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## 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] |
| Name | Type | Description | Notes |
| -------------- | ------------ | ------------------------------------------ | ---------- |
| **productUid** | **String** | The ProductUID that the device should use. |
| **deviceSn** | **String** | The serial number to assign to the device. | [optional] |
| **fleetUids** | **[String]** | The fleetUIDs to provision the device to. | [optional] |
12 changes: 6 additions & 6 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions src/src/model/PostProvisionProjectDeviceRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class PostProvisionProjectDeviceRequest {
if (data.hasOwnProperty("device_sn")) {
obj["device_sn"] = ApiClient.convertToType(data["device_sn"], "String");
}
if (data.hasOwnProperty("fleet_uids")) {
obj["fleet_uids"] = ApiClient.convertToType(data["fleet_uids"], [
"String",
]);
}
} else if (data === null) {
return null;
}
Expand Down Expand Up @@ -106,6 +111,13 @@ class PostProvisionProjectDeviceRequest {
data["device_sn"]
);
}
// ensure the json data is an array
if (!Array.isArray(data["fleet_uids"])) {
throw new Error(
"Expected the field `fleet_uids` to be an array in the JSON data but got " +
data["fleet_uids"]
);
}

return true;
}
Expand All @@ -125,4 +137,10 @@ PostProvisionProjectDeviceRequest.prototype["product_uid"] = undefined;
*/
PostProvisionProjectDeviceRequest.prototype["device_sn"] = undefined;

/**
* The fleetUIDs to provision the device to.
* @member {Array.<String>} fleet_uids
*/
PostProvisionProjectDeviceRequest.prototype["fleet_uids"] = undefined;

export default PostProvisionProjectDeviceRequest;
6 changes: 6 additions & 0 deletions src/test/model/PostProvisionProjectDeviceRequest.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,11 @@
//var instance = new NotehubJs.PostProvisionProjectDeviceRequest();
//expect(instance).to.be();
});

it('should have the property fleetUids (base name: "fleet_uids")', function () {
// uncomment below and update the code to test the property fleetUids
//var instance = new NotehubJs.PostProvisionProjectDeviceRequest();
//expect(instance).to.be();
});
});
});

0 comments on commit 92eb2c2

Please sign in to comment.