@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.
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 +13 -3
  67. package/dist/collector.d.ts.map +1 -1
  68. package/dist/collector.js +69 -32
  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 +7 -0
  75. package/dist/fastify.d.ts.map +1 -1
  76. package/dist/fastify.js +39 -20
  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
@@ -1,79 +1,43 @@
1
1
  """Generated type definitions for {{moduleName}}."""
2
2
 
3
- from typing import Optional, List, Dict, Any, Literal, Union
4
- from datetime import datetime
5
- from pydantic import BaseModel, Field
6
-
7
-
8
- # -- Pagination --------------------------------------------------
9
-
10
- class PaginationQuery(BaseModel):
11
- page: Optional[int] = Field(None, description="Page number (1-indexed)")
12
- limit: Optional[int] = Field(None, description="Number of items per page")
13
- sort_by: Optional[str] = Field(None, description="Column name to sort by")
14
- sort_order: Optional[Literal["asc", "desc"]] = Field(None, description="Sort direction")
15
-
16
-
17
- class PageMeta(BaseModel):
18
- size: int
19
- total_pages: int
20
- has_more: bool
21
-
22
-
23
- class Page(BaseModel):
24
- data: List[Any]
25
- page: PageMeta
26
-
27
-
28
- # -- Common Responses --------------------------------------------
29
-
30
- class SuccessResponse(BaseModel):
31
- success: bool
32
- message: Optional[str] = None
33
-
3
+ from __future__ import annotations
34
4
 
35
- class MessageResponse(BaseModel):
36
- message: str
37
-
38
-
39
- class ApiErrorEnvelope(BaseModel):
40
- error: str
41
- message: str
42
- status: int
43
- request_id: Optional[str] = None
44
- timestamp: Optional[str] = None
45
- path: Optional[str] = None
46
- method: Optional[str] = None
47
- hint: Optional[str] = None
48
-
49
-
50
- # -- Generated Schemas -------------------------------------------
5
+ from datetime import datetime
6
+ from enum import Enum
7
+ from typing import Any, Dict, List, Literal, Optional, Union
8
+ from pydantic import BaseModel, ConfigDict, Field
51
9
 
52
10
  {{#each schemas}}
53
- {{#if (eq ownership.kind "external")}}
54
- {{else}}
55
- {{#if isEnum}}
56
- class {{name}}(str):
11
+ {{#if external}}
12
+ {{name}} = Any
13
+
14
+ {{else if isEnum}}
15
+ class {{name}}({{enumBase}}, Enum):
57
16
  """{{#if description}}{{description}}{{else}}Enum for {{name}}{{/if}}"""
58
17
  {{#each enumValues}}
59
- {{pascalCase this}} = "{{this}}"
18
+ {{name}} = {{{value}}}
60
19
  {{/each}}
61
20
 
62
21
  {{else if isUnionType}}
63
- {{name}} = Union[{{#each unionMembers}}{{this}}{{#unless @last}}, {{/unless}}{{/each}}]
64
- """{{#if description}}{{description}}{{else}}Union type for {{name}}{{/if}}"""
22
+ {{name}} = {{{unionType}}}
65
23
 
66
24
  {{else if isTypeAlias}}
67
- {{name}} = {{additionalPropertiesType}}
68
- """{{#if description}}{{description}}{{else}}Type alias for {{name}}{{/if}}"""
25
+ {{name}} = {{{aliasType}}}
26
+
27
+ {{else if isIntersectionType}}
28
+ {{name}} = Dict[str, Any]
69
29
 
70
30
  {{else}}
71
31
  class {{name}}(BaseModel):
72
32
  """{{#if description}}{{description}}{{else}}Schema for {{name}}{{/if}}"""
33
+ model_config = ConfigDict(populate_by_name=True)
34
+ {{#if properties.length}}
73
35
  {{#each properties}}
74
- {{name}}: {{#if nullable}}Optional[{{/if}}{{pythonType type}}{{#if nullable}}] = None{{else}}{{#unless required}} = None{{/unless}}{{/if}}
36
+ {{fieldName}}: {{{targetType}}} = {{{fieldDefault}}}
75
37
  {{/each}}
76
-
38
+ {{else}}
39
+ pass
77
40
  {{/if}}
41
+
78
42
  {{/if}}
79
43
  {{/each}}
@@ -5,7 +5,7 @@ require_relative "transport"
5
5
  require_relative "resources/{{fileName}}"
6
6
  {{/each}}
7
7
 
8
- module {{pascalCase meta.clientName}}
8
+ module {{moduleName}}
9
9
  # Configuration for the {{meta.title}} SDK client.
10
10
  class Config
11
11
  # @return [String] the base URL for API requests
@@ -16,6 +16,8 @@ module {{pascalCase meta.clientName}}
16
16
  attr_accessor :retries
17
17
  # @return [Hash] default headers sent with every request
18
18
  attr_accessor :default_headers
19
+ # @return [Boolean] whether POST/PATCH requests may be retried without an idempotency key
20
+ attr_accessor :retry_unsafe_requests
19
21
  {{#each securitySchemes}}
20
22
  # @return [String, nil] credential for {{name}} security scheme
21
23
  attr_accessor :{{camelCase name}}
@@ -33,6 +35,7 @@ module {{pascalCase meta.clientName}}
33
35
  timeout: 15,
34
36
  retries: { attempts: 3, backoff: 0.4, jitter: true, max_backoff: 30.0 },
35
37
  default_headers: {},
38
+ retry_unsafe_requests: false,
36
39
  {{#each securitySchemes}}
37
40
  {{camelCase name}}: nil,
38
41
  {{/each}}
@@ -42,6 +45,7 @@ module {{pascalCase meta.clientName}}
42
45
  @timeout = timeout
43
46
  @retries = retries
44
47
  @default_headers = default_headers
48
+ @retry_unsafe_requests = retry_unsafe_requests
45
49
  {{#each securitySchemes}}
46
50
  @{{camelCase name}} = {{camelCase name}}
47
51
  {{/each}}
@@ -53,19 +57,19 @@ module {{pascalCase meta.clientName}}
53
57
  # Provides access to all API domains as instance methods.
54
58
  class Client
55
59
  {{#each groups}}
56
- # @return [{{pascalCase ../meta.clientName}}::{{pascalCase name}}]
60
+ # @return [{{../moduleName}}::{{pascalCase name}}]
57
61
  attr_reader :{{name}}
58
62
  {{/each}}
59
63
 
60
- # @return [{{pascalCase meta.clientName}}::Config] the client configuration
64
+ # @return [{{moduleName}}::Config] the client configuration
61
65
  attr_reader :config
62
66
 
63
- # @return [{{pascalCase meta.clientName}}::Transport] the underlying HTTP transport
67
+ # @return [{{moduleName}}::Transport] the underlying HTTP transport
64
68
  attr_reader :transport
65
69
 
66
70
  # Create a new API client.
67
71
  #
68
- # @param config [{{pascalCase meta.clientName}}::Config, Hash, nil]
72
+ # @param config [{{moduleName}}::Config, Hash, nil]
69
73
  # Either a Config instance or keyword arguments matching Config#initialize.
70
74
  def initialize(config = nil)
71
75
  @config = if config.is_a?(Config)
@@ -79,7 +83,7 @@ module {{pascalCase meta.clientName}}
79
83
  @transport = Transport.new(@config)
80
84
 
81
85
  {{#each groups}}
82
- @{{name}} = {{pascalCase ../meta.clientName}}::{{pascalCase name}}.new(@transport)
86
+ @{{name}} = {{../moduleName}}::{{pascalCase name}}.new(@transport)
83
87
  {{/each}}
84
88
  end
85
89
  end
@@ -3,13 +3,11 @@
3
3
  require_relative "../transport"
4
4
  require_relative "../errors"
5
5
 
6
- module {{pascalCase meta.clientName}}
6
+ module {{moduleName}}
7
7
  # {{#if description}}{{description}}{{else}}{{name}} API domain{{/if}}
8
8
  class {{pascalCase name}}
9
- # @return [Transport]
10
9
  attr_reader :transport
11
10
 
12
- # @param transport [Transport]
13
11
  def initialize(transport)
14
12
  @transport = transport
15
13
  end
@@ -21,87 +19,70 @@ module {{pascalCase meta.clientName}}
21
19
  {{#if (or summary description)}}
22
20
  # {{#if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else}}{{description}}{{/if}}
23
21
  {{/if}}
24
- {{#if pathParams.length}}
25
- # @param {{#each pathParams}}{{snakeCase name}} [{{type}}]{{#unless @last}}, {{/unless}}{{/each}}
26
- {{/if}}
22
+ {{#each pathParams}}
23
+ # @param {{snakeCase name}} [{{docType}}]
24
+ {{/each}}
27
25
  {{#if requestBody}}
28
- # @param body [{{requestBody.type}}{{#unless requestBody.required}}, nil{{/unless}}] request body
26
+ # @param body [{{requestBodyDocType}}{{#unless requestBody.required}}, nil{{/unless}}] request body
29
27
  {{/if}}
30
- {{#if (or queryParams.length queryType)}}
31
- # @param query [Hash, nil] query parameters
28
+ {{#if queryParams.length}}
29
+ # @param query [Hash{{#unless queryRequired}}, nil{{/unless}}] query parameters
32
30
  {{/if}}
33
- {{#if (and headerParams.length headerType)}}
34
- # @param headers [Hash, nil] extra request headers
31
+ {{#if headerParams.length}}
32
+ # @param headers [Hash, nil] request headers
35
33
  {{/if}}
36
- {{#if (and cookieParams.length cookieType)}}
34
+ {{#if cookieParams.length}}
37
35
  # @param cookies [Hash, nil] cookie values
38
36
  {{/if}}
39
- {{#if timeoutMs}}
40
- # @param timeout [Integer, nil] per-request timeout override (seconds)
41
- {{/if}}
42
- # @raise [{{pascalCase ../meta.clientName}}::SDKError]
43
- # @return [{{responseType}}]
44
- def {{snakeCase name}}({{#if pathParams.length}}{{#each pathParams}}{{snakeCase name}}:{{#if (or ../requestBody (or ../queryType ../queryParams.length) (or ../headerType ../cookieType))}}, {{/if}}{{/each}}{{/if}}{{#if requestBody}}body: nil{{#if (or ../queryType ../queryParams.length (or ../headerType ../cookieType))}}, {{/if}}{{/if}}{{#if (or queryParams.length queryType)}}query: nil{{#if (or ../headerType ../cookieType)}}, {{/if}}{{/if}}{{#if (and headerParams.length headerType)}}headers: {}{{#if ../cookieType}}, {{/if}}{{/if}}{{#if (and cookieParams.length cookieType)}}cookies: nil{{/if}})
45
- {{#if (or pathParams.length headerParams.length cookieParams.length)}}
46
- # Build request headers
47
- request_headers = {}
48
- {{#if (and headerParams.length headerType)}}
49
- {{#each headerParams}}
50
- request_headers["{{originalName}}"] = headers[:{{snakeCase name}}].to_s if headers[:{{snakeCase name}}]
51
- {{/each}}
52
- {{/if}}
53
- {{#if (and cookieParams.length cookieType)}}
54
- if cookies
55
- cookie_pairs = []
56
- {{#each cookieParams}}
57
- cookie_pairs << "{{originalName}}=#{::URI.encode_www_form_component(cookies[:{{snakeCase name}}].to_s)}" if cookies[:{{snakeCase name}}]
58
- {{/each}}
59
- request_headers["Cookie"] = cookie_pairs.join("; ") unless cookie_pairs.empty?
60
- end
61
- {{/if}}
62
- {{/if}}
63
-
64
- {{#if pathParams.length}}
65
- # Path parameter substitution
37
+ # @raise [{{../moduleName}}::SDKError]
38
+ # @return [{{responseDocType}}]
39
+ def {{methodName}}({{{signature}}})
40
+ {{#if pathParams.length}}
66
41
  path_params = {
67
- {{#each pathParams}}
68
- {{originalName}}: {{snakeCase name}},
69
- {{/each}}
42
+ {{#each pathParams}}
43
+ {{name}}: {{parameterName}},
44
+ {{/each}}
70
45
  }
71
- {{/if}}
72
-
73
- {{#if queryParams.length}}
74
- # Query parameters
46
+ {{/if}}
47
+ {{#if queryParams.length}}
75
48
  query_params = {}
76
- {{#each queryParams}}
77
- query_params["{{originalName}}"] = query[:{{snakeCase name}}] if query && query.key?(:{{snakeCase name}})
78
- {{/each}}
49
+ {{#each queryParams}}
50
+ query_params["{{originalName}}"] = query[:{{parameterName}}] if query && query.key?(:{{parameterName}})
51
+ {{/each}}
79
52
  query_params = nil if query_params.empty?
80
- {{else if queryType}}
81
- # Free-form query parameters
82
- query_params = query
83
- {{/if}}
53
+ {{/if}}
54
+ {{#if (or headerParams.length cookieParams.length)}}
55
+ request_headers = {}
56
+ {{#each headerParams}}
57
+ request_headers["{{originalName}}"] = headers[:{{parameterName}}].to_s if headers && headers.key?(:{{parameterName}})
58
+ {{/each}}
59
+ {{#if cookieParams.length}}
60
+ cookie_pairs = []
61
+ {{#each cookieParams}}
62
+ cookie_pairs << "{{originalName}}=#{::URI.encode_www_form_component(cookies[:{{parameterName}}].to_s)}" if cookies && cookies.key?(:{{parameterName}})
63
+ {{/each}}
64
+ request_headers["Cookie"] = cookie_pairs.join("; ") unless cookie_pairs.empty?
65
+ {{/if}}
66
+ {{/if}}
84
67
 
85
- transport.request(
86
- method: :{{httpMethod}},
68
+ transport.{{#if isEventStream}}stream{{else}}request{{/if}}(
69
+ method: :{{rubyHttpMethod}},
87
70
  path: "{{path}}",
88
- {{#if pathParams.length}}
71
+ {{#if pathParams.length}}
89
72
  path_params: path_params,
90
- {{/if}}
91
- {{#if requestBody}}
73
+ {{/if}}
74
+ {{#if requestBody}}
92
75
  body: body,
93
- {{/if}}
94
- {{#if (or queryParams.length queryType)}}
76
+ {{/if}}
77
+ {{#if queryParams.length}}
95
78
  query: query_params,
96
- {{/if}}
97
- {{#if (or (and headerParams.length headerType) (and cookieParams.length cookieType))}}
79
+ {{/if}}
80
+ {{#if (or headerParams.length cookieParams.length)}}
98
81
  headers: request_headers,
99
- {{/if}}
100
- {{#if (neq requestBody.contentType "application/json")}}
101
- {{#if requestBody.contentType}}
82
+ {{/if}}
83
+ {{#if requestBody.contentType}}
102
84
  content_type: "{{requestBody.contentType}}",
103
- {{/if}}
104
- {{/if}}
85
+ {{/if}}
105
86
  )
106
87
  end
107
88
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module {{pascalCase meta.clientName}}
3
+ module {{moduleName}}
4
4
  # Structured error raised on API and network failures.
5
5
  #
6
6
  # Inherits from StandardError and provides structured access to error
@@ -10,7 +10,7 @@ module {{pascalCase meta.clientName}}
10
10
  # @example Basic error handling
11
11
  # begin
12
12
  # client.users.get_user(id: "123")
13
- # rescue {{pascalCase meta.clientName}}::SDKError => e
13
+ # rescue {{moduleName}}::SDKError => e
14
14
  # puts "Error #{e.status}: #{e.message} (#{e.code})"
15
15
  # puts "Request ID: #{e.request_id}" if e.request_id
16
16
  #
@@ -122,7 +122,7 @@ module {{pascalCase meta.clientName}}
122
122
  def retryable?
123
123
  @code == "network_error" ||
124
124
  @code == "gateway_timeout" ||
125
- @status == 429 ||
125
+ [408, 425, 429].include?(@status) ||
126
126
  @status >= 500
127
127
  end
128
128
 
@@ -4,26 +4,19 @@ require_relative "lib/{{snakeModule}}/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "{{gemName}}"
7
- spec.version = {{pascalCase snakeModule}}::VERSION
7
+ spec.version = {{moduleName}}::VERSION
8
8
  spec.authors = ["API SDK Generator"]
9
9
  spec.email = ["sdk@example.com"]
10
10
 
11
- spec.summary = "{{#if meta.description}}{{meta.description}}{{else}}Ruby SDK for {{meta.title}}{{/if}}"
11
+ spec.summary = "Ruby SDK for {{meta.title}}"
12
12
  spec.description = "{{#if meta.description}}{{meta.description}}{{else}}A Ruby client library for the {{meta.title}} API.{{/if}}"
13
- spec.homepage = "https://github.com/example/{{gemName}}"
14
13
  spec.license = "MIT"
15
14
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
16
15
 
17
- spec.metadata["homepage_uri"] = spec.homepage
18
- spec.metadata["source_code_uri"] = "https://github.com/example/{{gemName}}"
19
- spec.metadata["changelog_uri"] = "https://github.com/example/{{gemName}}/blob/main/CHANGELOG.md"
20
-
21
- spec.files = Dir.glob("lib/**/*.rb") + %w[README.md LICENSE Gemfile]
16
+ spec.files = Dir.glob("lib/**/*.rb") + Dir.glob("docs/**/*.md") + %w[README.md LICENSE Gemfile]
22
17
  spec.require_paths = ["lib"]
23
18
 
24
19
  spec.add_dependency "faraday", "~> 2.0"
25
- spec.add_dependency "json"
26
-
27
20
  spec.add_development_dependency "rake", "~> 13.0"
28
21
  spec.add_development_dependency "rspec", "~> 3.0"
29
22
  spec.add_development_dependency "webmock", "~> 3.0"
@@ -9,7 +9,7 @@ require_relative "{{snakeModule}}/client"
9
9
  require_relative "{{../snakeModule}}/resources/{{fileName}}"
10
10
  {{/each}}
11
11
 
12
- module {{pascalCase snakeModule}}
12
+ module {{moduleName}}
13
13
  # Factory method to create a new client instance.
14
14
  #
15
15
  # @param base_url [String] the base URL for the API
@@ -25,7 +25,7 @@ module {{pascalCase snakeModule}}
25
25
  {{#if hasSSE}}
26
26
  # @param sse_client [Object, nil] optional SSE client implementation
27
27
  {{/if}}
28
- # @return [{{pascalCase meta.clientName}}::Client]
28
+ # @return [{{moduleName}}::Client]
29
29
  def self.create_client(
30
30
  base_url: '{{meta.baseUrl}}',
31
31
  timeout: 15,
@@ -38,7 +38,7 @@ module {{pascalCase snakeModule}}
38
38
  {{/if}}
39
39
  **extra
40
40
  )
41
- {{pascalCase meta.clientName}}::Client.new(
41
+ {{moduleName}}::Client.new(
42
42
  base_url: base_url,
43
43
  timeout: timeout,
44
44
  retries: retries,
@@ -1,113 +1,76 @@
1
1
  # {{meta.title}} Ruby SDK
2
2
 
3
- {{#if meta.description}}
4
- {{meta.description}}
3
+ {{#if meta.description}}{{meta.description}}{{else}}Ruby client for the {{meta.title}} API.{{/if}}
5
4
 
6
- {{/if}}
7
- > This SDK was automatically generated by [Tesseract](https://www.npmjs.com/package/@apollo-deploy/tesseract).
5
+ > Generated by [Tesseract](https://www.npmjs.com/package/@apollo-deploy/tesseract). Generated source files should not be edited manually.
8
6
 
9
7
  ## Installation
10
8
 
11
- Add this line to your application's Gemfile:
12
-
13
9
  ```ruby
14
10
  gem '{{gemName}}'
15
11
  ```
16
12
 
17
- And then execute:
18
-
19
13
  ```bash
20
14
  bundle install
21
15
  ```
22
16
 
23
- Or install it yourself as:
24
-
25
- ```bash
26
- gem install {{gemName}}
27
- ```
28
-
29
- ## Quick Start
17
+ ## Quick start
30
18
 
31
19
  ```ruby
32
20
  require '{{gemName}}'
33
21
 
34
- client = {{pascalCase meta.clientName}}::Client.new(
22
+ client = {{moduleName}}::Client.new(
35
23
  base_url: '{{meta.baseUrl}}',
36
24
  {{#each securitySchemes}}
37
- {{camelCase name}}: 'your-{{kebabCase name}}-credential',
25
+ {{camelCase name}}: ENV['{{upperCase (snakeCase name)}}'],
38
26
  {{/each}}
27
+ timeout: 15
39
28
  )
40
29
 
41
- # Make API calls
42
- result = client.{{groups.[0].name}}.{{groups.[0].operations.[0].name}}
30
+ {{#if groups.length}}
31
+ api = client.{{groups.[0].name}}
32
+ {{/if}}
43
33
  ```
44
34
 
45
- ## Configuration
35
+ ## Configuration and reliability
36
+
37
+ The transport provides bounded timeouts, exponential-backoff retries, rate-limit handling, default headers, and structured `SDKError` values. Unsafe requests are retried only when explicitly enabled or made idempotent.
46
38
 
47
39
  ```ruby
48
- client = {{pascalCase meta.clientName}}::Client.new(
49
- base_url: '{{meta.baseUrl}}',
50
- {{#each securitySchemes}}
51
- {{camelCase name}}: ENV['{{upperCase (snakeCase name)}}'],
52
- {{/each}}
53
- timeout: 30, # seconds
54
- retries: { attempts: 3, backoff: 0.4, jitter: true }
40
+ client = {{moduleName}}::Client.new(
41
+ timeout: 30,
42
+ retries: {
43
+ attempts: 3,
44
+ backoff: 0.4,
45
+ jitter: true,
46
+ max_backoff: 30.0
47
+ },
48
+ default_headers: { 'X-Application' => 'my-service' }
55
49
  )
56
50
  ```
57
51
 
58
- ## API Reference
52
+ ## Documentation
59
53
 
60
- {{#each groups}}
61
- ### {{pascalCase name}}
62
-
63
- {{#if description}}
64
- {{description}}
65
-
66
- {{/if}}
67
- | Method | HTTP | Path | Description |
68
- |--------|------|------|-------------|
69
- {{#each operations}}
70
- | `{{snakeCase name}}` | {{httpMethod}} | `{{path}}` | {{#if summary}}{{summary}}{{else}}-{{/if}} |
71
- {{/each}}
72
-
73
- {{/each}}
54
+ - [Documentation index](./docs/README.md)
55
+ - [Generated types](./docs/types.md)
74
56
 
75
- ## Types
76
-
77
- {{#each schemas}}
78
- {{#if isEnum}}
79
- - `{{pascalCase name}}` — module with constants: {{#each enumValues}}`{{this}}`{{#unless @last}}, {{/unless}}{{/each}}
80
- {{else if isTypeAlias}}
81
- - `{{pascalCase name}}` — type alias
82
- {{else}}
83
- - `{{pascalCase name}}`{{#if description}} — {{description}}{{/if}}
84
- {{/if}}
57
+ | Domain | Description |
58
+ |---|---|
59
+ {{#each groups}}
60
+ | [{{pascalCase name}}](./docs/domains/{{fileName}}.md) | {{#if description}}{{description}}{{else}}{{name}} operations{{/if}} |
85
61
  {{/each}}
86
62
 
87
- ## Error Handling
63
+ ## Error handling
88
64
 
89
65
  ```ruby
90
66
  begin
91
- result = client.some_api.some_method
92
- rescue {{pascalCase meta.clientName}}::SDKError => e
93
- puts "Error #{e.status}: #{e.message} (#{e.code})"
94
- puts "Request ID: #{e.request_id}" if e.request_id
95
-
96
- if e.rate_limited?
97
- sleep 1
98
- retry
99
- end
100
-
67
+ # Call a domain operation.
68
+ rescue {{moduleName}}::SDKError => error
69
+ warn "#{error.status} #{error.code} request=#{error.request_id}"
101
70
  raise
102
71
  end
103
72
  ```
104
73
 
105
- ## Development
106
-
107
- After checking out the repo, run `bin/setup` to install dependencies.
108
- Then, run `rake spec` to run the tests.
109
- You can also run `bin/console` for an interactive prompt.
110
-
111
74
  ## License
112
75
 
113
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
76
+ MIT