editVote method

Future<TranslationVote> editVote(
  1. TranslationVote vote, {
  2. required TranslationVoteType type,
  3. String? token,
})

Edit a vote. Parameters

  • vote The vote to edit.
  • type Up or down vote.
  • token The token to use for authentication (optional if you have set a global token).

Implementation

Future<TranslationVote> editVote(TranslationVote vote,
    {required TranslationVoteType type, String? token}) async {
  if (vote.type == type) {
    return vote;
  }

  APIHttpResponse response =
      await httpClient.patch('/translate/vote/${vote.uuid}', body: {
    'type': type.name,
  });

  return TranslationVote.fromMap(response.data);
}