@apollo-deploy/tesseract 1.8.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 +77 -3
  67. package/dist/collector.d.ts.map +1 -1
  68. package/dist/collector.js +198 -20
  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 +8 -9
  75. package/dist/fastify.d.ts.map +1 -1
  76. package/dist/fastify.js +105 -164
  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,172 +1,141 @@
1
1
  <?php
2
2
 
3
- /**
4
- * @generated
5
- * This file was automatically generated by Tesseract.
6
- * DO NOT MODIFY THIS FILE DIRECTLY.
7
- */
8
-
9
3
  declare(strict_types=1);
10
4
 
11
5
  namespace {{namespace}}\Api;
12
6
 
7
+ use {{namespace}}\SDKError;
8
+ use {{namespace}}\Transport;
9
+ {{#each imports}}
10
+ use {{this}};
11
+ {{/each}}
13
12
  use Psr\Http\Message\ResponseInterface;
14
13
 
15
- /**
16
- * {{interfaceName}} domain operations.
17
- *
18
- {{#if description}}
19
- * {{description}}
20
- *
21
- {{/if}}
22
- * @generated
23
- */
14
+ /** {{#if description}}{{description}}{{else}}{{interfaceName}} domain operations.{{/if}} */
24
15
  class {{className}}
25
16
  {
26
- private Transport $transport;
27
-
28
- public function __construct(Transport $transport)
17
+ public function __construct(private Transport $transport)
29
18
  {
30
- $this->transport = $transport;
31
19
  }
32
20
 
33
21
  {{#each operations}}
34
- {{#if (isEventStream this)}}
35
- // SSE operations are not yet supported in the PHP adapter — skipping {{name}}
36
-
37
- {{else}}
38
22
  /**
39
- {{#if deprecated}}
23
+ {{#if deprecated}}
40
24
  * @deprecated{{#if deprecationMessage}} {{deprecationMessage}}{{/if}}
41
- *
42
- {{/if}}
43
- {{#if (or summary description)}}
44
- * {{#if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else}}{{description}}{{/if}}
45
- *
46
- {{/if}}
47
- {{#each pathParams}}
48
- * @param {{type}} ${{name}}{{#if description}} {{description}}{{/if}}
49
- {{/each}}
50
- {{#if requestBody}}
51
- * @param array<string, mixed>{{#unless requestBody.required}}|null{{/unless}} $input Request body
52
- {{/if}}
53
- {{#each queryParams}}
54
- * @param {{type}}|null ${{name}}{{#if description}} {{description}}{{/if}}
55
- {{/each}}
56
- {{#each headerParams}}
57
- * @param {{type}}|null ${{name}}{{#if description}} {{description}}{{/if}}
58
- {{/each}}
59
- * @return {{responseType}}
25
+ {{/if}}
26
+ {{#each parameters}}
27
+ * @param {{docType}} ${{variableName}}{{#if description}} {{description}}{{/if}}
28
+ {{/each}}
29
+ {{#if isEventStream}}
30
+ * @return \Generator<int, string>
31
+ {{else}}
32
+ * @return {{responseDocType}}
33
+ {{/if}}
60
34
  * @throws SDKError
61
35
  */
62
- public function {{name}}(
63
- {{#each pathParams}}
64
- {{type}} ${{name}},
65
- {{/each}}
66
- {{#if requestBody}}
67
- {{#unless requestBody.required}}?{{/unless}}array $input{{#unless requestBody.required}} = null{{/unless}},
68
- {{/if}}
69
- {{#each queryParams}}
70
- ?{{type}} ${{name}} = null,
71
- {{/each}}
72
- {{#each headerParams}}
73
- ?{{type}} ${{name}} = null,
74
- {{/each}}
75
- ): {{responseType}}
36
+ public function {{methodName}}(
37
+ {{#each parameters}}
38
+ {{targetType}} ${{variableName}}{{#unless required}} = null{{/unless}},
39
+ {{/each}}
40
+ ): {{#if isEventStream}}\Generator{{else}}{{targetResponseType}}{{/if}}
76
41
  {
77
- // Build path with parameter substitution
78
42
  $path = '{{path}}';
79
- {{#if (hasPathParams this)}}
80
- $path = str_replace(
81
- [{{#each pathParams}}'{{@root.LBRACE}}{{originalName}}{{@root.RBRACE}}'{{#unless @last}}, {{/unless}}{{/each}}],
82
- [{{#each pathParams}}${{name}}{{#unless @last}}, {{/unless}}{{/each}}],
83
- $path
84
- );
85
- {{/if}}
43
+ {{#each pathParams}}
44
+ $path = str_replace('{{placeholder}}', rawurlencode((string) ${{variableName}}), $path);
45
+ {{/each}}
86
46
 
87
- // Build query parameters
88
47
  $query = [];
89
- {{#if (hasQueryParams this)}}
90
- {{#each queryParams}}
91
- if (${{name}} !== null) {
92
- $query['{{originalName}}'] = ${{name}};
48
+ {{#each queryParams}}
49
+ if (${{variableName}} !== null) {
50
+ $query['{{originalName}}'] = ${{variableName}};
93
51
  }
94
- {{/each}}
95
- {{/if}}
52
+ {{/each}}
96
53
 
97
- // Build extra headers
98
54
  $headers = [];
99
- {{#each headerParams}}
100
- if (${{name}} !== null) {
101
- $headers['{{originalName}}'] = (string) ${{name}};
55
+ {{#each headerParams}}
56
+ if (${{variableName}} !== null) {
57
+ $headers['{{originalName}}'] = (string) ${{variableName}};
58
+ }
59
+ {{/each}}
60
+ {{#if cookieParams.length}}
61
+ $cookies = [];
62
+ {{#each cookieParams}}
63
+ if (${{variableName}} !== null) {
64
+ $cookies[] = '{{originalName}}=' . rawurlencode((string) ${{variableName}});
102
65
  }
103
- {{/each}}
66
+ {{/each}}
67
+ if ($cookies !== []) {
68
+ $headers['Cookie'] = implode('; ', $cookies);
69
+ }
70
+ {{/if}}
104
71
 
105
- // Execute request
106
- $requestDef = [
72
+ $request = [
107
73
  'method' => '{{httpMethod}}',
108
74
  'path' => $path,
109
75
  'query' => $query,
110
76
  'headers' => $headers,
77
+ {{#if isEventStream}}
78
+ 'stream' => true,
79
+ {{/if}}
111
80
  ];
112
-
113
- {{#if (hasRequestBody this)}}
81
+ {{#if requestBody}}
114
82
  if ($input !== null) {
115
- $requestDef['body'] = $input;
83
+ $request['body'] = $input;
84
+ $request['contentType'] = '{{requestBody.contentType}}';
116
85
  }
117
- {{/if}}
118
-
119
- $response = $this->transport->executeRequest($requestDef);
86
+ {{/if}}
120
87
 
121
- // Deserialize response
88
+ $response = $this->transport->executeRequest($request);
89
+ {{#if isEventStream}}
90
+ $body = $response->getBody();
91
+ $buffer = '';
92
+ while (!$body->eof()) {
93
+ $buffer .= $body->read(8192);
94
+ while (($lineEnd = strpos($buffer, "\n")) !== false) {
95
+ $line = substr($buffer, 0, $lineEnd);
96
+ $buffer = substr($buffer, $lineEnd + 1);
97
+ yield rtrim($line, "\r");
98
+ }
99
+ }
100
+ if ($buffer !== '') {
101
+ yield rtrim($buffer, "\r");
102
+ }
103
+ {{else}}
122
104
  $data = $this->decodeResponse($response);
123
-
124
- {{#if (eq responseType "void")}}
105
+ {{#if isVoid}}
125
106
  return;
126
- {{else if (eq responseType "string")}}
107
+ {{else if (eq targetResponseType "string")}}
127
108
  return (string) $data;
128
- {{else if (eq responseType "int")}}
109
+ {{else if (eq targetResponseType "int")}}
129
110
  return (int) $data;
130
- {{else if (eq responseType "float")}}
111
+ {{else if (eq targetResponseType "float")}}
131
112
  return (float) $data;
132
- {{else if (eq responseType "bool")}}
113
+ {{else if (eq targetResponseType "bool")}}
133
114
  return (bool) $data;
134
- {{else if (eq responseType "array")}}
115
+ {{else if (eq targetResponseType "array")}}
116
+ return is_array($data) ? $data : [];
117
+ {{else if (eq targetResponseType "mixed")}}
135
118
  return $data;
136
- {{else}}
137
- // Complex type: deserialize via fromArray
138
- if (class_exists({{responseType}}::class) && method_exists({{responseType}}::class, 'fromArray')) {
139
- return {{responseType}}::fromArray($data);
119
+ {{else}}
120
+ if (is_array($data) && method_exists({{targetResponseType}}::class, 'fromArray')) {
121
+ return {{targetResponseType}}::fromArray($data);
140
122
  }
141
123
  return $data;
142
- {{/if}}
124
+ {{/if}}
125
+ {{/if}}
143
126
  }
144
127
 
145
- {{/if}}
146
128
  {{/each}}
147
-
148
- /**
149
- * Decode a PSR-7 response body to an associative array or raw value.
150
- *
151
- * @return array<string, mixed>|string
152
- */
153
- private function decodeResponse(ResponseInterface $response): array|string
129
+ private function decodeResponse(ResponseInterface $response): mixed
154
130
  {
155
131
  $contents = $response->getBody()->__toString();
132
+ if (trim($contents) === '') {
133
+ return null;
134
+ }
156
135
 
157
136
  try {
158
- $decoded = json_decode($contents, true, 512, JSON_THROW_ON_ERROR);
159
- if (is_array($decoded)) {
160
- return $decoded;
161
- }
162
- if (is_scalar($decoded)) {
163
- return (string) $decoded;
164
- }
165
- return ['raw' => $decoded];
137
+ return json_decode($contents, true, 512, JSON_THROW_ON_ERROR);
166
138
  } catch (\JsonException) {
167
- if (trim($contents) === '') {
168
- return [];
169
- }
170
139
  return $contents;
171
140
  }
172
141
  }
@@ -110,7 +110,7 @@ class SDKError extends \Exception
110
110
  */
111
111
  public function isRetryable(): bool
112
112
  {
113
- return $this->httpStatus >= 500 || $this->httpStatus === 429;
113
+ return $this->httpStatus >= 500 || in_array($this->httpStatus, [408, 425, 429], true);
114
114
  }
115
115
 
116
116
  /**
@@ -1,10 +1,8 @@
1
1
  # {{title}} PHP SDK
2
2
 
3
- {{#if description}}
4
- {{description}}
3
+ {{#if description}}{{description}}{{else}}PHP client for the {{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
 
@@ -12,7 +10,7 @@
12
10
  composer require {{composerName}}
13
11
  ```
14
12
 
15
- ## Quick Start
13
+ ## Quick start
16
14
 
17
15
  ```php
18
16
  <?php
@@ -24,66 +22,61 @@ use {{namespace}}\Client;
24
22
  $client = new Client([
25
23
  'baseUrl' => '{{baseUrl}}',
26
24
  {{#each securitySchemes}}
27
- '{{configKey}}' => 'your-{{kebabCase name}}-credential',
25
+ '{{configKey}}' => getenv('{{upperCase (snakeCase configKey)}}'),
28
26
  {{/each}}
27
+ 'timeoutMs' => 15000,
29
28
  ]);
30
29
 
31
- {{#with groups.[0]}}
32
- $api = $client->{{name}}();
33
- {{/with}}
30
+ {{#if groups.length}}
31
+ $api = $client->{{groups.[0].accessorName}}();
32
+ {{/if}}
34
33
  ```
35
34
 
36
- ## Configuration
37
-
38
- The `Client` constructor accepts an associative array with the following keys:
39
-
40
- | Option | Type | Default | Description |
41
- |--------|------|---------|-------------|
42
- | `baseUrl` | `string` | `'{{baseUrl}}'` | Base URL for the API |
43
- {{#each securitySchemes}}
44
- | `{{configKey}}` | `string` | `null` | {{#if description}}{{description}}{{else}}{{type}} credential for {{name}}{{/if}} |
45
- {{/each}}
46
- | `timeoutMs` | `int` | `15000` | Request timeout in milliseconds |
47
- | `retries` | `array` | `['attempts' => 3, 'backoffMs' => 400, 'jitter' => true]` | Retry configuration |
48
- | `defaultHeaders` | `array` | `[]` | Default headers sent with every request |
49
-
50
- ## API Reference
51
-
52
- {{#each groups}}
53
- ### `{{className}}`
35
+ ## Configuration and reliability
54
36
 
55
- {{#if description}}
56
- {{description}}
37
+ The generated Guzzle transport supports bounded timeouts, exponential-backoff retries, rate-limit handling, default headers, and structured `SDKError` exceptions. Unsafe methods are not retried unless the request is idempotent or unsafe retries are explicitly enabled.
57
38
 
58
- {{/if}}
59
- | Method | HTTP | Path | Description |
60
- |--------|------|------|-------------|
61
- {{#each operations}}
62
- | `{{name}}()` | `{{upperCase httpMethod}}` | `{{path}}` | {{#if description}}{{description}}{{else}}-{{/if}} |
63
- {{/each}}
39
+ ```php
40
+ $client = new Client([
41
+ 'timeoutMs' => 30000,
42
+ 'retries' => [
43
+ 'attempts' => 3,
44
+ 'backoffMs' => 400,
45
+ 'jitter' => true,
46
+ 'maxBackoffMs' => 30000,
47
+ ],
48
+ 'defaultHeaders' => ['X-Application' => 'my-service'],
49
+ ]);
50
+ ```
64
51
 
65
- {{/each}}
52
+ ## Documentation
66
53
 
67
- ## Types
54
+ - [Documentation index](./docs/README.md)
55
+ - [Generated types](./docs/types.md)
68
56
 
69
- {{#each schemas}}
70
- {{#if isEnum}}
71
- - `{{name}}` — enum: {{#each enumValues}}`{{this}}`{{#unless @last}}, {{/unless}}{{/each}}
72
- {{else}}
73
- - `{{name}}`{{#if description}} — {{description}}{{/if}}
74
- {{/if}}
57
+ | Domain | Description |
58
+ |---|---|
59
+ {{#each groups}}
60
+ | [{{className}}](./docs/domains/{{fileName}}.md) | {{#if description}}{{description}}{{else}}{{name}} operations{{/if}} |
75
61
  {{/each}}
76
62
 
77
- ## Error Handling
63
+ ## Error handling
78
64
 
79
65
  ```php
80
- <?php
81
-
82
66
  use {{namespace}}\SDKError;
83
67
 
84
68
  try {
85
- $result = $client->{{groups.[0].name}}()->{{groups.[0].operations.[0].name}}(/* params */);
86
- } catch (SDKError $e) {
87
- echo sprintf("Error %d: %s (%s)\n", $e->getHttpStatus(), $e->getMessage(), $e->getErrorCode());
69
+ // Call a domain operation.
70
+ } catch (SDKError $error) {
71
+ fprintf(STDERR, "%d %s request=%s\n", $error->getHttpStatus(), $error->getErrorCode(), $error->getRequestId());
72
+ throw $error;
88
73
  }
89
74
  ```
75
+
76
+ ## Requirements
77
+
78
+ - PHP 8.2 or later
79
+
80
+ ## License
81
+
82
+ MIT