@@ -357,19 +357,93 @@ class Cayenne {
357
357
return this . auth . send ( this . service , 'GET' , url ) ;
358
358
}
359
359
360
+ /**
361
+ * Get V2 one things data type
362
+ */
363
+ deleteThingDataTypeV2 ( id ) {
364
+ const url = `${ this . url } /v2/things/datatypes/${ id } ` ;
365
+ return this . auth . send ( this . service , 'DELETE' , url ) ;
366
+ }
367
+
368
+ /**
369
+ * @param {Object } payload
370
+ * @param {String } payload.name
371
+ * @param {String } payload.label
372
+ * @param {String } payload.payload
373
+ */
374
+ createThingDataTypeV2 ( payload ) {
375
+ const url = `${ this . url } /v2/things/datatypes` ;
376
+ return this . auth . send ( this . service , 'POST' , url , { payload } ) ;
377
+ }
378
+
379
+ /**
380
+ * @param {Object } id
381
+ * @param {Object } payload
382
+ * @param {String } payload.name
383
+ * @param {String } payload.label
384
+ * @param {String } payload.payload
385
+ */
386
+ updateThingDataTypeV2 ( id , payload ) {
387
+ const url = `${ this . url } /v2/things/datatypes/${ id } ` ;
388
+ return this . auth . send ( this . service , 'PUT' , url , { payload } ) ;
389
+ }
390
+
360
391
/**
361
392
* Get V2 one things data type properties
393
+ * @param {String } typeId
362
394
* @param {Object } query
363
395
* @param {Number } [query.limit]
364
396
* @param {Number } [query.page]
365
397
*/
366
- getThingDataTypePropertiesV2 ( id , query ) {
367
- const url = `${ this . url } /v2/things/datatypes/${ id } /properties` ;
398
+ getThingDataTypePropertiesV2 ( typeId , query ) {
399
+ const url = `${ this . url } /v2/things/datatypes/${ typeId } /properties` ;
400
+ return this . auth . send ( this . service , 'GET' , url , { query } ) ;
401
+ }
402
+
403
+ /**
404
+ * Count V2 all things data types
405
+ * @param {Object } query
406
+ */
407
+ countThingDataTypePropertiesV2 ( typeId , query ) {
408
+ const url = `${ this . url } /v2/things/datatypes/${ typeId } /properties` ;
368
409
return this . auth . send ( this . service , 'GET' , url , { query } ) ;
369
410
}
370
411
412
+ /**
413
+ * Create a V2 datatype property
414
+ * @param {String } typeId
415
+ * @param {Object } payload
416
+ */
417
+ createThingDataTypePropertyV2 ( typeId , payload ) {
418
+ const url = `${ this . url } /v2/things/datatypes/${ typeId } /properties` ;
419
+ return this . auth . send ( this . service , 'POST' , url , { payload } ) ;
420
+ }
421
+
422
+ /**
423
+ * Update V2 datatypes properties
424
+ * @param {String } typeId
425
+ * @param {Number } propertyId
426
+ * @param {Object } payload
427
+ */
428
+ updateThingDataTypePropertyV2 ( typeId , pid , payload ) {
429
+ const url = `${ this . url } /v2/things/datatypes/${ typeId } /properties/${ pid } ` ;
430
+ return this . auth . send ( this . service , 'PUT' , url , { payload } ) ;
431
+ }
432
+
433
+ /**
434
+ * delete V2 one things data type properties
435
+ * @param {String } typeId
436
+ * @param {Number } pid
437
+ */
438
+ deleteThingDataTypePropertyV2 ( typeId , pid ) {
439
+ const url = `${ this . url } /v2/things/datatypes/${ typeId } /properties/${ pid } ` ;
440
+ return this . auth . send ( this . service , 'GET' , url ) ;
441
+ }
442
+
371
443
/**
372
444
* Get V2 one things data type property by it's id
445
+ * @param {String } typeId
446
+ * @param {Number } pid
373
447
*/
374
448
getThingDataTypePropertyV2 ( id , pid ) {
375
449
const url = `${ this . url } /v2/things/datatypes/${ id } /properties/${ pid } ` ;
@@ -402,6 +476,14 @@ class Cayenne {
402
476
return this . auth . send ( this . service , 'GET' , url ) ;
403
477
}
404
478
479
+ /**
480
+ * Count device types
481
+ */
482
+ countDeviceTypes ( ) {
483
+ const url = `${ this . url } /things/types/count` ;
484
+ return this . auth . send ( this . service , 'GET' , url ) ;
485
+ }
486
+
405
487
/**
406
488
* Gets a device's meta data by device type id
407
489
* @param {String } deviceTypeId
@@ -428,6 +510,15 @@ class Cayenne {
428
510
} ) ;
429
511
}
430
512
513
+ /**
514
+ * Count a device's meta data by device type id
515
+ * @param {String } deviceTypeId
516
+ */
517
+ countDeviceTypeMeta ( deviceTypeId ) {
518
+ const url = `${ this . url } /things/types/${ deviceTypeId } /meta/count` ;
519
+ return this . auth . send ( this . service , 'GET' , url ) ;
520
+ }
521
+
431
522
/**
432
523
* Gets a device's meta data by device type id
433
524
* @param {String } deviceTypeId
@@ -465,6 +556,15 @@ class Cayenne {
465
556
return this . auth . send ( this . service , 'GET' , url ) ;
466
557
}
467
558
559
+ /**
560
+ * Count a device's channel meta by device type id
561
+ * @param {String } deviceTypeId
562
+ */
563
+ countDeviceTypeChannels ( deviceTypeId ) {
564
+ const url = `${ this . url } /things/types/${ deviceTypeId } /channels/count` ;
565
+ return this . auth . send ( this . service , 'GET' , url ) ;
566
+ }
567
+
468
568
/**
469
569
* Get a device type's uses
470
570
* @param {String } deviceTypeId
@@ -474,6 +574,15 @@ class Cayenne {
474
574
return this . auth . send ( this . service , 'GET' , url ) ;
475
575
}
476
576
577
+ /**
578
+ * Count a device type's uses
579
+ * @param {String } deviceTypeId
580
+ */
581
+ countDeviceTypeUses ( deviceTypeId ) {
582
+ const url = `${ this . url } /things/types/${ deviceTypeId } /uses/count` ;
583
+ return this . auth . send ( this . service , 'GET' , url ) ;
584
+ }
585
+
477
586
/**
478
587
* Creates a new device type
479
588
* @param {Object } payload
@@ -496,6 +605,29 @@ class Cayenne {
496
605
return this . auth . send ( this . service , 'POST' , url , { payload } ) ;
497
606
}
498
607
608
+ /**
609
+ * Updates a device type
610
+ * @param {String } id
611
+ * @param {Object } payload
612
+ * @param {String } payload.name
613
+ * @param {String } payload.description
614
+ * @param {String } payload.model
615
+ * @param {String } payload.version
616
+ * @param {String } payload.properties
617
+ * @param {String } payload.manufacturer
618
+ * @param {String } payload.transport_protocol
619
+ * @param {String } payload.protocol_version
620
+ * @param {String } payload.category
621
+ * @param {String } payload.codec
622
+ * @param {String } payload.subcategory
623
+ * @param {String } payload.parent_constraint
624
+ * @param {String } payload.child_constraint
625
+ */
626
+ updateDeviceType ( deviceTypeId , payload ) {
627
+ const url = `${ this . url } /things/types/${ deviceTypeId } ` ;
628
+ return this . auth . send ( this . service , 'PUT' , url , { payload } ) ;
629
+ }
630
+
499
631
/**
500
632
* @param {String } deviceTypeId
501
633
* @param {Object } payload
@@ -509,6 +641,32 @@ class Cayenne {
509
641
return this . auth . send ( this . service , 'POST' , url , { payload } ) ;
510
642
}
511
643
644
+ /**
645
+ * @param {String } deviceTypeId
646
+ * @param {Object } payload
647
+ * @param {String } payload.name
648
+ * @param {String } payload.datatype
649
+ * @param {String } payload.channel
650
+ * @param {String } [payload.ipso]
651
+ */
652
+ updateDeviceTypeChannel ( deviceTypeId , channelId , payload ) {
653
+ const url = `${
654
+ this . url
655
+ } /things/types/${ deviceTypeId } /channels/${ channelId } `;
656
+ return this . auth . send ( this . service , 'PUT' , url , { payload } ) ;
657
+ }
658
+
659
+ /**
660
+ * @param {String } deviceTypeId
661
+ * @param {String } channelId
662
+ */
663
+ deleteDeviceTypeChannel ( deviceTypeId , channelId ) {
664
+ const url = `${
665
+ this . url
666
+ } /things/types/${ deviceTypeId } /channels/${ channelId } `;
667
+ return this . auth . send ( this . service , 'DELETE' , url ) ;
668
+ }
669
+
512
670
/**
513
671
* @param {String } deviceTypeId
514
672
* @param {Object } payload
@@ -520,6 +678,29 @@ class Cayenne {
520
678
return this . auth . send ( this . service , 'POST' , url , { payload } ) ;
521
679
}
522
680
681
+ /**
682
+ * @param {String } deviceTypeId
683
+ * @param {String } metaId
684
+ * @param {Object } payload
685
+ * @param {String } payload.name
686
+ * @param {String } payload.datatype
687
+ * @param {String } payload.channel
688
+ * @param {String } [payload.ipso]
689
+ */
690
+ updateDeviceTypeMeta ( deviceTypeId , metaId , payload ) {
691
+ const url = `${ this . url } /things/types/${ deviceTypeId } /meta/${ metaId } ` ;
692
+ return this . auth . send ( this . service , 'PUT' , url , { payload } ) ;
693
+ }
694
+
695
+ /**
696
+ * @param {String } deviceTypeId
697
+ * @param {String } metaId
698
+ */
699
+ deleteDeviceTypeMeta ( deviceTypeId , metaId ) {
700
+ const url = `${ this . url } /things/types/${ deviceTypeId } /channels/${ metaId } ` ;
701
+ return this . auth . send ( this . service , 'DELETE' , url ) ;
702
+ }
703
+
523
704
/**
524
705
* @param {String } deviceTypeId
525
706
* @param {Object } payload
@@ -534,6 +715,29 @@ class Cayenne {
534
715
return this . auth . send ( this . service , 'POST' , url , { payload } ) ;
535
716
}
536
717
718
+ /**
719
+ * @param {String } deviceTypeId
720
+ * @param {String } useId
721
+ * @param {Object } payload
722
+ * @param {String } payload.name
723
+ * @param {String } payload.datatype
724
+ * @param {String } payload.channel
725
+ * @param {String } [payload.ipso]
726
+ */
727
+ updateDeviceTypeUse ( deviceTypeId , useId , payload ) {
728
+ const url = `${ this . url } /things/types/${ deviceTypeId } /meta/${ useId } ` ;
729
+ return this . auth . send ( this . service , 'PUT' , url , { payload } ) ;
730
+ }
731
+
732
+ /**
733
+ * @param {String } deviceTypeId
734
+ * @param {String } useId
735
+ */
736
+ deleteDeviceTypeUse ( deviceTypeId , useId ) {
737
+ const url = `${ this . url } /things/types/${ deviceTypeId } /channels/${ useId } ` ;
738
+ return this . auth . send ( this . service , 'DELETE' , url ) ;
739
+ }
740
+
537
741
/**
538
742
* Delete a device type
539
743
* @param {String } deviceTypeId
0 commit comments