diff --git a/kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/gift.kt b/kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/gift.kt new file mode 100644 index 0000000..67607d1 --- /dev/null +++ b/kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/gift.kt @@ -0,0 +1,49 @@ +@file:Suppress("UNUSED_PARAMETER", "unused", "UnusedReceiverParameter") + +package org.jetbrains.qodana.cloudclient.examples + +internal class QodanaPage(val url: String) + +internal fun QodanaPage.buyUltimatePlus(): BuyPage { + return BuyPage() +} + +internal class BuyPage + +internal fun BuyPage.applyAnnualDiscountForThreeContributors(discountCode: String) { +} + +internal fun BuyPage.fillPaymentDetails() {} + +internal fun BuyPage.orderAndPay(): String { + return "" +} + +internal fun getQodanaCloudProjectToken(license: String): String { + return "token" +} + +internal fun analyzeRepository(url: String, qodanaLicense: String, block: AnalyzeRepository.() -> Unit): AnalyzeRepository { + return AnalyzeRepository(url, qodanaLicense) +} + +internal class AnalyzeRepository(val url: String, qodanaLicense: String) { + fun checkLicensesCompliance() { + } + + fun checkVulnerabilities() { + } + + fun checkCodeStyle() { + } + + fun checkBugs() { + + } + + fun checkCoverage() { + } + + fun setQualityGate() { + } +} diff --git a/kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/qodana-example.kt b/kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/qodana-example.kt new file mode 100644 index 0000000..2c5680b --- /dev/null +++ b/kotlin/src/main/kotlin/org/jetbrains/qodana/cloudclient/examples/qodana-example.kt @@ -0,0 +1,25 @@ +package org.jetbrains.qodana.cloudclient.examples + +@Suppress("unused") +internal fun licenseApiExample() { + val qodanaPage = QodanaPage("https://www.jetbrains.com/qodana/") + val buyPage = qodanaPage.buyUltimatePlus() + + val qodanaFullDiscountCoupon = "xoxp-12345678901-987654321012-987654321012-1234123412341234567890abcdef12345" + buyPage.applyAnnualDiscountForThreeContributors(qodanaFullDiscountCoupon) + buyPage.fillPaymentDetails() + val qodanaLicense = buyPage.orderAndPay() +} + +private fun enjoy(qodanaLicense: String) { + val token = getQodanaCloudProjectToken(qodanaLicense) + analyzeRepository("https://github.com/my-project", token) { + checkLicensesCompliance() + checkVulnerabilities() + checkCodeStyle() + checkCoverage() + checkBugs() + + setQualityGate() + } +}