Skip to content

Commit 9275652

Browse files
Ivan KamkinIvan Kamkin
authored andcommitted
Updated templates for go and php
Switch all submodules to main
1 parent faab38c commit 9275652

File tree

12 files changed

+20
-26
lines changed

12 files changed

+20
-26
lines changed

codegen/Templates/go/api.mustache

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,17 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
277277
text: string(responseBody),
278278
StatusCode: httpResponse.StatusCode,
279279
}
280-
{{#responses}}{{#dataType}}
281-
if httpResponse.StatusCode == {{{code}}} {
282-
var v {{{dataType}}}
280+
if httpResponse.StatusCode >= 400 && httpResponse.StatusCode < 500 {
281+
var v ApiErrorResponse
283282
err = a.client.decode(&v, responseBody, httpResponse.Header.Get("Content-Type"))
284283
if err != nil {
285284
newErr.error = err.Error()
286-
return {{#returnType}}returnValue, {{/returnType}}httpResponse, newErr
285+
return returnValue, httpResponse, newErr
287286
}
288287
newErr.model = v
289-
return {{#returnType}}returnValue, {{/returnType}}httpResponse, newErr
288+
return returnValue, httpResponse, newErr
290289
}
291-
{{/dataType}}{{/responses}}
290+
292291
return {{#returnType}}returnValue, {{/returnType}}httpResponse, newErr
293292
}
294293

codegen/Templates/php/README.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{{#artifactVersion}}
1010
- Package version: {{artifactVersion}}
1111
{{/artifactVersion}}
12-
- Supported PHP versions: ">=7.4 || >=8.0"
12+
- Supported PHP versions: ">=8.0"
1313

1414
## SDK and API Version Compatibility:
1515

codegen/Templates/php/api.mustache

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use RuntimeException;
4444
* @param Configuration|null $config configuration info
4545
* @param HeaderSelector|null $selector class for header selection
4646
*/
47-
public function __construct(ClientInterface $client = null, Configuration $config = null, HeaderSelector $selector = null)
47+
public function __construct(?ClientInterface $client = null, ?Configuration $config = null, ?HeaderSelector $selector = null)
4848
{
4949
$this->client = $client ?: new Client();
5050
$this->config = $config ?: new Configuration();
@@ -155,15 +155,10 @@ use RuntimeException;
155155
return [null, $statusCode, $response->getHeaders()];
156156
{{/returnType}}
157157
} catch (ApiException $e) {
158-
switch ($e->getCode()) {
159-
{{#responses}}
160-
{{#dataType}}
161-
{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
162-
$data = ObjectSerializer::deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders());
163-
$e->setResponseObject($data);
164-
break;
165-
{{/dataType}}
166-
{{/responses}}
158+
$code = $e->getCode();
159+
if ($code >= 400 && $code < 500) {
160+
$data = ObjectSerializer::deserialize($e->getResponseBody(), '\Aspose\BarCode\Model\ApiErrorResponse', $e->getResponseHeaders());
161+
$e->setResponseObject($data);
167162
}
168163
throw $e;
169164
}

codegen/Templates/php/model.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa
186186
* @param mixed[] $data Associated array of property values
187187
* initializing the model
188188
*/
189-
public function __construct(array $data = null)
189+
public function __construct(?array $data = null)
190190
{
191191
{{#parentSchema}}
192192
parent::__construct($data);

submodules/android

submodules/dart

Submodule dart updated 1 file

submodules/dotnet

submodules/java

Submodule java updated from 96d7caa to 07f655e

submodules/node

0 commit comments

Comments
 (0)