updateUserAttributes method

Future<UserAttributesUpdateResult> updateUserAttributes({
  1. required String userToken,
  2. bool? isPaying,
  3. String? plan,
  4. double? mrr,
  5. String? currency,
})

Reports self-declared user attributes.

Implementation

Future<UserAttributesUpdateResult> updateUserAttributes({
  required String userToken,
  bool? isPaying,
  String? plan,
  double? mrr,
  String? currency,
}) async {
  final body = <String, dynamic>{};
  if (isPaying != null) body['isPaying'] = isPaying;
  if (plan != null && plan.isNotEmpty) body['plan'] = plan.trim();
  if (mrr != null) body['mrr'] = mrr;
  if (currency != null && currency.isNotEmpty) body['currency'] = currency.trim();

  final json = await _sendJson(
    method: 'PUT',
    path: '/api/v1/public/apps/${config.appKey}/user',
    body: body,
    userToken: userToken,
    acceptedStatuses: const [200],
  );
  return UserAttributesUpdateResult.fromJson(json);
}