@apollo-deploy/tesseract 1.9.0 → 2.1.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.
Files changed (194) hide show
  1. package/README.md +218 -110
  2. package/dist/adapters/csharp/index.d.ts +5 -8
  3. package/dist/adapters/csharp/index.d.ts.map +1 -1
  4. package/dist/adapters/csharp/index.js +314 -74
  5. package/dist/adapters/csharp/index.js.map +1 -1
  6. package/dist/adapters/documentation.d.ts +17 -0
  7. package/dist/adapters/documentation.d.ts.map +1 -0
  8. package/dist/adapters/documentation.js +268 -0
  9. package/dist/adapters/documentation.js.map +1 -0
  10. package/dist/adapters/go/index.d.ts +5 -8
  11. package/dist/adapters/go/index.d.ts.map +1 -1
  12. package/dist/adapters/go/index.js +197 -101
  13. package/dist/adapters/go/index.js.map +1 -1
  14. package/dist/adapters/kotlin/index.d.ts +5 -9
  15. package/dist/adapters/kotlin/index.d.ts.map +1 -1
  16. package/dist/adapters/kotlin/index.js +280 -212
  17. package/dist/adapters/kotlin/index.js.map +1 -1
  18. package/dist/adapters/php/index.d.ts +5 -15
  19. package/dist/adapters/php/index.d.ts.map +1 -1
  20. package/dist/adapters/php/index.js +362 -90
  21. package/dist/adapters/php/index.js.map +1 -1
  22. package/dist/adapters/python/index.d.ts +5 -8
  23. package/dist/adapters/python/index.d.ts.map +1 -1
  24. package/dist/adapters/python/index.js +240 -109
  25. package/dist/adapters/python/index.js.map +1 -1
  26. package/dist/adapters/ruby/index.d.ts +3 -3
  27. package/dist/adapters/ruby/index.d.ts.map +1 -1
  28. package/dist/adapters/ruby/index.js +235 -46
  29. package/dist/adapters/ruby/index.js.map +1 -1
  30. package/dist/adapters/rust/index.d.ts +5 -9
  31. package/dist/adapters/rust/index.d.ts.map +1 -1
  32. package/dist/adapters/rust/index.js +237 -169
  33. package/dist/adapters/rust/index.js.map +1 -1
  34. package/dist/adapters/shared.d.ts +7 -0
  35. package/dist/adapters/shared.d.ts.map +1 -0
  36. package/dist/adapters/shared.js +68 -0
  37. package/dist/adapters/shared.js.map +1 -0
  38. package/dist/adapters/type-utils.d.ts +13 -0
  39. package/dist/adapters/type-utils.d.ts.map +1 -0
  40. package/dist/adapters/type-utils.js +105 -0
  41. package/dist/adapters/type-utils.js.map +1 -0
  42. package/dist/adapters/types.d.ts.map +1 -1
  43. package/dist/adapters/typescript/emitter/emitSchema.d.ts +2 -2
  44. package/dist/adapters/typescript/emitter/emitSchema.js +39 -27
  45. package/dist/adapters/typescript/emitter/emitSchema.js.map +1 -1
  46. package/dist/adapters/typescript/emitter/emitTypeScriptModels.d.ts +2 -2
  47. package/dist/adapters/typescript/emitter/emitTypeScriptModels.js +15 -15
  48. package/dist/adapters/typescript/emitter/importCollector.d.ts +2 -4
  49. package/dist/adapters/typescript/emitter/importCollector.d.ts.map +1 -1
  50. package/dist/adapters/typescript/emitter/importCollector.js +40 -50
  51. package/dist/adapters/typescript/emitter/importCollector.js.map +1 -1
  52. package/dist/adapters/typescript/emitter/parsers.d.ts +1 -1
  53. package/dist/adapters/typescript/emitter/parsers.js +13 -13
  54. package/dist/adapters/typescript/emitter/typeHoister.d.ts +1 -1
  55. package/dist/adapters/typescript/emitter/typeHoister.d.ts.map +1 -1
  56. package/dist/adapters/typescript/emitter/typeHoister.js +12 -20
  57. package/dist/adapters/typescript/emitter/typeHoister.js.map +1 -1
  58. package/dist/adapters/typescript/index.d.ts +3 -3
  59. package/dist/adapters/typescript/index.d.ts.map +1 -1
  60. package/dist/adapters/typescript/index.js +148 -166
  61. package/dist/adapters/typescript/index.js.map +1 -1
  62. package/dist/adapters/typescript/shared.d.ts +2 -2
  63. package/dist/adapters/typescript/shared.js +12 -12
  64. package/dist/cli.js +50 -37
  65. package/dist/cli.js.map +1 -1
  66. package/dist/collector.d.ts +32 -7
  67. package/dist/collector.d.ts.map +1 -1
  68. package/dist/collector.js +149 -49
  69. package/dist/collector.js.map +1 -1
  70. package/dist/elysia.js +2 -2
  71. package/dist/elysia.js.map +1 -1
  72. package/dist/express.d.ts.map +1 -1
  73. package/dist/express.js.map +1 -1
  74. package/dist/fastify.d.ts +9 -2
  75. package/dist/fastify.d.ts.map +1 -1
  76. package/dist/fastify.js +40 -21
  77. package/dist/fastify.js.map +1 -1
  78. package/dist/helpers/handlebars.d.ts +7 -16
  79. package/dist/helpers/handlebars.d.ts.map +1 -1
  80. package/dist/helpers/handlebars.js +127 -177
  81. package/dist/helpers/handlebars.js.map +1 -1
  82. package/dist/hono.d.ts.map +1 -1
  83. package/dist/hono.js.map +1 -1
  84. package/dist/index.d.ts +14 -12
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +32 -30
  87. package/dist/index.js.map +1 -1
  88. package/dist/koa.d.ts.map +1 -1
  89. package/dist/koa.js.map +1 -1
  90. package/dist/nestjs.d.ts.map +1 -1
  91. package/dist/nestjs.js +41 -14
  92. package/dist/nestjs.js.map +1 -1
  93. package/dist/pipeline/enrich.d.ts +2 -13
  94. package/dist/pipeline/enrich.d.ts.map +1 -1
  95. package/dist/pipeline/enrich.js +157 -212
  96. package/dist/pipeline/enrich.js.map +1 -1
  97. package/dist/pipeline/intake.d.ts +3 -3
  98. package/dist/pipeline/intake.d.ts.map +1 -1
  99. package/dist/pipeline/intake.js +342 -238
  100. package/dist/pipeline/intake.js.map +1 -1
  101. package/dist/pipeline/write.d.ts +1 -14
  102. package/dist/pipeline/write.d.ts.map +1 -1
  103. package/dist/pipeline/write.js +73 -113
  104. package/dist/pipeline/write.js.map +1 -1
  105. package/dist/types/config.d.ts +14 -26
  106. package/dist/types/config.d.ts.map +1 -1
  107. package/dist/types/config.js +16 -12
  108. package/dist/types/config.js.map +1 -1
  109. package/dist/types/ir.d.ts +12 -8
  110. package/dist/types/ir.d.ts.map +1 -1
  111. package/dist/types/manifest.d.ts +10 -11
  112. package/dist/types/manifest.d.ts.map +1 -1
  113. package/dist/types/manifest.js +54 -14
  114. package/dist/types/manifest.js.map +1 -1
  115. package/dist/types/sdk-module.d.ts +2 -2
  116. package/dist/types/sdk-module.js +1 -1
  117. package/dist/utils/format.d.ts +1 -3
  118. package/dist/utils/format.d.ts.map +1 -1
  119. package/dist/utils/format.js +3 -10
  120. package/dist/utils/format.js.map +1 -1
  121. package/dist/utils/naming.d.ts.map +1 -1
  122. package/dist/utils/naming.js +174 -184
  123. package/dist/utils/naming.js.map +1 -1
  124. package/dist/utils/npm-token.d.ts +1 -17
  125. package/dist/utils/npm-token.d.ts.map +1 -1
  126. package/dist/utils/npm-token.js +27 -76
  127. package/dist/utils/npm-token.js.map +1 -1
  128. package/dist/utils/version.d.ts +14 -0
  129. package/dist/utils/version.d.ts.map +1 -0
  130. package/dist/utils/version.js +60 -0
  131. package/dist/utils/version.js.map +1 -0
  132. package/package.json +4 -3
  133. package/templates/csharp/client.hbs +26 -49
  134. package/templates/csharp/csproj.hbs +7 -0
  135. package/templates/csharp/domain.hbs +48 -130
  136. package/templates/csharp/errors.hbs +17 -25
  137. package/templates/csharp/readme.hbs +31 -44
  138. package/templates/csharp/transport.hbs +238 -136
  139. package/templates/csharp/types.hbs +30 -76
  140. package/templates/go/client.hbs +44 -109
  141. package/templates/go/domain.hbs +83 -25
  142. package/templates/go/go-mod.hbs +1 -4
  143. package/templates/go/readme.hbs +32 -29
  144. package/templates/go/transport.hbs +174 -173
  145. package/templates/go/types.hbs +17 -53
  146. package/templates/go/utils.hbs +3 -2
  147. package/templates/kotlin/build-gradle.hbs +1 -1
  148. package/templates/kotlin/client.hbs +18 -15
  149. package/templates/kotlin/domain.hbs +54 -51
  150. package/templates/kotlin/errors.hbs +1 -1
  151. package/templates/kotlin/readme.hbs +35 -137
  152. package/templates/kotlin/transport.hbs +140 -123
  153. package/templates/kotlin/types.hbs +30 -81
  154. package/templates/php/client.hbs +8 -46
  155. package/templates/php/composer.hbs +2 -1
  156. package/templates/php/domain.hbs +86 -117
  157. package/templates/php/errors.hbs +1 -1
  158. package/templates/php/readme.hbs +42 -49
  159. package/templates/php/transport.hbs +192 -145
  160. package/templates/php/types.hbs +63 -60
  161. package/templates/python/client.hbs +15 -2
  162. package/templates/python/domain.hbs +50 -108
  163. package/templates/python/pyproject.hbs +5 -0
  164. package/templates/python/readme.hbs +47 -30
  165. package/templates/python/resources-init.hbs +1 -1
  166. package/templates/python/transport.hbs +167 -53
  167. package/templates/python/types.hbs +22 -58
  168. package/templates/ruby/client.hbs +10 -6
  169. package/templates/ruby/domain.hbs +48 -67
  170. package/templates/ruby/errors.hbs +3 -3
  171. package/templates/ruby/gemspec.hbs +3 -10
  172. package/templates/ruby/index.hbs +3 -3
  173. package/templates/ruby/readme.hbs +33 -70
  174. package/templates/ruby/transport.hbs +129 -103
  175. package/templates/ruby/types.hbs +11 -16
  176. package/templates/ruby/version.hbs +1 -1
  177. package/templates/rust/cargo.hbs +2 -0
  178. package/templates/rust/client.hbs +10 -1
  179. package/templates/rust/domain.hbs +69 -52
  180. package/templates/rust/error.hbs +3 -1
  181. package/templates/rust/lib.hbs +4 -5
  182. package/templates/rust/readme.hbs +33 -46
  183. package/templates/rust/transport.hbs +170 -159
  184. package/templates/rust/types.hbs +34 -111
  185. package/templates/typescript/domain-class.hbs +14 -6
  186. package/templates/typescript/domain.hbs +13 -5
  187. package/templates/typescript/package-json.hbs +3 -1
  188. package/templates/typescript/readme.hbs +42 -42
  189. package/templates/typescript/transport.hbs +46 -8
  190. package/templates/typescript/types-errors.hbs +1 -1
  191. package/dist/adapters/typescript/model-emitter.d.ts +0 -13
  192. package/dist/adapters/typescript/model-emitter.d.ts.map +0 -1
  193. package/dist/adapters/typescript/model-emitter.js +0 -415
  194. 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 = 15000,
33
- /** Maximum number of retry attempts. */
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: Transport = 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 kotlinx.coroutines.*
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
- {{#if summary}}
16
- /**
17
- * {{summary}}{{#if description}}
18
- *
19
- * {{description}}{{/if}}
20
- */
21
- {{/if}}
22
- {{#if deprecated}}
23
- @Deprecated(
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
- {{name}}: {{{kotlinType type}}},
26
+ path = path.replace("{{placeholder}}", {{parameterName}}.toString().encodeURLPathPart())
30
27
  {{/each}}
31
- {{#if requestBody}}
32
- body: {{{requestBody.kotlinType}}},
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
- {{#if (hasRequestBody this)}}
52
- {{#if (and (neq requestBody.contentType "application/json") (neq requestBody.contentType "multipart/form-data"))}}
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
- {{/if}}
55
- {{/if}}
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
- return transport.execute<{{{kotlinResponseType}}}>(
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 = queryMap,
67
- body = {{#if requestBody}}body{{else}}null{{/if}},
68
- headers = headers{{#unless (or (hasRequestBody this) (needsRequestHeaders this))}}{{/unless}},
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
- {{#unless description}}An auto-generated Kotlin SDK for the {{title}} API.{{/unless}}
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}}:{{#if packageVersion}}{{packageVersion}}{{else}}0.1.0{{/if}}")
11
+ implementation("{{groupId}}:{{artifactId}}:{{packageVersion}}")
21
12
  }
22
13
  ```
23
14
 
24
- ### Maven
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
- fun main() = runBlocking {
70
- val config = ClientConfig(
71
- {{#each securitySchemes}}
72
- {{#if (eq type "apiKey")}}
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
- val client = Client(config)
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
- ## API Reference
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
- ## Error Handling
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
- try {
119
- val result = client.users.getUser("user-123")
120
- println("Success: $result")
121
- } catch (e: SdkException) {
122
- when {
123
- e.isClientError() -> println("Bad request: ${e.message}")
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
- ## Project Structure
46
+ ## Documentation
132
47
 
133
- ```
134
- .
135
- ├── build.gradle.kts # Build configuration and dependencies
136
- ├── settings.gradle.kts # Project name
137
- ├── gradle.properties # Gradle JVM args and code style
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
- {{#if @last}}└──{{else}}├──{{/if}} {{interfaceName}}.kt
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
- > **Note:** The Gradle Wrapper JAR (`gradle/wrapper/gradle-wrapper.jar`) and the
160
- > `gradlew` / `gradlew.bat` scripts are not generated. Run the following once
161
- > after cloning to populate them:
162
- >
163
- > ```bash
164
- > gradle wrapper --gradle-version 9.5.1
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