editSourceText method

Future<SourceText> editSourceText(
  1. SourceText sourceText, {
  2. String? source,
  3. List<String>? gameVersions,
  4. String? key,
  5. String? token,
})

Edit a source text. Parameters

  • sourceText The source text to edit.
  • source The source content,
  • gameVersions The game versions of the text.
  • key The key of the text.
  • token The token to use for authentication (optional if you have set a global token).

Implementation

Future<SourceText> editSourceText(SourceText sourceText,
    {String? source,
    List<String>? gameVersions,
    String? key,
    String? token}) async {
  if (source == null && gameVersions == null && key == null) {
    return sourceText;
  }

  APIHttpResponse response =
      await httpClient.patch('/translate/source-text/${sourceText.uuid}',
          body: {
            if (source != null) 'source': source,
            if (gameVersions != null) 'gameVersions': gameVersions,
            if (key != null) 'key': key,
          },
          token: token);

  return SourceText.fromMap(response.data);
}