UserPushTokenRegisterRequest constructor
UserPushTokenRegisterRequest({
- required PushTokenType type,
- required String token,
- bool alwaysPush = false,
- bool unique = false,
- String? userId,
Implementation
UserPushTokenRegisterRequest({
required PushTokenType type,
required String token,
bool alwaysPush = false,
bool unique = false,
String? userId,
}) : super(userId: userId) {
final typeUrl = pushTokenToString(type);
if (typeUrl == null) {
return;
}
url = 'users/${userId ?? state.userId}/push/$typeUrl';
body = {
if (type == PushTokenType.fcm) 'gcm_reg_token': token,
if (type == PushTokenType.apns) 'apns_device_token': token,
if (type == PushTokenType.hms) 'huawei_device_token': token,
'is_unique': unique,
'always_push': alwaysPush,
};
}