Skip to content

Commit

Permalink
add kdoc and javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
tonisives committed Dec 1, 2023
1 parent 48567bc commit 30215fe
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 4 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/create-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- main
- v2
- dokka

jobs:
docs:
Expand All @@ -22,7 +23,6 @@ jobs:
java-version: 17
cache: gradle


- name: Setup SSH Keys and known_hosts to access submodules
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
Expand All @@ -36,11 +36,13 @@ jobs:
run: git submodule update --init --recursive

- name: Create docs
run: ./gradlew :hmkit-fleet:dokkaJavadoc
run: |
./gradlew :hmkit-fleet:dokkaJavadoc
./gradlew :hmkit-fleet:dokkaHtml
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
BRANCH: gh-pages
FOLDER: hmkit-fleet/build/dokka/javadoc
FOLDER: hmkit-fleet/build/dokka/html
8 changes: 8 additions & 0 deletions hmkit-fleet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,12 @@ dependencies {
detekt {
config = files("$rootDir/detekt.yaml")
buildUponDefaultConfig = true
}

dokkaHtml {
outputDirectory.set(file("$buildDir/dokka/html/v2"))
}

dokkaJavadoc {
outputDirectory.set(file("$buildDir/dokka/html/v2/javadoc"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ package com.highmobility.hmkitfleet

import okhttp3.OkHttpClient

/**
* The configuration for the SDK. This is a mandatory class to be passed to the SDK.
*
* @param credentials The credentials to be used for the SDK. Choose from either [HMKitOAuthCredentials] or
* [HMKitPrivateKeyCredentials].
* @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/v2/javadoc/com/highmobility/hmkitfleet/HMKitConfiguration.html)
*/
class HMKitConfiguration private constructor(builder: Builder) {
val credentials = builder.credentials ?: throw IllegalArgumentException("credentials must be set")
val client = builder.client ?: OkHttpClient()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import java.security.interfaces.ECPrivateKey
import java.security.spec.PKCS8EncodedKeySpec
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/v2/javadoc/com/highmobility/hmkitfleet/HMKitCredentials.html)
*
*/
abstract class HMKitCredentials {
internal abstract fun getTokenRequestBody(jwtProvider: JwtProvider?): String

Expand All @@ -19,6 +26,11 @@ abstract class HMKitCredentials {
}
}

/**
* The OAuth credentials to be used for the SDK.
*
* [javadoc](https://highmobility.github.io/hmkit-fleet-v2/v2/javadoc/com/highmobility/hmkitfleet/HMKitOAuthCredentials.html)
*/
@Serializable
data class HMKitOAuthCredentials(
/**
Expand All @@ -42,6 +54,11 @@ data class HMKitOAuthCredentials(
}
}

/**
* The private key credentials to be used for the SDK.
*
* [javadoc](https://highmobility.github.io/hmkit-fleet-v2/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 @@ -48,6 +48,9 @@ import java.util.concurrent.CompletableFuture
* .build()
* );
* ```
*
* [javadoc](https://highmobility.github.io/hmkit-fleet-v2/v2/javadoc/com/highmobility/hmkitfleet/HMKitFleet.html)
*
*/
class HMKitFleet constructor(
/**
Expand Down Expand Up @@ -140,6 +143,8 @@ class HMKitFleet constructor(

/**
* The Fleet SDK environment.
*
* [javadoc](https://highmobility.github.io/hmkit-fleet-v2/v2/javadoc/com/highmobility/hmkitfleet/HMKitFleet.Environment.html)
*/
enum class Environment {
PRODUCTION, SANDBOX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException

@Suppress("TooGenericExceptionCaught", "SwallowedException")
suspend fun Call.await(): Response {
internal suspend fun Call.await(): Response {
return suspendCancellableCoroutine { continuation ->
enqueue(object : Callback {
override fun onResponse(call: Call, response: Response) {
Expand Down

0 comments on commit 30215fe

Please sign in to comment.