Skip to content

Commit cde252a

Browse files
authored
feat: Add Usage API and data usage support [BLUESDEV-493]
2 parents 6ff4b05 + 36a928a commit cde252a

35 files changed

+2289
-404
lines changed

config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"packageName": "notehub_py",
33
"packageUrl": "https://github.com/blues/notehub-py",
44
"projectName": "notehub-py",
5-
"packageVersion": "2.0.0"
5+
"packageVersion": "2.1.0"
66
}

openapi.yaml

Lines changed: 179 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,39 @@ paths:
327327
- personalAccessToken: []
328328
tags:
329329
- project
330+
'/v1/projects/{projectOrProductUID}':
331+
delete:
332+
operationId: deleteProject
333+
description: Delete a Project by ProjectUID
334+
parameters:
335+
- $ref: '#/components/parameters/projectOrProductUIDParam'
336+
responses:
337+
'200':
338+
description: Successful operation
339+
default:
340+
$ref: '#/components/responses/ErrorResponse'
341+
security:
342+
- personalAccessToken: []
343+
tags:
344+
- project
345+
get:
346+
operationId: getProject
347+
description: Get a Project by ProjectUID
348+
parameters:
349+
- $ref: '#/components/parameters/projectOrProductUIDParam'
350+
responses:
351+
'200':
352+
description: Successful operation
353+
content:
354+
application/json:
355+
schema:
356+
$ref: '#/components/schemas/Project'
357+
default:
358+
$ref: '#/components/responses/ErrorResponse'
359+
security:
360+
- personalAccessToken: []
361+
tags:
362+
- project
330363
'/v1/projects/{projectOrProductUID}/alerts':
331364
get:
332365
operationId: getAlerts
@@ -821,6 +854,19 @@ paths:
821854
parameters:
822855
- $ref: '#/components/parameters/projectOrProductUIDParam'
823856
- $ref: '#/components/parameters/deviceUIDParam'
857+
- $ref: '#/components/parameters/startDateParam'
858+
- $ref: '#/components/parameters/endDateParam'
859+
- name: log_type
860+
in: query
861+
description: Return only specified log types
862+
required: false
863+
schema:
864+
type: array
865+
items:
866+
enum:
867+
- boot
868+
- dfu_completed
869+
type: string
824870
responses:
825871
'200':
826872
description: Successful operation
@@ -1069,6 +1115,22 @@ paths:
10691115
- personalAccessToken: []
10701116
tags:
10711117
- device
1118+
'/v1/projects/{projectOrProductUID}/devices/{deviceUID}/plans':
1119+
get:
1120+
operationId: getDevicePlans
1121+
description: 'Get Data Plans associated with the device, this include the primary sim, any external sim, as well as any satellite connections.'
1122+
responses:
1123+
'200':
1124+
$ref: '#/components/responses/DevicePlansResponse'
1125+
default:
1126+
$ref: '#/components/responses/ErrorResponse'
1127+
security:
1128+
- api_key: []
1129+
tags:
1130+
- device
1131+
parameters:
1132+
- $ref: '#/components/parameters/projectOrProductUIDParam'
1133+
- $ref: '#/components/parameters/deviceUIDParam'
10721134
'/v1/projects/{projectOrProductUID}/devices/{deviceUID}/provision':
10731135
post:
10741136
operationId: postProvisionProjectDevice
@@ -2042,7 +2104,7 @@ paths:
20422104
- monitor
20432105
'/v1/projects/{projectOrProductUID}/products':
20442106
get:
2045-
operationId: getProjectProducts
2107+
operationId: getProducts
20462108
description: Get Products within a Project
20472109
responses:
20482110
'200':
@@ -2104,6 +2166,22 @@ paths:
21042166
- personalAccessToken: []
21052167
tags:
21062168
- project
2169+
'/v1/projects/{projectOrProductUID}/products/{productUID}':
2170+
delete:
2171+
operationId: deleteProduct
2172+
description: Delete a product
2173+
responses:
2174+
'204':
2175+
description: Successful operation
2176+
default:
2177+
$ref: '#/components/responses/ErrorResponse'
2178+
security:
2179+
- personalAccessToken: []
2180+
tags:
2181+
- project
2182+
parameters:
2183+
- $ref: '#/components/parameters/projectOrProductUIDParam'
2184+
- $ref: '#/components/parameters/productUIDParam'
21072185
'/v1/projects/{projectOrProductUID}/routes':
21082186
get:
21092187
operationId: getRoutes
@@ -2412,7 +2490,7 @@ paths:
24122490
'/v1/projects/{projectOrProductUID}/usage/events':
24132491
get:
24142492
operationId: getProjectEventsUsage
2415-
description: Get events usage for a project with time range and period aggregation
2493+
description: 'Get events usage for a project with time range and period aggregation, when endDate is 0 or unspecified the current time is implied'
24162494
parameters:
24172495
- $ref: '#/components/parameters/projectOrProductUIDParam'
24182496
- $ref: '#/components/parameters/startDateParam'
@@ -2444,7 +2522,7 @@ paths:
24442522
'/v1/projects/{projectOrProductUID}/usage/route-logs':
24452523
get:
24462524
operationId: getRouteLogsUsage
2447-
description: Get route logs usage for a project with time range and period aggregation
2525+
description: 'Get route logs usage for a project with time range and period aggregation, when endDate is 0 or unspecified the current time is implied'
24482526
parameters:
24492527
- $ref: '#/components/parameters/projectOrProductUIDParam'
24502528
- $ref: '#/components/parameters/startDateParam'
@@ -2476,7 +2554,7 @@ paths:
24762554
'/v1/projects/{projectOrProductUID}/usage/sessions':
24772555
get:
24782556
operationId: getSessionsUsage
2479-
description: Get sessions usage for a project with time range and period aggregation
2557+
description: 'Get sessions usage for a project with time range and period aggregation, when endDate is 0 or unspecified the current time is implied'
24802558
parameters:
24812559
- $ref: '#/components/parameters/projectOrProductUIDParam'
24822560
- $ref: '#/components/parameters/startDateParam'
@@ -2614,39 +2692,6 @@ paths:
26142692
- personalAccessToken: []
26152693
tags:
26162694
- webhook
2617-
'/v1/projects/{projectUID}':
2618-
delete:
2619-
operationId: deleteProject
2620-
description: Delete a Project by ProjectUID
2621-
parameters:
2622-
- $ref: '#/components/parameters/projectOrProductUIDParam'
2623-
responses:
2624-
'200':
2625-
description: Successful operation
2626-
default:
2627-
$ref: '#/components/responses/ErrorResponse'
2628-
security:
2629-
- personalAccessToken: []
2630-
tags:
2631-
- project
2632-
get:
2633-
operationId: getProject
2634-
description: Get a Project by ProjectUID
2635-
parameters:
2636-
- $ref: '#/components/parameters/projectOrProductUIDParam'
2637-
responses:
2638-
'200':
2639-
description: Successful operation
2640-
content:
2641-
application/json:
2642-
schema:
2643-
$ref: '#/components/schemas/Project'
2644-
default:
2645-
$ref: '#/components/responses/ErrorResponse'
2646-
security:
2647-
- personalAccessToken: []
2648-
tags:
2649-
- project
26502695
components:
26512696
parameters:
26522697
cursorParam:
@@ -3316,6 +3361,40 @@ components:
33163361
properties:
33173362
body:
33183363
type: object
3364+
CellularPlan:
3365+
type: object
3366+
properties:
3367+
activated:
3368+
description: Unix timestamp of when the SIM was activated
3369+
type: integer
3370+
format: int64
3371+
example: 1656010061
3372+
data_usage:
3373+
$ref: '#/components/schemas/DataUsage'
3374+
expires_at:
3375+
type: integer
3376+
format: int64
3377+
iccid:
3378+
description: The Integrated Circuit Card Identifier of the SIM card
3379+
type: string
3380+
example: '345678432765434567890765746354465786'
3381+
imsi:
3382+
description: IMSI of the SIM card
3383+
type: string
3384+
example: '310170830688975'
3385+
last_updated:
3386+
description: Time this plan information was last updated
3387+
type: integer
3388+
format: int64
3389+
example: 1656010061
3390+
lifetime_used:
3391+
description: Total bytes used by this SIM
3392+
type: integer
3393+
format: int64
3394+
plan_type:
3395+
description: 'Description of the SIM plan type including data allowance, region, and validity period'
3396+
type: string
3397+
example: '500MB, North America, 10-year lifetime'
33193398
CellularUsage:
33203399
type: array
33213400
items:
@@ -3470,6 +3549,28 @@ components:
34703549
name:
34713550
description: The name of the field
34723551
type: string
3552+
DataUsage:
3553+
type: object
3554+
properties:
3555+
kb_remaining:
3556+
description: Kilobytes remaining in the plan
3557+
type: number
3558+
format: double
3559+
example: 372.55
3560+
kb_total:
3561+
description: Total Kilobytes included in the plan
3562+
type: number
3563+
format: double
3564+
example: 500
3565+
kb_used:
3566+
description: Kilobytes used to date
3567+
type: number
3568+
format: double
3569+
example: 127.45
3570+
required:
3571+
- kb_total
3572+
- kb_used
3573+
- kb_remaining
34733574
Device:
34743575
type: object
34753576
properties:
@@ -4634,6 +4735,35 @@ components:
46344735
url:
46354736
description: The URL of the route.
46364737
type: string
4738+
SatellitePlan:
4739+
type: object
4740+
properties:
4741+
activated:
4742+
description: Activation date of the satellite plan as Unix timestamp
4743+
type: integer
4744+
format: int64
4745+
example: 1609459200
4746+
billable_bytes:
4747+
$ref: '#/components/schemas/DataUsage'
4748+
last_updated:
4749+
description: Time this plan information was last updated
4750+
type: integer
4751+
format: int64
4752+
example: 1656010061
4753+
ntn_provider:
4754+
description: Non-Terrestrial Network provider name
4755+
type: string
4756+
example: Skylo
4757+
psid:
4758+
description: Provider-specific identifier for the satellite subscription
4759+
type: string
4760+
example: 'skylo:5746354465786'
4761+
nullable: true
4762+
required:
4763+
- ntn_provider
4764+
- psid
4765+
- activated
4766+
- cumulative_billable_bytes
46374767
SchemaProperty:
46384768
type: object
46394769
properties:
@@ -5649,6 +5779,18 @@ components:
56495779
required:
56505780
- alerts
56515781
- has_more
5782+
DevicePlansResponse:
5783+
description: Response body for /plans
5784+
content:
5785+
application/json:
5786+
schema:
5787+
type: object
5788+
properties:
5789+
cellular_plans:
5790+
type: array
5791+
items:
5792+
$ref: '#/components/schemas/CellularPlan'
5793+
nullable: true
56525794
DevicesResponse:
56535795
description: List of Devices
56545796
content:

0 commit comments

Comments
 (0)