Skip to content

Commit 865c2af

Browse files
committed
fix: update API and remove baseUrl + update README.md
1 parent 6986754 commit 865c2af

File tree

5 files changed

+36
-28
lines changed

5 files changed

+36
-28
lines changed

README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Kotlin Spring OpenAPI Generator
22

3-
Gradle plugin to help you generate OpenAPI clients with features like filtering out custom fields and handling remote
4-
OpenAPI specs.
3+
Gradle plugin to help you interact with the Jaqpot API using Java/Kotlin.
54

65
## Installation
76

@@ -10,18 +9,44 @@ Add this dependency to your project:
109
Gradle (Kotlin DSL)
1110

1211
```kotlin
13-
id("org.jaqpot.kotlin-sdk") version "0.1.0"
12+
id("org.jaqpot.kotlin-sdk") version "0.2.0"
1413
```
1514

1615
Gradle (Groovy)
1716

1817
```groovy
19-
id 'org.jaqpot.kotlin-sdk' version '0.1.0'
18+
id 'org.jaqpot.kotlin-sdk' version '0.2.0'
2019
```
2120

2221
## Usage
2322

24-
TODO
23+
In java code, you can use the generated client like this:
24+
25+
```java
26+
ModelApiClient modelApiClient = new ModelApiClient(System.getenv("JAQPOT_API_KEY"), System.getenv("JAQPOT_API_SECRET"));
27+
System.out.
28+
29+
Dataset dataset = modelApiClient
30+
.predictSync(
31+
modelId,
32+
List.of(
33+
Map.of("X1", "1", "X2", "2", "X3", "3", "X4", "4")
34+
)
35+
);
36+
```
37+
38+
In Kotlin:
39+
40+
```kotlin
41+
val modelApiClient = ModelApiClient(System.getenv("JAQPOT_API_KEY"), System.getenv("JAQPOT_API_SECRET"))
42+
val dataset = modelApiClient.predictSync(
43+
modelId,
44+
listOf(
45+
mapOf("X1" to "1", "X2" to "2", "X3" to "3", "X4" to "4")
46+
)
47+
)
48+
println(dataset)
49+
```
2550

2651
## Contributing
2752

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
}
1212

1313
group = "org.jaqpot.kotlinsdk"
14-
version = "0.1.0"
14+
version = "0.2.0"
1515

1616
repositories {
1717
mavenCentral()

src/main/kotlin/TestKotlin.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/main/kotlin/client/BaseApiClient.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import java.time.OffsetDateTime
1212

1313

1414
open class BaseApiClient protected constructor(
15-
private val apiKey: String,
16-
private val apiSecret: String,
17-
private val baseUrl: String = SDKConfig.host
15+
apiKey: String,
16+
apiSecret: String
1817
) {
1918

2019
private val authorizationInterceptor = AuthorizationInterceptor(apiKey, apiSecret)
@@ -27,7 +26,7 @@ open class BaseApiClient protected constructor(
2726
.create()
2827

2928
protected val retrofit: Retrofit = Retrofit.Builder()
30-
.baseUrl(baseUrl)
29+
.baseUrl(SDKConfig.host)
3130
.client(httpClient)
3231
.addConverterFactory(GsonConverterFactory.create(gson))
3332
.build()

src/main/kotlin/client/ModelApiClient.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.jaqpot.client
22

33
import client.BaseApiClient
4-
import org.jaqpot.config.SDKConfig
54
import org.jaqpot.exception.JaqpotSDKException
65
import org.openapitools.client.api.DatasetApi
76
import org.openapitools.client.api.ModelApi
@@ -12,9 +11,8 @@ import retrofit2.Call
1211

1312
class ModelApiClient(
1413
apiKey: String,
15-
apiSecret: String,
16-
baseUrl: String = SDKConfig.host
17-
) : BaseApiClient(apiKey, apiSecret, baseUrl) {
14+
apiSecret: String
15+
) : BaseApiClient(apiKey, apiSecret) {
1816

1917
private val modelApi: ModelApi = retrofit.create(ModelApi::class.java)
2018
private val datasetApi: DatasetApi = retrofit.create(DatasetApi::class.java)

0 commit comments

Comments
 (0)