@apollo-deploy/tesseract 1.9.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +218 -110
- package/dist/adapters/csharp/index.d.ts +5 -8
- package/dist/adapters/csharp/index.d.ts.map +1 -1
- package/dist/adapters/csharp/index.js +314 -74
- package/dist/adapters/csharp/index.js.map +1 -1
- package/dist/adapters/documentation.d.ts +17 -0
- package/dist/adapters/documentation.d.ts.map +1 -0
- package/dist/adapters/documentation.js +268 -0
- package/dist/adapters/documentation.js.map +1 -0
- package/dist/adapters/go/index.d.ts +5 -8
- package/dist/adapters/go/index.d.ts.map +1 -1
- package/dist/adapters/go/index.js +197 -101
- package/dist/adapters/go/index.js.map +1 -1
- package/dist/adapters/kotlin/index.d.ts +5 -9
- package/dist/adapters/kotlin/index.d.ts.map +1 -1
- package/dist/adapters/kotlin/index.js +280 -212
- package/dist/adapters/kotlin/index.js.map +1 -1
- package/dist/adapters/php/index.d.ts +5 -15
- package/dist/adapters/php/index.d.ts.map +1 -1
- package/dist/adapters/php/index.js +362 -90
- package/dist/adapters/php/index.js.map +1 -1
- package/dist/adapters/python/index.d.ts +5 -8
- package/dist/adapters/python/index.d.ts.map +1 -1
- package/dist/adapters/python/index.js +240 -109
- package/dist/adapters/python/index.js.map +1 -1
- package/dist/adapters/ruby/index.d.ts +3 -3
- package/dist/adapters/ruby/index.d.ts.map +1 -1
- package/dist/adapters/ruby/index.js +235 -46
- package/dist/adapters/ruby/index.js.map +1 -1
- package/dist/adapters/rust/index.d.ts +5 -9
- package/dist/adapters/rust/index.d.ts.map +1 -1
- package/dist/adapters/rust/index.js +237 -169
- package/dist/adapters/rust/index.js.map +1 -1
- package/dist/adapters/shared.d.ts +7 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/shared.js +68 -0
- package/dist/adapters/shared.js.map +1 -0
- package/dist/adapters/type-utils.d.ts +13 -0
- package/dist/adapters/type-utils.d.ts.map +1 -0
- package/dist/adapters/type-utils.js +105 -0
- package/dist/adapters/type-utils.js.map +1 -0
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/typescript/emitter/emitSchema.d.ts +2 -2
- package/dist/adapters/typescript/emitter/emitSchema.js +39 -27
- package/dist/adapters/typescript/emitter/emitSchema.js.map +1 -1
- package/dist/adapters/typescript/emitter/emitTypeScriptModels.d.ts +2 -2
- package/dist/adapters/typescript/emitter/emitTypeScriptModels.js +15 -15
- package/dist/adapters/typescript/emitter/importCollector.d.ts +2 -4
- package/dist/adapters/typescript/emitter/importCollector.d.ts.map +1 -1
- package/dist/adapters/typescript/emitter/importCollector.js +40 -50
- package/dist/adapters/typescript/emitter/importCollector.js.map +1 -1
- package/dist/adapters/typescript/emitter/parsers.d.ts +1 -1
- package/dist/adapters/typescript/emitter/parsers.js +13 -13
- package/dist/adapters/typescript/emitter/typeHoister.d.ts +1 -1
- package/dist/adapters/typescript/emitter/typeHoister.d.ts.map +1 -1
- package/dist/adapters/typescript/emitter/typeHoister.js +12 -20
- package/dist/adapters/typescript/emitter/typeHoister.js.map +1 -1
- package/dist/adapters/typescript/index.d.ts +3 -3
- package/dist/adapters/typescript/index.d.ts.map +1 -1
- package/dist/adapters/typescript/index.js +148 -166
- package/dist/adapters/typescript/index.js.map +1 -1
- package/dist/adapters/typescript/shared.d.ts +2 -2
- package/dist/adapters/typescript/shared.js +12 -12
- package/dist/cli.js +50 -37
- package/dist/cli.js.map +1 -1
- package/dist/collector.d.ts +13 -3
- package/dist/collector.d.ts.map +1 -1
- package/dist/collector.js +69 -32
- package/dist/collector.js.map +1 -1
- package/dist/elysia.js +2 -2
- package/dist/elysia.js.map +1 -1
- package/dist/express.d.ts.map +1 -1
- package/dist/express.js.map +1 -1
- package/dist/fastify.d.ts +7 -0
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +39 -20
- package/dist/fastify.js.map +1 -1
- package/dist/helpers/handlebars.d.ts +7 -16
- package/dist/helpers/handlebars.d.ts.map +1 -1
- package/dist/helpers/handlebars.js +127 -177
- package/dist/helpers/handlebars.js.map +1 -1
- package/dist/hono.d.ts.map +1 -1
- package/dist/hono.js.map +1 -1
- package/dist/index.d.ts +14 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -30
- package/dist/index.js.map +1 -1
- package/dist/koa.d.ts.map +1 -1
- package/dist/koa.js.map +1 -1
- package/dist/nestjs.d.ts.map +1 -1
- package/dist/nestjs.js +41 -14
- package/dist/nestjs.js.map +1 -1
- package/dist/pipeline/enrich.d.ts +2 -13
- package/dist/pipeline/enrich.d.ts.map +1 -1
- package/dist/pipeline/enrich.js +157 -212
- package/dist/pipeline/enrich.js.map +1 -1
- package/dist/pipeline/intake.d.ts +3 -3
- package/dist/pipeline/intake.d.ts.map +1 -1
- package/dist/pipeline/intake.js +342 -238
- package/dist/pipeline/intake.js.map +1 -1
- package/dist/pipeline/write.d.ts +1 -14
- package/dist/pipeline/write.d.ts.map +1 -1
- package/dist/pipeline/write.js +73 -113
- package/dist/pipeline/write.js.map +1 -1
- package/dist/types/config.d.ts +14 -26
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/config.js +16 -12
- package/dist/types/config.js.map +1 -1
- package/dist/types/ir.d.ts +12 -8
- package/dist/types/ir.d.ts.map +1 -1
- package/dist/types/manifest.d.ts +10 -11
- package/dist/types/manifest.d.ts.map +1 -1
- package/dist/types/manifest.js +54 -14
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/sdk-module.d.ts +2 -2
- package/dist/types/sdk-module.js +1 -1
- package/dist/utils/format.d.ts +1 -3
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +3 -10
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/naming.d.ts.map +1 -1
- package/dist/utils/naming.js +174 -184
- package/dist/utils/naming.js.map +1 -1
- package/dist/utils/npm-token.d.ts +1 -17
- package/dist/utils/npm-token.d.ts.map +1 -1
- package/dist/utils/npm-token.js +27 -76
- package/dist/utils/npm-token.js.map +1 -1
- package/dist/utils/version.d.ts +14 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +60 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +4 -3
- package/templates/csharp/client.hbs +26 -49
- package/templates/csharp/csproj.hbs +7 -0
- package/templates/csharp/domain.hbs +48 -130
- package/templates/csharp/errors.hbs +17 -25
- package/templates/csharp/readme.hbs +31 -44
- package/templates/csharp/transport.hbs +238 -136
- package/templates/csharp/types.hbs +30 -76
- package/templates/go/client.hbs +44 -109
- package/templates/go/domain.hbs +83 -25
- package/templates/go/go-mod.hbs +1 -4
- package/templates/go/readme.hbs +32 -29
- package/templates/go/transport.hbs +174 -173
- package/templates/go/types.hbs +17 -53
- package/templates/go/utils.hbs +3 -2
- package/templates/kotlin/build-gradle.hbs +1 -1
- package/templates/kotlin/client.hbs +18 -15
- package/templates/kotlin/domain.hbs +54 -51
- package/templates/kotlin/errors.hbs +1 -1
- package/templates/kotlin/readme.hbs +35 -137
- package/templates/kotlin/transport.hbs +140 -123
- package/templates/kotlin/types.hbs +30 -81
- package/templates/php/client.hbs +8 -46
- package/templates/php/composer.hbs +2 -1
- package/templates/php/domain.hbs +86 -117
- package/templates/php/errors.hbs +1 -1
- package/templates/php/readme.hbs +42 -49
- package/templates/php/transport.hbs +192 -145
- package/templates/php/types.hbs +63 -60
- package/templates/python/client.hbs +15 -2
- package/templates/python/domain.hbs +50 -108
- package/templates/python/pyproject.hbs +5 -0
- package/templates/python/readme.hbs +47 -30
- package/templates/python/resources-init.hbs +1 -1
- package/templates/python/transport.hbs +167 -53
- package/templates/python/types.hbs +22 -58
- package/templates/ruby/client.hbs +10 -6
- package/templates/ruby/domain.hbs +48 -67
- package/templates/ruby/errors.hbs +3 -3
- package/templates/ruby/gemspec.hbs +3 -10
- package/templates/ruby/index.hbs +3 -3
- package/templates/ruby/readme.hbs +33 -70
- package/templates/ruby/transport.hbs +129 -103
- package/templates/ruby/types.hbs +11 -16
- package/templates/ruby/version.hbs +1 -1
- package/templates/rust/cargo.hbs +2 -0
- package/templates/rust/client.hbs +10 -1
- package/templates/rust/domain.hbs +69 -52
- package/templates/rust/error.hbs +3 -1
- package/templates/rust/lib.hbs +4 -5
- package/templates/rust/readme.hbs +33 -46
- package/templates/rust/transport.hbs +170 -159
- package/templates/rust/types.hbs +34 -111
- package/templates/typescript/domain-class.hbs +14 -6
- package/templates/typescript/domain.hbs +13 -5
- package/templates/typescript/package-json.hbs +3 -1
- package/templates/typescript/readme.hbs +42 -42
- package/templates/typescript/transport.hbs +46 -8
- package/templates/typescript/types-errors.hbs +1 -1
- package/dist/adapters/typescript/model-emitter.d.ts +0 -13
- package/dist/adapters/typescript/model-emitter.d.ts.map +0 -1
- package/dist/adapters/typescript/model-emitter.js +0 -415
- package/dist/adapters/typescript/model-emitter.js.map +0 -1
|
@@ -3,11 +3,8 @@ package {{packageName}}
|
|
|
3
3
|
import {{packageName}}.api.*
|
|
4
4
|
import {{packageName}}.internal.Transport
|
|
5
5
|
import {{packageName}}.internal.TransportConfig
|
|
6
|
-
import kotlinx.coroutines.*
|
|
7
6
|
|
|
8
|
-
/**
|
|
9
|
-
* Configuration for the {{title}} API client.
|
|
10
|
-
*/
|
|
7
|
+
/** Configuration for the {{title}} API client. */
|
|
11
8
|
data class ClientConfig(
|
|
12
9
|
val baseUrl: String = "{{baseUrl}}",
|
|
13
10
|
{{#each securitySchemes}}
|
|
@@ -28,33 +25,39 @@ data class ClientConfig(
|
|
|
28
25
|
val {{configKey}}: String? = null,
|
|
29
26
|
{{/if}}
|
|
30
27
|
{{/each}}
|
|
28
|
+
/** Headers sent with every request. */
|
|
29
|
+
val defaultHeaders: Map<String, String> = emptyMap(),
|
|
31
30
|
/** Request timeout in milliseconds. */
|
|
32
|
-
val timeoutMs: Long =
|
|
33
|
-
/**
|
|
31
|
+
val timeoutMs: Long = 15_000,
|
|
32
|
+
/** Number of retries after the initial request. */
|
|
34
33
|
val maxRetries: Int = 3,
|
|
34
|
+
/** Allow automatic retries for POST and PATCH requests. */
|
|
35
|
+
val retryUnsafeRequests: Boolean = false,
|
|
35
36
|
)
|
|
36
37
|
|
|
37
|
-
/**
|
|
38
|
-
* Primary API client for {{title}}.
|
|
39
|
-
*
|
|
40
|
-
* Provides access to all domain-specific API groups.
|
|
41
|
-
*/
|
|
38
|
+
/** Primary API client for {{title}}. */
|
|
42
39
|
class {{clientName}}Client(
|
|
43
|
-
config: ClientConfig = ClientConfig()
|
|
44
|
-
) {
|
|
45
|
-
private val transport
|
|
40
|
+
config: ClientConfig = ClientConfig(),
|
|
41
|
+
) : AutoCloseable {
|
|
42
|
+
private val transport = Transport(
|
|
46
43
|
TransportConfig(
|
|
47
44
|
baseUrl = config.baseUrl,
|
|
48
45
|
{{#each securitySchemes}}
|
|
49
46
|
{{configKey}} = config.{{configKey}},
|
|
50
47
|
{{/each}}
|
|
48
|
+
defaultHeaders = config.defaultHeaders,
|
|
51
49
|
timeoutMs = config.timeoutMs,
|
|
52
50
|
maxRetries = config.maxRetries,
|
|
53
|
-
|
|
51
|
+
retryUnsafeRequests = config.retryUnsafeRequests,
|
|
52
|
+
),
|
|
54
53
|
)
|
|
55
54
|
|
|
56
55
|
{{#each groups}}
|
|
57
56
|
/** {{#if description}}{{description}}{{else}}{{interfaceName}} operations.{{/if}} */
|
|
58
57
|
val {{name}}: {{interfaceName}} = {{interfaceName}}(transport)
|
|
59
58
|
{{/each}}
|
|
59
|
+
|
|
60
|
+
override fun close() {
|
|
61
|
+
transport.close()
|
|
62
|
+
}
|
|
60
63
|
}
|
|
@@ -2,70 +2,73 @@ package {{packageName}}.api
|
|
|
2
2
|
|
|
3
3
|
import {{packageName}}.internal.Transport
|
|
4
4
|
import {{packageName}}.models.*
|
|
5
|
-
import io.ktor.http
|
|
6
|
-
import
|
|
5
|
+
import io.ktor.http.HttpMethod
|
|
6
|
+
import io.ktor.http.encodeURLPathPart
|
|
7
|
+
import kotlinx.serialization.json.Json
|
|
8
|
+
import kotlinx.serialization.json.JsonObject
|
|
9
|
+
import kotlinx.serialization.json.encodeToJsonElement
|
|
7
10
|
|
|
8
|
-
/**
|
|
9
|
-
* {{#if description}}{{description}}{{else}}{{interfaceName}} API operations.{{/if}}
|
|
10
|
-
*/
|
|
11
|
+
/** {{#if description}}{{description}}{{else}}{{interfaceName}} API operations.{{/if}} */
|
|
11
12
|
class {{interfaceName}}(
|
|
12
|
-
private val transport: Transport
|
|
13
|
+
private val transport: Transport,
|
|
13
14
|
) {
|
|
14
15
|
{{#each operations}}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{{
|
|
23
|
-
|
|
24
|
-
message = "{{#if deprecationMessage}}{{deprecationMessage}}{{else}}This operation is deprecated.{{/if}}",
|
|
25
|
-
)
|
|
26
|
-
{{/if}}
|
|
27
|
-
suspend fun {{name}}(
|
|
16
|
+
{{#if deprecated}}
|
|
17
|
+
@Deprecated("{{#if deprecationMessage}}{{deprecationMessage}}{{else}}This operation is deprecated.{{/if}}")
|
|
18
|
+
{{/if}}
|
|
19
|
+
suspend fun {{methodName}}(
|
|
20
|
+
{{#if hasParameters}}
|
|
21
|
+
{{{signature}}},
|
|
22
|
+
{{/if}}
|
|
23
|
+
): {{{targetResponseType}}} {
|
|
24
|
+
var path = "{{targetPath}}"
|
|
28
25
|
{{#each pathParams}}
|
|
29
|
-
{{
|
|
26
|
+
path = path.replace("{{placeholder}}", {{parameterName}}.toString().encodeURLPathPart())
|
|
30
27
|
{{/each}}
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
|
|
29
|
+
val query = mutableMapOf<String, String?>()
|
|
30
|
+
{{#each queryParams}}
|
|
31
|
+
{{#if required}}
|
|
32
|
+
query["{{originalName}}"] = {{parameterName}}.toString()
|
|
33
|
+
{{else}}
|
|
34
|
+
{{parameterName}}?.let { query["{{originalName}}"] = it.toString() }
|
|
33
35
|
{{/if}}
|
|
34
|
-
{{#each _queryParams}}
|
|
35
|
-
{{name}}: {{{kotlinType type}}}? = null,
|
|
36
36
|
{{/each}}
|
|
37
|
-
): {{{kotlinResponseType}}} {
|
|
38
|
-
val path = "{{path}}"
|
|
39
|
-
|
|
40
|
-
{{#if (hasQueryParams this)}}
|
|
41
|
-
val queryMap = mutableMapOf<String, String?>()
|
|
42
|
-
{{#each _queryParams}}
|
|
43
|
-
if ({{name}} != null) queryMap["{{originalName}}"] = {{name}}.toString()
|
|
44
|
-
{{/each}}
|
|
45
|
-
{{else}}
|
|
46
|
-
val queryMap: Map<String, String?>? = null
|
|
47
|
-
{{/if}}
|
|
48
|
-
|
|
49
|
-
{{#if (or (hasRequestBody this) (needsRequestHeaders this))}}
|
|
50
37
|
val headers = mutableMapOf<String, String>()
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
{{#each headerParams}}
|
|
39
|
+
{{#if required}}
|
|
40
|
+
headers["{{originalName}}"] = {{parameterName}}.toString()
|
|
41
|
+
{{else}}
|
|
42
|
+
{{parameterName}}?.let { headers["{{originalName}}"] = it.toString() }
|
|
43
|
+
{{/if}}
|
|
44
|
+
{{/each}}
|
|
45
|
+
{{#if cookieParams.length}}
|
|
46
|
+
val cookies = mutableListOf<String>()
|
|
47
|
+
{{#each cookieParams}}
|
|
48
|
+
{{#if required}}
|
|
49
|
+
cookies += "{{originalName}}=${{{parameterName}}}"
|
|
50
|
+
{{else}}
|
|
51
|
+
{{parameterName}}?.let { cookies += "{{originalName}}=$it" }
|
|
52
|
+
{{/if}}
|
|
53
|
+
{{/each}}
|
|
54
|
+
if (cookies.isNotEmpty()) headers["Cookie"] = cookies.joinToString("; ")
|
|
55
|
+
{{/if}}
|
|
56
|
+
{{#if requestBody}}
|
|
57
|
+
{{#if (and (neq requestBody.contentType "application/json") (neq requestBody.contentType "multipart/form-data"))}}
|
|
53
58
|
headers["Content-Type"] = "{{requestBody.contentType}}"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{{#each headerParams}}
|
|
57
|
-
// TODO: inject header param '{{originalName}}' from header options
|
|
58
|
-
{{/each}}
|
|
59
|
-
{{else}}
|
|
60
|
-
val headers: Map<String, String>? = null
|
|
61
|
-
{{/if}}
|
|
59
|
+
{{/if}}
|
|
60
|
+
{{/if}}
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
{{#if isEventStream}}
|
|
63
|
+
return transport.executeRaw(
|
|
64
|
+
{{else}}
|
|
65
|
+
return transport.execute<{{{targetResponseType}}}>(
|
|
66
|
+
{{/if}}
|
|
64
67
|
method = HttpMethod.{{pascalCase httpMethod}},
|
|
65
68
|
path = path,
|
|
66
|
-
query =
|
|
67
|
-
body = {{
|
|
68
|
-
headers = headers{
|
|
69
|
+
query = query.ifEmpty { null },
|
|
70
|
+
body = {{{bodyExpression}}},
|
|
71
|
+
headers = headers.ifEmpty { null },
|
|
69
72
|
)
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -28,7 +28,7 @@ class SdkException(
|
|
|
28
28
|
fun isNetworkError(): Boolean = status == null
|
|
29
29
|
|
|
30
30
|
/** Returns `true` if this error is retryable. */
|
|
31
|
-
fun isRetryable(): Boolean = isNetworkError() || status in setOf(429, 502, 503, 504)
|
|
31
|
+
fun isRetryable(): Boolean = isNetworkError() || status in setOf(408, 425, 429, 500, 502, 503, 504)
|
|
32
32
|
|
|
33
33
|
override fun toString(): String {
|
|
34
34
|
val sb = StringBuilder("SdkException(")
|
|
@@ -1,168 +1,66 @@
|
|
|
1
|
-
# {{title}}
|
|
1
|
+
# {{title}} Kotlin SDK
|
|
2
2
|
|
|
3
|
-
{{#if description}}{{description}}{{/if}}
|
|
3
|
+
{{#if description}}{{description}}{{else}}Kotlin client for the {{title}} API.{{/if}}
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> Generated by Tesseract. Generated source files should not be edited manually.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
### Gradle
|
|
10
|
-
|
|
11
|
-
Add the dependency to your `build.gradle.kts`:
|
|
12
|
-
|
|
13
9
|
```kotlin
|
|
14
|
-
repositories {
|
|
15
|
-
mavenCentral()
|
|
16
|
-
// If publishing to a private repository, add it here.
|
|
17
|
-
}
|
|
18
|
-
|
|
19
10
|
dependencies {
|
|
20
|
-
implementation("{{groupId}}:{{artifactId}}:{{
|
|
11
|
+
implementation("{{groupId}}:{{artifactId}}:{{packageVersion}}")
|
|
21
12
|
}
|
|
22
13
|
```
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```xml
|
|
27
|
-
<dependency>
|
|
28
|
-
<groupId>{{groupId}}</groupId>
|
|
29
|
-
<artifactId>{{artifactId}}</artifactId>
|
|
30
|
-
<version>{{#if packageVersion}}{{packageVersion}}{{else}}0.1.0{{/if}}</version>
|
|
31
|
-
</dependency>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Publishing
|
|
35
|
-
|
|
36
|
-
Publish to your local Maven cache:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
gradle publishToMavenLocal
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Publish to a Maven repository:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
MAVEN_REPOSITORY_URL="https://maven.example.com/releases" \
|
|
46
|
-
MAVEN_REPOSITORY_USERNAME="username" \
|
|
47
|
-
MAVEN_REPOSITORY_PASSWORD="password" \
|
|
48
|
-
gradle publish
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
The generated Gradle project also supports equivalent Gradle properties:
|
|
52
|
-
|
|
53
|
-
- `mavenRepositoryUrl`
|
|
54
|
-
- `mavenRepositoryUsername`
|
|
55
|
-
- `mavenRepositoryPassword`
|
|
56
|
-
- `mavenRepositoryName`
|
|
57
|
-
|
|
58
|
-
For signed publications, provide `SIGNING_IN_MEMORY_KEY` and `SIGNING_IN_MEMORY_KEY_PASSWORD` or the matching Gradle properties `signingInMemoryKey` and `signingInMemoryKeyPassword`.
|
|
59
|
-
|
|
60
|
-
For repositories that require richer POM metadata, set `POM_URL`, `POM_SCM_URL`, `POM_SCM_CONNECTION`, `POM_SCM_DEVELOPER_CONNECTION`, `POM_DEVELOPER_ID`, and `POM_DEVELOPER_NAME` or the equivalent lower-camel Gradle properties.
|
|
61
|
-
|
|
62
|
-
## Quick Start
|
|
15
|
+
## Quick start
|
|
63
16
|
|
|
64
17
|
```kotlin
|
|
65
|
-
import {{packageName}}.Client
|
|
18
|
+
import {{packageName}}.{{clientName}}Client
|
|
66
19
|
import {{packageName}}.ClientConfig
|
|
67
|
-
import kotlinx.coroutines.runBlocking
|
|
68
20
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
{{
|
|
72
|
-
|
|
73
|
-
{{configKey}} = "your-api-key",
|
|
74
|
-
{{/if}}
|
|
75
|
-
{{#if (and (eq type "http") (eq scheme "bearer"))}}
|
|
76
|
-
{{configKey}} = "your-bearer-token",
|
|
77
|
-
{{/if}}
|
|
78
|
-
{{/each}}
|
|
21
|
+
val client = {{clientName}}Client(
|
|
22
|
+
ClientConfig(
|
|
23
|
+
baseUrl = "{{baseUrl}}",
|
|
24
|
+
timeoutMs = 15_000,
|
|
79
25
|
)
|
|
26
|
+
)
|
|
80
27
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{{#each groups}}
|
|
84
|
-
{{#if @first}}
|
|
85
|
-
// val result = client.{{name}}.someOperation()
|
|
28
|
+
{{#if groups.length}}
|
|
29
|
+
val api = client.{{groups.[0].name}}
|
|
86
30
|
{{/if}}
|
|
87
|
-
{{/each}}
|
|
88
|
-
}
|
|
89
31
|
```
|
|
90
32
|
|
|
91
|
-
##
|
|
92
|
-
|
|
93
|
-
{{#each groups}}
|
|
94
|
-
### {{interfaceName}}
|
|
95
|
-
|
|
96
|
-
{{#if description}}
|
|
97
|
-
{{description}}
|
|
98
|
-
{{/if}}
|
|
99
|
-
|
|
100
|
-
| Method | HTTP | Description |
|
|
101
|
-
|--------|------|-------------|
|
|
102
|
-
{{#each operations}}
|
|
103
|
-
| `{{name}}()` | `{{httpMethod}}` | {{#if summary}}{{summary}}{{else}}—{{/if}} |
|
|
104
|
-
{{/each}}
|
|
105
|
-
|
|
106
|
-
{{/each}}
|
|
33
|
+
## Configuration and reliability
|
|
107
34
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
All API methods throw `SdkException` on failure. The exception contains:
|
|
111
|
-
|
|
112
|
-
- `status`: HTTP status code (for API errors)
|
|
113
|
-
- `code`: Machine-readable error code (if available)
|
|
114
|
-
- `message`: Human-readable error message
|
|
115
|
-
- `requestId`: Server-assigned request ID for support
|
|
35
|
+
The Ktor transport supports bounded request/connect/socket timeouts, coroutine cancellation, exponential-backoff retries, `Retry-After` handling, default headers, and structured `SdkException` values. Unsafe requests are not retried unless they are explicitly idempotent or unsafe retries are enabled.
|
|
116
36
|
|
|
117
37
|
```kotlin
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
e.isServerError() -> println("Server error (${e.status}): ${e.message}")
|
|
125
|
-
e.isNetworkError() -> println("Network error: ${e.message}")
|
|
126
|
-
else -> println("Error: ${e.message}")
|
|
127
|
-
}
|
|
128
|
-
}
|
|
38
|
+
val client = {{clientName}}Client(
|
|
39
|
+
ClientConfig(
|
|
40
|
+
timeoutMs = 30_000,
|
|
41
|
+
maxRetries = 3,
|
|
42
|
+
)
|
|
43
|
+
)
|
|
129
44
|
```
|
|
130
45
|
|
|
131
|
-
##
|
|
46
|
+
## Documentation
|
|
132
47
|
|
|
133
|
-
|
|
134
|
-
.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
├── gradle/
|
|
139
|
-
│ └── wrapper/
|
|
140
|
-
│ └── gradle-wrapper.properties # Gradle wrapper distribution config
|
|
141
|
-
├── .gitignore
|
|
142
|
-
└── src/
|
|
143
|
-
└── main/
|
|
144
|
-
└── kotlin/
|
|
145
|
-
└── {{pkgPath}}/
|
|
146
|
-
├── Client.kt # Entry point — {{clientName}}Client
|
|
147
|
-
├── api/
|
|
48
|
+
- [Documentation index](./docs/README.md)
|
|
49
|
+
- [Generated types](./docs/types.md)
|
|
50
|
+
|
|
51
|
+
| Domain | Description |
|
|
52
|
+
|---|---|
|
|
148
53
|
{{#each groups}}
|
|
149
|
-
|
|
54
|
+
| [{{interfaceName}}](./docs/domains/{{fileName}}.md) | {{#if description}}{{description}}{{else}}{{name}} operations{{/if}} |
|
|
150
55
|
{{/each}}
|
|
151
|
-
├── exceptions/
|
|
152
|
-
│ └── SdkException.kt
|
|
153
|
-
├── internal/
|
|
154
|
-
│ └── Transport.kt # HTTP layer (Ktor CIO + retry logic)
|
|
155
|
-
└── models/
|
|
156
|
-
└── Types.kt # Generated data classes and enums
|
|
157
|
-
```
|
|
158
56
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
57
|
+
## Error handling
|
|
58
|
+
|
|
59
|
+
All operations throw `SdkException` on failure. It exposes `status`, `code`, `requestId`, and helpers for client, server, network, and retryable failures.
|
|
60
|
+
|
|
61
|
+
## Requirements
|
|
62
|
+
|
|
63
|
+
- JVM 17 or later
|
|
166
64
|
|
|
167
65
|
## License
|
|
168
66
|
|