This commit is contained in:
wing328 2017-11-15 21:46:08 +08:00
commit d676cd12c9
136 changed files with 3658 additions and 1492 deletions

View File

@ -3,7 +3,7 @@
- [ ] Read the [contribution guidelines](https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md). - [ ] Read the [contribution guidelines](https://github.com/swagger-api/swagger-codegen/blob/master/CONTRIBUTING.md).
- [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`. - [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`.
- [ ] Filed the PR against the correct branch: `3.0.0` branch for changes related to OpenAPI spec 3.0. Default: `master`. - [ ] Filed the PR against the correct branch: `3.0.0` branch for changes related to OpenAPI spec 3.0. Default: `master`.
- [ ] Copied the [technical committee](https://github.com/swagger-api/swagger-codegen/#swagger-codegen-technical-committee) to review the pull request if your PR is targeting a particular programming langauge. - [ ] Copied the [technical committee](https://github.com/swagger-api/swagger-codegen/#swagger-codegen-technical-committee) to review the pull request if your PR is targeting a particular programming language.
### Description of the PR ### Description of the PR

View File

@ -8,7 +8,7 @@ echo "Please press CTRL+C to stop or the script will continue in 10 seconds."
sleep 10 sleep 10
for SCRIPT in ./bin/*.sh for SCRIPT in `ls -l ./bin/*.sh | grep -v all`
do do
if [ -f $SCRIPT -a -x $SCRIPT ] if [ -f $SCRIPT -a -x $SCRIPT ]
then then

View File

@ -10,6 +10,7 @@ machine:
environment: environment:
DOCKER_GENERATOR_IMAGE_NAME: swaggerapi/swagger-generator DOCKER_GENERATOR_IMAGE_NAME: swaggerapi/swagger-generator
DOCKER_CODEGEN_CLI_IMAGE_NAME: swaggerapi/swagger-codegen-cli DOCKER_CODEGEN_CLI_IMAGE_NAME: swaggerapi/swagger-codegen-cli
DOCKER_BUILD_TAG: 2.2.3
dependencies: dependencies:
cache_directories: cache_directories:
@ -45,5 +46,7 @@ test:
- if [ $? -ne 0 ]; then exit 1; fi - if [ $? -ne 0 ]; then exit 1; fi
## docker: build generator image and push to Docker Hub ## docker: build generator image and push to Docker Hub
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME; fi; fi - if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME; fi; fi
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_GENERATOR_IMAGE_NAME ./modules/swagger-generator && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_GENERATOR_IMAGE_NAME:latest $DOCKER_GENERATOR_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_GENERATOR_IMAGE_NAME:$DOCKER_BUILD_TAG; fi; fi
## docker: build cli image and push to Docker Hub ## docker: build cli image and push to Docker Hub
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi - if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME; fi; fi
- if [ $DOCKER_HUB_USERNAME ]; then docker login --email=$DOCKER_HUB_EMAIL --username=$DOCKER_HUB_USERNAME --password=$DOCKER_HUB_PASSWORD && docker build --rm=false -t $DOCKER_CODEGEN_CLI_IMAGE_NAME ./modules/swagger-codegen-cli && if [ ! -z "$CIRCLE_TAG" ]; then docker tag $DOCKER_CODEGEN_CLI_IMAGE_NAME:latest $DOCKER_CODEGEN_CLI_IMAGE_NAME:$CIRCLE_TAG; fi && if [ ! -z "$CIRCLE_TAG" ] || [ "$CIRCLE_BRANCH" = "master" ]; then docker push $DOCKER_CODEGEN_CLI_IMAGE_NAME:$DOCKER_BUILD_TAG; fi; fi

View File

@ -87,8 +87,6 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig
.defaultValue(this.packageName)); .defaultValue(this.packageName));
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Erlang application version") cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Erlang application version")
.defaultValue(this.packageVersion)); .defaultValue(this.packageVersion));
} }
@Override @Override

View File

@ -580,6 +580,17 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
ops.get(0).vendorExtensions.put(X_HAS_NEW_TAG, true); ops.get(0).vendorExtensions.put(X_HAS_NEW_TAG, true);
} }
updateGlobalAdditionalProps();
return ret;
}
@Override
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
updateGlobalAdditionalProps();
return super.postProcessAllModels(objs);
}
public void updateGlobalAdditionalProps() {
additionalProperties.put(X_HAS_UNKNOWN_MIME_TYPES, !unknownMimeTypes.isEmpty()); additionalProperties.put(X_HAS_UNKNOWN_MIME_TYPES, !unknownMimeTypes.isEmpty());
Collections.sort(unknownMimeTypes, new Comparator<Map<String, String>>() { Collections.sort(unknownMimeTypes, new Comparator<Map<String, String>>() {
@ -601,8 +612,6 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
} }
}); });
additionalProperties.put(X_ALL_UNIQUE_PARAMS, params); additionalProperties.put(X_ALL_UNIQUE_PARAMS, params);
return ret;
} }
@Override @Override

View File

@ -150,7 +150,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
"FILE", "mutating", "protocol", "switch", "FUNCTION", "none", "public", "FILE", "mutating", "protocol", "switch", "FUNCTION", "none", "public",
"where", "LINE", "nonmutating", "static", "while", "optional", "struct", "where", "LINE", "nonmutating", "static", "while", "optional", "struct",
"override", "subscript", "postfix", "typealias", "precedence", "var", "override", "subscript", "postfix", "typealias", "precedence", "var",
"prefix", "Protocol", "required", "right", "set", "Type", "unowned", "weak", "prefix", "Protocol", "required", "right", "set", "throw", "Type", "unowned", "weak",
"Data", "Codable", "Encodable", "Decodable") "Data", "Codable", "Encodable", "Decodable")
); );

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -26,9 +26,6 @@ import com.google.api.client.json.Json;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
{{>generatedAnnotation}} {{>generatedAnnotation}}
public class ApiClient { public class ApiClient {
private final String basePath; private final String basePath;

View File

@ -72,45 +72,40 @@ public class {{classname}} {
{{/externalDocs}} {{/externalDocs}}
**/ **/
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map<String, Object> params) throws IOException { public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#bodyParam}}{{^required}}{{{dataType}}} {{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map<String, Object> params) throws IOException {
{{#returnType}}HttpResponse response = {{/returnType}}{{operationId}}ForHttpResponse({{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}params);{{#returnType}} {{#returnType}}HttpResponse response = {{/returnType}}{{operationId}}ForHttpResponse({{#bodyParam}}{{^required}}{{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}params);{{#returnType}}
TypeReference typeRef = new TypeReference<{{{returnType}}}>() {}; TypeReference typeRef = new TypeReference<{{{returnType}}}>() {};
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);{{/returnType}} return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);{{/returnType}}
} }
public HttpResponse {{operationId}}ForHttpResponse({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws IOException { public HttpResponse {{operationId}}ForHttpResponse({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws IOException {
Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) { if ({{paramName}} == null) {
throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}"); throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}");
} }{{/required}}{{/allParams}}
{{/required}}{{/allParams}}
{{#hasPathParams}} {{#hasPathParams}}
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();{{#pathParams}} final Map<String, Object> uriVariables = new HashMap<String, Object>();{{#pathParams}}
uriVariables.put("{{baseName}}", {{{paramName}}});{{/pathParams}} uriVariables.put("{{baseName}}", {{{paramName}}});{{/pathParams}}
{{/hasPathParams}} {{/hasPathParams}}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "{{{path}}}");{{#hasQueryParams}} UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "{{{path}}}");{{#hasQueryParams}}
{{#queryParams}}if ({{paramName}} != null) { {{#queryParams}}
if ({{paramName}} != null) {
uriBuilder = uriBuilder.queryParam("{{baseName}}", {{paramName}}); uriBuilder = uriBuilder.queryParam("{{baseName}}", {{paramName}});
}{{#hasMore}}{{/hasMore}}{{/queryParams}}{{/hasQueryParams}} }{{/queryParams}}{{/hasQueryParams}}
String url = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}} String url = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}}
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = {{#bodyParam}}{{paramName}} == null ? null : apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute();
} }
public HttpResponse {{operationId}}ForHttpResponse({{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map<String, Object> params) throws IOException { public HttpResponse {{operationId}}ForHttpResponse({{#bodyParam}}{{^required}}{{{dataType}}} {{paramName}}, {{/required}}{{/bodyParam}}{{#requiredParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/requiredParams}}{{#hasRequiredParams}}, {{/hasRequiredParams}}Map<String, Object> params) throws IOException {
Object {{localVariablePrefix}}postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; {{#allParams}}{{#required}}// verify the required parameter '{{paramName}}' is set
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) { if ({{paramName}} == null) {
throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}"); throw new IllegalArgumentException("Missing the required parameter '{{paramName}}' when calling {{operationId}}");
} }{{/required}}{{/allParams}}
{{/required}}{{/allParams}}
{{#hasPathParams}} {{#hasPathParams}}
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();{{#pathParams}} final Map<String, Object> uriVariables = new HashMap<String, Object>();{{#pathParams}}
@ -118,14 +113,12 @@ public class {{classname}} {
{{/hasPathParams}} {{/hasPathParams}}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "{{{path}}}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "{{{path}}}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);{{#queryParams}}{{#required}}
}{{#queryParams}}{{#required}}
// Add the required query param '{{paramName}}' to the map of query params // Add the required query param '{{paramName}}' to the map of query params
params.put("{{paramName}}", {{paramName}});{{/required}}{{/queryParams}} allParams.put("{{paramName}}", {{paramName}});{{/required}}{{/queryParams}}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -138,11 +131,10 @@ public class {{classname}} {
} }
} }
String url = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}} String url = uriBuilder{{#hasPathParams}}.buildFromMap(uriVariables).toString();{{/hasPathParams}}{{^hasPathParams}}.build().toString();{{/hasPathParams}}
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = {{#bodyParam}}{{paramName}} == null ? null : apiClient.new JacksonJsonHttpContent({{paramName}}){{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.{{httpMethod}}, genericUrl, content).execute();
} }

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -8,6 +8,6 @@
/// Enum {{name}} for {{{value}}} /// Enum {{name}} for {{{value}}}
/// </summary> /// </summary>
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}} {{/-last}}{{/enumVars}}{{/allowableValues}}
} }

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -12,6 +12,6 @@
/// Enum {{name}} for {{{value}}} /// Enum {{name}} for {{{value}}}
/// </summary> /// </summary>
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}} {{/-last}}{{/enumVars}}{{/allowableValues}}
} }

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -12,6 +12,6 @@
/// Enum {{name}} for {{{value}}} /// Enum {{name}} for {{{value}}}
/// </summary> /// </summary>
[EnumMember(Value = {{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})] [EnumMember(Value = {{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})]
{{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}} {{/-last}}{{/enumVars}}{{/allowableValues}}
} }

View File

@ -13,7 +13,7 @@
/// Enum {{name}} for {{{value}}} /// Enum {{name}} for {{{value}}}
/// </summary> /// </summary>
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})] [EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}} {{/-last}}{{/enumVars}}{{/allowableValues}}
} }
{{/isContainer}} {{/isContainer}}

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -4,7 +4,7 @@
public enum {{>innerApiEnumName}} public enum {{>innerApiEnumName}}
{ {
{{#allowableValues}} {{#allowableValues}}
{{#values}} {{&.}}{{^-last}}, {{/-last}} {{#values}} {{&.}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}}, {{/-last}}
{{/values}} {{/values}}
{{/allowableValues}} {{/allowableValues}}
}; };

View File

@ -10,6 +10,6 @@
/// <summary> /// <summary>
/// Enum {{name}} /// Enum {{name}}
/// </summary> /// </summary>
{{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}}, {{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}},
{{/-last}}{{/enumVars}}{{/allowableValues}} {{/-last}}{{/enumVars}}{{/allowableValues}}
} }

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -68,22 +68,27 @@ Please follow the [installation procedure](#installation--usage) and then run th
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}} // Configure HTTP basic authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME'); ->setUsername('YOUR_USERNAME')
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}} ->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}} // Configure API key authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}} // $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}} // Configure OAuth2 access token for authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}} $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}} {{/hasAuthMethods}}
$api_instance = new {{invokerPackage}}\Api\{{classname}}(); $apiInstance = new {{invokerPackage}}\Api\{{classname}}(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(){{#hasAuthMethods}},
$config{{/hasAuthMethods}}
);
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
{{/allParams}} {{/allParams}}
try { try {
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
print_r($result);{{/returnType}} print_r($result);{{/returnType}}
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;

View File

@ -130,7 +130,8 @@ use {{invokerPackage}}\ObjectSerializer;
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }

View File

@ -23,22 +23,29 @@ Method | HTTP request | Description
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}} // Configure HTTP basic authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME'); $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}} ->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}} // Configure API key authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY'); $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKey('{{{keyParamName}}}', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}} // $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}} // Configure OAuth2 access token for authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}} $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}} {{/hasAuthMethods}}
$api_instance = new {{invokerPackage}}\Api\{{classname}}(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new {{invokerPackage}}\Api\{{classname}}(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(){{#hasAuthMethods}},
$config{{/hasAuthMethods}}
);
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}
{{/allParams}} {{/allParams}}
try { try {
{{#returnType}}$result = {{/returnType}}$api_instance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
print_r($result);{{/returnType}} print_r($result);{{/returnType}}
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -150,7 +150,6 @@ class ApiClient(object):
_request_timeout=_request_timeout) _request_timeout=_request_timeout)
self.last_response = response_data self.last_response = response_data
{{^tornado}}
return_data = response_data return_data = response_data
if _preload_content: if _preload_content:
@ -160,12 +159,20 @@ class ApiClient(object):
else: else:
return_data = None return_data = None
{{^tornado}}
if _return_http_data_only: if _return_http_data_only:
return (return_data) return (return_data)
else: else:
return (return_data, response_data.status, return (return_data, response_data.status,
response_data.getheaders()) response_data.getheaders())
{{/tornado}} {{/tornado}}
{{#tornado}}
if _return_http_data_only:
raise tornado.gen.Return(return_data)
else:
raise tornado.gen.Return((return_data, response_data.status,
response_data.getheaders()))
{{/tornado}}
def sanitize_for_serialization(self, obj): def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object. """Builds a JSON POST object.
@ -524,7 +531,7 @@ class ApiClient(object):
content_disposition).group(1) content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename) path = os.path.join(os.path.dirname(path), filename)
with open(path, "w") as f: with open(path, "wb") as f:
f.write(response.data) f.write(response.data)
return path return path

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -10,6 +10,7 @@ import ssl
import certifi import certifi
# python 2 and python 3 compatibility library # python 2 and python 3 compatibility library
import six
from six.moves.urllib.parse import urlencode from six.moves.urllib.parse import urlencode
import tornado import tornado
import tornado.gen import tornado.gen
@ -50,7 +51,7 @@ class RESTClientObject(object):
# if not set certificate file, use Mozilla's root certificates. # if not set certificate file, use Mozilla's root certificates.
ca_certs = certifi.where() ca_certs = certifi.where()
self.ssl_context = ssl.SSLContext() self.ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
self.ssl_context.load_verify_locations(cafile=ca_certs) self.ssl_context.load_verify_locations(cafile=ca_certs)
if configuration.cert_file: if configuration.cert_file:
self.ssl_context.load_cert_chain( self.ssl_context.load_cert_chain(
@ -121,7 +122,8 @@ class RESTClientObject(object):
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
request.body = urlencode(post_params) request.body = urlencode(post_params)
elif headers['Content-Type'] == 'multipart/form-data': elif headers['Content-Type'] == 'multipart/form-data':
request.body = encode_multipart_formdata(post_params) multipart = encode_multipart_formdata(post_params)
request.body, headers['Content-Type'] = multipart
# Pass a `bytes` parameter directly in the body to support # Pass a `bytes` parameter directly in the body to support
# other content types than Json when `body` argument is provided # other content types than Json when `body` argument is provided
# in serialized form # in serialized form
@ -134,8 +136,15 @@ class RESTClientObject(object):
declared content type.""" declared content type."""
raise ApiException(status=0, reason=msg) raise ApiException(status=0, reason=msg)
r = yield self.pool_manager.fetch(request) r = yield self.pool_manager.fetch(request, raise_error=False)
if _preload_content:
r = RESTResponse(r, r.body) r = RESTResponse(r, r.body)
# In the python 3, the response.data is bytes.
# we need to decode it to string.
if six.PY3:
r.data = r.data.decode('utf8')
# log response body # log response body
logger.debug("response body: %s", r.data) logger.debug("response body: %s", r.data)
@ -143,6 +152,8 @@ class RESTClientObject(object):
if not 200 <= r.status <= 299: if not 200 <= r.status <= 299:
raise ApiException(http_resp=r) raise ApiException(http_resp=r)
raise tornado.gen.Return(r)
@tornado.gen.coroutine @tornado.gen.coroutine
def GET(self, url, headers=None, query_params=None, _preload_content=True, def GET(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None): _request_timeout=None):

View File

@ -35,7 +35,8 @@ void
void void
{{classname}}::cleanup() { {{classname}}::cleanup() {
{{#vars}}{{#complexType}} {{#vars}}
{{#complexType}}
if({{name}} != nullptr) { if({{name}} != nullptr) {
{{#isContainer}}{{#isListContainer}}QList<{{complexType}}*>* arr = {{name}};{{/isListContainer}}{{#isMapContainer}}QMap<QString, {{complexType}}*>* arr = {{name}};{{/isMapContainer}} {{#isContainer}}{{#isListContainer}}QList<{{complexType}}*>* arr = {{name}};{{/isListContainer}}{{#isMapContainer}}QMap<QString, {{complexType}}*>* arr = {{name}};{{/isMapContainer}}
foreach({{complexType}}* o, *arr) { foreach({{complexType}}* o, *arr) {
@ -58,10 +59,16 @@ void
void void
{{classname}}::fromJsonObject(QJsonObject &pJson) { {{classname}}::fromJsonObject(QJsonObject &pJson) {
{{#vars}} {{#vars}}
{{^isContainer}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/isContainer}} {{^isContainer}}
::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");
{{/isContainer}}
{{#isListContainer}} {{#isListContainer}}
{{#complexType}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");{{/complexType}} {{#complexType}}
{{^complexType}}::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{items.baseType}}");{{/complexType}} ::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{complexType}}");
{{/complexType}}
{{^complexType}}
::{{cppNamespace}}::setValue(&{{name}}, pJson["{{baseName}}"], "{{baseType}}", "{{items.baseType}}");
{{/complexType}}
{{/isListContainer}} {{/isListContainer}}
{{#isMapContainer}} {{#isMapContainer}}
if( pJson["{{baseName}}"].isObject()){ if( pJson["{{baseName}}"].isObject()){
@ -95,32 +102,52 @@ QString
QJsonObject* QJsonObject*
{{classname}}::asJsonObject() { {{classname}}::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject* obj = new QJsonObject();
{{#vars}}{{#complexType}}{{^isContainer}}{{#complexType}} {{#vars}}
toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}"));{{/complexType}}{{^complexType}} {{#complexType}}
{{^isContainer}}
{{#complexType}}
toJsonValue(QString("{{baseName}}"), {{name}}, obj, QString("{{complexType}}"));
{{/complexType}}
{{^complexType}}
if({{name}} != nullptr && *{{name}} != nullptr) { if({{name}} != nullptr && *{{name}} != nullptr) {
obj->insert("{{name}}", QJsonValue(*{{name}})); obj->insert("{{name}}", QJsonValue(*{{name}}));
}{{/complexType}}{{/isContainer}}{{#isListContainer}} }
{{/complexType}}
{{/isContainer}}
{{#isListContainer}}
QJsonArray {{name}}JsonArray; QJsonArray {{name}}JsonArray;
toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{complexType}}"); toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{complexType}}");
obj->insert("{{baseName}}", {{name}}JsonArray);{{/isListContainer}}{{#isMapContainer}} obj->insert("{{baseName}}", {{name}}JsonArray);
{{/isListContainer}}
{{#isMapContainer}}
QJsonArray {{name}}JsonArray; QJsonArray {{name}}JsonArray;
for(auto keyval : {{name}}->keys()){ for(auto keyval : {{name}}->keys()){
QJsonObject {{name}}_jobj; QJsonObject {{name}}_jobj;
toJsonValue(keyval, ((*{{name}})[keyval]), &{{name}}_jobj, "{{complexType}}"); toJsonValue(keyval, ((*{{name}})[keyval]), &{{name}}_jobj, "{{complexType}}");
{{name}}JsonArray.append({{name}}_jobj); {{name}}JsonArray.append({{name}}_jobj);
} }
obj->insert("{{baseName}}", {{name}}JsonArray);{{/isMapContainer}}{{/complexType}}{{^complexType}}{{^isContainer}} obj->insert("{{baseName}}", {{name}}JsonArray);
obj->insert("{{baseName}}", QJsonValue({{name}}));{{/isContainer}}{{#isListContainer}} {{/isMapContainer}}
{{/complexType}}
{{^complexType}}
{{^isContainer}}
obj->insert("{{baseName}}", QJsonValue({{name}}));
{{/isContainer}}
{{#isListContainer}}
QJsonArray {{name}}JsonArray; QJsonArray {{name}}JsonArray;
toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{items.baseType}}"); toJsonArray((QList<void*>*){{name}}, &{{name}}JsonArray, "{{name}}", "{{items.baseType}}");
obj->insert("{{baseName}}", {{name}}JsonArray);{{/isListContainer}}{{#isMapContainer}} obj->insert("{{baseName}}", {{name}}JsonArray);
{{/isListContainer}}
{{#isMapContainer}}
QJsonArray {{name}}JsonArray; QJsonArray {{name}}JsonArray;
for(auto keyval : {{name}}->keys()){ for(auto keyval : {{name}}->keys()){
QJsonObject {{name}}_jobj; QJsonObject {{name}}_jobj;
toJsonValue(keyval, ((*{{name}})[keyval]), &{{name}}_jobj, "{{items.baseType}}"); toJsonValue(keyval, ((*{{name}})[keyval]), &{{name}}_jobj, "{{items.baseType}}");
{{name}}JsonArray.append(portsobj); {{name}}JsonArray.append(portsobj);
} }
obj->insert("{{baseName}}", {{name}}JsonArray);{{/isMapContainer}}{{/complexType}} obj->insert("{{baseName}}", {{name}}JsonArray);
{{/isMapContainer}}
{{/complexType}}
{{/vars}} {{/vars}}
return obj; return obj;

View File

@ -16,7 +16,8 @@
#include "SWGObject.h" #include "SWGObject.h"
{{#models}}{{#model}} {{#models}}
{{#model}}
{{#cppNamespaceDeclarations}} {{#cppNamespaceDeclarations}}
namespace {{this}} { namespace {{this}} {
{{/cppNamespaceDeclarations}} {{/cppNamespaceDeclarations}}

View File

@ -21,7 +21,8 @@ using namespace Tizen::Web::Json;
{{#imports}}{{{import}}} {{#imports}}{{{import}}}
{{/imports}} {{/imports}}
{{#models}}{{#model}} {{#models}}
{{#model}}
{{#cppNamespaceDeclarations}} {{#cppNamespaceDeclarations}}
namespace {{this}} { namespace {{this}} {
@ -47,11 +48,12 @@ public:
{{#vars}} {{#vars}}
{{datatype}} {{getter}}(); {{datatype}} {{getter}}();
void {{setter}}({{datatype}} {{name}}); void {{setter}}({{{datatype}}} {{name}});
{{/vars}} {{/vars}}
private: private:
{{#vars}}{{datatype}} {{name}}; {{#vars}}
{{{datatype}}} {{name}};
{{/vars}} {{/vars}}
}; };

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -39,7 +39,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -11,15 +11,21 @@ public typealias EncodeResult = (data: Data?, error: Error?)
open class CodableHelper { open class CodableHelper {
open static var dateformatter: DateFormatter?
open class func decode<T>(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T : Decodable { open class func decode<T>(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T : Decodable {
var returnedDecodable: T? = nil var returnedDecodable: T? = nil
var returnedError: Error? = nil var returnedError: Error? = nil
let decoder = JSONDecoder() let decoder = JSONDecoder()
if let df = self.dateformatter {
decoder.dateDecodingStrategy = .formatted(df)
} else {
decoder.dataDecodingStrategy = .base64 decoder.dataDecodingStrategy = .base64
if #available(iOS 10.0, *) { if #available(iOS 10.0, *) {
decoder.dateDecodingStrategy = .iso8601 decoder.dateDecodingStrategy = .iso8601
} }
}
do { do {
returnedDecodable = try decoder.decode(type, from: data) returnedDecodable = try decoder.decode(type, from: data)

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -448,7 +448,7 @@ export class {{classname}} {
{{#returnType}} {{#returnType}}
body = ObjectSerializer.deserialize(body, "{{{returnType}}}"); body = ObjectSerializer.deserialize(body, "{{{returnType}}}");
{{/returnType}} {{/returnType}}
if (response.statusCode >= 200 && response.statusCode <= 299) { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body }); resolve({ response: response, body: body });
} else { } else {
reject({ response: response, body: body }); reject({ response: response, body: body });

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -41,43 +41,43 @@ namespace IO.Swagger.Model
/// Enum Sun for "sun" /// Enum Sun for "sun"
/// </summary> /// </summary>
[EnumMember(Value = "sun")] [EnumMember(Value = "sun")]
Sun, Sun = 1,
/// <summary> /// <summary>
/// Enum Mon for "mon" /// Enum Mon for "mon"
/// </summary> /// </summary>
[EnumMember(Value = "mon")] [EnumMember(Value = "mon")]
Mon, Mon = 2,
/// <summary> /// <summary>
/// Enum Tue for "tue" /// Enum Tue for "tue"
/// </summary> /// </summary>
[EnumMember(Value = "tue")] [EnumMember(Value = "tue")]
Tue, Tue = 3,
/// <summary> /// <summary>
/// Enum Wed for "wed" /// Enum Wed for "wed"
/// </summary> /// </summary>
[EnumMember(Value = "wed")] [EnumMember(Value = "wed")]
Wed, Wed = 4,
/// <summary> /// <summary>
/// Enum Thu for "thu" /// Enum Thu for "thu"
/// </summary> /// </summary>
[EnumMember(Value = "thu")] [EnumMember(Value = "thu")]
Thu, Thu = 5,
/// <summary> /// <summary>
/// Enum Fri for "fri" /// Enum Fri for "fri"
/// </summary> /// </summary>
[EnumMember(Value = "fri")] [EnumMember(Value = "fri")]
Fri, Fri = 6,
/// <summary> /// <summary>
/// Enum Sat for "sat" /// Enum Sat for "sat"
/// </summary> /// </summary>
[EnumMember(Value = "sat")] [EnumMember(Value = "sat")]
Sat Sat = 7
} }
/// <summary> /// <summary>

View File

@ -41,43 +41,43 @@ namespace IO.Swagger.Model
/// Enum Sun for "sun" /// Enum Sun for "sun"
/// </summary> /// </summary>
[EnumMember(Value = "sun")] [EnumMember(Value = "sun")]
Sun, Sun = 1,
/// <summary> /// <summary>
/// Enum Mon for "mon" /// Enum Mon for "mon"
/// </summary> /// </summary>
[EnumMember(Value = "mon")] [EnumMember(Value = "mon")]
Mon, Mon = 2,
/// <summary> /// <summary>
/// Enum Tue for "tue" /// Enum Tue for "tue"
/// </summary> /// </summary>
[EnumMember(Value = "tue")] [EnumMember(Value = "tue")]
Tue, Tue = 3,
/// <summary> /// <summary>
/// Enum Wed for "wed" /// Enum Wed for "wed"
/// </summary> /// </summary>
[EnumMember(Value = "wed")] [EnumMember(Value = "wed")]
Wed, Wed = 4,
/// <summary> /// <summary>
/// Enum Thu for "thu" /// Enum Thu for "thu"
/// </summary> /// </summary>
[EnumMember(Value = "thu")] [EnumMember(Value = "thu")]
Thu, Thu = 5,
/// <summary> /// <summary>
/// Enum Fri for "fri" /// Enum Fri for "fri"
/// </summary> /// </summary>
[EnumMember(Value = "fri")] [EnumMember(Value = "fri")]
Fri, Fri = 6,
/// <summary> /// <summary>
/// Enum Sat for "sat" /// Enum Sat for "sat"
/// </summary> /// </summary>
[EnumMember(Value = "sat")] [EnumMember(Value = "sat")]
Sat Sat = 7
} }
/// <summary> /// <summary>

View File

@ -35,43 +35,43 @@ namespace IO.Swagger.Model
/// Enum Sun for "sun" /// Enum Sun for "sun"
/// </summary> /// </summary>
[EnumMember(Value = "sun")] [EnumMember(Value = "sun")]
Sun, Sun = 1,
/// <summary> /// <summary>
/// Enum Mon for "mon" /// Enum Mon for "mon"
/// </summary> /// </summary>
[EnumMember(Value = "mon")] [EnumMember(Value = "mon")]
Mon, Mon = 2,
/// <summary> /// <summary>
/// Enum Tue for "tue" /// Enum Tue for "tue"
/// </summary> /// </summary>
[EnumMember(Value = "tue")] [EnumMember(Value = "tue")]
Tue, Tue = 3,
/// <summary> /// <summary>
/// Enum Wed for "wed" /// Enum Wed for "wed"
/// </summary> /// </summary>
[EnumMember(Value = "wed")] [EnumMember(Value = "wed")]
Wed, Wed = 4,
/// <summary> /// <summary>
/// Enum Thu for "thu" /// Enum Thu for "thu"
/// </summary> /// </summary>
[EnumMember(Value = "thu")] [EnumMember(Value = "thu")]
Thu, Thu = 5,
/// <summary> /// <summary>
/// Enum Fri for "fri" /// Enum Fri for "fri"
/// </summary> /// </summary>
[EnumMember(Value = "fri")] [EnumMember(Value = "fri")]
Fri, Fri = 6,
/// <summary> /// <summary>
/// Enum Sat for "sat" /// Enum Sat for "sat"
/// </summary> /// </summary>
[EnumMember(Value = "sat")] [EnumMember(Value = "sat")]
Sat Sat = 7
} }
} }

View File

@ -111,7 +111,7 @@
<goal>wget</goal> <goal>wget</goal>
</goals> </goals>
<configuration> <configuration>
<url>http://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url> <url>https://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>
<unpack>true</unpack> <unpack>true</unpack>
<skipCache>true</skipCache> <skipCache>true</skipCache>

View File

@ -839,11 +839,13 @@
<modules> <modules>
<!-- <module>samples/server/petstore/erlang-server</module> note: make sample compilation work --> <!-- <module>samples/server/petstore/erlang-server</module> note: make sample compilation work -->
<!-- clients --> <!-- clients -->
<module>samples/client/petstore/php/SwaggerClient-php</module>
<module>samples/client/petstore/ruby</module> <module>samples/client/petstore/ruby</module>
<module>samples/client/petstore/scala</module> <module>samples/client/petstore/scala</module>
<module>samples/client/petstore/akka-scala</module> <module>samples/client/petstore/akka-scala</module>
<module>samples/client/petstore/javascript</module> <module>samples/client/petstore/javascript</module>
<module>samples/client/petstore/python</module> <module>samples/client/petstore/python</module>
<module>samples/client/petstore/python-tornado</module>
<module>samples/client/petstore/typescript-fetch/builds/default</module> <module>samples/client/petstore/typescript-fetch/builds/default</module>
<module>samples/client/petstore/typescript-fetch/builds/es6-target</module> <module>samples/client/petstore/typescript-fetch/builds/es6-target</module>
<module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module> <module>samples/client/petstore/typescript-fetch/builds/with-npm-version</module>

View File

@ -56,11 +56,15 @@ Please follow the [installation procedure](#installation--usage) and then run th
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r $test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
try { try {
$api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r); $apiInstance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL;
} }

View File

@ -17,11 +17,15 @@ To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r $test_code_inject____end____rn_n_r = "test_code_inject____end____rn_n_r_example"; // string | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r
try { try {
$api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r); $apiInstance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL;
} }

View File

@ -1,9 +1,11 @@
# coding: utf-8 # coding: utf-8
# flake8: noqa
""" """
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -13,13 +15,11 @@
from __future__ import absolute_import from __future__ import absolute_import
# import models into sdk package
from .models.model_return import ModelReturn
# import apis into sdk package # import apis into sdk package
from .apis.fake_api import FakeApi from petstore_api.api.fake_api import FakeApi
# import ApiClient # import ApiClient
from .api_client import ApiClient from petstore_api.api_client import ApiClient
from petstore_api.configuration import Configuration
from .configuration import Configuration # import models into sdk package
from petstore_api.models.model_return import ModelReturn

View File

@ -0,0 +1,6 @@
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from petstore_api.api.fake_api import FakeApi

View File

@ -0,0 +1,127 @@
# coding: utf-8
"""
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from petstore_api.api_client import ApiClient
class FakeApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def test_code_inject____end__rn_n_r(self, **kwargs): # noqa: E501
"""To test code injection */ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_code_inject____end__rn_n_r(async=True)
>>> result = thread.get()
:param async bool
:param str test_code_inject____end____rn_n_r: To test code injection */ ' \" =end -- \\r\\n \\n \\r
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
return self.test_code_inject____end__rn_n_r_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.test_code_inject____end__rn_n_r_with_http_info(**kwargs) # noqa: E501
return data
def test_code_inject____end__rn_n_r_with_http_info(self, **kwargs): # noqa: E501
"""To test code injection */ &#39; \&quot; &#x3D;end -- \\r\\n \\n \\r # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_code_inject____end__rn_n_r_with_http_info(async=True)
>>> result = thread.get()
:param async bool
:param str test_code_inject____end____rn_n_r: To test code injection */ ' \" =end -- \\r\\n \\n \\r
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['test_code_inject____end____rn_n_r'] # noqa: E501
all_params.append('async')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method test_code_inject____end__rn_n_r" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
if 'test_code_inject____end____rn_n_r' in params:
form_params.append(('test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r', params['test_code_inject____end____rn_n_r'])) # noqa: E501
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', '*/ \" =end -- ']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', '*/ \" =end -- ']) # noqa: E501
# Authentication setting
auth_settings = [] # noqa: E501
return self.api_client.call_api(
'/fake', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async=params.get('async'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

View File

@ -2,7 +2,7 @@
""" """
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -11,27 +11,25 @@
from __future__ import absolute_import from __future__ import absolute_import
import os import datetime
import re
import json import json
import mimetypes import mimetypes
import tempfile
from multiprocessing.pool import ThreadPool from multiprocessing.pool import ThreadPool
import os
from datetime import date, datetime import re
import tempfile
# python 2 and python 3 compatibility library # python 2 and python 3 compatibility library
from six import PY3, integer_types, iteritems, text_type import six
from six.moves.urllib.parse import quote from six.moves.urllib.parse import quote
from . import models from petstore_api.configuration import Configuration
from .configuration import Configuration import petstore_api.models
from .rest import ApiException, RESTClientObject from petstore_api import rest
class ApiClient(object): class ApiClient(object):
""" """Generic API client for Swagger client library builds.
Generic API client for Swagger client library builds.
Swagger generic API client. This client handles the client- Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of server communication, and is invariant across implementations. Specifics of
@ -42,30 +40,34 @@ class ApiClient(object):
Ref: https://github.com/swagger-api/swagger-codegen Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually. Do not edit the class manually.
:param host: The base path for the server to call. :param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API. :param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to the API. :param header_value: a header value to pass when making calls to
the API.
:param cookie: a cookie to include in the header when making calls
to the API
""" """
PRIMITIVE_TYPES = (float, bool, bytes, text_type) + integer_types PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
NATIVE_TYPES_MAPPING = { NATIVE_TYPES_MAPPING = {
'int': int, 'int': int,
'long': int if PY3 else long, 'long': int if six.PY3 else long, # noqa: F821
'float': float, 'float': float,
'str': str, 'str': str,
'bool': bool, 'bool': bool,
'date': date, 'date': datetime.date,
'datetime': datetime, 'datetime': datetime.datetime,
'object': object, 'object': object,
} }
def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None): def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None):
if configuration is None: if configuration is None:
configuration = Configuration() configuration = Configuration()
self.configuration = configuration self.configuration = configuration
self.pool = ThreadPool() self.pool = ThreadPool()
self.rest_client = RESTClientObject(configuration) self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {} self.default_headers = {}
if header_name is not None: if header_name is not None:
self.default_headers[header_name] = header_value self.default_headers[header_name] = header_value
@ -79,27 +81,22 @@ class ApiClient(object):
@property @property
def user_agent(self): def user_agent(self):
""" """User agent for this API client"""
Gets user agent.
"""
return self.default_headers['User-Agent'] return self.default_headers['User-Agent']
@user_agent.setter @user_agent.setter
def user_agent(self, value): def user_agent(self, value):
"""
Sets user agent.
"""
self.default_headers['User-Agent'] = value self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value): def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value self.default_headers[header_name] = header_value
def __call_api(self, resource_path, method, def __call_api(
path_params=None, query_params=None, header_params=None, self, resource_path, method, path_params=None,
body=None, post_params=None, files=None, query_params=None, header_params=None, body=None, post_params=None,
response_type=None, auth_settings=None, files=None, response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True, _return_http_data_only=None, collection_formats=None,
_request_timeout=None): _preload_content=True, _request_timeout=None):
config = self.configuration config = self.configuration
@ -121,7 +118,9 @@ class ApiClient(object):
for k, v in path_params: for k, v in path_params:
# specified safe chars, encode everything # specified safe chars, encode everything
resource_path = resource_path.replace( resource_path = resource_path.replace(
'{%s}' % k, quote(str(v), safe=config.safe_chars_for_path_param)) '{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
# query parameters # query parameters
if query_params: if query_params:
@ -147,9 +146,8 @@ class ApiClient(object):
url = self.configuration.host + resource_path url = self.configuration.host + resource_path
# perform request and return response # perform request and return response
response_data = self.request(method, url, response_data = self.request(
query_params=query_params, method, url, query_params=query_params, headers=header_params,
headers=header_params,
post_params=post_params, body=body, post_params=post_params, body=body,
_preload_content=_preload_content, _preload_content=_preload_content,
_request_timeout=_request_timeout) _request_timeout=_request_timeout)
@ -167,11 +165,11 @@ class ApiClient(object):
if _return_http_data_only: if _return_http_data_only:
return (return_data) return (return_data)
else: else:
return (return_data, response_data.status, response_data.getheaders()) return (return_data, response_data.status,
response_data.getheaders())
def sanitize_for_serialization(self, obj): def sanitize_for_serialization(self, obj):
""" """Builds a JSON POST object.
Builds a JSON POST object.
If obj is None, return None. If obj is None, return None.
If obj is str, int, long, float, bool, return directly. If obj is str, int, long, float, bool, return directly.
@ -194,7 +192,7 @@ class ApiClient(object):
elif isinstance(obj, tuple): elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj) return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj) for sub_obj in obj)
elif isinstance(obj, (datetime, date)): elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat() return obj.isoformat()
if isinstance(obj, dict): if isinstance(obj, dict):
@ -206,15 +204,14 @@ class ApiClient(object):
# Convert attribute name to json key in # Convert attribute name to json key in
# model definition for request. # model definition for request.
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in iteritems(obj.swagger_types) for attr, _ in six.iteritems(obj.swagger_types)
if getattr(obj, attr) is not None} if getattr(obj, attr) is not None}
return {key: self.sanitize_for_serialization(val) return {key: self.sanitize_for_serialization(val)
for key, val in iteritems(obj_dict)} for key, val in six.iteritems(obj_dict)}
def deserialize(self, response, response_type): def deserialize(self, response, response_type):
""" """Deserializes response into an object.
Deserializes response into an object.
:param response: RESTResponse object to be deserialized. :param response: RESTResponse object to be deserialized.
:param response_type: class literal for :param response_type: class literal for
@ -236,8 +233,7 @@ class ApiClient(object):
return self.__deserialize(data, response_type) return self.__deserialize(data, response_type)
def __deserialize(self, data, klass): def __deserialize(self, data, klass):
""" """Deserializes dict, list, str into an object.
Deserializes dict, list, str into an object.
:param data: dict, list or str. :param data: dict, list or str.
:param klass: class literal, or string of class name. :param klass: class literal, or string of class name.
@ -256,21 +252,21 @@ class ApiClient(object):
if klass.startswith('dict('): if klass.startswith('dict('):
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls) return {k: self.__deserialize(v, sub_kls)
for k, v in iteritems(data)} for k, v in six.iteritems(data)}
# convert str to class # convert str to class
if klass in self.NATIVE_TYPES_MAPPING: if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass] klass = self.NATIVE_TYPES_MAPPING[klass]
else: else:
klass = getattr(models, klass) klass = getattr(petstore_api.models, klass)
if klass in self.PRIMITIVE_TYPES: if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass) return self.__deserialize_primitive(data, klass)
elif klass == object: elif klass == object:
return self.__deserialize_object(data) return self.__deserialize_object(data)
elif klass == date: elif klass == datetime.date:
return self.__deserialize_date(data) return self.__deserialize_date(data)
elif klass == datetime: elif klass == datetime.datetime:
return self.__deserialize_datatime(data) return self.__deserialize_datatime(data)
else: else:
return self.__deserialize_model(data, klass) return self.__deserialize_model(data, klass)
@ -279,10 +275,10 @@ class ApiClient(object):
path_params=None, query_params=None, header_params=None, path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None, body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async=None, response_type=None, auth_settings=None, async=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True, _return_http_data_only=None, collection_formats=None,
_request_timeout=None): _preload_content=True, _request_timeout=None):
""" """Makes the HTTP request (synchronous) and returns deserialized data.
Makes the HTTP request (synchronous) and return the deserialized data.
To make an async request, set the async parameter. To make an async request, set the async parameter.
:param resource_path: Path to method endpoint. :param resource_path: Path to method endpoint.
@ -299,13 +295,17 @@ class ApiClient(object):
:param files dict: key -> filename, value -> filepath, :param files dict: key -> filename, value -> filepath,
for `multipart/form-data`. for `multipart/form-data`.
:param async bool: execute request asynchronously :param async bool: execute request asynchronously
:param _return_http_data_only: response data without head status code and headers :param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query, :param collection_formats: dict of collection formats for path, query,
header, and post parameters. header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will be returned without :param _preload_content: if False, the urllib3.HTTPResponse object will
reading/decoding response data. Default is True. be returned without reading/decoding response
:param _request_timeout: timeout setting for this request. If one number provided, it will be total request data. Default is True.
timeout. It can also be a pair (tuple) of (connection, read) timeouts. :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: :return:
If async parameter is True, If async parameter is True,
the request will be called asynchronously. the request will be called asynchronously.
@ -318,22 +318,23 @@ class ApiClient(object):
path_params, query_params, header_params, path_params, query_params, header_params,
body, post_params, files, body, post_params, files,
response_type, auth_settings, response_type, auth_settings,
_return_http_data_only, collection_formats, _preload_content, _request_timeout) _return_http_data_only, collection_formats,
_preload_content, _request_timeout)
else: else:
thread = self.pool.apply_async(self.__call_api, (resource_path, method, thread = self.pool.apply_async(self.__call_api, (resource_path,
path_params, query_params, method, path_params, query_params,
header_params, body, header_params, body,
post_params, files, post_params, files,
response_type, auth_settings, response_type, auth_settings,
_return_http_data_only, _return_http_data_only,
collection_formats, _preload_content, _request_timeout)) collection_formats,
_preload_content, _request_timeout))
return thread return thread
def request(self, method, url, query_params=None, headers=None, def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True, _request_timeout=None): post_params=None, body=None, _preload_content=True,
""" _request_timeout=None):
Makes the HTTP request using RESTClient. """Makes the HTTP request using RESTClient."""
"""
if method == "GET": if method == "GET":
return self.rest_client.GET(url, return self.rest_client.GET(url,
query_params=query_params, query_params=query_params,
@ -392,8 +393,7 @@ class ApiClient(object):
) )
def parameters_to_tuples(self, params, collection_formats): def parameters_to_tuples(self, params, collection_formats):
""" """Get parameters as list of tuples, formatting collections.
Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples :param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats :param dict collection_formats: Parameter collection formats
@ -402,7 +402,7 @@ class ApiClient(object):
new_params = [] new_params = []
if collection_formats is None: if collection_formats is None:
collection_formats = {} collection_formats = {}
for k, v in iteritems(params) if isinstance(params, dict) else params: for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
if k in collection_formats: if k in collection_formats:
collection_format = collection_formats[k] collection_format = collection_formats[k]
if collection_format == 'multi': if collection_format == 'multi':
@ -423,8 +423,7 @@ class ApiClient(object):
return new_params return new_params
def prepare_post_parameters(self, post_params=None, files=None): def prepare_post_parameters(self, post_params=None, files=None):
""" """Builds form parameters.
Builds form parameters.
:param post_params: Normal form parameters. :param post_params: Normal form parameters.
:param files: File parameters. :param files: File parameters.
@ -436,7 +435,7 @@ class ApiClient(object):
params = post_params params = post_params
if files: if files:
for k, v in iteritems(files): for k, v in six.iteritems(files):
if not v: if not v:
continue continue
file_names = v if type(v) is list else [v] file_names = v if type(v) is list else [v]
@ -444,15 +443,15 @@ class ApiClient(object):
with open(n, 'rb') as f: with open(n, 'rb') as f:
filename = os.path.basename(f.name) filename = os.path.basename(f.name)
filedata = f.read() filedata = f.read()
mimetype = mimetypes.\ mimetype = (mimetypes.guess_type(filename)[0] or
guess_type(filename)[0] or 'application/octet-stream' 'application/octet-stream')
params.append(tuple([k, tuple([filename, filedata, mimetype])])) params.append(
tuple([k, tuple([filename, filedata, mimetype])]))
return params return params
def select_header_accept(self, accepts): def select_header_accept(self, accepts):
""" """Returns `Accept` based on an array of accepts provided.
Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers. :param accepts: List of headers.
:return: Accept (e.g. application/json). :return: Accept (e.g. application/json).
@ -468,8 +467,7 @@ class ApiClient(object):
return ', '.join(accepts) return ', '.join(accepts)
def select_header_content_type(self, content_types): def select_header_content_type(self, content_types):
""" """Returns `Content-Type` based on an array of content_types provided.
Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types. :param content_types: List of content-types.
:return: Content-Type (e.g. application/json). :return: Content-Type (e.g. application/json).
@ -485,8 +483,7 @@ class ApiClient(object):
return content_types[0] return content_types[0]
def update_params_for_auth(self, headers, querys, auth_settings): def update_params_for_auth(self, headers, querys, auth_settings):
""" """Updates header and query params based on authentication setting.
Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated. :param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated. :param querys: Query parameters tuple list to be updated.
@ -510,7 +507,8 @@ class ApiClient(object):
) )
def __deserialize_file(self, response): def __deserialize_file(self, response):
""" """Deserializes body to file
Saves response body into a file in a temporary folder, Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided. using the filename from the `Content-Disposition` header if provided.
@ -523,19 +521,17 @@ class ApiClient(object):
content_disposition = response.getheader("Content-Disposition") content_disposition = response.getheader("Content-Disposition")
if content_disposition: if content_disposition:
filename = re.\ filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\ content_disposition).group(1)
group(1)
path = os.path.join(os.path.dirname(path), filename) path = os.path.join(os.path.dirname(path), filename)
with open(path, "w") as f: with open(path, "wb") as f:
f.write(response.data) f.write(response.data)
return path return path
def __deserialize_primitive(self, data, klass): def __deserialize_primitive(self, data, klass):
""" """Deserializes string to primitive type.
Deserializes string to primitive type.
:param data: str. :param data: str.
:param klass: class literal. :param klass: class literal.
@ -545,21 +541,19 @@ class ApiClient(object):
try: try:
return klass(data) return klass(data)
except UnicodeEncodeError: except UnicodeEncodeError:
return unicode(data) return six.u(data)
except TypeError: except TypeError:
return data return data
def __deserialize_object(self, value): def __deserialize_object(self, value):
""" """Return a original value.
Return a original value.
:return: object. :return: object.
""" """
return value return value
def __deserialize_date(self, string): def __deserialize_date(self, string):
""" """Deserializes string to date.
Deserializes string to date.
:param string: str. :param string: str.
:return: date. :return: date.
@ -570,14 +564,13 @@ class ApiClient(object):
except ImportError: except ImportError:
return string return string
except ValueError: except ValueError:
raise ApiException( raise rest.ApiException(
status=0, status=0,
reason="Failed to parse `{0}` into a date object".format(string) reason="Failed to parse `{0}` as date object".format(string)
) )
def __deserialize_datatime(self, string): def __deserialize_datatime(self, string):
""" """Deserializes string to datetime.
Deserializes string to datetime.
The string should be in iso8601 datetime format. The string should be in iso8601 datetime format.
@ -590,32 +583,32 @@ class ApiClient(object):
except ImportError: except ImportError:
return string return string
except ValueError: except ValueError:
raise ApiException( raise rest.ApiException(
status=0, status=0,
reason=( reason=(
"Failed to parse `{0}` into a datetime object" "Failed to parse `{0}` as datetime object"
.format(string) .format(string)
) )
) )
def __deserialize_model(self, data, klass): def __deserialize_model(self, data, klass):
""" """Deserializes list or dict to model.
Deserializes list or dict to model.
:param data: dict, list. :param data: dict, list.
:param klass: class literal. :param klass: class literal.
:return: model object. :return: model object.
""" """
if not klass.swagger_types and not hasattr(klass, 'get_real_child_model'): if not klass.swagger_types and not hasattr(klass,
'get_real_child_model'):
return data return data
kwargs = {} kwargs = {}
if klass.swagger_types is not None: if klass.swagger_types is not None:
for attr, attr_type in iteritems(klass.swagger_types): for attr, attr_type in six.iteritems(klass.swagger_types):
if data is not None \ if (data is not None and
and klass.attribute_map[attr] in data \ klass.attribute_map[attr] in data and
and isinstance(data, (list, dict)): isinstance(data, (list, dict))):
value = data[klass.attribute_map[attr]] value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type) kwargs[attr] = self.__deserialize(value, attr_type)

View File

@ -3,7 +3,7 @@
""" """
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -13,24 +13,23 @@
from __future__ import absolute_import from __future__ import absolute_import
import urllib3
import copy import copy
import logging import logging
import multiprocessing import multiprocessing
import sys import sys
import urllib3
from six import iteritems import six
from six import with_metaclass
from six.moves import http_client as httplib from six.moves import http_client as httplib
class TypeWithDefault(type): class TypeWithDefault(type):
def __init__(cls, name, bases, dct): def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct) super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None cls._default = None
def __call__(cls): def __call__(cls):
if cls._default == None: if cls._default is None:
cls._default = type.__call__(cls) cls._default = type.__call__(cls)
return copy.copy(cls._default) return copy.copy(cls._default)
@ -38,17 +37,15 @@ class TypeWithDefault(type):
cls._default = copy.copy(default) cls._default = copy.copy(default)
class Configuration(with_metaclass(TypeWithDefault, object)): class Configuration(six.with_metaclass(TypeWithDefault, object)):
""" """NOTE: This class is auto generated by the swagger code generator program.
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually. Do not edit the class manually.
""" """
def __init__(self): def __init__(self):
""" """Constructor"""
Constructor
"""
# Default Base url # Default Base url
self.host = "https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r" self.host = "https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r"
# Temp file folder for downloading files # Temp file folder for downloading files
@ -83,7 +80,8 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
self.debug = False self.debug = False
# SSL/TLS verification # SSL/TLS verification
# Set this to false to skip verifying SSL certificate when calling API from https server. # Set this to false to skip verifying SSL certificate when calling API
# from https server.
self.verify_ssl = True self.verify_ssl = True
# Set this to customize the certificate file to verify the peer. # Set this to customize the certificate file to verify the peer.
self.ssl_ca_cert = None self.ssl_ca_cert = None
@ -101,7 +99,6 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
# cpu_count * 5 is used as default value to increase performance. # cpu_count * 5 is used as default value to increase performance.
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
# Proxy URL # Proxy URL
self.proxy = None self.proxy = None
# Safe chars for path_param # Safe chars for path_param
@ -109,18 +106,22 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
@property @property
def logger_file(self): def logger_file(self):
""" """The logger file.
Gets the logger_file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
""" """
return self.__logger_file return self.__logger_file
@logger_file.setter @logger_file.setter
def logger_file(self, value): def logger_file(self, value):
""" """The logger file.
Sets the logger_file.
If the logger_file is None, then add stream handler and remove file handler. If the logger_file is None, then add stream handler and remove file
Otherwise, add file handler and remove stream handler. handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path. :param value: The logger_file path.
:type: str :type: str
@ -131,7 +132,7 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
# then add file handler and remove stream handler. # then add file handler and remove stream handler.
self.logger_file_handler = logging.FileHandler(self.__logger_file) self.logger_file_handler = logging.FileHandler(self.__logger_file)
self.logger_file_handler.setFormatter(self.logger_formatter) self.logger_file_handler.setFormatter(self.logger_formatter)
for _, logger in iteritems(self.logger): for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_file_handler) logger.addHandler(self.logger_file_handler)
if self.logger_stream_handler: if self.logger_stream_handler:
logger.removeHandler(self.logger_stream_handler) logger.removeHandler(self.logger_stream_handler)
@ -140,22 +141,23 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
# then add stream handler and remove file handler. # then add stream handler and remove file handler.
self.logger_stream_handler = logging.StreamHandler() self.logger_stream_handler = logging.StreamHandler()
self.logger_stream_handler.setFormatter(self.logger_formatter) self.logger_stream_handler.setFormatter(self.logger_formatter)
for _, logger in iteritems(self.logger): for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_stream_handler) logger.addHandler(self.logger_stream_handler)
if self.logger_file_handler: if self.logger_file_handler:
logger.removeHandler(self.logger_file_handler) logger.removeHandler(self.logger_file_handler)
@property @property
def debug(self): def debug(self):
""" """Debug status
Gets the debug status.
:param value: The debug status, True or False.
:type: bool
""" """
return self.__debug return self.__debug
@debug.setter @debug.setter
def debug(self, value): def debug(self, value):
""" """Debug status
Sets the debug status.
:param value: The debug status, True or False. :param value: The debug status, True or False.
:type: bool :type: bool
@ -163,29 +165,32 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
self.__debug = value self.__debug = value
if self.__debug: if self.__debug:
# if debug status is True, turn on debug logging # if debug status is True, turn on debug logging
for _, logger in iteritems(self.logger): for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG)
# turn on httplib debug # turn on httplib debug
httplib.HTTPConnection.debuglevel = 1 httplib.HTTPConnection.debuglevel = 1
else: else:
# if debug status is False, turn off debug logging, # if debug status is False, turn off debug logging,
# setting log level to default `logging.WARNING` # setting log level to default `logging.WARNING`
for _, logger in iteritems(self.logger): for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.WARNING) logger.setLevel(logging.WARNING)
# turn off httplib debug # turn off httplib debug
httplib.HTTPConnection.debuglevel = 0 httplib.HTTPConnection.debuglevel = 0
@property @property
def logger_format(self): def logger_format(self):
""" """The logger format.
Gets the logger_format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
""" """
return self.__logger_format return self.__logger_format
@logger_format.setter @logger_format.setter
def logger_format(self, value): def logger_format(self, value):
""" """The logger format.
Sets the logger_format.
The logger_formatter will be updated when sets logger_format. The logger_formatter will be updated when sets logger_format.
@ -196,29 +201,28 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
self.logger_formatter = logging.Formatter(self.__logger_format) self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier): def get_api_key_with_prefix(self, identifier):
""" """Gets API key (with prefix if set).
Gets API key (with prefix if set).
:param identifier: The identifier of apiKey. :param identifier: The identifier of apiKey.
:return: The token for api key authentication. :return: The token for api key authentication.
""" """
if self.api_key.get(identifier) and self.api_key_prefix.get(identifier): if (self.api_key.get(identifier) and
return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] self.api_key_prefix.get(identifier)):
return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501
elif self.api_key.get(identifier): elif self.api_key.get(identifier):
return self.api_key[identifier] return self.api_key[identifier]
def get_basic_auth_token(self): def get_basic_auth_token(self):
""" """Gets HTTP basic authentication header (string).
Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication. :return: The token for basic HTTP authentication.
""" """
return urllib3.util.make_headers(basic_auth=self.username + ':' + self.password)\ return urllib3.util.make_headers(
.get('authorization') basic_auth=self.username + ':' + self.password
).get('authorization')
def auth_settings(self): def auth_settings(self):
""" """Gets Auth Settings dict for api client.
Gets Auth Settings dict for api client.
:return: The Auth Settings information dict. :return: The Auth Settings information dict.
""" """
@ -242,8 +246,7 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
} }
def to_debug_report(self): def to_debug_report(self):
""" """Gets the essential information for debugging.
Gets the essential information for debugging.
:return: The report for debugging. :return: The report for debugging.
""" """

View File

@ -1,9 +1,10 @@
# coding: utf-8 # coding: utf-8
# flake8: noqa
""" """
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -14,4 +15,4 @@
from __future__ import absolute_import from __future__ import absolute_import
# import models into model package # import models into model package
from .model_return import ModelReturn from petstore_api.models.model_return import ModelReturn

View File

@ -3,7 +3,7 @@
""" """
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -11,18 +11,18 @@
""" """
from pprint import pformat import pprint
from six import iteritems import re # noqa: F401
import re
import six
class ModelReturn(object): class ModelReturn(object):
""" """NOTE: This class is auto generated by the swagger code generator program.
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. Do not edit the class manually.
""" """
""" """
Attributes: Attributes:
swagger_types (dict): The key is attribute name swagger_types (dict): The key is attribute name
@ -38,10 +38,8 @@ class ModelReturn(object):
'_return': 'return' '_return': 'return'
} }
def __init__(self, _return=None): def __init__(self, _return=None): # noqa: E501
""" """ModelReturn - a model defined in Swagger""" # noqa: E501
ModelReturn - a model defined in Swagger
"""
self.__return = None self.__return = None
self.discriminator = None self.discriminator = None
@ -51,34 +49,32 @@ class ModelReturn(object):
@property @property
def _return(self): def _return(self):
""" """Gets the _return of this ModelReturn. # noqa: E501
Gets the _return of this ModelReturn.
property description */ ' \" =end -- \\r\\n \\n \\r
:return: The _return of this ModelReturn. property description */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
:return: The _return of this ModelReturn. # noqa: E501
:rtype: int :rtype: int
""" """
return self.__return return self.__return
@_return.setter @_return.setter
def _return(self, _return): def _return(self, _return):
""" """Sets the _return of this ModelReturn.
Sets the _return of this ModelReturn.
property description */ ' \" =end -- \\r\\n \\n \\r
:param _return: The _return of this ModelReturn. property description */ ' \" =end -- \\r\\n \\n \\r # noqa: E501
:param _return: The _return of this ModelReturn. # noqa: E501
:type: int :type: int
""" """
self.__return = _return self.__return = _return
def to_dict(self): def to_dict(self):
""" """Returns the model properties as a dict"""
Returns the model properties as a dict
"""
result = {} result = {}
for attr, _ in iteritems(self.swagger_types): for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr) value = getattr(self, attr)
if isinstance(value, list): if isinstance(value, list):
result[attr] = list(map( result[attr] = list(map(
@ -99,28 +95,20 @@ class ModelReturn(object):
return result return result
def to_str(self): def to_str(self):
""" """Returns the string representation of the model"""
Returns the string representation of the model return pprint.pformat(self.to_dict())
"""
return pformat(self.to_dict())
def __repr__(self): def __repr__(self):
""" """For `print` and `pprint`"""
For `print` and `pprint`
"""
return self.to_str() return self.to_str()
def __eq__(self, other): def __eq__(self, other):
""" """Returns true if both objects are equal"""
Returns true if both objects are equal
"""
if not isinstance(other, ModelReturn): if not isinstance(other, ModelReturn):
return False return False
return self.__dict__ == other.__dict__ return self.__dict__ == other.__dict__
def __ne__(self, other): def __ne__(self, other):
""" """Returns true if both objects are not equal"""
Returns true if both objects are not equal
"""
return not self == other return not self == other

View File

@ -3,7 +3,7 @@
""" """
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -15,13 +15,13 @@ from __future__ import absolute_import
import io import io
import json import json
import ssl
import certifi
import logging import logging
import re import re
import ssl
import certifi
# python 2 and python 3 compatibility library # python 2 and python 3 compatibility library
from six import PY3 import six
from six.moves.urllib.parse import urlencode from six.moves.urllib.parse import urlencode
try: try:
@ -42,15 +42,11 @@ class RESTResponse(io.IOBase):
self.data = resp.data self.data = resp.data
def getheaders(self): def getheaders(self):
""" """Returns a dictionary of the response headers."""
Returns a dictionary of the response headers.
"""
return self.urllib3_response.getheaders() return self.urllib3_response.getheaders()
def getheader(self, name, default=None): def getheader(self, name, default=None):
""" """Returns a given response header."""
Returns a given response header.
"""
return self.urllib3_response.getheader(name, default) return self.urllib3_response.getheader(name, default)
@ -58,10 +54,10 @@ class RESTClientObject(object):
def __init__(self, configuration, pools_size=4, maxsize=None): def __init__(self, configuration, pools_size=4, maxsize=None):
# urllib3.PoolManager will pass all kw parameters to connectionpool # urllib3.PoolManager will pass all kw parameters to connectionpool
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
# maxsize is the number of requests to host that are allowed in parallel # maxsize is the number of requests to host that are allowed in parallel # noqa: E501
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
# cert_reqs # cert_reqs
if configuration.verify_ssl: if configuration.verify_ssl:
@ -78,7 +74,7 @@ class RESTClientObject(object):
addition_pool_args = {} addition_pool_args = {}
if configuration.assert_hostname is not None: if configuration.assert_hostname is not None:
addition_pool_args['assert_hostname'] = configuration.assert_hostname addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
if maxsize is None: if maxsize is None:
if configuration.connection_pool_maxsize is not None: if configuration.connection_pool_maxsize is not None:
@ -110,8 +106,10 @@ class RESTClientObject(object):
) )
def request(self, method, url, query_params=None, headers=None, def request(self, method, url, query_params=None, headers=None,
body=None, post_params=None, _preload_content=True, _request_timeout=None): body=None, post_params=None, _preload_content=True,
""" _request_timeout=None):
"""Perform requests.
:param method: http request method :param method: http request method
:param url: http request url :param url: http request url
:param query_params: query parameters in the url :param query_params: query parameters in the url
@ -120,13 +118,17 @@ class RESTClientObject(object):
:param post_params: request post parameters, :param post_params: request post parameters,
`application/x-www-form-urlencoded` `application/x-www-form-urlencoded`
and `multipart/form-data` and `multipart/form-data`
:param _preload_content: if False, the urllib3.HTTPResponse object will be returned without :param _preload_content: if False, the urllib3.HTTPResponse object will
reading/decoding response data. Default is True. be returned without reading/decoding response
:param _request_timeout: timeout setting for this request. If one number provided, it will be total request data. Default is True.
timeout. It can also be a pair (tuple) of (connection, read) timeouts. :param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
""" """
method = method.upper() method = method.upper()
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS'] assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
'PATCH', 'OPTIONS']
if post_params and body: if post_params and body:
raise ValueError( raise ValueError(
@ -138,10 +140,12 @@ class RESTClientObject(object):
timeout = None timeout = None
if _request_timeout: if _request_timeout:
if isinstance(_request_timeout, (int, ) if PY3 else (int, long)): if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821
timeout = urllib3.Timeout(total=_request_timeout) timeout = urllib3.Timeout(total=_request_timeout)
elif isinstance(_request_timeout, tuple) and len(_request_timeout) == 2: elif (isinstance(_request_timeout, tuple) and
timeout = urllib3.Timeout(connect=_request_timeout[0], read=_request_timeout[1]) len(_request_timeout) == 2):
timeout = urllib3.Timeout(
connect=_request_timeout[0], read=_request_timeout[1])
if 'Content-Type' not in headers: if 'Content-Type' not in headers:
headers['Content-Type'] = 'application/json' headers['Content-Type'] = 'application/json'
@ -155,42 +159,48 @@ class RESTClientObject(object):
request_body = None request_body = None
if body is not None: if body is not None:
request_body = json.dumps(body) request_body = json.dumps(body)
r = self.pool_manager.request(method, url, r = self.pool_manager.request(
method, url,
body=request_body, body=request_body,
preload_content=_preload_content, preload_content=_preload_content,
timeout=timeout, timeout=timeout,
headers=headers) headers=headers)
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
r = self.pool_manager.request(method, url, r = self.pool_manager.request(
method, url,
fields=post_params, fields=post_params,
encode_multipart=False, encode_multipart=False,
preload_content=_preload_content, preload_content=_preload_content,
timeout=timeout, timeout=timeout,
headers=headers) headers=headers)
elif headers['Content-Type'] == 'multipart/form-data': elif headers['Content-Type'] == 'multipart/form-data':
# must del headers['Content-Type'], or the correct Content-Type # must del headers['Content-Type'], or the correct
# which generated by urllib3 will be overwritten. # Content-Type which generated by urllib3 will be
# overwritten.
del headers['Content-Type'] del headers['Content-Type']
r = self.pool_manager.request(method, url, r = self.pool_manager.request(
method, url,
fields=post_params, fields=post_params,
encode_multipart=True, encode_multipart=True,
preload_content=_preload_content, preload_content=_preload_content,
timeout=timeout, timeout=timeout,
headers=headers) headers=headers)
# Pass a `string` parameter directly in the body to support # Pass a `string` parameter directly in the body to support
# other content types than Json when `body` argument is provided # other content types than Json when `body` argument is
# in serialized form # provided in serialized form
elif isinstance(body, str): elif isinstance(body, str):
request_body = body request_body = body
r = self.pool_manager.request(method, url, r = self.pool_manager.request(
method, url,
body=request_body, body=request_body,
preload_content=_preload_content, preload_content=_preload_content,
timeout=timeout, timeout=timeout,
headers=headers) headers=headers)
else: else:
# Cannot generate the request from given parameters # Cannot generate the request from given parameters
msg = """Cannot prepare a request message for provided arguments. msg = """Cannot prepare a request message for provided
Please check that your arguments match declared content type.""" arguments. Please check that your arguments match
declared content type."""
raise ApiException(status=0, reason=msg) raise ApiException(status=0, reason=msg)
# For `GET`, `HEAD` # For `GET`, `HEAD`
else: else:
@ -208,7 +218,7 @@ class RESTClientObject(object):
# In the python 3, the response.data is bytes. # In the python 3, the response.data is bytes.
# we need to decode it to string. # we need to decode it to string.
if PY3: if six.PY3:
r.data = r.data.decode('utf8') r.data = r.data.decode('utf8')
# log response body # log response body
@ -219,22 +229,24 @@ class RESTClientObject(object):
return r return r
def GET(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): def GET(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
return self.request("GET", url, return self.request("GET", url,
headers=headers, headers=headers,
_preload_content=_preload_content, _preload_content=_preload_content,
_request_timeout=_request_timeout, _request_timeout=_request_timeout,
query_params=query_params) query_params=query_params)
def HEAD(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): def HEAD(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):
return self.request("HEAD", url, return self.request("HEAD", url,
headers=headers, headers=headers,
_preload_content=_preload_content, _preload_content=_preload_content,
_request_timeout=_request_timeout, _request_timeout=_request_timeout,
query_params=query_params) query_params=query_params)
def OPTIONS(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, def OPTIONS(self, url, headers=None, query_params=None, post_params=None,
_request_timeout=None): body=None, _preload_content=True, _request_timeout=None):
return self.request("OPTIONS", url, return self.request("OPTIONS", url,
headers=headers, headers=headers,
query_params=query_params, query_params=query_params,
@ -243,7 +255,8 @@ class RESTClientObject(object):
_request_timeout=_request_timeout, _request_timeout=_request_timeout,
body=body) body=body)
def DELETE(self, url, headers=None, query_params=None, body=None, _preload_content=True, _request_timeout=None): def DELETE(self, url, headers=None, query_params=None, body=None,
_preload_content=True, _request_timeout=None):
return self.request("DELETE", url, return self.request("DELETE", url,
headers=headers, headers=headers,
query_params=query_params, query_params=query_params,
@ -251,8 +264,8 @@ class RESTClientObject(object):
_request_timeout=_request_timeout, _request_timeout=_request_timeout,
body=body) body=body)
def POST(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, def POST(self, url, headers=None, query_params=None, post_params=None,
_request_timeout=None): body=None, _preload_content=True, _request_timeout=None):
return self.request("POST", url, return self.request("POST", url,
headers=headers, headers=headers,
query_params=query_params, query_params=query_params,
@ -261,8 +274,8 @@ class RESTClientObject(object):
_request_timeout=_request_timeout, _request_timeout=_request_timeout,
body=body) body=body)
def PUT(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, def PUT(self, url, headers=None, query_params=None, post_params=None,
_request_timeout=None): body=None, _preload_content=True, _request_timeout=None):
return self.request("PUT", url, return self.request("PUT", url,
headers=headers, headers=headers,
query_params=query_params, query_params=query_params,
@ -271,8 +284,8 @@ class RESTClientObject(object):
_request_timeout=_request_timeout, _request_timeout=_request_timeout,
body=body) body=body)
def PATCH(self, url, headers=None, query_params=None, post_params=None, body=None, _preload_content=True, def PATCH(self, url, headers=None, query_params=None, post_params=None,
_request_timeout=None): body=None, _preload_content=True, _request_timeout=None):
return self.request("PATCH", url, return self.request("PATCH", url,
headers=headers, headers=headers,
query_params=query_params, query_params=query_params,
@ -297,13 +310,12 @@ class ApiException(Exception):
self.headers = None self.headers = None
def __str__(self): def __str__(self):
""" """Custom error messages for exception"""
Custom error messages for exception
"""
error_message = "({0})\n"\ error_message = "({0})\n"\
"Reason: {1}\n".format(self.status, self.reason) "Reason: {1}\n".format(self.status, self.reason)
if self.headers: if self.headers:
error_message += "HTTP response headers: {0}\n".format(self.headers) error_message += "HTTP response headers: {0}\n".format(
self.headers)
if self.body: if self.body:
error_message += "HTTP response body: {0}\n".format(self.body) error_message += "HTTP response body: {0}\n".format(self.body)

View File

@ -3,7 +3,7 @@
""" """
Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r Swagger Petstore */ ' \" =end -- \\r\\n \\n \\r
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ */ ' \" =end -- # noqa: E501
OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r OpenAPI spec version: 1.0.0 */ ' \" =end -- \\r\\n \\n \\r
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -11,8 +11,7 @@
""" """
import sys from setuptools import setup, find_packages # noqa: H301
from setuptools import setup, find_packages
NAME = "petstore-api" NAME = "petstore-api"
VERSION = "1.0.0" VERSION = "1.0.0"
@ -36,6 +35,6 @@ setup(
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
long_description="""\ long_description="""\
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\ */ &#39; \&quot; &#x3D;end -- This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \&quot; \\ */ &#39; \&quot; &#x3D;end -- # noqa: E501
""" """
) )

View File

@ -10,7 +10,7 @@
* Do not edit the class manually. * Do not edit the class manually.
*/ */
import request = require('request'); import localVarRequest = require('request');
import http = require('http'); import http = require('http');
import Promise = require('bluebird'); import Promise = require('bluebird');
@ -171,13 +171,13 @@ export interface Authentication {
/** /**
* Apply authentication settings to header and query params. * Apply authentication settings to header and query params.
*/ */
applyToRequest(requestOptions: request.Options): void; applyToRequest(requestOptions: localVarRequest.Options): void;
} }
export class HttpBasicAuth implements Authentication { export class HttpBasicAuth implements Authentication {
public username: string; public username: string;
public password: string; public password: string;
applyToRequest(requestOptions: request.Options): void { applyToRequest(requestOptions: localVarRequest.Options): void {
requestOptions.auth = { requestOptions.auth = {
username: this.username, password: this.password username: this.username, password: this.password
} }
@ -190,7 +190,7 @@ export class ApiKeyAuth implements Authentication {
constructor(private location: string, private paramName: string) { constructor(private location: string, private paramName: string) {
} }
applyToRequest(requestOptions: request.Options): void { applyToRequest(requestOptions: localVarRequest.Options): void {
if (this.location == "query") { if (this.location == "query") {
(<any>requestOptions.qs)[this.paramName] = this.apiKey; (<any>requestOptions.qs)[this.paramName] = this.apiKey;
} else if (this.location == "header" && requestOptions && requestOptions.headers) { } else if (this.location == "header" && requestOptions && requestOptions.headers) {
@ -202,7 +202,7 @@ export class ApiKeyAuth implements Authentication {
export class OAuth implements Authentication { export class OAuth implements Authentication {
public accessToken: string; public accessToken: string;
applyToRequest(requestOptions: request.Options): void { applyToRequest(requestOptions: localVarRequest.Options): void {
if (requestOptions && requestOptions.headers) { if (requestOptions && requestOptions.headers) {
requestOptions.headers["Authorization"] = "Bearer " + this.accessToken; requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
} }
@ -212,7 +212,7 @@ export class OAuth implements Authentication {
export class VoidAuth implements Authentication { export class VoidAuth implements Authentication {
public username: string; public username: string;
public password: string; public password: string;
applyToRequest(_: request.Options): void { applyToRequest(_: localVarRequest.Options): void {
// Do nothing // Do nothing
} }
} }
@ -275,41 +275,41 @@ export class FakeApi {
*/ */
public testCodeInjectEndRnNR (test code inject * &#39; &quot; &#x3D;end rn n r?: string) : Promise<{ response: http.ClientResponse; body?: any; }> { public testCodeInjectEndRnNR (test code inject * &#39; &quot; &#x3D;end rn n r?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/fake'; const localVarPath = this.basePath + '/fake';
let queryParameters: any = {}; let localVarQueryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders); let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {}; let localVarFormParams: any = {};
let useFormData = false; let localVarUseFormData = false;
if (test code inject * &#39; &quot; &#x3D;end rn n r !== undefined) { if (test code inject * &#39; &quot; &#x3D;end rn n r !== undefined) {
formParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = ObjectSerializer.serialize(test code inject * &#39; &quot; &#x3D;end rn n r, "string"); localVarFormParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = ObjectSerializer.serialize(test code inject * &#39; &quot; &#x3D;end rn n r, "string");
} }
let requestOptions: request.Options = { let localVarRequestOptions: localVarRequest.Options = {
method: 'PUT', method: 'PUT',
qs: queryParameters, qs: localVarQueryParameters,
headers: headerParams, headers: localVarHeaderParams,
uri: localVarPath, uri: localVarPath,
useQuerystring: this._useQuerystring, useQuerystring: this._useQuerystring,
json: true, json: true,
}; };
this.authentications.default.applyToRequest(requestOptions); this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(formParams).length) { if (Object.keys(localVarFormParams).length) {
if (useFormData) { if (localVarUseFormData) {
(<any>requestOptions).formData = formParams; (<any>localVarRequestOptions).formData = localVarFormParams;
} else { } else {
requestOptions.form = formParams; localVarRequestOptions.form = localVarFormParams;
} }
} }
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => { return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
request(requestOptions, (error, response, body) => { localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) { if (error) {
reject(error); reject(error);
} else { } else {
if (response.statusCode >= 200 && response.statusCode <= 299) { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body }); resolve({ response: response, body: body });
} else { } else {
reject({ response: response, body: body }); reject({ response: response, body: body });

View File

@ -12,6 +12,6 @@
{modules, []}, {modules, []},
{maintainers, []}, {maintainers, []},
{licenses, ["Apache 2.0"]}, {licenses, ["Apache-2.0"]},
{links, []} {links, []}
]}. ]}.

View File

@ -268,7 +268,7 @@ FakeApi apiInstance = new FakeApi();
BigDecimal number = new BigDecimal(); // BigDecimal | None BigDecimal number = new BigDecimal(); // BigDecimal | None
Double _double = 3.4D; // Double | None Double _double = 3.4D; // Double | None
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
byte[] _byte = _byte_example; // byte[] | None byte[] _byte = B; // byte[] | None
Integer integer = 56; // Integer | None Integer integer = 56; // Integer | None
Integer int32 = 56; // Integer | None Integer int32 = 56; // Integer | None
Long int64 = 789L; // Long | None Long int64 = 789L; // Long | None

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -16,9 +16,6 @@ import com.google.api.client.json.Json;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ApiClient { public class ApiClient {
private final String basePath; private final String basePath;

View File

@ -68,37 +68,30 @@ public class AnotherFakeApi {
} }
public HttpResponse testSpecialTagsForHttpResponse(Client body) throws IOException { public HttpResponse testSpecialTagsForHttpResponse(Client body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testSpecialTags"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling testSpecialTags");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
} }
public HttpResponse testSpecialTagsForHttpResponse(Client body, Map<String, Object> params) throws IOException { public HttpResponse testSpecialTagsForHttpResponse(Client body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testSpecialTags"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling testSpecialTags");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -111,11 +104,10 @@ public class AnotherFakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
} }

View File

@ -58,7 +58,6 @@ public class FakeApi {
/** /**
* Test serialization of outer boolean types * Test serialization of outer boolean types
* <p><b>200</b> - Output boolean * <p><b>200</b> - Output boolean
* @param body Input boolean as post body
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return Boolean * @return Boolean
* @throws IOException if an error occurs while attempting to invoke the API * @throws IOException if an error occurs while attempting to invoke the API
@ -70,27 +69,24 @@ public class FakeApi {
} }
public HttpResponse fakeOuterBooleanSerializeForHttpResponse(Boolean body) throws IOException { public HttpResponse fakeOuterBooleanSerializeForHttpResponse(Boolean body) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse fakeOuterBooleanSerializeForHttpResponse(Boolean body, Map<String, Object> params) throws IOException { public HttpResponse fakeOuterBooleanSerializeForHttpResponse(Boolean body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -103,11 +99,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -128,7 +123,6 @@ public class FakeApi {
/** /**
* Test serialization of object with outer number type * Test serialization of object with outer number type
* <p><b>200</b> - Output composite * <p><b>200</b> - Output composite
* @param body Input composite as post body
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return OuterComposite * @return OuterComposite
* @throws IOException if an error occurs while attempting to invoke the API * @throws IOException if an error occurs while attempting to invoke the API
@ -140,27 +134,24 @@ public class FakeApi {
} }
public HttpResponse fakeOuterCompositeSerializeForHttpResponse(OuterComposite body) throws IOException { public HttpResponse fakeOuterCompositeSerializeForHttpResponse(OuterComposite body) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse fakeOuterCompositeSerializeForHttpResponse(OuterComposite body, Map<String, Object> params) throws IOException { public HttpResponse fakeOuterCompositeSerializeForHttpResponse(OuterComposite body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -173,11 +164,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -198,7 +188,6 @@ public class FakeApi {
/** /**
* Test serialization of outer number types * Test serialization of outer number types
* <p><b>200</b> - Output number * <p><b>200</b> - Output number
* @param body Input number as post body
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return BigDecimal * @return BigDecimal
* @throws IOException if an error occurs while attempting to invoke the API * @throws IOException if an error occurs while attempting to invoke the API
@ -210,27 +199,24 @@ public class FakeApi {
} }
public HttpResponse fakeOuterNumberSerializeForHttpResponse(BigDecimal body) throws IOException { public HttpResponse fakeOuterNumberSerializeForHttpResponse(BigDecimal body) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse fakeOuterNumberSerializeForHttpResponse(BigDecimal body, Map<String, Object> params) throws IOException { public HttpResponse fakeOuterNumberSerializeForHttpResponse(BigDecimal body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -243,11 +229,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -268,7 +253,6 @@ public class FakeApi {
/** /**
* Test serialization of outer string types * Test serialization of outer string types
* <p><b>200</b> - Output string * <p><b>200</b> - Output string
* @param body Input string as post body
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return String * @return String
* @throws IOException if an error occurs while attempting to invoke the API * @throws IOException if an error occurs while attempting to invoke the API
@ -280,27 +264,24 @@ public class FakeApi {
} }
public HttpResponse fakeOuterStringSerializeForHttpResponse(String body) throws IOException { public HttpResponse fakeOuterStringSerializeForHttpResponse(String body) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse fakeOuterStringSerializeForHttpResponse(String body, Map<String, Object> params) throws IOException { public HttpResponse fakeOuterStringSerializeForHttpResponse(String body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -313,11 +294,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -352,37 +332,30 @@ public class FakeApi {
} }
public HttpResponse testClientModelForHttpResponse(Client body) throws IOException { public HttpResponse testClientModelForHttpResponse(Client body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
} }
public HttpResponse testClientModelForHttpResponse(Client body, Map<String, Object> params) throws IOException { public HttpResponse testClientModelForHttpResponse(Client body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -395,11 +368,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
} }
@ -446,67 +418,48 @@ public class FakeApi {
} }
public HttpResponse testEndpointParametersForHttpResponse(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws IOException { public HttpResponse testEndpointParametersForHttpResponse(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, byte[] binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws IOException {
Object postBody = null;
// verify the required parameter 'number' is set // verify the required parameter 'number' is set
if (number == null) { if (number == null) {
throw new IllegalArgumentException("Missing the required parameter 'number' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter 'number' when calling testEndpointParameters");
} }// verify the required parameter '_double' is set
// verify the required parameter '_double' is set
if (_double == null) { if (_double == null) {
throw new IllegalArgumentException("Missing the required parameter '_double' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter '_double' when calling testEndpointParameters");
} }// verify the required parameter 'patternWithoutDelimiter' is set
// verify the required parameter 'patternWithoutDelimiter' is set
if (patternWithoutDelimiter == null) { if (patternWithoutDelimiter == null) {
throw new IllegalArgumentException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
} }// verify the required parameter '_byte' is set
// verify the required parameter '_byte' is set
if (_byte == null) { if (_byte == null) {
throw new IllegalArgumentException("Missing the required parameter '_byte' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter '_byte' when calling testEndpointParameters");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse testEndpointParametersForHttpResponse(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Map<String, Object> params) throws IOException { public HttpResponse testEndpointParametersForHttpResponse(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'number' is set // verify the required parameter 'number' is set
if (number == null) { if (number == null) {
throw new IllegalArgumentException("Missing the required parameter 'number' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter 'number' when calling testEndpointParameters");
} }// verify the required parameter '_double' is set
// verify the required parameter '_double' is set
if (_double == null) { if (_double == null) {
throw new IllegalArgumentException("Missing the required parameter '_double' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter '_double' when calling testEndpointParameters");
} }// verify the required parameter 'patternWithoutDelimiter' is set
// verify the required parameter 'patternWithoutDelimiter' is set
if (patternWithoutDelimiter == null) { if (patternWithoutDelimiter == null) {
throw new IllegalArgumentException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter 'patternWithoutDelimiter' when calling testEndpointParameters");
} }// verify the required parameter '_byte' is set
// verify the required parameter '_byte' is set
if (_byte == null) { if (_byte == null) {
throw new IllegalArgumentException("Missing the required parameter '_byte' when calling testEndpointParameters"); throw new IllegalArgumentException("Missing the required parameter '_byte' when calling testEndpointParameters");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -519,11 +472,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -560,7 +512,6 @@ public class FakeApi {
} }
public HttpResponse testEnumParametersForHttpResponse(List<String> enumFormStringArray, String enumFormString, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws IOException { public HttpResponse testEnumParametersForHttpResponse(List<String> enumFormStringArray, String enumFormString, List<String> enumHeaderStringArray, String enumHeaderString, List<String> enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble) throws IOException {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (enumQueryStringArray != null) { if (enumQueryStringArray != null) {
@ -574,20 +525,18 @@ public class FakeApi {
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse testEnumParametersForHttpResponse(Map<String, Object> params) throws IOException { public HttpResponse testEnumParametersForHttpResponse(Map<String, Object> params) throws IOException {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -600,11 +549,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -633,37 +581,30 @@ public class FakeApi {
} }
public HttpResponse testInlineAdditionalPropertiesForHttpResponse(Object param) throws IOException { public HttpResponse testInlineAdditionalPropertiesForHttpResponse(Object param) throws IOException {
Object postBody = param;
// verify the required parameter 'param' is set // verify the required parameter 'param' is set
if (param == null) { if (param == null) {
throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties"); throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = param == null ? null : apiClient.new JacksonJsonHttpContent(param);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse testInlineAdditionalPropertiesForHttpResponse(Object param, Map<String, Object> params) throws IOException { public HttpResponse testInlineAdditionalPropertiesForHttpResponse(Object param, Map<String, Object> params) throws IOException {
Object postBody = param;
// verify the required parameter 'param' is set // verify the required parameter 'param' is set
if (param == null) { if (param == null) {
throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties"); throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -676,11 +617,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = param == null ? null : apiClient.new JacksonJsonHttpContent(param);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -711,47 +651,36 @@ public class FakeApi {
} }
public HttpResponse testJsonFormDataForHttpResponse(String param, String param2) throws IOException { public HttpResponse testJsonFormDataForHttpResponse(String param, String param2) throws IOException {
Object postBody = null;
// verify the required parameter 'param' is set // verify the required parameter 'param' is set
if (param == null) { if (param == null) {
throw new IllegalArgumentException("Missing the required parameter 'param' when calling testJsonFormData"); throw new IllegalArgumentException("Missing the required parameter 'param' when calling testJsonFormData");
} }// verify the required parameter 'param2' is set
// verify the required parameter 'param2' is set
if (param2 == null) { if (param2 == null) {
throw new IllegalArgumentException("Missing the required parameter 'param2' when calling testJsonFormData"); throw new IllegalArgumentException("Missing the required parameter 'param2' when calling testJsonFormData");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/jsonFormData"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/jsonFormData");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse testJsonFormDataForHttpResponse(String param, String param2, Map<String, Object> params) throws IOException { public HttpResponse testJsonFormDataForHttpResponse(String param, String param2, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'param' is set // verify the required parameter 'param' is set
if (param == null) { if (param == null) {
throw new IllegalArgumentException("Missing the required parameter 'param' when calling testJsonFormData"); throw new IllegalArgumentException("Missing the required parameter 'param' when calling testJsonFormData");
} }// verify the required parameter 'param2' is set
// verify the required parameter 'param2' is set
if (param2 == null) { if (param2 == null) {
throw new IllegalArgumentException("Missing the required parameter 'param2' when calling testJsonFormData"); throw new IllegalArgumentException("Missing the required parameter 'param2' when calling testJsonFormData");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/jsonFormData"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/jsonFormData");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -764,11 +693,10 @@ public class FakeApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }

View File

@ -66,37 +66,30 @@ public class FakeClassnameTags123Api {
} }
public HttpResponse testClassnameForHttpResponse(Client body) throws IOException { public HttpResponse testClassnameForHttpResponse(Client body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
} }
public HttpResponse testClassnameForHttpResponse(Client body, Map<String, Object> params) throws IOException { public HttpResponse testClassnameForHttpResponse(Client body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -109,11 +102,10 @@ public class FakeClassnameTags123Api {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PATCH, genericUrl, content).execute();
} }

View File

@ -64,37 +64,30 @@ public class PetApi {
} }
public HttpResponse addPetForHttpResponse(Pet body) throws IOException { public HttpResponse addPetForHttpResponse(Pet body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling addPet"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling addPet");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse addPetForHttpResponse(Pet body, Map<String, Object> params) throws IOException { public HttpResponse addPetForHttpResponse(Pet body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling addPet"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling addPet");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -107,11 +100,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -141,13 +133,10 @@ public class PetApi {
} }
public HttpResponse deletePetForHttpResponse(Long petId, String apiKey) throws IOException { public HttpResponse deletePetForHttpResponse(Long petId, String apiKey) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling deletePet"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling deletePet");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
@ -156,28 +145,24 @@ public class PetApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute();
} }
public HttpResponse deletePetForHttpResponse(Long petId, Map<String, Object> params) throws IOException { public HttpResponse deletePetForHttpResponse(Long petId, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling deletePet"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling deletePet");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -190,11 +175,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute();
} }
@ -231,13 +215,10 @@ public class PetApi {
} }
public HttpResponse findPetsByStatusForHttpResponse(List<String> status) throws IOException { public HttpResponse findPetsByStatusForHttpResponse(List<String> status) throws IOException {
Object postBody = null;
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == null) { if (status == null) {
throw new IllegalArgumentException("Missing the required parameter 'status' when calling findPetsByStatus"); throw new IllegalArgumentException("Missing the required parameter 'status' when calling findPetsByStatus");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByStatus"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByStatus");
if (status != null) { if (status != null) {
uriBuilder = uriBuilder.queryParam("status", status); uriBuilder = uriBuilder.queryParam("status", status);
@ -246,28 +227,23 @@ public class PetApi {
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse findPetsByStatusForHttpResponse(List<String> status, Map<String, Object> params) throws IOException { public HttpResponse findPetsByStatusForHttpResponse(List<String> status, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'status' is set // verify the required parameter 'status' is set
if (status == null) { if (status == null) {
throw new IllegalArgumentException("Missing the required parameter 'status' when calling findPetsByStatus"); throw new IllegalArgumentException("Missing the required parameter 'status' when calling findPetsByStatus");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByStatus"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByStatus");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
// Add the required query param 'status' to the map of query params // Add the required query param 'status' to the map of query params
params.put("status", status); allParams.put("status", status);
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -280,11 +256,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -321,13 +296,10 @@ public class PetApi {
} }
public HttpResponse findPetsByTagsForHttpResponse(List<String> tags) throws IOException { public HttpResponse findPetsByTagsForHttpResponse(List<String> tags) throws IOException {
Object postBody = null;
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == null) { if (tags == null) {
throw new IllegalArgumentException("Missing the required parameter 'tags' when calling findPetsByTags"); throw new IllegalArgumentException("Missing the required parameter 'tags' when calling findPetsByTags");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByTags"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByTags");
if (tags != null) { if (tags != null) {
uriBuilder = uriBuilder.queryParam("tags", tags); uriBuilder = uriBuilder.queryParam("tags", tags);
@ -336,28 +308,23 @@ public class PetApi {
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse findPetsByTagsForHttpResponse(List<String> tags, Map<String, Object> params) throws IOException { public HttpResponse findPetsByTagsForHttpResponse(List<String> tags, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'tags' is set // verify the required parameter 'tags' is set
if (tags == null) { if (tags == null) {
throw new IllegalArgumentException("Missing the required parameter 'tags' when calling findPetsByTags"); throw new IllegalArgumentException("Missing the required parameter 'tags' when calling findPetsByTags");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByTags"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/findByTags");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
// Add the required query param 'tags' to the map of query params // Add the required query param 'tags' to the map of query params
params.put("tags", tags); allParams.put("tags", tags);
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -370,11 +337,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -413,13 +379,10 @@ public class PetApi {
} }
public HttpResponse getPetByIdForHttpResponse(Long petId) throws IOException { public HttpResponse getPetByIdForHttpResponse(Long petId) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling getPetById"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling getPetById");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
@ -428,28 +391,24 @@ public class PetApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse getPetByIdForHttpResponse(Long petId, Map<String, Object> params) throws IOException { public HttpResponse getPetByIdForHttpResponse(Long petId, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling getPetById"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling getPetById");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -462,11 +421,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -499,37 +457,30 @@ public class PetApi {
} }
public HttpResponse updatePetForHttpResponse(Pet body) throws IOException { public HttpResponse updatePetForHttpResponse(Pet body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling updatePet"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling updatePet");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
} }
public HttpResponse updatePetForHttpResponse(Pet body, Map<String, Object> params) throws IOException { public HttpResponse updatePetForHttpResponse(Pet body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling updatePet"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling updatePet");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -542,11 +493,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
} }
@ -577,13 +527,10 @@ public class PetApi {
} }
public HttpResponse updatePetWithFormForHttpResponse(Long petId, String name, String status) throws IOException { public HttpResponse updatePetWithFormForHttpResponse(Long petId, String name, String status) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling updatePetWithForm"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling updatePetWithForm");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
@ -592,28 +539,24 @@ public class PetApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse updatePetWithFormForHttpResponse(Long petId, Map<String, Object> params) throws IOException { public HttpResponse updatePetWithFormForHttpResponse(Long petId, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling updatePetWithForm"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling updatePetWithForm");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -626,11 +569,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -667,13 +609,10 @@ public class PetApi {
} }
public HttpResponse uploadFileForHttpResponse(Long petId, String additionalMetadata, File file) throws IOException { public HttpResponse uploadFileForHttpResponse(Long petId, String additionalMetadata, File file) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling uploadFile"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling uploadFile");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
@ -682,28 +621,24 @@ public class PetApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse uploadFileForHttpResponse(Long petId, Map<String, Object> params) throws IOException { public HttpResponse uploadFileForHttpResponse(Long petId, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'petId' is set // verify the required parameter 'petId' is set
if (petId == null) { if (petId == null) {
throw new IllegalArgumentException("Missing the required parameter 'petId' when calling uploadFile"); throw new IllegalArgumentException("Missing the required parameter 'petId' when calling uploadFile");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("petId", petId); uriVariables.put("petId", petId);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}/uploadImage"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/pet/{petId}/uploadImage");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -716,11 +651,10 @@ public class PetApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }

View File

@ -64,13 +64,10 @@ public class StoreApi {
} }
public HttpResponse deleteOrderForHttpResponse(String orderId) throws IOException { public HttpResponse deleteOrderForHttpResponse(String orderId) throws IOException {
Object postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling deleteOrder"); throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling deleteOrder");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("order_id", orderId); uriVariables.put("order_id", orderId);
@ -79,28 +76,24 @@ public class StoreApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute();
} }
public HttpResponse deleteOrderForHttpResponse(String orderId, Map<String, Object> params) throws IOException { public HttpResponse deleteOrderForHttpResponse(String orderId, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling deleteOrder"); throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling deleteOrder");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("order_id", orderId); uriVariables.put("order_id", orderId);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order/{order_id}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order/{order_id}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -113,11 +106,10 @@ public class StoreApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute();
} }
@ -150,27 +142,24 @@ public class StoreApi {
} }
public HttpResponse getInventoryForHttpResponse() throws IOException { public HttpResponse getInventoryForHttpResponse() throws IOException {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/inventory"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/inventory");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse getInventoryForHttpResponse(Map<String, Object> params) throws IOException { public HttpResponse getInventoryForHttpResponse(Map<String, Object> params) throws IOException {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/inventory"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/inventory");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -183,11 +172,10 @@ public class StoreApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -226,13 +214,10 @@ public class StoreApi {
} }
public HttpResponse getOrderByIdForHttpResponse(Long orderId) throws IOException { public HttpResponse getOrderByIdForHttpResponse(Long orderId) throws IOException {
Object postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling getOrderById"); throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling getOrderById");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("order_id", orderId); uriVariables.put("order_id", orderId);
@ -241,28 +226,24 @@ public class StoreApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse getOrderByIdForHttpResponse(Long orderId, Map<String, Object> params) throws IOException { public HttpResponse getOrderByIdForHttpResponse(Long orderId, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'orderId' is set // verify the required parameter 'orderId' is set
if (orderId == null) { if (orderId == null) {
throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling getOrderById"); throw new IllegalArgumentException("Missing the required parameter 'orderId' when calling getOrderById");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("order_id", orderId); uriVariables.put("order_id", orderId);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order/{order_id}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order/{order_id}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -275,11 +256,10 @@ public class StoreApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -316,37 +296,30 @@ public class StoreApi {
} }
public HttpResponse placeOrderForHttpResponse(Order body) throws IOException { public HttpResponse placeOrderForHttpResponse(Order body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling placeOrder"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling placeOrder");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse placeOrderForHttpResponse(Order body, Map<String, Object> params) throws IOException { public HttpResponse placeOrderForHttpResponse(Order body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling placeOrder"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling placeOrder");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/store/order");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -359,11 +332,10 @@ public class StoreApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }

View File

@ -62,37 +62,30 @@ public class UserApi {
} }
public HttpResponse createUserForHttpResponse(User body) throws IOException { public HttpResponse createUserForHttpResponse(User body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUser"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUser");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse createUserForHttpResponse(User body, Map<String, Object> params) throws IOException { public HttpResponse createUserForHttpResponse(User body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUser"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUser");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -105,11 +98,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -138,37 +130,30 @@ public class UserApi {
} }
public HttpResponse createUsersWithArrayInputForHttpResponse(List<User> body) throws IOException { public HttpResponse createUsersWithArrayInputForHttpResponse(List<User> body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithArrayInput"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithArrayInput");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithArray"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithArray");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse createUsersWithArrayInputForHttpResponse(List<User> body, Map<String, Object> params) throws IOException { public HttpResponse createUsersWithArrayInputForHttpResponse(List<User> body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithArrayInput"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithArrayInput");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithArray"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithArray");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -181,11 +166,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -214,37 +198,30 @@ public class UserApi {
} }
public HttpResponse createUsersWithListInputForHttpResponse(List<User> body) throws IOException { public HttpResponse createUsersWithListInputForHttpResponse(List<User> body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithListInput"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithListInput");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithList"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithList");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
public HttpResponse createUsersWithListInputForHttpResponse(List<User> body, Map<String, Object> params) throws IOException { public HttpResponse createUsersWithListInputForHttpResponse(List<User> body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set // verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithListInput"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling createUsersWithListInput");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithList"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/createWithList");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -257,11 +234,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content).execute();
} }
@ -292,13 +268,10 @@ public class UserApi {
} }
public HttpResponse deleteUserForHttpResponse(String username) throws IOException { public HttpResponse deleteUserForHttpResponse(String username) throws IOException {
Object postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling deleteUser"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling deleteUser");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username); uriVariables.put("username", username);
@ -307,28 +280,24 @@ public class UserApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute();
} }
public HttpResponse deleteUserForHttpResponse(String username, Map<String, Object> params) throws IOException { public HttpResponse deleteUserForHttpResponse(String username, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling deleteUser"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling deleteUser");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username); uriVariables.put("username", username);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/{username}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/{username}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -341,11 +310,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.DELETE, genericUrl, content).execute();
} }
@ -384,13 +352,10 @@ public class UserApi {
} }
public HttpResponse getUserByNameForHttpResponse(String username) throws IOException { public HttpResponse getUserByNameForHttpResponse(String username) throws IOException {
Object postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling getUserByName"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling getUserByName");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username); uriVariables.put("username", username);
@ -399,28 +364,24 @@ public class UserApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse getUserByNameForHttpResponse(String username, Map<String, Object> params) throws IOException { public HttpResponse getUserByNameForHttpResponse(String username, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling getUserByName"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling getUserByName");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username); uriVariables.put("username", username);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/{username}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/{username}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -433,11 +394,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -476,18 +436,13 @@ public class UserApi {
} }
public HttpResponse loginUserForHttpResponse(String username, String password) throws IOException { public HttpResponse loginUserForHttpResponse(String username, String password) throws IOException {
Object postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling loginUser"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling loginUser");
} }// verify the required parameter 'password' is set
// verify the required parameter 'password' is set
if (password == null) { if (password == null) {
throw new IllegalArgumentException("Missing the required parameter 'password' when calling loginUser"); throw new IllegalArgumentException("Missing the required parameter 'password' when calling loginUser");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/login"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/login");
if (username != null) { if (username != null) {
uriBuilder = uriBuilder.queryParam("username", username); uriBuilder = uriBuilder.queryParam("username", username);
@ -498,36 +453,28 @@ public class UserApi {
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse loginUserForHttpResponse(String username, String password, Map<String, Object> params) throws IOException { public HttpResponse loginUserForHttpResponse(String username, String password, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling loginUser"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling loginUser");
} }// verify the required parameter 'password' is set
// verify the required parameter 'password' is set
if (password == null) { if (password == null) {
throw new IllegalArgumentException("Missing the required parameter 'password' when calling loginUser"); throw new IllegalArgumentException("Missing the required parameter 'password' when calling loginUser");
} }
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/login"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/login");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
// Add the required query param 'username' to the map of query params // Add the required query param 'username' to the map of query params
params.put("username", username); allParams.put("username", username);
// Add the required query param 'password' to the map of query params // Add the required query param 'password' to the map of query params
params.put("password", password); allParams.put("password", password);
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -540,11 +487,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -571,27 +517,24 @@ public class UserApi {
} }
public HttpResponse logoutUserForHttpResponse() throws IOException { public HttpResponse logoutUserForHttpResponse() throws IOException {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/logout"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/logout");
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
public HttpResponse logoutUserForHttpResponse(Map<String, Object> params) throws IOException { public HttpResponse logoutUserForHttpResponse(Map<String, Object> params) throws IOException {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/logout"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/logout");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -604,11 +547,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.build().toString(); String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = null;
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content).execute();
} }
@ -641,18 +583,13 @@ public class UserApi {
} }
public HttpResponse updateUserForHttpResponse(String username, User body) throws IOException { public HttpResponse updateUserForHttpResponse(String username, User body) throws IOException {
Object postBody = body;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling updateUser"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling updateUser");
} }// verify the required parameter 'body' is set
// verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateUser"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateUser");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username); uriVariables.put("username", username);
@ -661,33 +598,27 @@ public class UserApi {
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
} }
public HttpResponse updateUserForHttpResponse(String username, User body, Map<String, Object> params) throws IOException { public HttpResponse updateUserForHttpResponse(String username, User body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'username' is set // verify the required parameter 'username' is set
if (username == null) { if (username == null) {
throw new IllegalArgumentException("Missing the required parameter 'username' when calling updateUser"); throw new IllegalArgumentException("Missing the required parameter 'username' when calling updateUser");
} }// verify the required parameter 'body' is set
// verify the required parameter 'body' is set
if (body == null) { if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateUser"); throw new IllegalArgumentException("Missing the required parameter 'body' when calling updateUser");
} }
// create a map of path variables // create a map of path variables
final Map<String, Object> uriVariables = new HashMap<String, Object>(); final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("username", username); uriVariables.put("username", username);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/{username}"); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/user/{username}");
if (params == null) { // Copy the params argument if present, to allow passing in immutable maps
params = new HashMap<String, Object>(); Map<String, Object> allParams = params == null ? new HashMap<String, Object>() : new HashMap<String, Object>(params);
}
for (Map.Entry<String, Object> entry: params.entrySet()) { for (Map.Entry<String, Object> entry: allParams.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
Object value = entry.getValue(); Object value = entry.getValue();
@ -700,11 +631,10 @@ public class UserApi {
} }
} }
String url = uriBuilder.buildFromMap(uriVariables).toString(); String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url); GenericUrl genericUrl = new GenericUrl(url);
HttpContent content = postBody == null ? null : apiClient.new JacksonJsonHttpContent(postBody); HttpContent content = body == null ? null : apiClient.new JacksonJsonHttpContent(body);
return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute(); return apiClient.getHttpRequestFactory().buildRequest(HttpMethods.PUT, genericUrl, content).execute();
} }

View File

@ -56,11 +56,15 @@ Please follow the [installation procedure](#installation--usage) and then run th
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\AnotherFakeApi(); $apiInstance = new Swagger\Client\Api\AnotherFakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model $body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model
try { try {
$result = $api_instance->testSpecialTags($body); $result = $apiInstance->testSpecialTags($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL;

View File

@ -19,11 +19,15 @@ To test special tags
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\AnotherFakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\AnotherFakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model $body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model
try { try {
$result = $api_instance->testSpecialTags($body); $result = $apiInstance->testSpecialTags($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL;

View File

@ -27,11 +27,15 @@ Test serialization of outer boolean types
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\OuterBoolean(); // \Swagger\Client\Model\OuterBoolean | Input boolean as post body $body = new \Swagger\Client\Model\OuterBoolean(); // \Swagger\Client\Model\OuterBoolean | Input boolean as post body
try { try {
$result = $api_instance->fakeOuterBooleanSerialize($body); $result = $apiInstance->fakeOuterBooleanSerialize($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterBooleanSerialize: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->fakeOuterBooleanSerialize: ', $e->getMessage(), PHP_EOL;
@ -72,11 +76,15 @@ Test serialization of object with outer number type
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\OuterComposite(); // \Swagger\Client\Model\OuterComposite | Input composite as post body $body = new \Swagger\Client\Model\OuterComposite(); // \Swagger\Client\Model\OuterComposite | Input composite as post body
try { try {
$result = $api_instance->fakeOuterCompositeSerialize($body); $result = $apiInstance->fakeOuterCompositeSerialize($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterCompositeSerialize: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->fakeOuterCompositeSerialize: ', $e->getMessage(), PHP_EOL;
@ -117,11 +125,15 @@ Test serialization of outer number types
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\OuterNumber(); // \Swagger\Client\Model\OuterNumber | Input number as post body $body = new \Swagger\Client\Model\OuterNumber(); // \Swagger\Client\Model\OuterNumber | Input number as post body
try { try {
$result = $api_instance->fakeOuterNumberSerialize($body); $result = $apiInstance->fakeOuterNumberSerialize($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterNumberSerialize: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->fakeOuterNumberSerialize: ', $e->getMessage(), PHP_EOL;
@ -162,11 +174,15 @@ Test serialization of outer string types
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\OuterString(); // \Swagger\Client\Model\OuterString | Input string as post body $body = new \Swagger\Client\Model\OuterString(); // \Swagger\Client\Model\OuterString | Input string as post body
try { try {
$result = $api_instance->fakeOuterStringSerialize($body); $result = $apiInstance->fakeOuterStringSerialize($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterStringSerialize: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->fakeOuterStringSerialize: ', $e->getMessage(), PHP_EOL;
@ -207,11 +223,15 @@ To test \"client\" model
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model $body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model
try { try {
$result = $api_instance->testClientModel($body); $result = $apiInstance->testClientModel($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->testClientModel: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->testClientModel: ', $e->getMessage(), PHP_EOL;
@ -253,14 +273,21 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: http_basic_test // Configure HTTP basic authorization: http_basic_test
Swagger\Client\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME'); $config = Swagger\Client\Configuration::getDefaultConfiguration()
Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD'); ->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client());
$number = 3.4; // float | None $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$number = 8.14; // float | None
$double = 1.2; // double | None $double = 1.2; // double | None
$pattern_without_delimiter = "pattern_without_delimiter_example"; // string | None $pattern_without_delimiter = "pattern_without_delimiter_example"; // string | None
$byte = "byte_example"; // string | None $byte = "B"; // string | None
$integer = 56; // int | None $integer = 56; // int | None
$int32 = 56; // int | None $int32 = 56; // int | None
$int64 = 789; // int | None $int64 = 789; // int | None
@ -273,7 +300,7 @@ $password = "password_example"; // string | None
$callback = "callback_example"; // string | None $callback = "callback_example"; // string | None
try { try {
$api_instance->testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback); $apiInstance->testEndpointParameters($number, $double, $pattern_without_delimiter, $byte, $integer, $int32, $int64, $float, $string, $binary, $date, $date_time, $password, $callback);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), PHP_EOL;
} }
@ -326,7 +353,11 @@ To test enum parameters
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$enum_form_string_array = array("enum_form_string_array_example"); // string[] | Form parameter enum test (string array) $enum_form_string_array = array("enum_form_string_array_example"); // string[] | Form parameter enum test (string array)
$enum_form_string = "-efg"; // string | Form parameter enum test (string) $enum_form_string = "-efg"; // string | Form parameter enum test (string)
$enum_header_string_array = array("enum_header_string_array_example"); // string[] | Header parameter enum test (string array) $enum_header_string_array = array("enum_header_string_array_example"); // string[] | Header parameter enum test (string array)
@ -337,7 +368,7 @@ $enum_query_integer = 56; // int | Query parameter enum test (double)
$enum_query_double = 1.2; // double | Query parameter enum test (double) $enum_query_double = 1.2; // double | Query parameter enum test (double)
try { try {
$api_instance->testEnumParameters($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double); $apiInstance->testEnumParameters($enum_form_string_array, $enum_form_string, $enum_header_string_array, $enum_header_string, $enum_query_string_array, $enum_query_string, $enum_query_integer, $enum_query_double);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->testEnumParameters: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->testEnumParameters: ', $e->getMessage(), PHP_EOL;
} }
@ -384,11 +415,15 @@ test inline additionalProperties
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$param = new \stdClass; // object | request body $param = new \stdClass; // object | request body
try { try {
$api_instance->testInlineAdditionalProperties($param); $apiInstance->testInlineAdditionalProperties($param);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->testInlineAdditionalProperties: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->testInlineAdditionalProperties: ', $e->getMessage(), PHP_EOL;
} }
@ -428,12 +463,16 @@ test json serialization of form data
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\FakeApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$param = "param_example"; // string | field1 $param = "param_example"; // string | field1
$param2 = "param2_example"; // string | field2 $param2 = "param2_example"; // string | field2
try { try {
$api_instance->testJsonFormData($param, $param2); $apiInstance->testJsonFormData($param, $param2);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeApi->testJsonFormData: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeApi->testJsonFormData: ', $e->getMessage(), PHP_EOL;
} }

View File

@ -18,15 +18,20 @@ To test class name in snake case
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key_query // Configure API key authorization: api_key_query
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key_query', 'YOUR_API_KEY'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key_query', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key_query', 'Bearer'); // $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key_query', 'Bearer');
$api_instance = new Swagger\Client\Api\FakeClassnameTags123Api(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\FakeClassnameTags123Api(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model $body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model
try { try {
$result = $api_instance->testClassname($body); $result = $apiInstance->testClassname($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling FakeClassnameTags123Api->testClassname: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling FakeClassnameTags123Api->testClassname: ', $e->getMessage(), PHP_EOL;

View File

@ -27,13 +27,18 @@ Add a new pet to the store
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth // Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store $body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store
try { try {
$api_instance->addPet($body); $apiInstance->addPet($body);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), PHP_EOL;
} }
@ -74,14 +79,19 @@ Deletes a pet
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth // Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$pet_id = 789; // int | Pet id to delete $pet_id = 789; // int | Pet id to delete
$api_key = "api_key_example"; // string | $api_key = "api_key_example"; // string |
try { try {
$api_instance->deletePet($pet_id, $api_key); $apiInstance->deletePet($pet_id, $api_key);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->deletePet: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->deletePet: ', $e->getMessage(), PHP_EOL;
} }
@ -123,13 +133,18 @@ Multiple status values can be provided with comma separated strings
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth // Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$status = array("status_example"); // string[] | Status values that need to be considered for filter $status = array("status_example"); // string[] | Status values that need to be considered for filter
try { try {
$result = $api_instance->findPetsByStatus($status); $result = $apiInstance->findPetsByStatus($status);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->findPetsByStatus: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->findPetsByStatus: ', $e->getMessage(), PHP_EOL;
@ -171,13 +186,18 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth // Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$tags = array("tags_example"); // string[] | Tags to filter by $tags = array("tags_example"); // string[] | Tags to filter by
try { try {
$result = $api_instance->findPetsByTags($tags); $result = $apiInstance->findPetsByTags($tags);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->findPetsByTags: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->findPetsByTags: ', $e->getMessage(), PHP_EOL;
@ -219,15 +239,20 @@ Returns a single pet
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key // Configure API key authorization: api_key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer'); // $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$pet_id = 789; // int | ID of pet to return $pet_id = 789; // int | ID of pet to return
try { try {
$result = $api_instance->getPetById($pet_id); $result = $apiInstance->getPetById($pet_id);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->getPetById: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->getPetById: ', $e->getMessage(), PHP_EOL;
@ -269,13 +294,18 @@ Update an existing pet
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth // Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store $body = new \Swagger\Client\Model\Pet(); // \Swagger\Client\Model\Pet | Pet object that needs to be added to the store
try { try {
$api_instance->updatePet($body); $apiInstance->updatePet($body);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->updatePet: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->updatePet: ', $e->getMessage(), PHP_EOL;
} }
@ -316,15 +346,20 @@ Updates a pet in the store with form data
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth // Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$pet_id = 789; // int | ID of pet that needs to be updated $pet_id = 789; // int | ID of pet that needs to be updated
$name = "name_example"; // string | Updated name of the pet $name = "name_example"; // string | Updated name of the pet
$status = "status_example"; // string | Updated status of the pet $status = "status_example"; // string | Updated status of the pet
try { try {
$api_instance->updatePetWithForm($pet_id, $name, $status); $apiInstance->updatePetWithForm($pet_id, $name, $status);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->updatePetWithForm: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->updatePetWithForm: ', $e->getMessage(), PHP_EOL;
} }
@ -367,15 +402,20 @@ uploads an image
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: petstore_auth // Configure OAuth2 access token for authorization: petstore_auth
Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Swagger\Client\Api\PetApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\PetApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$pet_id = 789; // int | ID of pet to update $pet_id = 789; // int | ID of pet to update
$additional_metadata = "additional_metadata_example"; // string | Additional data to pass to server $additional_metadata = "additional_metadata_example"; // string | Additional data to pass to server
$file = "/path/to/file.txt"; // \SplFileObject | file to upload $file = "/path/to/file.txt"; // \SplFileObject | file to upload
try { try {
$result = $api_instance->uploadFile($pet_id, $additional_metadata, $file); $result = $apiInstance->uploadFile($pet_id, $additional_metadata, $file);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), PHP_EOL;

View File

@ -22,11 +22,15 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\StoreApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\StoreApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$order_id = "order_id_example"; // string | ID of the order that needs to be deleted $order_id = "order_id_example"; // string | ID of the order that needs to be deleted
try { try {
$api_instance->deleteOrder($order_id); $apiInstance->deleteOrder($order_id);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling StoreApi->deleteOrder: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling StoreApi->deleteOrder: ', $e->getMessage(), PHP_EOL;
} }
@ -67,14 +71,19 @@ Returns a map of status codes to quantities
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: api_key // Configure API key authorization: api_key
Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer'); // $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'Bearer');
$api_instance = new Swagger\Client\Api\StoreApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\StoreApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
try { try {
$result = $api_instance->getInventory(); $result = $apiInstance->getInventory();
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling StoreApi->getInventory: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling StoreApi->getInventory: ', $e->getMessage(), PHP_EOL;
@ -112,11 +121,15 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\StoreApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\StoreApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$order_id = 789; // int | ID of pet that needs to be fetched $order_id = 789; // int | ID of pet that needs to be fetched
try { try {
$result = $api_instance->getOrderById($order_id); $result = $apiInstance->getOrderById($order_id);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling StoreApi->getOrderById: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling StoreApi->getOrderById: ', $e->getMessage(), PHP_EOL;
@ -157,11 +170,15 @@ Place an order for a pet
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\StoreApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\StoreApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\Order(); // \Swagger\Client\Model\Order | order placed for purchasing the pet $body = new \Swagger\Client\Model\Order(); // \Swagger\Client\Model\Order | order placed for purchasing the pet
try { try {
$result = $api_instance->placeOrder($body); $result = $apiInstance->placeOrder($body);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling StoreApi->placeOrder: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling StoreApi->placeOrder: ', $e->getMessage(), PHP_EOL;

View File

@ -26,11 +26,15 @@ This can only be done by the logged in user.
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User | Created user object $body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User | Created user object
try { try {
$api_instance->createUser($body); $apiInstance->createUser($body);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->createUser: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->createUser: ', $e->getMessage(), PHP_EOL;
} }
@ -70,11 +74,15 @@ Creates list of users with given input array
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = array(new \Swagger\Client\Model\User()); // \Swagger\Client\Model\User[] | List of user object $body = array(new \Swagger\Client\Model\User()); // \Swagger\Client\Model\User[] | List of user object
try { try {
$api_instance->createUsersWithArrayInput($body); $apiInstance->createUsersWithArrayInput($body);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->createUsersWithArrayInput: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->createUsersWithArrayInput: ', $e->getMessage(), PHP_EOL;
} }
@ -114,11 +122,15 @@ Creates list of users with given input array
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$body = array(new \Swagger\Client\Model\User()); // \Swagger\Client\Model\User[] | List of user object $body = array(new \Swagger\Client\Model\User()); // \Swagger\Client\Model\User[] | List of user object
try { try {
$api_instance->createUsersWithListInput($body); $apiInstance->createUsersWithListInput($body);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->createUsersWithListInput: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->createUsersWithListInput: ', $e->getMessage(), PHP_EOL;
} }
@ -158,11 +170,15 @@ This can only be done by the logged in user.
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$username = "username_example"; // string | The name that needs to be deleted $username = "username_example"; // string | The name that needs to be deleted
try { try {
$api_instance->deleteUser($username); $apiInstance->deleteUser($username);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->deleteUser: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->deleteUser: ', $e->getMessage(), PHP_EOL;
} }
@ -202,11 +218,15 @@ Get user by user name
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing. $username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing.
try { try {
$result = $api_instance->getUserByName($username); $result = $apiInstance->getUserByName($username);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->getUserByName: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->getUserByName: ', $e->getMessage(), PHP_EOL;
@ -247,12 +267,16 @@ Logs user into the system
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$username = "username_example"; // string | The user name for login $username = "username_example"; // string | The user name for login
$password = "password_example"; // string | The password for login in clear text $password = "password_example"; // string | The password for login in clear text
try { try {
$result = $api_instance->loginUser($username, $password); $result = $apiInstance->loginUser($username, $password);
print_r($result); print_r($result);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->loginUser: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->loginUser: ', $e->getMessage(), PHP_EOL;
@ -294,10 +318,14 @@ Logs out current logged in user session
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
try { try {
$api_instance->logoutUser(); $apiInstance->logoutUser();
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->logoutUser: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->logoutUser: ', $e->getMessage(), PHP_EOL;
} }
@ -334,12 +362,16 @@ This can only be done by the logged in user.
<?php <?php
require_once(__DIR__ . '/vendor/autoload.php'); require_once(__DIR__ . '/vendor/autoload.php');
$api_instance = new Swagger\Client\Api\UserApi(new \Http\Adapter\Guzzle6\Client()); $apiInstance = new Swagger\Client\Api\UserApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$username = "username_example"; // string | name that need to be deleted $username = "username_example"; // string | name that need to be deleted
$body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User | Updated user object $body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User | Updated user object
try { try {
$api_instance->updateUser($username, $body); $apiInstance->updateUser($username, $body);
} catch (Exception $e) { } catch (Exception $e) {
echo 'Exception when calling UserApi->updateUser: ', $e->getMessage(), PHP_EOL; echo 'Exception when calling UserApi->updateUser: ', $e->getMessage(), PHP_EOL;
} }

View File

@ -122,7 +122,8 @@ class AnotherFakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }

View File

@ -118,7 +118,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -364,7 +365,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -610,7 +612,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -856,7 +859,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1106,7 +1110,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1387,7 +1392,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1781,7 +1787,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -2050,7 +2057,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -2271,7 +2279,8 @@ class FakeApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }

View File

@ -122,7 +122,8 @@ class FakeClassnameTags123Api
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }

View File

@ -121,7 +121,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -346,7 +347,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -582,7 +584,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -846,7 +849,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1110,7 +1114,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1375,7 +1380,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1602,7 +1608,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1849,7 +1856,8 @@ class PetApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }

View File

@ -121,7 +121,8 @@ class StoreApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -344,7 +345,8 @@ class StoreApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -593,7 +595,8 @@ class StoreApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -861,7 +864,8 @@ class StoreApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }

View File

@ -121,7 +121,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -340,7 +341,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -559,7 +561,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -778,7 +781,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1003,7 +1007,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1266,7 +1271,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1533,7 +1539,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }
@ -1742,7 +1749,8 @@ class UserApi
throw new ApiException( throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}", "[{$e->getCode()}] {$e->getMessage()}",
$e->getCode(), $e->getCode(),
$e->getResponse() ? $e->getResponse()->getHeaders() : null $e->getResponse() ? $e->getResponse()->getHeaders() : null,
$e->getResponse()->getBody()->getContents()
); );
} }

View File

@ -525,7 +525,7 @@ class ApiClient(object):
content_disposition).group(1) content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename) path = os.path.join(os.path.dirname(path), filename)
with open(path, "w") as f: with open(path, "wb") as f:
f.write(response.data) f.write(response.data)
return path return path

View File

@ -0,0 +1,21 @@
#!/bin/bash
REQUIREMENTS_FILE=dev-requirements.txt
REQUIREMENTS_OUT=dev-requirements.txt.log
SETUP_OUT=*.egg-info
VENV=.venv
clean:
rm -rf $(REQUIREMENTS_OUT)
rm -rf $(SETUP_OUT)
rm -rf $(VENV)
rm -rf .tox
rm -rf .coverage
find . -name "*.py[oc]" -delete
find . -name "__pycache__" -delete
test: clean
bash ./test_python2.sh
test-all: clean
bash ./test_python2_and_3.sh

View File

@ -0,0 +1,5 @@
nose
tox
coverage
randomize
flake8

View File

@ -156,6 +156,20 @@ class ApiClient(object):
self.last_response = response_data self.last_response = response_data
return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
if _return_http_data_only:
raise tornado.gen.Return(return_data)
else:
raise tornado.gen.Return((return_data, response_data.status,
response_data.getheaders()))
def sanitize_for_serialization(self, obj): def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object. """Builds a JSON POST object.
@ -513,7 +527,7 @@ class ApiClient(object):
content_disposition).group(1) content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename) path = os.path.join(os.path.dirname(path), filename)
with open(path, "w") as f: with open(path, "wb") as f:
f.write(response.data) f.write(response.data)
return path return path

Some files were not shown because too many files have changed in this diff Show More