diff --git a/.github/workflows/add-md-docs-to-repo.yml b/.github/workflows/add-md-docs-to-repo.yml new file mode 100644 index 0000000..a3438c9 --- /dev/null +++ b/.github/workflows/add-md-docs-to-repo.yml @@ -0,0 +1,33 @@ +name: Add mod docs to repo + +on: + push: + branches: + - main + +jobs: + docs: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 17 + cache: gradle + + - name: Create docs + run: | + ./gradlew :hmkit-fleet:dokkaGfm + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Add generated docs" + commit_user_name: "GitHub Actions" + commit_user_email: "" diff --git a/.gitignore b/.gitignore index 23f003b..a5acde1 100644 --- a/.gitignore +++ b/.gitignore @@ -93,3 +93,4 @@ private-key.json credentialsPrivateKey.json credentialsOAuth.json hmkit-fleet/bin +.vscode \ No newline at end of file diff --git a/README.md b/README.md index a3dcb29..3ff0444 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Telematics API to help car companies manage their fleet. * [Requirements](#requirements) * [Getting Started](#getting-started) * [Architecture](#architecture) +* [API Reference](/docs/hmkit-fleet/com.highmobility.hmkitfleet/-h-m-kit-fleet/index.md) * [License](#License) * [Contributing](#contributing) diff --git a/hmkit-fleet/build.gradle b/hmkit-fleet/build.gradle index 1bea15d..4ed39fa 100644 --- a/hmkit-fleet/build.gradle +++ b/hmkit-fleet/build.gradle @@ -5,7 +5,7 @@ plugins { // CI id "org.barfuin.gradle.jacocolog" version "3.1.0" id "io.gitlab.arturbosch.detekt" version "1.23.0" - id "org.jetbrains.dokka" version "1.8.20" + id "org.jetbrains.dokka" version "1.9.20" } kotlin { @@ -68,6 +68,16 @@ dokkaJavadoc { outputDirectory.set(file("$buildDir/dokka/html/v2/javadoc")) } +dokkaGfm { + outputDirectory.set(file("$rootDir/docs/")) +} + +tasks.register('renameDokkaReadme') { + doLast { + file("$rootDir/docs/index.md").renameTo("$rootDir/docs/README.md") + } +} + tasks.register('writeRedirectIndexHtml') { doLast { String content = "\n" + @@ -77,6 +87,5 @@ tasks.register('writeRedirectIndexHtml') { } } -tasks.dokkaHtml { - finalizedBy writeRedirectIndexHtml -} \ No newline at end of file +tasks.dokkaHtml.finalizedBy writeRedirectIndexHtml +tasks.dokkaGfm.finalizedBy renameDokkaReadme diff --git a/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitConfiguration.kt b/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitConfiguration.kt index e742477..4190fe5 100644 --- a/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitConfiguration.kt +++ b/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitConfiguration.kt @@ -10,7 +10,7 @@ import okhttp3.OkHttpClient * @param environment The SDK environment. Default is Production. * @param client Optionally, set the OkHttpClient to be used for network requests. * - * [javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitConfiguration.html) + * [Check out the Javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitConfiguration.html) */ class HMKitConfiguration private constructor(builder: Builder) { val credentials = builder.credentials ?: throw IllegalArgumentException("credentials must be set") diff --git a/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitCredentials.kt b/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitCredentials.kt index d8f2ded..f335fa6 100644 --- a/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitCredentials.kt +++ b/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitCredentials.kt @@ -13,7 +13,7 @@ import java.util.Base64 * The credentials to be used for the SDK. Choose from either [HMKitOAuthCredentials] or * [HMKitPrivateKeyCredentials]. * - * [javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitCredentials.html) + * [Check out the Javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitCredentials.html) * */ abstract class HMKitCredentials { @@ -29,7 +29,7 @@ abstract class HMKitCredentials { /** * The OAuth credentials to be used for the SDK. * - * [javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitOAuthCredentials.html) + * [Check out the Javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitOAuthCredentials.html) */ @Serializable data class HMKitOAuthCredentials( @@ -57,7 +57,7 @@ data class HMKitOAuthCredentials( /** * The private key credentials to be used for the SDK. * - * [javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitPrivateKeyCredentials.html) + * [Check out the Javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitPrivateKeyCredentials.html) */ @Serializable data class HMKitPrivateKeyCredentials( diff --git a/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitFleet.kt b/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitFleet.kt index 44ee09c..c52b51c 100644 --- a/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitFleet.kt +++ b/hmkit-fleet/src/main/kotlin/com/highmobility/hmkitfleet/HMKitFleet.kt @@ -49,7 +49,7 @@ import java.util.concurrent.CompletableFuture * ); * ``` * - * [javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitFleet.html) + * [Check out the Javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitFleet.html) * */ class HMKitFleet constructor( @@ -160,7 +160,7 @@ class HMKitFleet constructor( /** * The Fleet SDK environment. * - * [javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitFleet.Environment.html) + * [Check out the Javadoc](https://highmobility.github.io/hmkit-fleet/v2/javadoc/com/highmobility/hmkitfleet/HMKitFleet.Environment.html) */ enum class Environment { PRODUCTION, SANDBOX;