setBuildConfig method

Future<bool> setBuildConfig({
  1. required BuildInfo? buildInfo,
  2. required String buildName,
  3. required int buildTime,
})

Implementation

Future<bool> setBuildConfig({
  required BuildInfo? buildInfo,
  required String buildName,
  required int buildTime,
}) async {
  final appwriteServer = AppwriteServer(environment);
  final databases = appwriteServer.databases;
  try {
    await databases.createDocument(
      databaseId: environment.databaseId,
      collectionId: environment.collectionId,
      documentId: ID.unique(),
      data: {
        'platform': platform,
        'build_name': buildName,
        // 'build_time': DateTime.fromMillisecondsSinceEpoch(buildTime * 1000)
        //     .toIso8601String(),
        'build_number': buildTime,
        'flutter_conmit': JSON(buildInfo?.flutter).stringValue,
        'unity_cache_commit': JSON(buildInfo?.unity.cache).stringValue,
        'unity_log_commit': JSON(buildInfo?.unity.log).stringValue,
        'branch': branch,
      },
    );
    return true;
  } catch (e) {
    logger.log(e.toString(), status: LogStatus.error);
    return false;
  }
}