File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -793,6 +793,29 @@ describe('AppClient tests', () => {
793
793
} ) ;
794
794
} ) ;
795
795
796
+ describe ( 'getRobotPartByNameAndLocation tests' , ( ) => {
797
+ const expectedResponse = new pb . GetRobotPartByNameAndLocationResponse ( {
798
+ part : robotPart ,
799
+ } ) ;
800
+ beforeEach ( ( ) => {
801
+ mockTransport = createRouterTransport ( ( { service } ) => {
802
+ service ( AppService , {
803
+ getRobotPartByNameAndLocation : ( ) => {
804
+ return expectedResponse ;
805
+ } ,
806
+ } ) ;
807
+ } ) ;
808
+ } ) ;
809
+
810
+ it ( 'getRobotPartByNameAndLocation' , async ( ) => {
811
+ const response = await subject ( ) . getRobotPartByNameAndLocation (
812
+ 'name' ,
813
+ 'locationId'
814
+ ) ;
815
+ expect ( response ) . toEqual ( expectedResponse ) ;
816
+ } ) ;
817
+ } ) ;
818
+
796
819
describe ( 'getRobotPartLogs tests' , ( ) => {
797
820
const expectedResponse = new pb . GetRobotPartLogsResponse ( {
798
821
logs : [ logEntry ] ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {
15
15
GetAppContentResponse ,
16
16
GetRobotPartLogsResponse ,
17
17
GetRobotPartResponse ,
18
+ GetRobotPartByNameAndLocationResponse ,
18
19
ListOrganizationMembersResponse ,
19
20
Location ,
20
21
LocationAuth ,
@@ -848,6 +849,32 @@ export class AppClient {
848
849
return this . client . getRobotPart ( { id } ) ;
849
850
}
850
851
852
+ /**
853
+ * Queries a specific robot part by name and location id.
854
+ *
855
+ * @example
856
+ *
857
+ * ```ts
858
+ * const robotPart = await appClient.getRobotPartByNameAndLocation(
859
+ * '<YOUR-ROBOT-PART-NAME>',
860
+ * '<YOUR-LOCATION-ID>'
861
+ * );
862
+ * ```
863
+ *
864
+ * For more information, see [App
865
+ * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotpartbynameandlocation).
866
+ *
867
+ * @param name The name of the requested robot part
868
+ * @param locationId The ID of the location of the requested robot part
869
+ * @returns The robot part
870
+ */
871
+ async getRobotPartByNameAndLocation (
872
+ name : string ,
873
+ locationId : string
874
+ ) : Promise < GetRobotPartByNameAndLocationResponse > {
875
+ return this . client . getRobotPartByNameAndLocation ( { name, locationId } ) ;
876
+ }
877
+
851
878
/**
852
879
* Get a page of log entries for a specific robot part. Logs are sorted by
853
880
* descending time (newest first).
You can’t perform that action at this time.
0 commit comments