From b39f651cc6476ab4a476060a46a6b5dfcf68489b Mon Sep 17 00:00:00 2001 From: Kenneth Date: Thu, 16 Oct 2025 16:45:59 -0400 Subject: [PATCH 1/3] Add uuid support --- lib/src/models/access_offer.dart | 5 ++++ lib/src/models/account.dart | 2 ++ lib/src/models/callHistory/call_history.dart | 24 ++++++++++++++++---- lib/src/platform_client.dart | 22 +++++++++--------- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/lib/src/models/access_offer.dart b/lib/src/models/access_offer.dart index 76d32eb..a7e4f3b 100644 --- a/lib/src/models/access_offer.dart +++ b/lib/src/models/access_offer.dart @@ -30,6 +30,7 @@ class AccessOfferDetails { enabled = json['enabled'], expired = json['expired'], id = json['id'], + uuid = json['uuid'], key = json['key'], message = json['message'], name = json['name'], @@ -58,6 +59,7 @@ class AccessOfferDetails { bool? enabled; bool? expired; int id; + String uuid; String? key; String? message; String name; @@ -123,6 +125,7 @@ class AccountDetails { : acceptBusinessUsers = json['acceptBusinessUsers'], accountCode = json['accountCode'], accountId = json['accountId'], + uuid = json['uuid'], accountType = AccountType.fromName(json['accountType']), email = json['email'], firstname = json['firstname'], @@ -132,6 +135,7 @@ class AccountDetails { bool? acceptBusinessUsers; String? accountCode; int? accountId; + String? uuid; AccountType? accountType; String? email; String? firstname; @@ -147,6 +151,7 @@ class AccountDetails { 'firstname': firstname, 'name': name, 'type': type, + 'uuid': uuid, }; } diff --git a/lib/src/models/account.dart b/lib/src/models/account.dart index a889fb2..9b97b36 100644 --- a/lib/src/models/account.dart +++ b/lib/src/models/account.dart @@ -36,6 +36,7 @@ enum AccessAiRestriction { class Account { final int id; + final String uuid; final String name; final AccountType type; @@ -44,6 +45,7 @@ class Account { Account.fromJson(Map json) : id = json['id'], + uuid = json['uuid'], name = json['name'], type = AccountType.fromName(json['accountType']), accessAI = AccessAiRestriction.fromValue(json['accessAi']); diff --git a/lib/src/models/callHistory/call_history.dart b/lib/src/models/callHistory/call_history.dart index 0e71e45..5264692 100644 --- a/lib/src/models/callHistory/call_history.dart +++ b/lib/src/models/callHistory/call_history.dart @@ -10,13 +10,17 @@ import 'package:flutter_aira/src/models/feedback.dart'; class SessionFeedback { SessionFeedback({ required this.serviceId, + required this.serviceUuid, this.requestReview = false, this.appFeedback, this.agentFeedback, this.aiFeedback, }); - factory SessionFeedback.fromJson(Map json) { + factory SessionFeedback.fromJson({ + required Map json, + required String serviceUuid, + }) { String? commentRaw = json['comment']; Map commentJson; try { @@ -32,6 +36,7 @@ class SessionFeedback { bool requestReview = commentJson['agent']?['requestReview'] ?? false; return SessionFeedback( serviceId: json['serviceId'], + serviceUuid: serviceUuid, requestReview: requestReview, appFeedback: Feedback.fromJson(commentJson['app']), agentFeedback: Feedback.fromJson(commentJson['agent']), @@ -42,6 +47,7 @@ class SessionFeedback { Map toJson() { return { 'serviceId': serviceId, + 'serviceUuid': serviceUuid, 'requestReview': requestReview, 'app': appFeedback?.toJson(), 'agent': agentFeedback?.toJson(), @@ -50,7 +56,11 @@ class SessionFeedback { } /// Service request ID. - int serviceId; + /// Please check the [serviceUuid] if [serviceId] not exist. + int? serviceId; + + /// please check the [serviceId] if [serviceUuid] not exist. + String? serviceUuid; /// True if the Explorer requested special attention to his review. bool requestReview; @@ -82,14 +92,18 @@ class CallSession { endTimeStamp = (json['endTimeStamp'] as String?)?.dateTime, requestSource = json['requestSource'], requestTimeStamp = (json['requestTimeStamp'] as String?)?.dateTime, - serviceId = json['serviceid'], + serviceId = json['serviceid'] ?? json['serviceId'], + serviceUuid = json['serviceUuid'], startTimeStamp = (json['startTimeStamp'] as String?)?.dateTime, status = json['status'], userFirstname = json['firstname'], userId = json['userId'], userFeedback = null == json['userFeedback'] ? null - : SessionFeedback.fromJson(json['userFeedback']), + : SessionFeedback.fromJson( + json: json['userFeedback'], + serviceUuid: json['serviceUuid'], + ), buildAi = json['buildAi'] != null ? BuildAi.fromJson(json['buildAi']) : null, userFeedbackForm = FeedbackForm.fromJson(json['userFeedbackForm']), @@ -114,6 +128,8 @@ class CallSession { /// ID representing the Service Request. int serviceId; + String serviceUuid; + /// Start time of the call. DateTime? startTimeStamp; diff --git a/lib/src/platform_client.dart b/lib/src/platform_client.dart index d35239e..9654603 100644 --- a/lib/src/platform_client.dart +++ b/lib/src/platform_client.dart @@ -368,7 +368,7 @@ class PlatformClient { static Future uploadSensorData({ required String apiKey, required String airaToken, - required String serviceRequestId, + required String serviceRequestUuid, required String platformHost, required int batchNumber, required Map body, @@ -376,7 +376,7 @@ class PlatformClient { // Send the request final uri = Uri.https( platformHost, - '/api/service-request/$serviceRequestId/sensors/$batchNumber', + '/api/service-request/$serviceRequestUuid/sensors/$batchNumber', ); final headers = { @@ -446,11 +446,11 @@ class PlatformClient { /// Update service request's Build AI Program allow sharing status. Future updateSessionShareStatus( - int serviceId, + String callId, bool value, ) async { await _httpPut( - '/api/service-request/$serviceId/build-ai/allow-sharing', + '/api/service-request/$callId/build-ai/allow-sharing', body: jsonEncode( {'value': value}, ), @@ -527,7 +527,7 @@ class PlatformClient { Map? agentFeedback = feedback.agentFeedback?.toJson(); agentFeedback?['requestReview'] = feedback.requestReview; String body = jsonEncode({ - 'serviceId': feedback.serviceId, + 'serviceId': feedback.serviceUuid ?? feedback.serviceId, 'comment': jsonEncode({ 'schemaVersion': 2, 'agent': agentFeedback, @@ -544,15 +544,15 @@ class PlatformClient { } /// Uploads a photo for a service request. - Future uploadPhoto(int serviceRequestId, ByteBuffer photo) async { + Future uploadPhoto(String callId, ByteBuffer photo) async { _verifyIsLoggedIn(); - return uploadPhotoWithUint8List(serviceRequestId, photo.asUint8List()); + return uploadPhotoWithUint8List(callId, photo.asUint8List()); } /// Uploads a photo for a service request. Future uploadPhotoWithUint8List( - int serviceRequestId, + String callId, Uint8List photo, ) async { _verifyIsLoggedIn(); @@ -565,7 +565,7 @@ class PlatformClient { 'category': 'sr_trigger', 'entityid': _userId.toString(), 'entitytype': 'user', - 'serviceid': serviceRequestId.toString(), + 'serviceid': callId, }; http.MultipartFile file = http.MultipartFile.fromBytes( 'file', @@ -793,14 +793,14 @@ class PlatformClient { } /// This API returns the same data as on the call-history API, just for a single session. - Future getCallHistorySingleCall(int serviceRequestId) async { + Future getCallHistorySingleCall(String callId) async { _verifyIsLoggedIn(); Map response = await _httpGet( '/api/user/service/history/bu', queryParameters: { 'userId': _userId.toString(), - 'serviceId': serviceRequestId.toString(), + 'serviceId': callId, }, ); From 2ee30a0db7108121b56f5210f0e0c2a69dbdce32 Mon Sep 17 00:00:00 2001 From: Kenneth Date: Mon, 20 Oct 2025 16:50:48 -0400 Subject: [PATCH 2/3] Bump version --- CHANGELOG.md | 4 ++++ example/pubspec.lock | 2 +- pubspec.yaml | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edf6353..cece1a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.3.7] - 2025-10-20 + +- API migration support UUIDs (FE-58) + ## [3.3.6] - 2025-10-07 - Remove duplicated `LiveKitSettings` object with the parsing issue which is already in `aira_call` (FE-81) diff --git a/example/pubspec.lock b/example/pubspec.lock index affcfc8..32a3348 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -116,7 +116,7 @@ packages: path: ".." relative: true source: path - version: "3.3.6" + version: "3.3.7" flutter_lints: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 133da09..55a5b20 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_aira description: The Aira Flutter SDK. -version: 3.3.6 +version: 3.3.7 homepage: https://github.com/aira/flutter_aira environment: From 5e201b0472c7b48148aa8362d13752e323a83266 Mon Sep 17 00:00:00 2001 From: Kenneth Chu Date: Mon, 20 Oct 2025 16:54:46 -0400 Subject: [PATCH 3/3] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- lib/src/models/access_offer.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/models/access_offer.dart b/lib/src/models/access_offer.dart index a7e4f3b..8189bc3 100644 --- a/lib/src/models/access_offer.dart +++ b/lib/src/models/access_offer.dart @@ -30,7 +30,7 @@ class AccessOfferDetails { enabled = json['enabled'], expired = json['expired'], id = json['id'], - uuid = json['uuid'], + uuid = json['uuid'], key = json['key'], message = json['message'], name = json['name'],