Skip to content

Commit

Permalink
Merge pull request #42 from highmobility/md-docs
Browse files Browse the repository at this point in the history
Md docs
  • Loading branch information
tonisives authored Aug 1, 2024
2 parents d527b3c + af7f6f0 commit df27136
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 10 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/add-md-docs-to-repo.yml
Original file line number Diff line number Diff line change
@@ -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: ""
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ private-key.json
credentialsPrivateKey.json
credentialsOAuth.json
hmkit-fleet/bin
.vscode
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
17 changes: 13 additions & 4 deletions hmkit-fleet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 = "<html>\n" +
Expand All @@ -77,6 +87,5 @@ tasks.register('writeRedirectIndexHtml') {
}
}

tasks.dokkaHtml {
finalizedBy writeRedirectIndexHtml
}
tasks.dokkaHtml.finalizedBy writeRedirectIndexHtml
tasks.dokkaGfm.finalizedBy renameDokkaReadme
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit df27136

Please sign in to comment.