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).
- [ ] 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`.
- [ ] 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

View File

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

View File

@ -10,6 +10,7 @@ machine:
environment:
DOCKER_GENERATOR_IMAGE_NAME: swaggerapi/swagger-generator
DOCKER_CODEGEN_CLI_IMAGE_NAME: swaggerapi/swagger-codegen-cli
DOCKER_BUILD_TAG: 2.2.3
dependencies:
cache_directories:
@ -45,5 +46,7 @@ test:
- if [ $? -ne 0 ]; then exit 1; fi
## 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:$DOCKER_BUILD_TAG; fi; fi
## 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:$DOCKER_BUILD_TAG; fi; fi

View File

@ -48,12 +48,12 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig
embeddedTemplateDir = templateDir = "erlang-client";
setReservedWordsLowerCase(
Arrays.asList(
"after","and","andalso","band","begin","bnot","bor","bsl","bsr","bxor","case",
"catch","cond","div","end","fun","if","let","not","of","or","orelse","receive",
"rem","try","when","xor"
)
);
Arrays.asList(
"after","and","andalso","band","begin","bnot","bor","bsl","bsr","bxor","case",
"catch","cond","div","end","fun","if","let","not","of","or","orelse","receive",
"rem","try","when","xor"
)
);
instantiationTypes.clear();
@ -84,11 +84,9 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig
cliOptions.clear();
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Erlang application name (convention: lowercase).")
.defaultValue(this.packageName));
.defaultValue(this.packageName));
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "Erlang application version")
.defaultValue(this.packageVersion));
.defaultValue(this.packageVersion));
}
@Override

View File

@ -580,6 +580,17 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC
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());
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);
return ret;
}
@Override

View File

@ -150,7 +150,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
"FILE", "mutating", "protocol", "switch", "FUNCTION", "none", "public",
"where", "LINE", "nonmutating", "static", "while", "optional", "struct",
"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")
);

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -5,16 +5,16 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
{{#joda}}
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.fasterxml.jackson.datatype.joda.JodaModule;
{{/joda}}
{{#java8}}
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
{{/java8}}
{{#threetenbp}}
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
{{/threetenbp}}
{{#threetenbp}}
import org.threeten.bp.*;
import org.threeten.bp.*;
{{/threetenbp}}
import com.google.api.client.googleapis.util.Utils;
import com.google.api.client.http.AbstractHttpContent;
@ -26,9 +26,6 @@ import com.google.api.client.json.Json;
import java.io.IOException;
import java.io.OutputStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
{{>generatedAnnotation}}
public class ApiClient {
private final String basePath;

View File

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

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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_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
else
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_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
else
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}}}
/// </summary>
[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}}
}

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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_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
else
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}}}
/// </summary>
[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}}
}

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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}}}
/// </summary>
[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}}
}

View File

@ -13,7 +13,7 @@
/// Enum {{name}} for {{{value}}}
/// </summary>
[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}}
}
{{/isContainer}}

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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_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
else
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_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
else
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_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
else
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_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
else
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_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
else
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}}
{
{{#allowableValues}}
{{#values}} {{&.}}{{^-last}}, {{/-last}}
{{#values}} {{&.}}{{^isInteger}} = {{-index}}{{/isInteger}}{{^-last}}, {{/-last}}
{{/values}}
{{/allowableValues}}
};

View File

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

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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_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
else
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_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
else
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');
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
// 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
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
// $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
// 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}}
$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}}
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}}
} catch (Exception $e) {
echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;

View File

@ -130,7 +130,8 @@ use {{invokerPackage}}\ObjectSerializer;
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
$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');
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
{{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');{{/isBasic}}{{#isApiKey}}
$config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
{{/isBasic}}{{#isApiKey}}
// 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
// {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
// $config = {{{invokerPackage}}}\Configuration::getDefaultConfiguration()->setApiKeyPrefix('{{{keyParamName}}}', 'Bearer');{{/isApiKey}}{{#isOAuth}}
// 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}}
$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}}
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}}
} catch (Exception $e) {
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_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
else
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)
self.last_response = response_data
{{^tornado}}
return_data = response_data
if _preload_content:
@ -160,12 +159,20 @@ class ApiClient(object):
else:
return_data = None
{{^tornado}}
if _return_http_data_only:
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
{{/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):
"""Builds a JSON POST object.
@ -524,7 +531,7 @@ class ApiClient(object):
content_disposition).group(1)
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)
return path

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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
# python 2 and python 3 compatibility library
import six
from six.moves.urllib.parse import urlencode
import tornado
import tornado.gen
@ -50,7 +51,7 @@ class RESTClientObject(object):
# if not set certificate file, use Mozilla's root certificates.
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)
if configuration.cert_file:
self.ssl_context.load_cert_chain(
@ -121,7 +122,8 @@ class RESTClientObject(object):
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
request.body = urlencode(post_params)
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
# other content types than Json when `body` argument is provided
# in serialized form
@ -134,15 +136,24 @@ class RESTClientObject(object):
declared content type."""
raise ApiException(status=0, reason=msg)
r = yield self.pool_manager.fetch(request)
r = RESTResponse(r, r.body)
r = yield self.pool_manager.fetch(request, raise_error=False)
# log response body
logger.debug("response body: %s", r.data)
if _preload_content:
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
logger.debug("response body: %s", r.data)
if not 200 <= r.status <= 299:
raise ApiException(http_resp=r)
raise tornado.gen.Return(r)
@tornado.gen.coroutine
def GET(self, url, headers=None, query_params=None, _preload_content=True,
_request_timeout=None):

View File

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

View File

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

View File

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

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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_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
else
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_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
else
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_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
else
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_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
else
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_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
else
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_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
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -11,14 +11,20 @@ public typealias EncodeResult = (data: Data?, error: Error?)
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 {
var returnedDecodable: T? = nil
var returnedError: Error? = nil
let decoder = JSONDecoder()
decoder.dataDecodingStrategy = .base64
if #available(iOS 10.0, *) {
decoder.dateDecodingStrategy = .iso8601
if let df = self.dateformatter {
decoder.dateDecodingStrategy = .formatted(df)
} else {
decoder.dataDecodingStrategy = .base64
if #available(iOS 10.0, *) {
decoder.dateDecodingStrategy = .iso8601
}
}
do {

View File

@ -36,7 +36,7 @@ git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
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
else
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_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
else
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_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
else
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_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
else
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_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
else
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_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
else
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}}
body = ObjectSerializer.deserialize(body, "{{{returnType}}}");
{{/returnType}}
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
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_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
else
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"
/// </summary>
[EnumMember(Value = "sun")]
Sun,
Sun = 1,
/// <summary>
/// Enum Mon for "mon"
/// </summary>
[EnumMember(Value = "mon")]
Mon,
Mon = 2,
/// <summary>
/// Enum Tue for "tue"
/// </summary>
[EnumMember(Value = "tue")]
Tue,
Tue = 3,
/// <summary>
/// Enum Wed for "wed"
/// </summary>
[EnumMember(Value = "wed")]
Wed,
Wed = 4,
/// <summary>
/// Enum Thu for "thu"
/// </summary>
[EnumMember(Value = "thu")]
Thu,
Thu = 5,
/// <summary>
/// Enum Fri for "fri"
/// </summary>
[EnumMember(Value = "fri")]
Fri,
Fri = 6,
/// <summary>
/// Enum Sat for "sat"
/// </summary>
[EnumMember(Value = "sat")]
Sat
Sat = 7
}
/// <summary>

View File

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

View File

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

View File

@ -111,7 +111,7 @@
<goal>wget</goal>
</goals>
<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>
<skipCache>true</skipCache>

View File

@ -839,11 +839,13 @@
<modules>
<!-- <module>samples/server/petstore/erlang-server</module> note: make sample compilation work -->
<!-- clients -->
<module>samples/client/petstore/php/SwaggerClient-php</module>
<module>samples/client/petstore/ruby</module>
<module>samples/client/petstore/scala</module>
<module>samples/client/petstore/akka-scala</module>
<module>samples/client/petstore/javascript</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/es6-target</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
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
try {
$api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
$apiInstance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
} catch (Exception $e) {
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
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
try {
$api_instance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
$apiInstance->testCodeInjectEndRnNR($test_code_inject____end____rn_n_r);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL;
}

View File

@ -12,7 +12,7 @@ Method | HTTP request | Description
To test code injection */ ' \" =end -- \\r\\n \\n \\r
### Example
### Example
```python
from __future__ import print_function
import time
@ -24,7 +24,7 @@ from pprint import pprint
api_instance = petstore_api.FakeApi()
test_code_inject____end____rn_n_r = 'test_code_inject____end____rn_n_r_example' # str | To test code injection */ ' \" =end -- \\r\\n \\n \\r (optional)
try:
try:
# To test code injection */ ' \" =end -- \\r\\n \\n \\r
api_instance.test_code_inject____end__rn_n_r(test_code_inject____end____rn_n_r=test_code_inject____end____rn_n_r)
except ApiException as e:

View File

@ -1,9 +1,11 @@
# coding: utf-8
# flake8: noqa
"""
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
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -13,13 +15,11 @@
from __future__ import absolute_import
# import models into sdk package
from .models.model_return import ModelReturn
# import apis into sdk package
from .apis.fake_api import FakeApi
from petstore_api.api.fake_api import FakeApi
# import ApiClient
from .api_client import ApiClient
from .configuration import Configuration
from petstore_api.api_client import ApiClient
from petstore_api.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
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
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -11,27 +11,25 @@
from __future__ import absolute_import
import os
import re
import datetime
import json
import mimetypes
import tempfile
from multiprocessing.pool import ThreadPool
from datetime import date, datetime
import os
import re
import tempfile
# 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 . import models
from .configuration import Configuration
from .rest import ApiException, RESTClientObject
from petstore_api.configuration import Configuration
import petstore_api.models
from petstore_api import rest
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-
server communication, and is invariant across implementations. Specifics of
@ -42,64 +40,63 @@ class ApiClient(object):
Ref: https://github.com/swagger-api/swagger-codegen
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_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 = {
'int': int,
'long': int if PY3 else long,
'long': int if six.PY3 else long, # noqa: F821
'float': float,
'str': str,
'bool': bool,
'date': date,
'datetime': datetime,
'date': datetime.date,
'datetime': datetime.datetime,
'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:
configuration = Configuration()
self.configuration = configuration
self.pool = ThreadPool()
self.rest_client = RESTClientObject(configuration)
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/1.0.0/python'
def __del__(self):
self.pool.close()
self.pool.join()
@property
def user_agent(self):
"""
Gets user agent.
"""
"""User agent for this API client"""
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
"""
Sets user agent.
"""
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
def __call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None):
def __call_api(
self, resource_path, method, path_params=None,
query_params=None, header_params=None, body=None, post_params=None,
files=None, response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
config = self.configuration
@ -121,7 +118,9 @@ class ApiClient(object):
for k, v in path_params:
# specified safe chars, encode everything
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
if query_params:
@ -147,12 +146,11 @@ class ApiClient(object):
url = self.configuration.host + resource_path
# perform request and return response
response_data = self.request(method, url,
query_params=query_params,
headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
response_data = self.request(
method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
self.last_response = response_data
@ -167,11 +165,11 @@ class ApiClient(object):
if _return_http_data_only:
return (return_data)
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):
"""
Builds a JSON POST object.
"""Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
@ -194,7 +192,7 @@ class ApiClient(object):
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime, date)):
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
if isinstance(obj, dict):
@ -206,15 +204,14 @@ class ApiClient(object):
# Convert attribute name to json key in
# model definition for request.
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}
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):
"""
Deserializes response into an object.
"""Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: class literal for
@ -236,8 +233,7 @@ class ApiClient(object):
return self.__deserialize(data, response_type)
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 klass: class literal, or string of class name.
@ -256,21 +252,21 @@ class ApiClient(object):
if klass.startswith('dict('):
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in iteritems(data)}
for k, v in six.iteritems(data)}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
else:
klass = getattr(models, klass)
klass = getattr(petstore_api.models, klass)
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
elif klass == object:
return self.__deserialize_object(data)
elif klass == date:
elif klass == datetime.date:
return self.__deserialize_date(data)
elif klass == datetime:
elif klass == datetime.datetime:
return self.__deserialize_datatime(data)
else:
return self.__deserialize_model(data, klass)
@ -279,10 +275,10 @@ class ApiClient(object):
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None):
"""
Makes the HTTP request (synchronous) and return the deserialized data.
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
"""Makes the HTTP request (synchronous) and returns deserialized data.
To make an async request, set the async parameter.
:param resource_path: Path to method endpoint.
@ -299,13 +295,17 @@ class ApiClient(object):
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
: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,
header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will be returned without
reading/decoding response data. Default is True.
: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.
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
: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:
If async parameter is True,
the request will be called asynchronously.
@ -318,22 +318,23 @@ class ApiClient(object):
path_params, query_params, header_params,
body, post_params, files,
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:
thread = self.pool.apply_async(self.__call_api, (resource_path, method,
path_params, query_params,
thread = self.pool.apply_async(self.__call_api, (resource_path,
method, path_params, query_params,
header_params, body,
post_params, files,
response_type, auth_settings,
_return_http_data_only,
collection_formats, _preload_content, _request_timeout))
collection_formats,
_preload_content, _request_timeout))
return thread
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True, _request_timeout=None):
"""
Makes the HTTP request using RESTClient.
"""
post_params=None, body=None, _preload_content=True,
_request_timeout=None):
"""Makes the HTTP request using RESTClient."""
if method == "GET":
return self.rest_client.GET(url,
query_params=query_params,
@ -392,8 +393,7 @@ class ApiClient(object):
)
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 dict collection_formats: Parameter collection formats
@ -402,7 +402,7 @@ class ApiClient(object):
new_params = []
if collection_formats is None:
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:
collection_format = collection_formats[k]
if collection_format == 'multi':
@ -423,8 +423,7 @@ class ApiClient(object):
return new_params
def prepare_post_parameters(self, post_params=None, files=None):
"""
Builds form parameters.
"""Builds form parameters.
:param post_params: Normal form parameters.
:param files: File parameters.
@ -436,7 +435,7 @@ class ApiClient(object):
params = post_params
if files:
for k, v in iteritems(files):
for k, v in six.iteritems(files):
if not v:
continue
file_names = v if type(v) is list else [v]
@ -444,15 +443,15 @@ class ApiClient(object):
with open(n, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = mimetypes.\
guess_type(filename)[0] or 'application/octet-stream'
params.append(tuple([k, tuple([filename, filedata, mimetype])]))
mimetype = (mimetypes.guess_type(filename)[0] or
'application/octet-stream')
params.append(
tuple([k, tuple([filename, filedata, mimetype])]))
return params
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.
:return: Accept (e.g. application/json).
@ -468,8 +467,7 @@ class ApiClient(object):
return ', '.join(accepts)
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.
:return: Content-Type (e.g. application/json).
@ -485,8 +483,7 @@ class ApiClient(object):
return content_types[0]
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 querys: Query parameters tuple list to be updated.
@ -510,7 +507,8 @@ class ApiClient(object):
)
def __deserialize_file(self, response):
"""
"""Deserializes body to file
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
@ -523,19 +521,17 @@ class ApiClient(object):
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re.\
search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).\
group(1)
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition).group(1)
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)
return path
def __deserialize_primitive(self, data, klass):
"""
Deserializes string to primitive type.
"""Deserializes string to primitive type.
:param data: str.
:param klass: class literal.
@ -545,21 +541,19 @@ class ApiClient(object):
try:
return klass(data)
except UnicodeEncodeError:
return unicode(data)
return six.u(data)
except TypeError:
return data
def __deserialize_object(self, value):
"""
Return a original value.
"""Return a original value.
:return: object.
"""
return value
def __deserialize_date(self, string):
"""
Deserializes string to date.
"""Deserializes string to date.
:param string: str.
:return: date.
@ -570,14 +564,13 @@ class ApiClient(object):
except ImportError:
return string
except ValueError:
raise ApiException(
raise rest.ApiException(
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):
"""
Deserializes string to datetime.
"""Deserializes string to datetime.
The string should be in iso8601 datetime format.
@ -590,32 +583,32 @@ class ApiClient(object):
except ImportError:
return string
except ValueError:
raise ApiException(
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` into a datetime object"
"Failed to parse `{0}` as datetime object"
.format(string)
)
)
def __deserialize_model(self, data, klass):
"""
Deserializes list or dict to model.
"""Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
: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
kwargs = {}
if klass.swagger_types is not None:
for attr, attr_type in iteritems(klass.swagger_types):
if data is not None \
and klass.attribute_map[attr] in data \
and isinstance(data, (list, dict)):
for attr, attr_type in six.iteritems(klass.swagger_types):
if (data is not None and
klass.attribute_map[attr] in data and
isinstance(data, (list, dict))):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)

View File

@ -3,7 +3,7 @@
"""
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
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -13,24 +13,23 @@
from __future__ import absolute_import
import urllib3
import copy
import logging
import multiprocessing
import sys
import urllib3
from six import iteritems
from six import with_metaclass
import six
from six.moves import http_client as httplib
class TypeWithDefault(type):
def __init__(cls, name, bases, dct):
super(TypeWithDefault, cls).__init__(name, bases, dct)
cls._default = None
def __call__(cls):
if cls._default == None:
if cls._default is None:
cls._default = type.__call__(cls)
return copy.copy(cls._default)
@ -38,17 +37,15 @@ class TypeWithDefault(type):
cls._default = copy.copy(default)
class Configuration(with_metaclass(TypeWithDefault, object)):
"""
NOTE: This class is auto generated by the swagger code generator program.
class Configuration(six.with_metaclass(TypeWithDefault, object)):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""
def __init__(self):
"""
Constructor
"""
"""Constructor"""
# Default Base url
self.host = "https://petstore.swagger.io */ ' \" =end -- \\r\\n \\n \\r/v2 */ ' \" =end -- \\r\\n \\n \\r"
# Temp file folder for downloading files
@ -83,7 +80,8 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
self.debug = False
# 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
# Set this to customize the certificate file to verify the peer.
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.
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
# Proxy URL
self.proxy = None
# Safe chars for path_param
@ -109,18 +106,22 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
@property
def logger_file(self):
"""
Gets the logger_file.
"""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
@logger_file.setter
def logger_file(self, value):
"""
Sets the logger_file.
"""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.
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
@ -131,7 +132,7 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
# then add file handler and remove stream handler.
self.logger_file_handler = logging.FileHandler(self.__logger_file)
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)
if 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.
self.logger_stream_handler = logging.StreamHandler()
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)
if self.logger_file_handler:
logger.removeHandler(self.logger_file_handler)
@property
def debug(self):
"""
Gets the debug status.
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
return self.__debug
@debug.setter
def debug(self, value):
"""
Sets the debug status.
"""Debug status
:param value: The debug status, True or False.
:type: bool
@ -163,29 +165,32 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
self.__debug = value
if self.__debug:
# 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)
# turn on httplib debug
httplib.HTTPConnection.debuglevel = 1
else:
# if debug status is False, turn off debug logging,
# setting log level to default `logging.WARNING`
for _, logger in iteritems(self.logger):
for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.WARNING)
# turn off httplib debug
httplib.HTTPConnection.debuglevel = 0
@property
def logger_format(self):
"""
Gets the logger_format.
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
return self.__logger_format
@logger_format.setter
def logger_format(self, value):
"""
Sets the logger_format.
"""The 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)
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.
:return: The token for api key authentication.
"""
if self.api_key.get(identifier) and self.api_key_prefix.get(identifier):
return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier]
if (self.api_key.get(identifier) and
self.api_key_prefix.get(identifier)):
return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501
elif self.api_key.get(identifier):
return self.api_key[identifier]
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 urllib3.util.make_headers(basic_auth=self.username + ':' + self.password)\
.get('authorization')
return urllib3.util.make_headers(
basic_auth=self.username + ':' + self.password
).get('authorization')
def auth_settings(self):
"""
Gets Auth Settings dict for api client.
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
@ -242,8 +246,7 @@ class Configuration(with_metaclass(TypeWithDefault, object)):
}
def to_debug_report(self):
"""
Gets the essential information for debugging.
"""Gets the essential information for debugging.
:return: The report for debugging.
"""

View File

@ -1,9 +1,10 @@
# coding: utf-8
# flake8: noqa
"""
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
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -14,4 +15,4 @@
from __future__ import absolute_import
# 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
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
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -11,18 +11,18 @@
"""
from pprint import pformat
from six import iteritems
import re
import pprint
import re # noqa: F401
import six
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.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
@ -38,47 +38,43 @@ class ModelReturn(object):
'_return': 'return'
}
def __init__(self, _return=None):
"""
ModelReturn - a model defined in Swagger
"""
def __init__(self, _return=None): # noqa: E501
"""ModelReturn - a model defined in Swagger""" # noqa: E501
self.__return = None
self.discriminator = None
if _return is not None:
self._return = _return
self._return = _return
@property
def _return(self):
"""
Gets the _return of this ModelReturn.
property description */ ' \" =end -- \\r\\n \\n \\r
"""Gets the _return of this ModelReturn. # noqa: E501
: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
"""
return self.__return
@_return.setter
def _return(self, _return):
"""
Sets the _return of this ModelReturn.
property description */ ' \" =end -- \\r\\n \\n \\r
"""Sets the _return of this ModelReturn.
: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
"""
self.__return = _return
def to_dict(self):
"""
Returns the model properties as a dict
"""
"""Returns the model properties as a dict"""
result = {}
for attr, _ in iteritems(self.swagger_types):
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
@ -99,28 +95,20 @@ class ModelReturn(object):
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
"""Returns true if both objects are equal"""
if not isinstance(other, ModelReturn):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
"""Returns true if both objects are not equal"""
return not self == other

View File

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

View File

@ -3,7 +3,7 @@
"""
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
Contact: apiteam@swagger.io */ ' \" =end -- \\r\\n \\n \\r
@ -11,8 +11,7 @@
"""
import sys
from setuptools import setup, find_packages
from setuptools import setup, find_packages # noqa: H301
NAME = "petstore-api"
VERSION = "1.0.0"
@ -36,6 +35,6 @@ setup(
packages=find_packages(),
include_package_data=True,
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.
*/
import request = require('request');
import localVarRequest = require('request');
import http = require('http');
import Promise = require('bluebird');
@ -171,13 +171,13 @@ export interface Authentication {
/**
* Apply authentication settings to header and query params.
*/
applyToRequest(requestOptions: request.Options): void;
applyToRequest(requestOptions: localVarRequest.Options): void;
}
export class HttpBasicAuth implements Authentication {
public username: string;
public password: string;
applyToRequest(requestOptions: request.Options): void {
applyToRequest(requestOptions: localVarRequest.Options): void {
requestOptions.auth = {
username: this.username, password: this.password
}
@ -190,7 +190,7 @@ export class ApiKeyAuth implements Authentication {
constructor(private location: string, private paramName: string) {
}
applyToRequest(requestOptions: request.Options): void {
applyToRequest(requestOptions: localVarRequest.Options): void {
if (this.location == "query") {
(<any>requestOptions.qs)[this.paramName] = this.apiKey;
} else if (this.location == "header" && requestOptions && requestOptions.headers) {
@ -202,7 +202,7 @@ export class ApiKeyAuth implements Authentication {
export class OAuth implements Authentication {
public accessToken: string;
applyToRequest(requestOptions: request.Options): void {
applyToRequest(requestOptions: localVarRequest.Options): void {
if (requestOptions && requestOptions.headers) {
requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
}
@ -212,7 +212,7 @@ export class OAuth implements Authentication {
export class VoidAuth implements Authentication {
public username: string;
public password: string;
applyToRequest(_: request.Options): void {
applyToRequest(_: localVarRequest.Options): void {
// 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; }> {
const localVarPath = this.basePath + '/fake';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
let useFormData = false;
let localVarUseFormData = false;
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',
qs: queryParameters,
headers: headerParams,
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.default.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
requestOptions.form = formParams;
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
request(requestOptions, (error, response, body) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });

View File

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

View File

@ -268,7 +268,7 @@ FakeApi apiInstance = new FakeApi();
BigDecimal number = new BigDecimal(); // BigDecimal | None
Double _double = 3.4D; // Double | None
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
byte[] _byte = _byte_example; // byte[] | None
byte[] _byte = B; // byte[] | None
Integer integer = 56; // Integer | None
Integer int32 = 56; // Integer | 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_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
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git

View File

@ -4,8 +4,8 @@ import io.swagger.client.api.*;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import org.threeten.bp.*;
import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule;
import org.threeten.bp.*;
import com.google.api.client.googleapis.util.Utils;
import com.google.api.client.http.AbstractHttpContent;
import com.google.api.client.http.HttpRequestFactory;
@ -16,9 +16,6 @@ import com.google.api.client.json.Json;
import java.io.IOException;
import java.io.OutputStream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class ApiClient {
private final String basePath;

View File

@ -68,37 +68,30 @@ public class AnotherFakeApi {
}
public HttpResponse testSpecialTagsForHttpResponse(Client body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testSpecialTags");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse testSpecialTagsForHttpResponse(Client body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testSpecialTags");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/another-fake/dummy");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -111,11 +104,10 @@ public class AnotherFakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}

View File

@ -58,7 +58,6 @@ public class FakeApi {
/**
* Test serialization of outer boolean types
* <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.
* @return Boolean
* @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 {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse fakeOuterBooleanSerializeForHttpResponse(Boolean body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/boolean");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -103,11 +99,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -128,7 +123,6 @@ public class FakeApi {
/**
* Test serialization of object with outer number type
* <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.
* @return OuterComposite
* @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 {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse fakeOuterCompositeSerializeForHttpResponse(OuterComposite body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/composite");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -173,11 +164,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -198,7 +188,6 @@ public class FakeApi {
/**
* Test serialization of outer number types
* <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.
* @return BigDecimal
* @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 {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse fakeOuterNumberSerializeForHttpResponse(BigDecimal body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/number");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -243,11 +229,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -268,7 +253,6 @@ public class FakeApi {
/**
* Test serialization of outer string types
* <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.
* @return String
* @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 {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse fakeOuterStringSerializeForHttpResponse(String body, Map<String, Object> params) throws IOException {
Object postBody = body;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/outer/string");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -313,11 +294,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -352,37 +332,30 @@ public class FakeApi {
}
public HttpResponse testClientModelForHttpResponse(Client body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse testClientModelForHttpResponse(Client body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClientModel");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -395,11 +368,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -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 {
Object postBody = null;
// verify the required parameter 'number' is set
if (number == null) {
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) {
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) {
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) {
throw new IllegalArgumentException("Missing the required parameter '_byte' when calling testEndpointParameters");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
String url = uriBuilder.build().toString();
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();
}
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
if (number == null) {
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) {
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) {
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) {
throw new IllegalArgumentException("Missing the required parameter '_byte' when calling testEndpointParameters");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -519,11 +472,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -560,34 +512,31 @@ 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 {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (enumQueryStringArray != null) {
uriBuilder = uriBuilder.queryParam("enum_query_string_array", enumQueryStringArray);
}if (enumQueryString != null) {
} if (enumQueryString != null) {
uriBuilder = uriBuilder.queryParam("enum_query_string", enumQueryString);
}if (enumQueryInteger != null) {
} if (enumQueryInteger != null) {
uriBuilder = uriBuilder.queryParam("enum_query_integer", enumQueryInteger);
}
String url = uriBuilder.build().toString();
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();
}
public HttpResponse testEnumParametersForHttpResponse(Map<String, Object> params) throws IOException {
Object postBody = null;
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -600,11 +549,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -633,37 +581,30 @@ public class FakeApi {
}
public HttpResponse testInlineAdditionalPropertiesForHttpResponse(Object param) throws IOException {
Object postBody = param;
// verify the required parameter 'param' is set
if (param == null) {
throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse testInlineAdditionalPropertiesForHttpResponse(Object param, Map<String, Object> params) throws IOException {
Object postBody = param;
// verify the required parameter 'param' is set
if (param == null) {
throw new IllegalArgumentException("Missing the required parameter 'param' when calling testInlineAdditionalProperties");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/inline-additionalProperties");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -676,11 +617,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}
@ -711,47 +651,36 @@ public class FakeApi {
}
public HttpResponse testJsonFormDataForHttpResponse(String param, String param2) throws IOException {
Object postBody = null;
// verify the required parameter 'param' is set
if (param == null) {
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) {
throw new IllegalArgumentException("Missing the required parameter 'param2' when calling testJsonFormData");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/jsonFormData");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse testJsonFormDataForHttpResponse(String param, String param2, Map<String, Object> params) throws IOException {
Object postBody = null;
// verify the required parameter 'param' is set
if (param == null) {
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) {
throw new IllegalArgumentException("Missing the required parameter 'param2' when calling testJsonFormData");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake/jsonFormData");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -764,11 +693,10 @@ public class FakeApi {
}
}
String url = uriBuilder.build().toString();
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();
}

View File

@ -66,37 +66,30 @@ public class FakeClassnameTags123Api {
}
public HttpResponse testClassnameForHttpResponse(Client body) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test");
String url = uriBuilder.build().toString();
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();
}
public HttpResponse testClassnameForHttpResponse(Client body, Map<String, Object> params) throws IOException {
Object postBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new IllegalArgumentException("Missing the required parameter 'body' when calling testClassname");
}
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/fake_classname_test");
if (params == null) {
params = new HashMap<String, Object>();
}
// Copy the params argument if present, to allow passing in immutable maps
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();
Object value = entry.getValue();
@ -109,11 +102,10 @@ public class FakeClassnameTags123Api {
}
}
String url = uriBuilder.build().toString();
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();
}

View File

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

View File

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

View File

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

View File

@ -56,11 +56,15 @@ Please follow the [installation procedure](#installation--usage) and then run th
<?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
try {
$result = $api_instance->testSpecialTags($body);
$result = $apiInstance->testSpecialTags($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL;

View File

@ -19,11 +19,15 @@ To test special tags
<?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
try {
$result = $api_instance->testSpecialTags($body);
$result = $apiInstance->testSpecialTags($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AnotherFakeApi->testSpecialTags: ', $e->getMessage(), PHP_EOL;

View File

@ -27,11 +27,15 @@ Test serialization of outer boolean types
<?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
try {
$result = $api_instance->fakeOuterBooleanSerialize($body);
$result = $apiInstance->fakeOuterBooleanSerialize($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterBooleanSerialize: ', $e->getMessage(), PHP_EOL;
@ -72,11 +76,15 @@ Test serialization of object with outer number type
<?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
try {
$result = $api_instance->fakeOuterCompositeSerialize($body);
$result = $apiInstance->fakeOuterCompositeSerialize($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterCompositeSerialize: ', $e->getMessage(), PHP_EOL;
@ -117,11 +125,15 @@ Test serialization of outer number types
<?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
try {
$result = $api_instance->fakeOuterNumberSerialize($body);
$result = $apiInstance->fakeOuterNumberSerialize($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterNumberSerialize: ', $e->getMessage(), PHP_EOL;
@ -162,11 +174,15 @@ Test serialization of outer string types
<?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
try {
$result = $api_instance->fakeOuterStringSerialize($body);
$result = $apiInstance->fakeOuterStringSerialize($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->fakeOuterStringSerialize: ', $e->getMessage(), PHP_EOL;
@ -207,11 +223,15 @@ To test \"client\" model
<?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
try {
$result = $api_instance->testClientModel($body);
$result = $apiInstance->testClientModel($body);
print_r($result);
} catch (Exception $e) {
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');
// Configure HTTP basic authorization: http_basic_test
Swagger\Client\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
$config = Swagger\Client\Configuration::getDefaultConfiguration()
->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
$pattern_without_delimiter = "pattern_without_delimiter_example"; // string | None
$byte = "byte_example"; // string | None
$byte = "B"; // string | None
$integer = 56; // int | None
$int32 = 56; // int | None
$int64 = 789; // int | None
@ -273,7 +300,7 @@ $password = "password_example"; // string | None
$callback = "callback_example"; // string | None
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) {
echo 'Exception when calling FakeApi->testEndpointParameters: ', $e->getMessage(), PHP_EOL;
}
@ -326,7 +353,11 @@ To test enum parameters
<?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 = "-efg"; // string | Form parameter enum test (string)
$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)
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) {
echo 'Exception when calling FakeApi->testEnumParameters: ', $e->getMessage(), PHP_EOL;
}
@ -384,11 +415,15 @@ test inline additionalProperties
<?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
try {
$api_instance->testInlineAdditionalProperties($param);
$apiInstance->testInlineAdditionalProperties($param);
} catch (Exception $e) {
echo 'Exception when calling FakeApi->testInlineAdditionalProperties: ', $e->getMessage(), PHP_EOL;
}
@ -428,12 +463,16 @@ test json serialization of form data
<?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
$param2 = "param2_example"; // string | field2
try {
$api_instance->testJsonFormData($param, $param2);
$apiInstance->testJsonFormData($param, $param2);
} catch (Exception $e) {
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');
// 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
// 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
try {
$result = $api_instance->testClassname($body);
$result = $apiInstance->testClassname($body);
print_r($result);
} catch (Exception $e) {
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');
// 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
try {
$api_instance->addPet($body);
$apiInstance->addPet($body);
} catch (Exception $e) {
echo 'Exception when calling PetApi->addPet: ', $e->getMessage(), PHP_EOL;
}
@ -74,14 +79,19 @@ Deletes a pet
require_once(__DIR__ . '/vendor/autoload.php');
// 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
$api_key = "api_key_example"; // string |
try {
$api_instance->deletePet($pet_id, $api_key);
$apiInstance->deletePet($pet_id, $api_key);
} catch (Exception $e) {
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');
// 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
try {
$result = $api_instance->findPetsByStatus($status);
$result = $apiInstance->findPetsByStatus($status);
print_r($result);
} catch (Exception $e) {
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');
// 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
try {
$result = $api_instance->findPetsByTags($tags);
$result = $apiInstance->findPetsByTags($tags);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->findPetsByTags: ', $e->getMessage(), PHP_EOL;
@ -219,15 +239,20 @@ Returns a single pet
require_once(__DIR__ . '/vendor/autoload.php');
// 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
// 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
try {
$result = $api_instance->getPetById($pet_id);
$result = $apiInstance->getPetById($pet_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PetApi->getPetById: ', $e->getMessage(), PHP_EOL;
@ -269,13 +294,18 @@ Update an existing pet
require_once(__DIR__ . '/vendor/autoload.php');
// 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
try {
$api_instance->updatePet($body);
$apiInstance->updatePet($body);
} catch (Exception $e) {
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');
// 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
$name = "name_example"; // string | Updated name of the pet
$status = "status_example"; // string | Updated status of the pet
try {
$api_instance->updatePetWithForm($pet_id, $name, $status);
$apiInstance->updatePetWithForm($pet_id, $name, $status);
} catch (Exception $e) {
echo 'Exception when calling PetApi->updatePetWithForm: ', $e->getMessage(), PHP_EOL;
}
@ -367,15 +402,20 @@ uploads an image
require_once(__DIR__ . '/vendor/autoload.php');
// 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
$additional_metadata = "additional_metadata_example"; // string | Additional data to pass to server
$file = "/path/to/file.txt"; // \SplFileObject | file to upload
try {
$result = $api_instance->uploadFile($pet_id, $additional_metadata, $file);
$result = $apiInstance->uploadFile($pet_id, $additional_metadata, $file);
print_r($result);
} catch (Exception $e) {
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
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
try {
$api_instance->deleteOrder($order_id);
$apiInstance->deleteOrder($order_id);
} catch (Exception $e) {
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');
// 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
// 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 {
$result = $api_instance->getInventory();
$result = $apiInstance->getInventory();
print_r($result);
} catch (Exception $e) {
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
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
try {
$result = $api_instance->getOrderById($order_id);
$result = $apiInstance->getOrderById($order_id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling StoreApi->getOrderById: ', $e->getMessage(), PHP_EOL;
@ -157,11 +170,15 @@ Place an order for a pet
<?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
try {
$result = $api_instance->placeOrder($body);
$result = $apiInstance->placeOrder($body);
print_r($result);
} catch (Exception $e) {
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
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
try {
$api_instance->createUser($body);
$apiInstance->createUser($body);
} catch (Exception $e) {
echo 'Exception when calling UserApi->createUser: ', $e->getMessage(), PHP_EOL;
}
@ -70,11 +74,15 @@ Creates list of users with given input array
<?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
try {
$api_instance->createUsersWithArrayInput($body);
$apiInstance->createUsersWithArrayInput($body);
} catch (Exception $e) {
echo 'Exception when calling UserApi->createUsersWithArrayInput: ', $e->getMessage(), PHP_EOL;
}
@ -114,11 +122,15 @@ Creates list of users with given input array
<?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
try {
$api_instance->createUsersWithListInput($body);
$apiInstance->createUsersWithListInput($body);
} catch (Exception $e) {
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
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
try {
$api_instance->deleteUser($username);
$apiInstance->deleteUser($username);
} catch (Exception $e) {
echo 'Exception when calling UserApi->deleteUser: ', $e->getMessage(), PHP_EOL;
}
@ -202,11 +218,15 @@ Get user by user name
<?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.
try {
$result = $api_instance->getUserByName($username);
$result = $apiInstance->getUserByName($username);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserApi->getUserByName: ', $e->getMessage(), PHP_EOL;
@ -247,12 +267,16 @@ Logs user into the system
<?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
$password = "password_example"; // string | The password for login in clear text
try {
$result = $api_instance->loginUser($username, $password);
$result = $apiInstance->loginUser($username, $password);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserApi->loginUser: ', $e->getMessage(), PHP_EOL;
@ -294,10 +318,14 @@ Logs out current logged in user session
<?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 {
$api_instance->logoutUser();
$apiInstance->logoutUser();
} catch (Exception $e) {
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
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
$body = new \Swagger\Client\Model\User(); // \Swagger\Client\Model\User | Updated user object
try {
$api_instance->updateUser($username, $body);
$apiInstance->updateUser($username, $body);
} catch (Exception $e) {
echo 'Exception when calling UserApi->updateUser: ', $e->getMessage(), PHP_EOL;
}

View File

@ -122,7 +122,8 @@ class AnotherFakeApi
throw new ApiException(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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(
"[{$e->getCode()}] {$e->getMessage()}",
$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)
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)
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

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