editGlossary method
Edit a glossary. Parameters
glossary
The glossary to edit.term
The term name of the glossary (optional).translation
The translation of the glossary (optional).description
The description of the glossary (optional).mod
The minecraft mod of the glossary (optional).global
If the glossary is global (optional, if set true mod must be null).token
The token to use for authentication (optional if you have set a global token).
Implementation
Future<Glossary> editGlossary(Glossary glossary,
{String? term,
String? translation,
String? description,
MinecraftMod? mod,
String? token,
bool global = false}) async {
if (term == null &&
translation == null &&
description == null &&
mod == null &&
global == false) {
return glossary;
}
APIHttpResponse response =
await httpClient.patch('/translate/glossary/${glossary.uuid}',
body: {
if (term != null) 'term': term,
if (translation != null) 'translation': translation,
if (description != null) 'description': description,
if (global && mod == null)
'modUUID': null
else if (mod != null)
'modUUID': mod.uuid,
},
token: token);
return Glossary.fromMap(response.data);
}