From f100c40357af053e5288e2fd90d091751e6191c1 Mon Sep 17 00:00:00 2001 From: Quentin Hibon Date: Mon, 8 Feb 2021 11:20:48 +0100 Subject: [PATCH] Implement task fetching users from crowdin project --- translators.gradle.kts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/translators.gradle.kts b/translators.gradle.kts index 3b9a3f1e2..564ca7e50 100644 --- a/translators.gradle.kts +++ b/translators.gradle.kts @@ -1,5 +1,35 @@ +import com.crowdin.client.Client +import com.crowdin.client.core.model.Credentials import groovy.xml.MarkupBuilder +buildscript { + repositories { + mavenCentral() + maven(url = "https://jitpack.io") + } + dependencies { + "classpath"("com.github.crowdin:crowdin-api-client-java:1.3.3") + } +} + +task("fetchTranslators") { + doLast { + val reader = file("token_crowdin").bufferedReader() + val t = reader.readLine() + + // Using test values + var organization = "loop-habit-tracker" + organization = "loop-habit-tracker-api-test" + var projectId = 162051L + projectId = 440668L + val baseUrl = "https://translate.loophabits.org" + + val client = Client(Credentials(t, organization, baseUrl)) + val res = client.usersApi.listProjectMembers(projectId, null, 5, null) + println(res) + } +} + task("updateTranslators") { doLast { val writer =