Added a new field called push provider name in addDevice api call

This commit is contained in:
Ayush Shekhar
2022-04-27 18:23:17 +05:30
parent d58f727a57
commit 28649107ee
5 changed files with 83 additions and 6 deletions
@@ -818,8 +818,16 @@ class StreamChatClient {
);
/// Add a device for Push Notifications.
Future<EmptyResponse> addDevice(String id, PushProvider pushProvider) =>
_chatApi.device.addDevice(id, pushProvider);
Future<EmptyResponse> addDevice(
String id,
PushProvider pushProvider, {
String? pushProviderName,
}) =>
_chatApi.device.addDevice(
id,
pushProvider,
pushProviderName: pushProviderName,
);
/// Gets a list of user devices.
Future<ListDevicesResponse> getDevices() => _chatApi.device.getDevices();
@@ -29,13 +29,16 @@ class DeviceApi {
/// Add a device for Push Notifications.
Future<EmptyResponse> addDevice(
String deviceId,
PushProvider pushProvider,
) async {
PushProvider pushProvider, {
String? pushProviderName,
}) async {
final response = await _client.post(
'/devices',
data: {
'id': deviceId,
'push_provider': pushProvider.name,
if (pushProviderName != null && pushProviderName.isNotEmpty)
'push_provider_name': pushProviderName,
},
);
return EmptyResponse.fromJson(response.data);