editMinecraftMod method

Future<MinecraftMod> editMinecraftMod({
  1. required String uuid,
  2. String? name,
  3. List<String>? supportVersions,
  4. String? id,
  5. String? description,
  6. List<RelationMod>? relationMods,
  7. ModIntegrationPlatform? integration,
  8. List<ModSide>? side,
  9. List<ModLoader>? loader,
  10. String? translatedName,
  11. String? introduction,
  12. String? imageStorageUUID,
  13. String? changelog,
  14. String? token,
})

編輯 Minecraft 模組,如果編輯成功將回傳編輯後的 Minecraft 模組資訊

必填參數

  • uuid 要編輯的模組 UUID 選填參數
  • name 模組名稱
  • supportVersions 該模組支援的 Minecraft 版本
  • id 模組 ID
  • description 模組描述
  • relationMods 關聯模組
  • integration 模組串連的平台
  • side 模組支援的執行環境
  • translatedName 模組譯名
  • introduction 模組介紹文
  • imageStorageUUID 模組封面圖的 Storage UUID
  • changelog 變更日誌

Implementation

Future<MinecraftMod> editMinecraftMod(
    {required String uuid,
    String? name,
    List<String>? supportVersions,
    String? id,
    String? description,
    List<RelationMod>? relationMods,
    ModIntegrationPlatform? integration,
    List<ModSide>? side,
    List<ModLoader>? loader,
    String? translatedName,
    String? introduction,
    String? imageStorageUUID,
    String? changelog,
    String? token}) async {
  if (token == null && httpClient.globalToken == null) {
    throw UnauthorizedException();
  }

  Map postData = {};

  if (name != null) {
    postData['name'] = name;
  }
  if (supportVersions != null) {
    postData['supportVersions'] = supportVersions;
  }
  if (id != null) {
    postData['id'] = id;
  }
  if (description != null) {
    postData['description'] = description;
  }
  if (relationMods != null) {
    postData['relationMods'] = relationMods.map((e) => e.toMap()).toList();
  }
  if (integration != null) {
    postData['integration'] = integration.toMap();
  }
  if (side != null) {
    postData['side'] = side.map((e) => e.toMap()).toList();
  }
  if (loader != null) {
    postData['loader'] = loader.map((e) => e.name).toList();
  }
  if (translatedName != null) {
    postData['translatedName'] = translatedName;
  }
  if (introduction != null) {
    postData['introduction'] = introduction;
  }
  if (imageStorageUUID != null) {
    postData['imageStorageUUID'] = imageStorageUUID;
  }
  if (changelog != null) {
    postData['changelog'] = changelog;
  }

  APIHttpResponse response =
      await httpClient.patch('/minecraft/mod/edit/$uuid', body: postData);

  return MinecraftMod.fromMap(response.data);
}