@@ -268,7 +268,7 @@ void main() {
268
268
),
269
269
]));
270
270
271
- final response = await dataClient.exportTabularData ('partId1' , 'resourceName1' , 'resourceSubtype1' , 'methodName' , null , null );
271
+ final response = await dataClient.exportTabularData ('partId1' , 'resourceName1' , 'resourceSubtype1' , 'methodName' , null , null , null );
272
272
var index = 0 ;
273
273
for (final point in response) {
274
274
expect (point.partId, equals (data[index].partId));
@@ -288,6 +288,75 @@ void main() {
288
288
}
289
289
});
290
290
291
+ test ('exportTabularData_withAdditionalParams' , () async {
292
+ final timeCaptured = DateTime .utc (2023 , 1 , 1 );
293
+ final Map <String , dynamic > methodParams = {'param1' : 'value1' , 'param2' : 42 };
294
+ final Map <String , dynamic > payload = {'key' : 'value' };
295
+ final Map <String , dynamic > additionalParams = {'filter' : 'test' , 'limit' : 100 , 'includeMetadata' : true };
296
+
297
+ final data = TabularDataPoint (
298
+ partId: 'partId1' ,
299
+ resourceName: 'resourceName1' ,
300
+ resourceSubtype: 'resourceSubtype1' ,
301
+ methodName: 'Readings' ,
302
+ timeCaptured: timeCaptured,
303
+ organizationId: 'orgId1' ,
304
+ locationId: 'locationId1' ,
305
+ robotName: 'robot1' ,
306
+ robotId: 'robotId1' ,
307
+ partName: 'part1' ,
308
+ methodParameters: methodParams,
309
+ tags: [],
310
+ payload: payload,
311
+ );
312
+
313
+ when (serviceClient.exportTabularData (any)).thenAnswer ((invocation) {
314
+ final request = invocation.positionalArguments[0 ] as ExportTabularDataRequest ;
315
+ // Verify that additional parameters are passed correctly
316
+ expect (request.additionalParameters, isNotNull);
317
+ expect (request.additionalParameters! .fields['filter' ]! .stringValue, equals ('test' ));
318
+ expect (request.additionalParameters! .fields['limit' ]! .numberValue, equals (100 ));
319
+ expect (request.additionalParameters! .fields['includeMetadata' ]! .boolValue, equals (true ));
320
+
321
+ return MockResponseStream .list ([
322
+ ExportTabularDataResponse (
323
+ partId: 'partId1' ,
324
+ resourceName: 'resourceName1' ,
325
+ resourceSubtype: 'resourceSubtype1' ,
326
+ methodName: 'Readings' ,
327
+ timeCaptured: Timestamp .fromDateTime (timeCaptured),
328
+ organizationId: 'orgId1' ,
329
+ locationId: 'locationId1' ,
330
+ robotName: 'robot1' ,
331
+ robotId: 'robotId1' ,
332
+ partName: 'part1' ,
333
+ methodParameters: methodParams.toStruct (),
334
+ tags: [],
335
+ payload: payload.toStruct (),
336
+ ),
337
+ ]);
338
+ });
339
+
340
+ final response =
341
+ await dataClient.exportTabularData ('partId1' , 'resourceName1' , 'resourceSubtype1' , 'methodName' , null , null , additionalParams);
342
+
343
+ expect (response, hasLength (1 ));
344
+ final point = response.first;
345
+ expect (point.partId, equals (data.partId));
346
+ expect (point.resourceName, equals (data.resourceName));
347
+ expect (point.resourceSubtype, equals (data.resourceSubtype));
348
+ expect (point.methodName, equals (data.methodName));
349
+ expect (point.timeCaptured, equals (data.timeCaptured));
350
+ expect (point.organizationId, equals (data.organizationId));
351
+ expect (point.locationId, equals (data.locationId));
352
+ expect (point.robotName, equals (data.robotName));
353
+ expect (point.robotId, equals (data.robotId));
354
+ expect (point.partName, equals (data.partName));
355
+ expect (point.methodParameters, equals (data.methodParameters));
356
+ expect (point.tags, equals (data.tags));
357
+ expect (point.payload, equals (data.payload));
358
+ });
359
+
291
360
test ('deleteTabularData' , () async {
292
361
when (serviceClient.deleteTabularData (any))
293
362
.thenAnswer ((_) => MockResponseFuture .value (DeleteTabularDataResponse ()..deletedCount = Int64 (12 )));
@@ -410,7 +479,7 @@ void main() {
410
479
timeSynced: Timestamp .fromDateTime (timeSynced),
411
480
payload: payload.toStruct ())));
412
481
413
- final response = await dataClient.getLatestTabularData ('part-id' , 'resource-name' , 'resource-subtype' , 'method-name' );
482
+ final response = await dataClient.getLatestTabularData ('part-id' , 'resource-name' , 'resource-subtype' , 'method-name' , null );
414
483
415
484
expect (response? .timeCaptured, equals (timeCaptured));
416
485
expect (response? .timeSynced, equals (timeSynced));
@@ -421,7 +490,7 @@ void main() {
421
490
// Test null response
422
491
when (serviceClient.getLatestTabularData (any)).thenAnswer ((_) => MockResponseFuture .value (GetLatestTabularDataResponse ()));
423
492
424
- final nullResponse = await dataClient.getLatestTabularData ('part-id' , 'resource-name' , 'resource-subtype' , 'method-name' );
493
+ final nullResponse = await dataClient.getLatestTabularData ('part-id' , 'resource-name' , 'resource-subtype' , 'method-name' , null );
425
494
426
495
expect (nullResponse, isNull);
427
496
});
0 commit comments