updateProfileSettings method

Future<bool> updateProfileSettings({
  1. required ProfileSettings profileSettings,
})

Updates the account's profile settings

Returns true if the profile settings had been updated, and false otherwise

Implementation

Future<bool> updateProfileSettings({
  required ProfileSettings profileSettings,
}) async {
  final response = await post(
    '/settings/profile',
    body: {
      'over18': profileSettings.over18,
      'hide_offensive': profileSettings.hideOffensive,
      'show_nsfl': profileSettings.showNsfl,
      'filter_nsfw': profileSettings.filterNsfw,
      'private': profileSettings.private,
      'nofollow': profileSettings.nofollow,
      'bio': profileSettings.bio,
      'title_id': profileSettings.titleId,
    },
  );

  if (response == null) {
    log.error('Failed to update profile settings');
    return false;
  }

  log.success('Settings updated');

  return true;
}