diff --git a/lib/src/app/app.dart b/lib/src/app/app.dart index 602637d2e92..15fa2c72e1a 100644 --- a/lib/src/app/app.dart +++ b/lib/src/app/app.dart @@ -904,4 +904,41 @@ class AppClient { ..data = data.toStruct(); await _client.updateRobotPartMetadata(request); } + + /// Upload a device push token for the user. + /// + /// Associates a device token with the user's email and app bundle ID so that + /// push notifications can be sent to this device when triggers fire. + Future uploadDevicePushToken(String email, String bundleId, String deviceUuid, String deviceToken) async { + final request = UploadDevicePushTokenRequest() + ..email = email + ..bundleId = bundleId + ..deviceUuid = deviceUuid + ..deviceToken = deviceToken; + await _client.uploadDevicePushToken(request); + } + + /// Delete a device push token for the user. + /// + /// Removes a previously registered device token, stopping push notifications + /// for this device. + Future deleteDevicePushToken(String email, String bundleId, String deviceUuid) async { + final request = DeleteDevicePushTokenRequest() + ..email = email + ..bundleId = bundleId + ..deviceUuid = deviceUuid; + await _client.deleteDevicePushToken(request); + } + + /// Get all device push tokens for the user. + /// + /// Returns a list of device tokens registered for the given user email and + /// app bundle ID. + Future> getDevicePushTokens(String email, String bundleId) async { + final request = GetDevicePushTokensRequest() + ..email = email + ..bundleId = bundleId; + final GetDevicePushTokensResponse response = await _client.getDevicePushTokens(request); + return response.deviceTokens; + } }