forked from loafle/openapi-generator-original
Fix query parameters encoding in Java apache-httpclient (#14195)
* fix query parameters encoding in java apache-httpclient * rearrange tests * add new files
This commit is contained in:
parent
1b344597bf
commit
b8b25e8ae0
@ -16,6 +16,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
sample:
|
sample:
|
||||||
# clients
|
# clients
|
||||||
|
- samples/client/echo_api/java/apache-httpclient
|
||||||
- samples/client/echo_api/java/native
|
- samples/client/echo_api/java/native
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
8
bin/configs/java-apache-httpclient-echo-api.yaml
Normal file
8
bin/configs/java-apache-httpclient-echo-api.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
generatorName: java
|
||||||
|
outputDir: samples/client/echo_api/java/apache-httpclient
|
||||||
|
library: apache-httpclient
|
||||||
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
||||||
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
||||||
|
additionalProperties:
|
||||||
|
artifactId: echo-api-apache-httpclient
|
||||||
|
hideGenerationTimestamp: "true"
|
@ -580,9 +580,11 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
List<Pair> params = new ArrayList<Pair>();
|
List<Pair> params = new ArrayList<Pair>();
|
||||||
|
|
||||||
// preconditions
|
// preconditions
|
||||||
if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params;
|
if (name == null || name.isEmpty() || value == null || value instanceof Collection) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
params.add(new Pair(name, parameterToString(value)));
|
params.add(new Pair(name, escapeString(parameterToString(value))));
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,6 +831,10 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
if (mimeType == null || isJsonMime(mimeType)) {
|
if (mimeType == null || isJsonMime(mimeType)) {
|
||||||
// Assume json if no mime type
|
// Assume json if no mime type
|
||||||
return objectMapper.readValue(entity.getContent(), valueType);
|
return objectMapper.readValue(entity.getContent(), valueType);
|
||||||
|
} else if ("text/plain".equalsIgnoreCase(mimeType)) {
|
||||||
|
// convert input stream to string
|
||||||
|
java.util.Scanner s = new java.util.Scanner(entity.getContent()).useDelimiter("\\A");
|
||||||
|
return (T) (s.hasNext() ? s.next() : "");
|
||||||
} else {
|
} else {
|
||||||
throw new ApiException(
|
throw new ApiException(
|
||||||
"Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'",
|
"Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'",
|
||||||
@ -917,7 +923,8 @@ public class ApiClient{{#jsr310}} extends JavaTimeFormatter{{/jsr310}} {
|
|||||||
url.append("&");
|
url.append("&");
|
||||||
}
|
}
|
||||||
String value = parameterToString(param.getValue());
|
String value = parameterToString(param.getValue());
|
||||||
url.append(escapeString(param.getName())).append("=").append(escapeString(value));
|
// query parameter value already escaped as part of parameterToPair
|
||||||
|
url.append(escapeString(param.getName())).append("=").append(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,66 @@ info:
|
|||||||
servers:
|
servers:
|
||||||
- url: http://localhost:3000/
|
- url: http://localhost:3000/
|
||||||
paths:
|
paths:
|
||||||
|
# path parameter tests
|
||||||
|
/path/string/{path_string}/integer/{path_integer}:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- path
|
||||||
|
summary: Test path parameter(s)
|
||||||
|
description: Test path parameter(s)
|
||||||
|
operationId: tests/path/string/{path_string}/integer/{path_integer}
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: path_string
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- in: path
|
||||||
|
name: path_integer
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful operation
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
# query parameter tests
|
||||||
|
/query/integer/boolean/string:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- query
|
||||||
|
summary: Test query parameter(s)
|
||||||
|
description: Test query parameter(s)
|
||||||
|
operationId: test/query/integer/boolean/string
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: integer_query
|
||||||
|
style: form #default
|
||||||
|
explode: true #default
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
- in: query
|
||||||
|
name: boolean_query
|
||||||
|
style: form #default
|
||||||
|
explode: true #default
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
- in: query
|
||||||
|
name: string_query
|
||||||
|
style: form #default
|
||||||
|
explode: true #default
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Successful operation
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
/query/style_form/explode_true/array_string:
|
/query/style_form/explode_true/array_string:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
30
samples/client/echo_api/java/apache-httpclient/.github/workflows/maven.yml
vendored
Normal file
30
samples/client/echo_api/java/apache-httpclient/.github/workflows/maven.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
|
||||||
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
||||||
|
#
|
||||||
|
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
|
||||||
|
|
||||||
|
name: Java CI with Maven
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main, master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main, master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build Echo Server API
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
java: [ '8' ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
java-version: ${{ matrix.java }}
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: maven
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B package --no-transfer-progress --file pom.xml
|
21
samples/client/echo_api/java/apache-httpclient/.gitignore
vendored
Normal file
21
samples/client/echo_api/java/apache-httpclient/.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
*.class
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
||||||
|
|
||||||
|
# exclude jar for gradle wrapper
|
||||||
|
!gradle/wrapper/*.jar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
# build files
|
||||||
|
**/target
|
||||||
|
target
|
||||||
|
.gradle
|
||||||
|
build
|
@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
@ -0,0 +1,41 @@
|
|||||||
|
.github/workflows/maven.yml
|
||||||
|
.gitignore
|
||||||
|
.travis.yml
|
||||||
|
README.md
|
||||||
|
api/openapi.yaml
|
||||||
|
build.gradle
|
||||||
|
build.sbt
|
||||||
|
docs/Category.md
|
||||||
|
docs/PathApi.md
|
||||||
|
docs/Pet.md
|
||||||
|
docs/QueryApi.md
|
||||||
|
docs/Tag.md
|
||||||
|
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
|
||||||
|
git_push.sh
|
||||||
|
gradle.properties
|
||||||
|
gradle/wrapper/gradle-wrapper.jar
|
||||||
|
gradle/wrapper/gradle-wrapper.properties
|
||||||
|
gradlew
|
||||||
|
gradlew.bat
|
||||||
|
pom.xml
|
||||||
|
settings.gradle
|
||||||
|
src/main/AndroidManifest.xml
|
||||||
|
src/main/java/org/openapitools/client/ApiClient.java
|
||||||
|
src/main/java/org/openapitools/client/ApiException.java
|
||||||
|
src/main/java/org/openapitools/client/Configuration.java
|
||||||
|
src/main/java/org/openapitools/client/JavaTimeFormatter.java
|
||||||
|
src/main/java/org/openapitools/client/Pair.java
|
||||||
|
src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
||||||
|
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||||
|
src/main/java/org/openapitools/client/ServerVariable.java
|
||||||
|
src/main/java/org/openapitools/client/StringUtil.java
|
||||||
|
src/main/java/org/openapitools/client/api/PathApi.java
|
||||||
|
src/main/java/org/openapitools/client/api/QueryApi.java
|
||||||
|
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/Authentication.java
|
||||||
|
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
|
||||||
|
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
|
||||||
|
src/main/java/org/openapitools/client/model/Category.java
|
||||||
|
src/main/java/org/openapitools/client/model/Pet.java
|
||||||
|
src/main/java/org/openapitools/client/model/Tag.java
|
||||||
|
src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java
|
@ -0,0 +1 @@
|
|||||||
|
6.3.0-SNAPSHOT
|
22
samples/client/echo_api/java/apache-httpclient/.travis.yml
Normal file
22
samples/client/echo_api/java/apache-httpclient/.travis.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Generated by OpenAPI Generator: https://openapi-generator.tech
|
||||||
|
#
|
||||||
|
# Ref: https://docs.travis-ci.com/user/languages/java/
|
||||||
|
#
|
||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- openjdk12
|
||||||
|
- openjdk11
|
||||||
|
- openjdk10
|
||||||
|
- openjdk9
|
||||||
|
- openjdk8
|
||||||
|
before_install:
|
||||||
|
# ensure gradlew has proper permission
|
||||||
|
- chmod a+x ./gradlew
|
||||||
|
script:
|
||||||
|
# test using maven
|
||||||
|
#- mvn test
|
||||||
|
# test using gradle
|
||||||
|
- gradle test
|
||||||
|
# test using sbt
|
||||||
|
# - sbt test
|
136
samples/client/echo_api/java/apache-httpclient/README.md
Normal file
136
samples/client/echo_api/java/apache-httpclient/README.md
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
# echo-api-apache-httpclient
|
||||||
|
|
||||||
|
Echo Server API
|
||||||
|
|
||||||
|
- API version: 0.1.0
|
||||||
|
|
||||||
|
Echo Server API
|
||||||
|
|
||||||
|
|
||||||
|
*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Building the API client library requires:
|
||||||
|
|
||||||
|
1. Java 1.8+
|
||||||
|
2. Maven/Gradle
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To install the API client library to your local Maven repository, simply execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean install
|
||||||
|
```
|
||||||
|
|
||||||
|
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean deploy
|
||||||
|
```
|
||||||
|
|
||||||
|
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
|
||||||
|
|
||||||
|
### Maven users
|
||||||
|
|
||||||
|
Add this dependency to your project's POM:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>echo-api-apache-httpclient</artifactId>
|
||||||
|
<version>0.1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Gradle users
|
||||||
|
|
||||||
|
Add this dependency to your project's build file:
|
||||||
|
|
||||||
|
```groovy
|
||||||
|
compile "org.openapitools:echo-api-apache-httpclient:0.1.0"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Others
|
||||||
|
|
||||||
|
At first generate the JAR by executing:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
mvn clean package
|
||||||
|
```
|
||||||
|
|
||||||
|
Then manually install the following JARs:
|
||||||
|
|
||||||
|
- `target/echo-api-apache-httpclient-0.1.0.jar`
|
||||||
|
- `target/lib/*.jar`
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Please follow the [installation](#installation) instruction and execute the following Java code:
|
||||||
|
|
||||||
|
```java
|
||||||
|
|
||||||
|
import org.openapitools.client.*;
|
||||||
|
import org.openapitools.client.auth.*;
|
||||||
|
import org.openapitools.client.model.*;
|
||||||
|
import org.openapitools.client.api.PathApi;
|
||||||
|
|
||||||
|
public class PathApiExample {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
PathApi apiInstance = new PathApi(defaultClient);
|
||||||
|
String pathString = "pathString_example"; // String |
|
||||||
|
Integer pathInteger = 56; // Integer |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost:3000*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||||
|
*QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||||
|
*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||||
|
*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation for Models
|
||||||
|
|
||||||
|
- [Category](docs/Category.md)
|
||||||
|
- [Pet](docs/Pet.md)
|
||||||
|
- [Tag](docs/Tag.md)
|
||||||
|
- [TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter](docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation for Authorization
|
||||||
|
|
||||||
|
All endpoints do not require authorization.
|
||||||
|
Authentication schemes defined for the API:
|
||||||
|
|
||||||
|
## Recommendation
|
||||||
|
|
||||||
|
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
team@openapitools.org
|
||||||
|
|
196
samples/client/echo_api/java/apache-httpclient/api/openapi.yaml
Normal file
196
samples/client/echo_api/java/apache-httpclient/api/openapi.yaml
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
openapi: 3.0.3
|
||||||
|
info:
|
||||||
|
contact:
|
||||||
|
email: team@openapitools.org
|
||||||
|
description: Echo Server API
|
||||||
|
license:
|
||||||
|
name: Apache 2.0
|
||||||
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
title: Echo Server API
|
||||||
|
version: 0.1.0
|
||||||
|
servers:
|
||||||
|
- url: http://localhost:3000/
|
||||||
|
paths:
|
||||||
|
/path/string/{path_string}/integer/{path_integer}:
|
||||||
|
get:
|
||||||
|
description: Test path parameter(s)
|
||||||
|
operationId: "tests/path/string/{path_string}/integer/{path_integer}"
|
||||||
|
parameters:
|
||||||
|
- explode: false
|
||||||
|
in: path
|
||||||
|
name: path_string
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
style: simple
|
||||||
|
- explode: false
|
||||||
|
in: path
|
||||||
|
name: path_integer
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
style: simple
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test path parameter(s)
|
||||||
|
tags:
|
||||||
|
- path
|
||||||
|
x-accepts: text/plain
|
||||||
|
/query/integer/boolean/string:
|
||||||
|
get:
|
||||||
|
description: Test query parameter(s)
|
||||||
|
operationId: test/query/integer/boolean/string
|
||||||
|
parameters:
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: integer_query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
style: form
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: boolean_query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
style: form
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: string_query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
style: form
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test query parameter(s)
|
||||||
|
tags:
|
||||||
|
- query
|
||||||
|
x-accepts: text/plain
|
||||||
|
/query/style_form/explode_true/array_string:
|
||||||
|
get:
|
||||||
|
description: Test query parameter(s)
|
||||||
|
operationId: test/query/style_form/explode_true/array_string
|
||||||
|
parameters:
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: query_object
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/test_query_style_form_explode_true_array_string_query_object_parameter'
|
||||||
|
style: form
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test query parameter(s)
|
||||||
|
tags:
|
||||||
|
- query
|
||||||
|
x-accepts: text/plain
|
||||||
|
/query/style_form/explode_true/object:
|
||||||
|
get:
|
||||||
|
description: Test query parameter(s)
|
||||||
|
operationId: test/query/style_form/explode_true/object
|
||||||
|
parameters:
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: query_object
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/Pet'
|
||||||
|
style: form
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test query parameter(s)
|
||||||
|
tags:
|
||||||
|
- query
|
||||||
|
x-accepts: text/plain
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
Category:
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
example: 1
|
||||||
|
format: int64
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
example: Dogs
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
xml:
|
||||||
|
name: category
|
||||||
|
Tag:
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
format: int64
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
xml:
|
||||||
|
name: tag
|
||||||
|
Pet:
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
example: 10
|
||||||
|
format: int64
|
||||||
|
type: integer
|
||||||
|
name:
|
||||||
|
example: doggie
|
||||||
|
type: string
|
||||||
|
category:
|
||||||
|
$ref: '#/components/schemas/Category'
|
||||||
|
photoUrls:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
xml:
|
||||||
|
name: photoUrl
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
wrapped: true
|
||||||
|
tags:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Tag'
|
||||||
|
type: array
|
||||||
|
xml:
|
||||||
|
wrapped: true
|
||||||
|
status:
|
||||||
|
description: pet status in the store
|
||||||
|
enum:
|
||||||
|
- available
|
||||||
|
- pending
|
||||||
|
- sold
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- name
|
||||||
|
- photoUrls
|
||||||
|
type: object
|
||||||
|
xml:
|
||||||
|
name: pet
|
||||||
|
test_query_style_form_explode_true_array_string_query_object_parameter:
|
||||||
|
properties:
|
||||||
|
values:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
|
139
samples/client/echo_api/java/apache-httpclient/build.gradle
Normal file
139
samples/client/echo_api/java/apache-httpclient/build.gradle
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
apply plugin: 'idea'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
|
||||||
|
group = 'org.openapitools'
|
||||||
|
version = '0.1.0'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||||
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
if(hasProperty('target') && target == 'android') {
|
||||||
|
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'com.github.dcendents.android-maven'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 25
|
||||||
|
buildToolsVersion '25.0.2'
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 14
|
||||||
|
targetSdkVersion 25
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename the aar correctly
|
||||||
|
libraryVariants.all { variant ->
|
||||||
|
variant.outputs.each { output ->
|
||||||
|
def outputFile = output.outputFile
|
||||||
|
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||||
|
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||||
|
output.outputFile = new File(outputFile.parent, fileName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
android.libraryVariants.all { variant ->
|
||||||
|
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||||
|
task.description = "Create jar artifact for ${variant.name}"
|
||||||
|
task.dependsOn variant.javaCompile
|
||||||
|
task.from variant.javaCompile.destinationDir
|
||||||
|
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||||
|
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||||
|
artifacts.add('archives', task);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar) {
|
||||||
|
from android.sourceSets.main.java.srcDirs
|
||||||
|
classifier = 'sources'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
maven(MavenPublication) {
|
||||||
|
artifactId = 'echo-api-apache-httpclient'
|
||||||
|
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task execute(type:JavaExec) {
|
||||||
|
main = System.getProperty('mainClass')
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
}
|
||||||
|
|
||||||
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
|
classifier = 'sources'
|
||||||
|
from sourceSets.main.allSource
|
||||||
|
}
|
||||||
|
|
||||||
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
|
classifier = 'javadoc'
|
||||||
|
from javadoc.destinationDir
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives sourcesJar
|
||||||
|
archives javadocJar
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ext {
|
||||||
|
swagger_annotations_version = "1.6.6"
|
||||||
|
jackson_version = "2.14.1"
|
||||||
|
jackson_databind_version = "2.14.1"
|
||||||
|
jackson_databind_nullable_version = "0.2.4"
|
||||||
|
jakarta_annotation_version = "1.3.5"
|
||||||
|
httpclient_version = "4.5.13"
|
||||||
|
jodatime_version = "2.9.9"
|
||||||
|
junit_version = "4.13.2"
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||||
|
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||||
|
implementation "org.apache.httpcomponents:httpclient:$httpclient_version"
|
||||||
|
implementation "org.apache.httpcomponents:httpmime:$httpclient_version"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||||
|
implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version"
|
||||||
|
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||||
|
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||||
|
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||||
|
testImplementation "junit:junit:$junit_version"
|
||||||
|
}
|
1
samples/client/echo_api/java/apache-httpclient/build.sbt
Normal file
1
samples/client/echo_api/java/apache-httpclient/build.sbt
Normal file
@ -0,0 +1 @@
|
|||||||
|
# TODO
|
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Category
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------ | ------------- | ------------- | -------------|
|
||||||
|
|**id** | **Long** | | [optional] |
|
||||||
|
|**name** | **String** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
|||||||
|
# PathApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost:3000*
|
||||||
|
|
||||||
|
| Method | HTTP request | Description |
|
||||||
|
|------------- | ------------- | -------------|
|
||||||
|
| [**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## testsPathStringPathStringIntegerPathInteger
|
||||||
|
|
||||||
|
> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.PathApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
PathApi apiInstance = new PathApi(defaultClient);
|
||||||
|
String pathString = "pathString_example"; // String |
|
||||||
|
Integer pathInteger = 56; // Integer |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **pathString** | **String**| | |
|
||||||
|
| **pathInteger** | **Integer**| | |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
28
samples/client/echo_api/java/apache-httpclient/docs/Pet.md
Normal file
28
samples/client/echo_api/java/apache-httpclient/docs/Pet.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Pet
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------ | ------------- | ------------- | -------------|
|
||||||
|
|**id** | **Long** | | [optional] |
|
||||||
|
|**name** | **String** | | |
|
||||||
|
|**category** | [**Category**](Category.md) | | [optional] |
|
||||||
|
|**photoUrls** | **List<String>** | | |
|
||||||
|
|**tags** | [**List<Tag>**](Tag.md) | | [optional] |
|
||||||
|
|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Enum: StatusEnum
|
||||||
|
|
||||||
|
| Name | Value |
|
||||||
|
|---- | -----|
|
||||||
|
| AVAILABLE | "available" |
|
||||||
|
| PENDING | "pending" |
|
||||||
|
| SOLD | "sold" |
|
||||||
|
|
||||||
|
|
||||||
|
|
213
samples/client/echo_api/java/apache-httpclient/docs/QueryApi.md
Normal file
213
samples/client/echo_api/java/apache-httpclient/docs/QueryApi.md
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
# QueryApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost:3000*
|
||||||
|
|
||||||
|
| Method | HTTP request | Description |
|
||||||
|
|------------- | ------------- | -------------|
|
||||||
|
| [**testQueryIntegerBooleanString**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) |
|
||||||
|
| [**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
|
||||||
|
| [**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## testQueryIntegerBooleanString
|
||||||
|
|
||||||
|
> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.QueryApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||||
|
Integer integerQuery = 56; // Integer |
|
||||||
|
Boolean booleanQuery = true; // Boolean |
|
||||||
|
String stringQuery = "stringQuery_example"; // String |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling QueryApi#testQueryIntegerBooleanString");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **integerQuery** | **Integer**| | [optional] |
|
||||||
|
| **booleanQuery** | **Boolean**| | [optional] |
|
||||||
|
| **stringQuery** | **String**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testQueryStyleFormExplodeTrueArrayString
|
||||||
|
|
||||||
|
> String testQueryStyleFormExplodeTrueArrayString(queryObject)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.QueryApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||||
|
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = new HashMap(); // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueArrayString");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **queryObject** | [**TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter**](.md)| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
|
## testQueryStyleFormExplodeTrueObject
|
||||||
|
|
||||||
|
> String testQueryStyleFormExplodeTrueObject(queryObject)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.QueryApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||||
|
Pet queryObject = new HashMap(); // Pet |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testQueryStyleFormExplodeTrueObject(queryObject);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueObject");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **queryObject** | [**Pet**](.md)| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
14
samples/client/echo_api/java/apache-httpclient/docs/Tag.md
Normal file
14
samples/client/echo_api/java/apache-httpclient/docs/Tag.md
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# Tag
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------ | ------------- | ------------- | -------------|
|
||||||
|
|**id** | **Long** | | [optional] |
|
||||||
|
|**name** | **String** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
# TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------ | ------------- | ------------- | -------------|
|
||||||
|
|**values** | **List<String>** | | [optional] |
|
||||||
|
|
||||||
|
|
||||||
|
|
57
samples/client/echo_api/java/apache-httpclient/git_push.sh
Normal file
57
samples/client/echo_api/java/apache-httpclient/git_push.sh
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
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 credential in your environment."
|
||||||
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
@ -0,0 +1,6 @@
|
|||||||
|
# This file is automatically generated by OpenAPI Generator (https://github.com/openAPITools/openapi-generator).
|
||||||
|
# To include other gradle properties as part of the code generation process, please use the `gradleProperties` option.
|
||||||
|
#
|
||||||
|
# Gradle properties reference: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
|
||||||
|
# For example, uncomment below to build for Android
|
||||||
|
#target = android
|
BIN
samples/client/echo_api/java/apache-httpclient/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
samples/client/echo_api/java/apache-httpclient/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
samples/client/echo_api/java/apache-httpclient/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
samples/client/echo_api/java/apache-httpclient/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
234
samples/client/echo_api/java/apache-httpclient/gradlew
vendored
Normal file
234
samples/client/echo_api/java/apache-httpclient/gradlew
vendored
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
89
samples/client/echo_api/java/apache-httpclient/gradlew.bat
vendored
Normal file
89
samples/client/echo_api/java/apache-httpclient/gradlew.bat
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
285
samples/client/echo_api/java/apache-httpclient/pom.xml
Normal file
285
samples/client/echo_api/java/apache-httpclient/pom.xml
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>echo-api-apache-httpclient</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>echo-api-apache-httpclient</name>
|
||||||
|
<version>0.1.0</version>
|
||||||
|
<url>https://github.com/openapitools/openapi-generator</url>
|
||||||
|
<description>OpenAPI Java</description>
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:openapitools/openapi-generator.git</developerConnection>
|
||||||
|
<url>https://github.com/openapitools/openapi-generator</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>Unlicense</name>
|
||||||
|
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>OpenAPI-Generator Contributors</name>
|
||||||
|
<email>team@openapitools.org</email>
|
||||||
|
<organization>OpenAPITools.org</organization>
|
||||||
|
<organizationUrl>http://openapitools.org</organizationUrl>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.10.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<fork>true</fork>
|
||||||
|
<meminitial>128m</meminitial>
|
||||||
|
<maxmem>512m</maxmem>
|
||||||
|
<compilerArgs>
|
||||||
|
<arg>-Xlint:all</arg>
|
||||||
|
<arg>-J-Xss4m</arg><!-- Compiling the generated JSON.java file may require larger stack size. -->
|
||||||
|
</compilerArgs>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-enforcer-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>enforce-maven</id>
|
||||||
|
<goals>
|
||||||
|
<goal>enforce</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<rules>
|
||||||
|
<requireMavenVersion>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</requireMavenVersion>
|
||||||
|
</rules>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>3.0.0-M7</version>
|
||||||
|
<configuration>
|
||||||
|
<systemProperties>
|
||||||
|
<property>
|
||||||
|
<name>loggerPath</name>
|
||||||
|
<value>conf/log4j.properties</value>
|
||||||
|
</property>
|
||||||
|
</systemProperties>
|
||||||
|
<argLine>-Xms512m -Xmx1500m</argLine>
|
||||||
|
<parallel>methods</parallel>
|
||||||
|
<threadCount>10</threadCount>
|
||||||
|
<forkMode>pertest</forkMode>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- attach test jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>test-jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add_sources</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/main/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>add_test_sources</id>
|
||||||
|
<phase>generate-test-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-test-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/test/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
<configuration>
|
||||||
|
<doclint>none</doclint>
|
||||||
|
<source>1.8</source>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- @Nullable annotation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.findbugs</groupId>
|
||||||
|
<artifactId>jsr305</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- HTTP client: apache client -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpclient</artifactId>
|
||||||
|
<version>${httpclient-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpmime</artifactId>
|
||||||
|
<version>${httpclient-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JSON processing: jackson -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>${jackson-databind-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.jaxrs</groupId>
|
||||||
|
<artifactId>jackson-jaxrs-json-provider</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
<version>${jackson-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openapitools</groupId>
|
||||||
|
<artifactId>jackson-databind-nullable</artifactId>
|
||||||
|
<version>${jackson-databind-nullable-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.annotation</groupId>
|
||||||
|
<artifactId>jakarta.annotation-api</artifactId>
|
||||||
|
<version>${jakarta-annotation-version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- test dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<httpclient-version>4.5.13</httpclient-version>
|
||||||
|
<jackson-version>2.14.1</jackson-version>
|
||||||
|
<jackson-databind-version>2.14.1</jackson-databind-version>
|
||||||
|
<jackson-databind-nullable-version>0.2.4</jackson-databind-nullable-version>
|
||||||
|
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
|
||||||
|
<junit-version>4.13.2</junit-version>
|
||||||
|
</properties>
|
||||||
|
</project>
|
@ -0,0 +1 @@
|
|||||||
|
rootProject.name = "echo-api-apache-httpclient"
|
@ -0,0 +1,3 @@
|
|||||||
|
<manifest package="org.openapitools.client" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<application />
|
||||||
|
</manifest>
|
@ -0,0 +1,959 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.*;
|
||||||
|
import com.fasterxml.jackson.databind.*;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
|
|
||||||
|
import org.apache.http.Header;
|
||||||
|
import org.apache.http.HttpEntity;
|
||||||
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.HttpStatus;
|
||||||
|
import org.apache.http.NameValuePair;
|
||||||
|
import org.apache.http.ParseException;
|
||||||
|
import org.apache.http.client.config.RequestConfig;
|
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
|
import org.apache.http.client.methods.RequestBuilder;
|
||||||
|
import org.apache.http.client.protocol.HttpClientContext;
|
||||||
|
import org.apache.http.entity.ByteArrayEntity;
|
||||||
|
import org.apache.http.entity.ContentType;
|
||||||
|
import org.apache.http.entity.FileEntity;
|
||||||
|
import org.apache.http.entity.StringEntity;
|
||||||
|
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||||
|
import org.apache.http.impl.client.BasicCookieStore;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.http.impl.cookie.BasicClientCookie;
|
||||||
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.apache.http.cookie.Cookie;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.net.URI;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
|
||||||
|
import org.openapitools.client.auth.Authentication;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class ApiClient extends JavaTimeFormatter {
|
||||||
|
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||||
|
private Map<String, String> defaultCookieMap = new HashMap<String, String>();
|
||||||
|
private String basePath = "http://localhost:3000";
|
||||||
|
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
|
||||||
|
new ServerConfiguration(
|
||||||
|
"http://localhost:3000",
|
||||||
|
"No description provided",
|
||||||
|
new HashMap<String, ServerVariable>()
|
||||||
|
)
|
||||||
|
));
|
||||||
|
protected Integer serverIndex = 0;
|
||||||
|
protected Map<String, String> serverVariables = null;
|
||||||
|
private boolean debugging = false;
|
||||||
|
private int connectionTimeout = 0;
|
||||||
|
|
||||||
|
private CloseableHttpClient httpClient;
|
||||||
|
private ObjectMapper objectMapper;
|
||||||
|
protected String tempFolderPath = null;
|
||||||
|
|
||||||
|
private Map<String, Authentication> authentications;
|
||||||
|
|
||||||
|
private int statusCode;
|
||||||
|
private Map<String, List<String>> responseHeaders;
|
||||||
|
|
||||||
|
private DateFormat dateFormat;
|
||||||
|
|
||||||
|
// Methods that can have a request body
|
||||||
|
private static List<String> bodyMethods = Arrays.asList("POST", "PUT", "DELETE", "PATCH");
|
||||||
|
|
||||||
|
public ApiClient(CloseableHttpClient httpClient) {
|
||||||
|
objectMapper = new ObjectMapper();
|
||||||
|
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
objectMapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
|
||||||
|
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
|
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
|
objectMapper.registerModule(new JavaTimeModule());
|
||||||
|
objectMapper.setDateFormat(ApiClient.buildDefaultDateFormat());
|
||||||
|
|
||||||
|
dateFormat = ApiClient.buildDefaultDateFormat();
|
||||||
|
|
||||||
|
// Set default User-Agent.
|
||||||
|
setUserAgent("OpenAPI-Generator/0.1.0/java");
|
||||||
|
|
||||||
|
// Setup authentications (key: authentication name, value: authentication).
|
||||||
|
authentications = new HashMap<String, Authentication>();
|
||||||
|
// Prevent the authentications from being modified.
|
||||||
|
authentications = Collections.unmodifiableMap(authentications);
|
||||||
|
|
||||||
|
this.httpClient = httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient() {
|
||||||
|
this(HttpClients.createDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DateFormat buildDefaultDateFormat() {
|
||||||
|
return new RFC3339DateFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current object mapper used for JSON serialization/deserialization.
|
||||||
|
* <p>
|
||||||
|
* Note: If you make changes to the object mapper, remember to set it back via
|
||||||
|
* <code>setObjectMapper</code> in order to trigger HTTP client rebuilding.
|
||||||
|
* </p>
|
||||||
|
* @return Object mapper
|
||||||
|
*/
|
||||||
|
public ObjectMapper getObjectMapper() {
|
||||||
|
return objectMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the object mapper.
|
||||||
|
*
|
||||||
|
* @param objectMapper object mapper
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setObjectMapper(ObjectMapper objectMapper) {
|
||||||
|
this.objectMapper = objectMapper;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CloseableHttpClient getHttpClient() {
|
||||||
|
return httpClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the HTTP client.
|
||||||
|
*
|
||||||
|
* @param httpClient HTTP client
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setHttpClient(CloseableHttpClient httpClient) {
|
||||||
|
this.httpClient = httpClient;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBasePath() {
|
||||||
|
return basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the base path.
|
||||||
|
*
|
||||||
|
* @param basePath base path
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setBasePath(String basePath) {
|
||||||
|
this.basePath = basePath;
|
||||||
|
this.serverIndex = null;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ServerConfiguration> getServers() {
|
||||||
|
return servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the server.
|
||||||
|
*
|
||||||
|
* @param servers a list of server configuration
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setServers(List<ServerConfiguration> servers) {
|
||||||
|
this.servers = servers;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getServerIndex() {
|
||||||
|
return serverIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the server index.
|
||||||
|
*
|
||||||
|
* @param serverIndex server index
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setServerIndex(Integer serverIndex) {
|
||||||
|
this.serverIndex = serverIndex;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getServerVariables() {
|
||||||
|
return serverVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the server variables.
|
||||||
|
*
|
||||||
|
* @param serverVariables server variables
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setServerVariables(Map<String, String> serverVariables) {
|
||||||
|
this.serverVariables = serverVariables;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the status code of the previous request
|
||||||
|
*
|
||||||
|
* @return Status code
|
||||||
|
*/
|
||||||
|
public int getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the response headers of the previous request
|
||||||
|
* @return Response headers
|
||||||
|
*/
|
||||||
|
public Map<String, List<String>> getResponseHeaders() {
|
||||||
|
return responseHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get authentications (key: authentication name, value: authentication).
|
||||||
|
* @return Map of authentication
|
||||||
|
*/
|
||||||
|
public Map<String, Authentication> getAuthentications() {
|
||||||
|
return authentications;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get authentication for the given name.
|
||||||
|
*
|
||||||
|
* @param authName The authentication name
|
||||||
|
* @return The authentication, null if not found
|
||||||
|
*/
|
||||||
|
public Authentication getAuthentication(String authName) {
|
||||||
|
return authentications.get(authName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The path of temporary folder used to store downloaded files from endpoints
|
||||||
|
* with file response. The default value is <code>null</code>, i.e. using
|
||||||
|
* the system's default temporary folder.
|
||||||
|
*
|
||||||
|
* @return Temp folder path
|
||||||
|
*/
|
||||||
|
public String getTempFolderPath() {
|
||||||
|
return tempFolderPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the User-Agent header's value (by adding to the default header map).
|
||||||
|
* @param userAgent User agent
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setUserAgent(String userAgent) {
|
||||||
|
addDefaultHeader("User-Agent", userAgent);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set temp folder path
|
||||||
|
* @param tempFolderPath Temp folder path
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setTempFolderPath(String tempFolderPath) {
|
||||||
|
this.tempFolderPath = tempFolderPath;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a default header.
|
||||||
|
*
|
||||||
|
* @param key The header's key
|
||||||
|
* @param value The header's value
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient addDefaultHeader(String key, String value) {
|
||||||
|
defaultHeaderMap.put(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a default cookie.
|
||||||
|
*
|
||||||
|
* @param key The cookie's key
|
||||||
|
* @param value The cookie's value
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient addDefaultCookie(String key, String value) {
|
||||||
|
defaultCookieMap.put(key, value);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that whether debugging is enabled for this API client.
|
||||||
|
* @return True if debugging is on
|
||||||
|
*/
|
||||||
|
public boolean isDebugging() {
|
||||||
|
return debugging;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable/disable debugging for this API client.
|
||||||
|
*
|
||||||
|
* @param debugging To enable (true) or disable (false) debugging
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setDebugging(boolean debugging) {
|
||||||
|
// TODO: implement debugging mode
|
||||||
|
this.debugging = debugging;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect timeout (in milliseconds).
|
||||||
|
* @return Connection timeout
|
||||||
|
*/
|
||||||
|
public int getConnectTimeout() {
|
||||||
|
return connectionTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the connect timeout (in milliseconds).
|
||||||
|
* A value of 0 means no timeout, otherwise values must be between 1 and
|
||||||
|
* {@link Integer#MAX_VALUE}.
|
||||||
|
* @param connectionTimeout Connection timeout in milliseconds
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setConnectTimeout(int connectionTimeout) {
|
||||||
|
this.connectionTimeout = connectionTimeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the date format used to parse/format date parameters.
|
||||||
|
* @return Date format
|
||||||
|
*/
|
||||||
|
public DateFormat getDateFormat() {
|
||||||
|
return dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the date format used to parse/format date parameters.
|
||||||
|
* @param dateFormat Date format
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
|
public ApiClient setDateFormat(DateFormat dateFormat) {
|
||||||
|
this.dateFormat = dateFormat;
|
||||||
|
// Also set the date format for model (de)serialization with Date properties.
|
||||||
|
this.objectMapper.setDateFormat((DateFormat) dateFormat.clone());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the given string into Date object.
|
||||||
|
* @param str String
|
||||||
|
* @return Date
|
||||||
|
*/
|
||||||
|
public Date parseDate(String str) {
|
||||||
|
try {
|
||||||
|
return dateFormat.parse(str);
|
||||||
|
} catch (java.text.ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the given Date object into string.
|
||||||
|
* @param date Date
|
||||||
|
* @return Date in string format
|
||||||
|
*/
|
||||||
|
public String formatDate(Date date) {
|
||||||
|
return dateFormat.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format the given parameter object into string.
|
||||||
|
* @param param Object
|
||||||
|
* @return Object in string format
|
||||||
|
*/
|
||||||
|
public String parameterToString(Object param) {
|
||||||
|
if (param == null) {
|
||||||
|
return "";
|
||||||
|
} else if (param instanceof Date) {
|
||||||
|
return formatDate((Date) param);
|
||||||
|
} else if (param instanceof OffsetDateTime) {
|
||||||
|
return formatOffsetDateTime((OffsetDateTime) param);
|
||||||
|
} else if (param instanceof Collection) {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
for(Object o : (Collection<?>)param) {
|
||||||
|
if(b.length() > 0) {
|
||||||
|
b.append(',');
|
||||||
|
}
|
||||||
|
b.append(String.valueOf(o));
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
} else {
|
||||||
|
return String.valueOf(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats the specified query parameter to a list containing a single {@code Pair} object.
|
||||||
|
*
|
||||||
|
* Note that {@code value} must not be a collection.
|
||||||
|
*
|
||||||
|
* @param name The name of the parameter.
|
||||||
|
* @param value The value of the parameter.
|
||||||
|
* @return A list containing a single {@code Pair} object.
|
||||||
|
*/
|
||||||
|
public List<Pair> parameterToPair(String name, Object value) {
|
||||||
|
List<Pair> params = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
// preconditions
|
||||||
|
if (name == null || name.isEmpty() || value == null || value instanceof Collection) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
params.add(new Pair(name, escapeString(parameterToString(value))));
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Formats the specified collection query parameters to a list of {@code Pair} objects.
|
||||||
|
*
|
||||||
|
* Note that the values of each of the returned Pair objects are percent-encoded.
|
||||||
|
*
|
||||||
|
* @param collectionFormat The collection format of the parameter.
|
||||||
|
* @param name The name of the parameter.
|
||||||
|
* @param value The value of the parameter.
|
||||||
|
* @return A list of {@code Pair} objects.
|
||||||
|
*/
|
||||||
|
public List<Pair> parameterToPairs(String collectionFormat, String name, Collection value) {
|
||||||
|
List<Pair> params = new ArrayList<Pair>();
|
||||||
|
|
||||||
|
// preconditions
|
||||||
|
if (name == null || name.isEmpty() || value == null) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create the params based on the collection format
|
||||||
|
if ("multi".equals(collectionFormat)) {
|
||||||
|
for (Object item : value) {
|
||||||
|
params.add(new Pair(name, escapeString(parameterToString(item))));
|
||||||
|
}
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
// collectionFormat is assumed to be "csv" by default
|
||||||
|
String delimiter = ",";
|
||||||
|
|
||||||
|
// escape all delimiters except commas, which are URI reserved
|
||||||
|
// characters
|
||||||
|
if ("ssv".equals(collectionFormat)) {
|
||||||
|
delimiter = escapeString(" ");
|
||||||
|
} else if ("tsv".equals(collectionFormat)) {
|
||||||
|
delimiter = escapeString("\t");
|
||||||
|
} else if ("pipes".equals(collectionFormat)) {
|
||||||
|
delimiter = escapeString("|");
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder() ;
|
||||||
|
for (Object item : value) {
|
||||||
|
sb.append(delimiter);
|
||||||
|
sb.append(escapeString(parameterToString(item)));
|
||||||
|
}
|
||||||
|
|
||||||
|
params.add(new Pair(name, sb.substring(delimiter.length())));
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the given MIME is a JSON MIME.
|
||||||
|
* JSON MIME examples:
|
||||||
|
* application/json
|
||||||
|
* application/json; charset=UTF8
|
||||||
|
* APPLICATION/JSON
|
||||||
|
* application/vnd.company+json
|
||||||
|
* @param mime MIME
|
||||||
|
* @return True if MIME type is boolean
|
||||||
|
*/
|
||||||
|
public boolean isJsonMime(String mime) {
|
||||||
|
String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$";
|
||||||
|
return mime != null && (mime.matches(jsonMime) || mime.equals("*/*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the Accept header's value from the given accepts array:
|
||||||
|
* if JSON exists in the given array, use it;
|
||||||
|
* otherwise use all of them (joining into a string)
|
||||||
|
*
|
||||||
|
* @param accepts The accepts array to select from
|
||||||
|
* @return The Accept header to use. If the given array is empty,
|
||||||
|
* null will be returned (not to set the Accept header explicitly).
|
||||||
|
*/
|
||||||
|
public String selectHeaderAccept(String[] accepts) {
|
||||||
|
if (accepts.length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (String accept : accepts) {
|
||||||
|
if (isJsonMime(accept)) {
|
||||||
|
return accept;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return StringUtil.join(accepts, ",");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select the Content-Type header's value from the given array:
|
||||||
|
* if JSON exists in the given array, use it;
|
||||||
|
* otherwise use the first one of the array.
|
||||||
|
*
|
||||||
|
* @param contentTypes The Content-Type array to select from
|
||||||
|
* @return The Content-Type header to use. If the given array is empty,
|
||||||
|
* or matches "any", JSON will be used.
|
||||||
|
*/
|
||||||
|
public String selectHeaderContentType(String[] contentTypes) {
|
||||||
|
if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) {
|
||||||
|
return "application/json";
|
||||||
|
}
|
||||||
|
for (String contentType : contentTypes) {
|
||||||
|
if (isJsonMime(contentType)) {
|
||||||
|
return contentType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return contentTypes[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escape the given string to be used as URL query value.
|
||||||
|
* @param str String
|
||||||
|
* @return Escaped string
|
||||||
|
*/
|
||||||
|
public String escapeString(String str) {
|
||||||
|
try {
|
||||||
|
return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transforms response headers into map.
|
||||||
|
*
|
||||||
|
* @param headers HTTP headers
|
||||||
|
* @return a map of string array
|
||||||
|
*/
|
||||||
|
protected Map<String, List<String>> transformResponseHeaders(Header[] headers) {
|
||||||
|
Map<String, List<String>> headersMap = new HashMap<>();
|
||||||
|
for (Header header : headers) {
|
||||||
|
List<String> valuesList = headersMap.get(header.getName());
|
||||||
|
if (valuesList != null) {
|
||||||
|
valuesList.add(header.getValue());
|
||||||
|
} else {
|
||||||
|
valuesList = new ArrayList<>();
|
||||||
|
valuesList.add(header.getValue());
|
||||||
|
headersMap.put(header.getName(), valuesList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return headersMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse content type object from header value
|
||||||
|
*/
|
||||||
|
private ContentType getContentType(String headerValue) throws ApiException {
|
||||||
|
try {
|
||||||
|
return ContentType.parse(headerValue);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new ApiException("Could not parse content type " + headerValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get content type of a response or null if one was not provided
|
||||||
|
*/
|
||||||
|
private String getResponseMimeType(HttpResponse response) throws ApiException {
|
||||||
|
Header contentTypeHeader = response.getFirstHeader("Content-Type");
|
||||||
|
if (contentTypeHeader != null) {
|
||||||
|
return getContentType(contentTypeHeader.getValue()).getMimeType();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serialize the given Java object into string according the given
|
||||||
|
* Content-Type (only JSON is supported for now).
|
||||||
|
* @param obj Object
|
||||||
|
* @param contentType Content type
|
||||||
|
* @param formParams Form parameters
|
||||||
|
* @return Object
|
||||||
|
* @throws ApiException API exception
|
||||||
|
*/
|
||||||
|
public HttpEntity serialize(Object obj, Map<String, Object> formParams, ContentType contentType) throws ApiException {
|
||||||
|
String mimeType = contentType.getMimeType();
|
||||||
|
if (isJsonMime(mimeType)) {
|
||||||
|
try {
|
||||||
|
return new StringEntity(objectMapper.writeValueAsString(obj), contentType);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
} else if (mimeType.equals(ContentType.MULTIPART_FORM_DATA.getMimeType())) {
|
||||||
|
MultipartEntityBuilder multiPartBuilder = MultipartEntityBuilder.create();
|
||||||
|
for (Entry<String, Object> paramEntry : formParams.entrySet()) {
|
||||||
|
Object value = paramEntry.getValue();
|
||||||
|
if (value instanceof File) {
|
||||||
|
multiPartBuilder.addBinaryBody(paramEntry.getKey(), (File) value);
|
||||||
|
} else if (value instanceof byte[]) {
|
||||||
|
multiPartBuilder.addBinaryBody(paramEntry.getKey(), (byte[]) value);
|
||||||
|
} else {
|
||||||
|
Charset charset = contentType.getCharset();
|
||||||
|
if (charset != null) {
|
||||||
|
ContentType customContentType = ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset);
|
||||||
|
multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue()),
|
||||||
|
customContentType);
|
||||||
|
} else {
|
||||||
|
multiPartBuilder.addTextBody(paramEntry.getKey(), parameterToString(paramEntry.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return multiPartBuilder.build();
|
||||||
|
} else if (mimeType.equals(ContentType.APPLICATION_FORM_URLENCODED.getMimeType())) {
|
||||||
|
List<NameValuePair> formValues = new ArrayList<>();
|
||||||
|
for (Entry<String, Object> paramEntry : formParams.entrySet()) {
|
||||||
|
formValues.add(new BasicNameValuePair(paramEntry.getKey(), parameterToString(paramEntry.getValue())));
|
||||||
|
}
|
||||||
|
return new UrlEncodedFormEntity(formValues, contentType.getCharset());
|
||||||
|
} else {
|
||||||
|
// Handle files with unknown content type
|
||||||
|
if (obj instanceof File) {
|
||||||
|
return new FileEntity((File) obj, contentType);
|
||||||
|
} else if (obj instanceof byte[]) {
|
||||||
|
return new ByteArrayEntity((byte[]) obj, contentType);
|
||||||
|
}
|
||||||
|
throw new ApiException("Serialization for content type '" + contentType + "' not supported");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deserialize response body to Java object according to the Content-Type.
|
||||||
|
*
|
||||||
|
* @param <T> Type
|
||||||
|
* @param response Response
|
||||||
|
* @param valueType Return type
|
||||||
|
* @return Deserialized object
|
||||||
|
* @throws ApiException API exception
|
||||||
|
* @throws IOException IO exception
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <T> T deserialize(HttpResponse response, TypeReference<T> valueType) throws ApiException, IOException {
|
||||||
|
if (valueType == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
HttpEntity entity = response.getEntity();
|
||||||
|
Type valueRawType = valueType.getType();
|
||||||
|
if (valueRawType.equals(byte[].class)) {
|
||||||
|
return (T) EntityUtils.toByteArray(entity);
|
||||||
|
} else if (valueRawType.equals(File.class)) {
|
||||||
|
return (T) downloadFileFromResponse(response);
|
||||||
|
}
|
||||||
|
String mimeType = getResponseMimeType(response);
|
||||||
|
if (mimeType == null || isJsonMime(mimeType)) {
|
||||||
|
// Assume json if no mime type
|
||||||
|
return objectMapper.readValue(entity.getContent(), valueType);
|
||||||
|
} else if ("text/plain".equalsIgnoreCase(mimeType)) {
|
||||||
|
// convert input stream to string
|
||||||
|
java.util.Scanner s = new java.util.Scanner(entity.getContent()).useDelimiter("\\A");
|
||||||
|
return (T) (s.hasNext() ? s.next() : "");
|
||||||
|
} else {
|
||||||
|
throw new ApiException(
|
||||||
|
"Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'",
|
||||||
|
response.getStatusLine().getStatusCode(),
|
||||||
|
responseHeaders,
|
||||||
|
EntityUtils.toString(entity)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private File downloadFileFromResponse(HttpResponse response) throws IOException {
|
||||||
|
Header contentDispositionHeader = response.getFirstHeader("Content-Disposition");
|
||||||
|
String contentDisposition = contentDispositionHeader == null ? null : contentDispositionHeader.getValue();
|
||||||
|
File file = prepareDownloadFile(contentDisposition);
|
||||||
|
Files.copy(response.getEntity().getContent(), file.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected File prepareDownloadFile(String contentDisposition) throws IOException {
|
||||||
|
String filename = null;
|
||||||
|
if (contentDisposition != null && !"".equals(contentDisposition)) {
|
||||||
|
// Get filename from the Content-Disposition header.
|
||||||
|
Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?");
|
||||||
|
Matcher matcher = pattern.matcher(contentDisposition);
|
||||||
|
if (matcher.find())
|
||||||
|
filename = matcher.group(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
String prefix;
|
||||||
|
String suffix = null;
|
||||||
|
if (filename == null) {
|
||||||
|
prefix = "download-";
|
||||||
|
suffix = "";
|
||||||
|
} else {
|
||||||
|
int pos = filename.lastIndexOf('.');
|
||||||
|
if (pos == -1) {
|
||||||
|
prefix = filename + "-";
|
||||||
|
} else {
|
||||||
|
prefix = filename.substring(0, pos) + "-";
|
||||||
|
suffix = filename.substring(pos);
|
||||||
|
}
|
||||||
|
// Files.createTempFile requires the prefix to be at least three characters long
|
||||||
|
if (prefix.length() < 3)
|
||||||
|
prefix = "download-";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tempFolderPath == null)
|
||||||
|
return Files.createTempFile(prefix, suffix).toFile();
|
||||||
|
else
|
||||||
|
return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build full URL by concatenating base path, the given sub path and query parameters.
|
||||||
|
*
|
||||||
|
* @param path The sub path
|
||||||
|
* @param queryParams The query parameters
|
||||||
|
* @param collectionQueryParams The collection query parameters
|
||||||
|
* @return The full URL
|
||||||
|
*/
|
||||||
|
private String buildUrl(String path, List<Pair> queryParams, List<Pair> collectionQueryParams) {
|
||||||
|
String baseURL;
|
||||||
|
if (serverIndex != null) {
|
||||||
|
if (serverIndex < 0 || serverIndex >= servers.size()) {
|
||||||
|
throw new ArrayIndexOutOfBoundsException(String.format(
|
||||||
|
"Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
baseURL = servers.get(serverIndex).URL(serverVariables);
|
||||||
|
} else {
|
||||||
|
baseURL = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuilder url = new StringBuilder();
|
||||||
|
url.append(baseURL).append(path);
|
||||||
|
|
||||||
|
if (queryParams != null && !queryParams.isEmpty()) {
|
||||||
|
// support (constant) query string in `path`, e.g. "/posts?draft=1"
|
||||||
|
String prefix = path.contains("?") ? "&" : "?";
|
||||||
|
for (Pair param : queryParams) {
|
||||||
|
if (param.getValue() != null) {
|
||||||
|
if (prefix != null) {
|
||||||
|
url.append(prefix);
|
||||||
|
prefix = null;
|
||||||
|
} else {
|
||||||
|
url.append("&");
|
||||||
|
}
|
||||||
|
String value = parameterToString(param.getValue());
|
||||||
|
// query parameter value already escaped as part of parameterToPair
|
||||||
|
url.append(escapeString(param.getName())).append("=").append(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) {
|
||||||
|
String prefix = url.toString().contains("?") ? "&" : "?";
|
||||||
|
for (Pair param : collectionQueryParams) {
|
||||||
|
if (param.getValue() != null) {
|
||||||
|
if (prefix != null) {
|
||||||
|
url.append(prefix);
|
||||||
|
prefix = null;
|
||||||
|
} else {
|
||||||
|
url.append("&");
|
||||||
|
}
|
||||||
|
String value = parameterToString(param.getValue());
|
||||||
|
// collection query parameter value already escaped as part of parameterToPairs
|
||||||
|
url.append(escapeString(param.getName())).append("=").append(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return url.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isSuccessfulStatus(int statusCode) {
|
||||||
|
return statusCode >= 200 && statusCode < 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isBodyAllowed(String method) {
|
||||||
|
return bodyMethods.contains(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Cookie buildCookie(String key, String value, URI uri) {
|
||||||
|
BasicClientCookie cookie = new BasicClientCookie(key, value);
|
||||||
|
cookie.setDomain(uri.getHost());
|
||||||
|
cookie.setPath("/");
|
||||||
|
return cookie;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected <T> T processResponse(CloseableHttpResponse response, TypeReference<T> returnType) throws ApiException, IOException {
|
||||||
|
statusCode = response.getStatusLine().getStatusCode();
|
||||||
|
if (statusCode == HttpStatus.SC_NO_CONTENT) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
responseHeaders = transformResponseHeaders(response.getAllHeaders());
|
||||||
|
if (isSuccessfulStatus(statusCode)) {
|
||||||
|
return this.deserialize(response, returnType);
|
||||||
|
} else {
|
||||||
|
String message = EntityUtils.toString(response.getEntity());
|
||||||
|
throw new ApiException(message, statusCode, responseHeaders, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoke API by sending HTTP request with the given options.
|
||||||
|
*
|
||||||
|
* @param <T> Type
|
||||||
|
* @param path The sub-path of the HTTP URL
|
||||||
|
* @param method The request method, one of "GET", "POST", "PUT", and "DELETE"
|
||||||
|
* @param queryParams The query parameters
|
||||||
|
* @param collectionQueryParams The collection query parameters
|
||||||
|
* @param body The request body object - if it is not binary, otherwise null
|
||||||
|
* @param headerParams The header parameters
|
||||||
|
* @param cookieParams The cookie parameters
|
||||||
|
* @param formParams The form parameters
|
||||||
|
* @param accept The request's Accept header
|
||||||
|
* @param contentType The request's Content-Type header
|
||||||
|
* @param authNames The authentications to apply
|
||||||
|
* @param returnType Return type
|
||||||
|
* @return The response body in type of string
|
||||||
|
* @throws ApiException API exception
|
||||||
|
*/
|
||||||
|
public <T> T invokeAPI(
|
||||||
|
String path,
|
||||||
|
String method,
|
||||||
|
List<Pair> queryParams,
|
||||||
|
List<Pair> collectionQueryParams,
|
||||||
|
Object body,
|
||||||
|
Map<String, String> headerParams,
|
||||||
|
Map<String, String> cookieParams,
|
||||||
|
Map<String, Object> formParams,
|
||||||
|
String accept,
|
||||||
|
String contentType,
|
||||||
|
String[] authNames,
|
||||||
|
TypeReference<T> returnType) throws ApiException {
|
||||||
|
if (body != null && !formParams.isEmpty()) {
|
||||||
|
throw new ApiException("Cannot have body and form params");
|
||||||
|
}
|
||||||
|
|
||||||
|
updateParamsForAuth(authNames, queryParams, headerParams, cookieParams);
|
||||||
|
final String url = buildUrl(path, queryParams, collectionQueryParams);
|
||||||
|
|
||||||
|
RequestBuilder builder = RequestBuilder.create(method);
|
||||||
|
builder.setUri(url);
|
||||||
|
|
||||||
|
RequestConfig config = RequestConfig.custom()
|
||||||
|
.setConnectionRequestTimeout(connectionTimeout)
|
||||||
|
.build();
|
||||||
|
builder.setConfig(config);
|
||||||
|
|
||||||
|
if (accept != null) {
|
||||||
|
builder.addHeader("Accept", accept);
|
||||||
|
}
|
||||||
|
for (Entry<String, String> keyValue : headerParams.entrySet()) {
|
||||||
|
builder.addHeader(keyValue.getKey(), keyValue.getValue());
|
||||||
|
}
|
||||||
|
for (Map.Entry<String,String> keyValue : defaultHeaderMap.entrySet()) {
|
||||||
|
if (!headerParams.containsKey(keyValue.getKey())) {
|
||||||
|
builder.addHeader(keyValue.getKey(), keyValue.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BasicCookieStore store = new BasicCookieStore();
|
||||||
|
for (Entry<String, String> keyValue : cookieParams.entrySet()) {
|
||||||
|
store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri()));
|
||||||
|
}
|
||||||
|
for (Entry<String,String> keyValue : defaultCookieMap.entrySet()) {
|
||||||
|
if (!cookieParams.containsKey(keyValue.getKey())) {
|
||||||
|
store.addCookie(buildCookie(keyValue.getKey(), keyValue.getValue(), builder.getUri()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpClientContext context = HttpClientContext.create();
|
||||||
|
context.setCookieStore(store);
|
||||||
|
|
||||||
|
ContentType contentTypeObj = getContentType(contentType);
|
||||||
|
if (body != null || !formParams.isEmpty()) {
|
||||||
|
if (isBodyAllowed(method)) {
|
||||||
|
// Add entity if we have content and a valid method
|
||||||
|
builder.setEntity(serialize(body, formParams, contentTypeObj));
|
||||||
|
} else {
|
||||||
|
throw new ApiException("method " + method + " does not support a request body");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try (CloseableHttpResponse response = httpClient.execute(builder.build(), context)) {
|
||||||
|
return processResponse(response, returnType);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update query and header parameters based on authentication settings.
|
||||||
|
*
|
||||||
|
* @param authNames The authentications to apply
|
||||||
|
* @param queryParams Query parameters
|
||||||
|
* @param headerParams Header parameters
|
||||||
|
* @param cookieParams Cookie parameters
|
||||||
|
*/
|
||||||
|
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
|
for (String authName : authNames) {
|
||||||
|
Authentication auth = authentications.get(authName);
|
||||||
|
if (auth == null) throw new RuntimeException("Authentication undefined: " + authName);
|
||||||
|
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class ApiException extends Exception {
|
||||||
|
private int code = 0;
|
||||||
|
private Map<String, List<String>> responseHeaders = null;
|
||||||
|
private String responseBody = null;
|
||||||
|
|
||||||
|
public ApiException() {}
|
||||||
|
|
||||||
|
public ApiException(Throwable throwable) {
|
||||||
|
super(throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
super(message, throwable);
|
||||||
|
this.code = code;
|
||||||
|
this.responseHeaders = responseHeaders;
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
this(message, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, Throwable throwable, int code, Map<String, List<String>> responseHeaders) {
|
||||||
|
this(message, throwable, code, responseHeaders, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, String message) {
|
||||||
|
super(message);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, String message, Map<String, List<String>> responseHeaders, String responseBody) {
|
||||||
|
this(code, message);
|
||||||
|
this.responseHeaders = responseHeaders;
|
||||||
|
this.responseBody = responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP status code.
|
||||||
|
*
|
||||||
|
* @return HTTP status code
|
||||||
|
*/
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP response headers.
|
||||||
|
*
|
||||||
|
* @return A map of list of string
|
||||||
|
*/
|
||||||
|
public Map<String, List<String>> getResponseHeaders() {
|
||||||
|
return responseHeaders;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the HTTP response body.
|
||||||
|
*
|
||||||
|
* @return Response body in the form of string
|
||||||
|
*/
|
||||||
|
public String getResponseBody() {
|
||||||
|
return responseBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ApiException{" +
|
||||||
|
"code=" + code +
|
||||||
|
", responseHeaders=" + responseHeaders +
|
||||||
|
", responseBody='" + responseBody + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class Configuration {
|
||||||
|
private static ApiClient defaultApiClient = new ApiClient();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the default API client, which would be used when creating API
|
||||||
|
* instances without providing an API client.
|
||||||
|
*
|
||||||
|
* @return Default API client
|
||||||
|
*/
|
||||||
|
public static ApiClient getDefaultApiClient() {
|
||||||
|
return defaultApiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default API client, which would be used when creating API
|
||||||
|
* instances without providing an API client.
|
||||||
|
*
|
||||||
|
* @param apiClient API client
|
||||||
|
*/
|
||||||
|
public static void setDefaultApiClient(ApiClient apiClient) {
|
||||||
|
defaultApiClient = apiClient;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that add parsing/formatting support for Java 8+ {@code OffsetDateTime} class.
|
||||||
|
* It's generated for java clients when {@code AbstractJavaCodegen#dateLibrary} specified as {@code java8}.
|
||||||
|
*/
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class JavaTimeFormatter {
|
||||||
|
|
||||||
|
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||||
|
* @return DateTimeFormatter
|
||||||
|
*/
|
||||||
|
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||||
|
return offsetDateTimeFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||||
|
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||||
|
*/
|
||||||
|
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||||
|
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the given string into {@code OffsetDateTime} object.
|
||||||
|
* @param str String
|
||||||
|
* @return {@code OffsetDateTime}
|
||||||
|
*/
|
||||||
|
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||||
|
try {
|
||||||
|
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||||
|
} catch (DateTimeParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Format the given {@code OffsetDateTime} object into string.
|
||||||
|
* @param offsetDateTime {@code OffsetDateTime}
|
||||||
|
* @return {@code OffsetDateTime} in string format
|
||||||
|
*/
|
||||||
|
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||||
|
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class Pair {
|
||||||
|
private String name = "";
|
||||||
|
private String value = "";
|
||||||
|
|
||||||
|
public Pair (String name, String value) {
|
||||||
|
setName(name);
|
||||||
|
setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setName(String name) {
|
||||||
|
if (!isValidString(name)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setValue(String value) {
|
||||||
|
if (!isValidString(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidString(String arg) {
|
||||||
|
if (arg == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.util.StdDateFormat;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.FieldPosition;
|
||||||
|
import java.text.ParsePosition;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
public class RFC3339DateFormat extends DateFormat {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
|
||||||
|
|
||||||
|
private final StdDateFormat fmt = new StdDateFormat()
|
||||||
|
.withTimeZone(TIMEZONE_Z)
|
||||||
|
.withColonInTimeZone(true);
|
||||||
|
|
||||||
|
public RFC3339DateFormat() {
|
||||||
|
this.calendar = new GregorianCalendar();
|
||||||
|
this.numberFormat = new DecimalFormat();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date parse(String source) {
|
||||||
|
return parse(source, new ParsePosition(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date parse(String source, ParsePosition pos) {
|
||||||
|
return fmt.parse(source, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
|
||||||
|
return fmt.format(date, toAppendTo, fieldPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
return super.clone();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server configuration.
|
||||||
|
*/
|
||||||
|
public class ServerConfiguration {
|
||||||
|
public String URL;
|
||||||
|
public String description;
|
||||||
|
public Map<String, ServerVariable> variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param URL A URL to the target host.
|
||||||
|
* @param description A description of the host designated by the URL.
|
||||||
|
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||||
|
*/
|
||||||
|
public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) {
|
||||||
|
this.URL = URL;
|
||||||
|
this.description = description;
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using given variables.
|
||||||
|
*
|
||||||
|
* @param variables A map between a variable name and its value.
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL(Map<String, String> variables) {
|
||||||
|
String url = this.URL;
|
||||||
|
|
||||||
|
// go through variables and replace placeholders
|
||||||
|
for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) {
|
||||||
|
String name = variable.getKey();
|
||||||
|
ServerVariable serverVariable = variable.getValue();
|
||||||
|
String value = serverVariable.defaultValue;
|
||||||
|
|
||||||
|
if (variables != null && variables.containsKey(name)) {
|
||||||
|
value = variables.get(name);
|
||||||
|
if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) {
|
||||||
|
throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + ".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url = url.replace("{" + name + "}", value);
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format URL template using default server variables.
|
||||||
|
*
|
||||||
|
* @return Formatted URL.
|
||||||
|
*/
|
||||||
|
public String URL() {
|
||||||
|
return URL(null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Representing a Server Variable for server URL template substitution.
|
||||||
|
*/
|
||||||
|
public class ServerVariable {
|
||||||
|
public String description;
|
||||||
|
public String defaultValue;
|
||||||
|
public HashSet<String> enumValues = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description A description for the server variable.
|
||||||
|
* @param defaultValue The default value to use for substitution.
|
||||||
|
* @param enumValues An enumeration of string values to be used if the substitution options are from a limited set.
|
||||||
|
*/
|
||||||
|
public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) {
|
||||||
|
this.description = description;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.enumValues = enumValues;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class StringUtil {
|
||||||
|
/**
|
||||||
|
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||||
|
*
|
||||||
|
* @param array The array
|
||||||
|
* @param value The value to search
|
||||||
|
* @return true if the array contains the value
|
||||||
|
*/
|
||||||
|
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||||
|
for (String str : array) {
|
||||||
|
if (value == null && str == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (value != null && value.equalsIgnoreCase(str)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join an array of strings with the given separator.
|
||||||
|
* <p>
|
||||||
|
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||||
|
* if one of those libraries is added as dependency.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param array The array of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(String[] array, String separator) {
|
||||||
|
int len = array.length;
|
||||||
|
if (len == 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
out.append(array[0]);
|
||||||
|
for (int i = 1; i < len; i++) {
|
||||||
|
out.append(separator).append(array[i]);
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Join a list of strings with the given separator.
|
||||||
|
*
|
||||||
|
* @param list The list of strings
|
||||||
|
* @param separator The separator
|
||||||
|
* @return the resulting string
|
||||||
|
*/
|
||||||
|
public static String join(Collection<String> list, String separator) {
|
||||||
|
Iterator<String> iterator = list.iterator();
|
||||||
|
StringBuilder out = new StringBuilder();
|
||||||
|
if (iterator.hasNext()) {
|
||||||
|
out.append(iterator.next());
|
||||||
|
}
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
out.append(separator).append(iterator.next());
|
||||||
|
}
|
||||||
|
return out.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.model.*;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class PathApi {
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
public PathApi() {
|
||||||
|
this(Configuration.getDefaultApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PathApi(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient getApiClient() {
|
||||||
|
return apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiClient(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test path parameter(s)
|
||||||
|
* Test path parameter(s)
|
||||||
|
* @param pathString (required)
|
||||||
|
* @param pathInteger (required)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testsPathStringPathStringIntegerPathInteger(String pathString, Integer pathInteger) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// verify the required parameter 'pathString' is set
|
||||||
|
if (pathString == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathInteger");
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify the required parameter 'pathInteger' is set
|
||||||
|
if (pathInteger == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathInteger");
|
||||||
|
}
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/path/string/{path_string}/integer/{path_integer}"
|
||||||
|
.replaceAll("\\{" + "path_string" + "\\}", apiClient.escapeString(pathString.toString()))
|
||||||
|
.replaceAll("\\{" + "path_integer" + "\\}", apiClient.escapeString(pathInteger.toString()));
|
||||||
|
|
||||||
|
// query params
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> localVarCookieParams = new HashMap<String, String>();
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"text/plain"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
|
||||||
|
return apiClient.invokeAPI(
|
||||||
|
localVarPath,
|
||||||
|
"GET",
|
||||||
|
localVarQueryParams,
|
||||||
|
localVarCollectionQueryParams,
|
||||||
|
localVarPostBody,
|
||||||
|
localVarHeaderParams,
|
||||||
|
localVarCookieParams,
|
||||||
|
localVarFormParams,
|
||||||
|
localVarAccept,
|
||||||
|
localVarContentType,
|
||||||
|
localVarAuthNames,
|
||||||
|
localVarReturnType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,217 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.model.*;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import org.openapitools.client.model.Pet;
|
||||||
|
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class QueryApi {
|
||||||
|
private ApiClient apiClient;
|
||||||
|
|
||||||
|
public QueryApi() {
|
||||||
|
this(Configuration.getDefaultApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public QueryApi(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiClient getApiClient() {
|
||||||
|
return apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiClient(ApiClient apiClient) {
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param integerQuery (optional)
|
||||||
|
* @param booleanQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testQueryIntegerBooleanString(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/query/integer/boolean/string";
|
||||||
|
|
||||||
|
// query params
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> localVarCookieParams = new HashMap<String, String>();
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("integer_query", integerQuery));
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("boolean_query", booleanQuery));
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("string_query", stringQuery));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"text/plain"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
|
||||||
|
return apiClient.invokeAPI(
|
||||||
|
localVarPath,
|
||||||
|
"GET",
|
||||||
|
localVarQueryParams,
|
||||||
|
localVarCollectionQueryParams,
|
||||||
|
localVarPostBody,
|
||||||
|
localVarHeaderParams,
|
||||||
|
localVarCookieParams,
|
||||||
|
localVarFormParams,
|
||||||
|
localVarAccept,
|
||||||
|
localVarContentType,
|
||||||
|
localVarAuthNames,
|
||||||
|
localVarReturnType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testQueryStyleFormExplodeTrueArrayString(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/query/style_form/explode_true/array_string";
|
||||||
|
|
||||||
|
// query params
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> localVarCookieParams = new HashMap<String, String>();
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "values", queryObject.getValues()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"text/plain"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
|
||||||
|
return apiClient.invokeAPI(
|
||||||
|
localVarPath,
|
||||||
|
"GET",
|
||||||
|
localVarQueryParams,
|
||||||
|
localVarCollectionQueryParams,
|
||||||
|
localVarPostBody,
|
||||||
|
localVarHeaderParams,
|
||||||
|
localVarCookieParams,
|
||||||
|
localVarFormParams,
|
||||||
|
localVarAccept,
|
||||||
|
localVarContentType,
|
||||||
|
localVarAuthNames,
|
||||||
|
localVarReturnType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param queryObject (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testQueryStyleFormExplodeTrueObject(Pet queryObject) throws ApiException {
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// create path and map variables
|
||||||
|
String localVarPath = "/query/style_form/explode_true/object";
|
||||||
|
|
||||||
|
// query params
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<Pair>();
|
||||||
|
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
|
||||||
|
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
|
||||||
|
Map<String, String> localVarCookieParams = new HashMap<String, String>();
|
||||||
|
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("id", queryObject.getId()));
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("name", queryObject.getName()));
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("category", queryObject.getCategory()));
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "photoUrls", queryObject.getPhotoUrls()));
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPairs("multi", "tags", queryObject.getTags()));
|
||||||
|
localVarQueryParams.addAll(apiClient.parameterToPair("status", queryObject.getStatus()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
final String[] localVarAccepts = {
|
||||||
|
"text/plain"
|
||||||
|
};
|
||||||
|
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
|
||||||
|
|
||||||
|
final String[] localVarContentTypes = {
|
||||||
|
|
||||||
|
};
|
||||||
|
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
|
||||||
|
|
||||||
|
String[] localVarAuthNames = new String[] { };
|
||||||
|
|
||||||
|
TypeReference<String> localVarReturnType = new TypeReference<String>() {};
|
||||||
|
return apiClient.invokeAPI(
|
||||||
|
localVarPath,
|
||||||
|
"GET",
|
||||||
|
localVarQueryParams,
|
||||||
|
localVarCollectionQueryParams,
|
||||||
|
localVarPostBody,
|
||||||
|
localVarHeaderParams,
|
||||||
|
localVarCookieParams,
|
||||||
|
localVarFormParams,
|
||||||
|
localVarAccept,
|
||||||
|
localVarContentType,
|
||||||
|
localVarAuthNames,
|
||||||
|
localVarReturnType
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class ApiKeyAuth implements Authentication {
|
||||||
|
private final String location;
|
||||||
|
private final String paramName;
|
||||||
|
|
||||||
|
private String apiKey;
|
||||||
|
private String apiKeyPrefix;
|
||||||
|
|
||||||
|
public ApiKeyAuth(String location, String paramName) {
|
||||||
|
this.location = location;
|
||||||
|
this.paramName = paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamName() {
|
||||||
|
return paramName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKey() {
|
||||||
|
return apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
this.apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKeyPrefix() {
|
||||||
|
return apiKeyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKeyPrefix(String apiKeyPrefix) {
|
||||||
|
this.apiKeyPrefix = apiKeyPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
|
if (apiKey == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String value;
|
||||||
|
if (apiKeyPrefix != null) {
|
||||||
|
value = apiKeyPrefix + " " + apiKey;
|
||||||
|
} else {
|
||||||
|
value = apiKey;
|
||||||
|
}
|
||||||
|
if ("query".equals(location)) {
|
||||||
|
queryParams.add(new Pair(paramName, value));
|
||||||
|
} else if ("header".equals(location)) {
|
||||||
|
headerParams.put(paramName, value);
|
||||||
|
} else if ("cookie".equals(location)) {
|
||||||
|
cookieParams.put(paramName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface Authentication {
|
||||||
|
/**
|
||||||
|
* Apply authentication settings to header and query params.
|
||||||
|
*
|
||||||
|
* @param queryParams List of query parameters
|
||||||
|
* @param headerParams Map of header parameters
|
||||||
|
* @param cookieParams Map of cookie parameters
|
||||||
|
*/
|
||||||
|
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams);
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.util.Base64;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class HttpBasicAuth implements Authentication {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
|
if (username == null && password == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
|
||||||
|
headerParams.put("Authorization", "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8)));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.auth;
|
||||||
|
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class HttpBearerAuth implements Authentication {
|
||||||
|
private final String scheme;
|
||||||
|
private String bearerToken;
|
||||||
|
|
||||||
|
public HttpBearerAuth(String scheme) {
|
||||||
|
this.scheme = scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||||
|
*
|
||||||
|
* @return The bearer token
|
||||||
|
*/
|
||||||
|
public String getBearerToken() {
|
||||||
|
return bearerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the token, which together with the scheme, will be sent as the value of the Authorization header.
|
||||||
|
*
|
||||||
|
* @param bearerToken The bearer token to send in the Authorization header
|
||||||
|
*/
|
||||||
|
public void setBearerToken(String bearerToken) {
|
||||||
|
this.bearerToken = bearerToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
|
||||||
|
if(bearerToken == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String upperCaseBearer(String scheme) {
|
||||||
|
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Category
|
||||||
|
*/
|
||||||
|
@JsonPropertyOrder({
|
||||||
|
Category.JSON_PROPERTY_ID,
|
||||||
|
Category.JSON_PROPERTY_NAME
|
||||||
|
})
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class Category {
|
||||||
|
public static final String JSON_PROPERTY_ID = "id";
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_NAME = "name";
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public Category() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Category id(Long id) {
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_ID)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_ID)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Category name(String name) {
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_NAME)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NAME)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Category category = (Category) o;
|
||||||
|
return Objects.equals(this.id, category.id) &&
|
||||||
|
Objects.equals(this.name, category.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Category {\n");
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,318 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.openapitools.client.model.Category;
|
||||||
|
import org.openapitools.client.model.Tag;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pet
|
||||||
|
*/
|
||||||
|
@JsonPropertyOrder({
|
||||||
|
Pet.JSON_PROPERTY_ID,
|
||||||
|
Pet.JSON_PROPERTY_NAME,
|
||||||
|
Pet.JSON_PROPERTY_CATEGORY,
|
||||||
|
Pet.JSON_PROPERTY_PHOTO_URLS,
|
||||||
|
Pet.JSON_PROPERTY_TAGS,
|
||||||
|
Pet.JSON_PROPERTY_STATUS
|
||||||
|
})
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class Pet {
|
||||||
|
public static final String JSON_PROPERTY_ID = "id";
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_NAME = "name";
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_CATEGORY = "category";
|
||||||
|
private Category category;
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls";
|
||||||
|
private List<String> photoUrls = new ArrayList<>();
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_TAGS = "tags";
|
||||||
|
private List<Tag> tags = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pet status in the store
|
||||||
|
*/
|
||||||
|
public enum StatusEnum {
|
||||||
|
AVAILABLE("available"),
|
||||||
|
|
||||||
|
PENDING("pending"),
|
||||||
|
|
||||||
|
SOLD("sold");
|
||||||
|
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
StatusEnum(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public static StatusEnum fromValue(String value) {
|
||||||
|
for (StatusEnum b : StatusEnum.values()) {
|
||||||
|
if (b.value.equals(value)) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_STATUS = "status";
|
||||||
|
private StatusEnum status;
|
||||||
|
|
||||||
|
public Pet() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pet id(Long id) {
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_ID)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_ID)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Pet name(String name) {
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nonnull
|
||||||
|
@JsonProperty(JSON_PROPERTY_NAME)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NAME)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Pet category(Category category) {
|
||||||
|
|
||||||
|
this.category = category;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get category
|
||||||
|
* @return category
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_CATEGORY)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public Category getCategory() {
|
||||||
|
return category;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_CATEGORY)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setCategory(Category category) {
|
||||||
|
this.category = category;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Pet photoUrls(List<String> photoUrls) {
|
||||||
|
|
||||||
|
this.photoUrls = photoUrls;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pet addPhotoUrlsItem(String photoUrlsItem) {
|
||||||
|
this.photoUrls.add(photoUrlsItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get photoUrls
|
||||||
|
* @return photoUrls
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nonnull
|
||||||
|
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||||
|
|
||||||
|
public List<String> getPhotoUrls() {
|
||||||
|
return photoUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_PHOTO_URLS)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.ALWAYS)
|
||||||
|
public void setPhotoUrls(List<String> photoUrls) {
|
||||||
|
this.photoUrls = photoUrls;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Pet tags(List<Tag> tags) {
|
||||||
|
|
||||||
|
this.tags = tags;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pet addTagsItem(Tag tagsItem) {
|
||||||
|
if (this.tags == null) {
|
||||||
|
this.tags = new ArrayList<>();
|
||||||
|
}
|
||||||
|
this.tags.add(tagsItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get tags
|
||||||
|
* @return tags
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_TAGS)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public List<Tag> getTags() {
|
||||||
|
return tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_TAGS)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setTags(List<Tag> tags) {
|
||||||
|
this.tags = tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Pet status(StatusEnum status) {
|
||||||
|
|
||||||
|
this.status = status;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pet status in the store
|
||||||
|
* @return status
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_STATUS)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public StatusEnum getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_STATUS)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setStatus(StatusEnum status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Pet pet = (Pet) o;
|
||||||
|
return Objects.equals(this.id, pet.id) &&
|
||||||
|
Objects.equals(this.name, pet.name) &&
|
||||||
|
Objects.equals(this.category, pet.category) &&
|
||||||
|
Objects.equals(this.photoUrls, pet.photoUrls) &&
|
||||||
|
Objects.equals(this.tags, pet.tags) &&
|
||||||
|
Objects.equals(this.status, pet.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name, category, photoUrls, tags, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Pet {\n");
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append(" category: ").append(toIndentedString(category)).append("\n");
|
||||||
|
sb.append(" photoUrls: ").append(toIndentedString(photoUrls)).append("\n");
|
||||||
|
sb.append(" tags: ").append(toIndentedString(tags)).append("\n");
|
||||||
|
sb.append(" status: ").append(toIndentedString(status)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,136 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tag
|
||||||
|
*/
|
||||||
|
@JsonPropertyOrder({
|
||||||
|
Tag.JSON_PROPERTY_ID,
|
||||||
|
Tag.JSON_PROPERTY_NAME
|
||||||
|
})
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class Tag {
|
||||||
|
public static final String JSON_PROPERTY_ID = "id";
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
public static final String JSON_PROPERTY_NAME = "name";
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public Tag() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tag id(Long id) {
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get id
|
||||||
|
* @return id
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_ID)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_ID)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Tag name(String name) {
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get name
|
||||||
|
* @return name
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_NAME)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_NAME)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Tag tag = (Tag) o;
|
||||||
|
return Objects.equals(this.id, tag.id) &&
|
||||||
|
Objects.equals(this.name, tag.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class Tag {\n");
|
||||||
|
sb.append(" id: ").append(toIndentedString(id)).append("\n");
|
||||||
|
sb.append(" name: ").append(toIndentedString(name)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
*/
|
||||||
|
@JsonPropertyOrder({
|
||||||
|
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.JSON_PROPERTY_VALUES
|
||||||
|
})
|
||||||
|
@JsonTypeName("test_query_style_form_explode_true_array_string_query_object_parameter")
|
||||||
|
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {
|
||||||
|
public static final String JSON_PROPERTY_VALUES = "values";
|
||||||
|
private List<String> values = null;
|
||||||
|
|
||||||
|
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter values(List<String> values) {
|
||||||
|
|
||||||
|
this.values = values;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter addValuesItem(String valuesItem) {
|
||||||
|
if (this.values == null) {
|
||||||
|
this.values = new ArrayList<>();
|
||||||
|
}
|
||||||
|
this.values.add(valuesItem);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get values
|
||||||
|
* @return values
|
||||||
|
**/
|
||||||
|
@javax.annotation.Nullable
|
||||||
|
@JsonProperty(JSON_PROPERTY_VALUES)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
|
||||||
|
public List<String> getValues() {
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(JSON_PROPERTY_VALUES)
|
||||||
|
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
|
||||||
|
public void setValues(List<String> values) {
|
||||||
|
this.values = values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter = (TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter) o;
|
||||||
|
return Objects.equals(this.values, testQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.values);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter {\n");
|
||||||
|
sb.append(" values: ").append(toIndentedString(values)).append("\n");
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.oprg
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.api.QueryApi;
|
||||||
|
import org.openapitools.client.model.Category;
|
||||||
|
import org.openapitools.client.model.Pet;
|
||||||
|
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for QueryApi
|
||||||
|
*/
|
||||||
|
public class CustomTest {
|
||||||
|
|
||||||
|
private final QueryApi api = new QueryApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* <p>
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testQueryStyleFormExplodeTrueObjectTest() throws ApiException {
|
||||||
|
Pet queryObject = new Pet().id(12345L).name("Hello World").
|
||||||
|
photoUrls(Arrays.asList(new String[]{"http://a.com", "http://b.com"})).category(new Category().id(987L).name("new category"));
|
||||||
|
|
||||||
|
// TODO uncomment below to test deepObject
|
||||||
|
//String response = api.testQueryStyleFormExplodeTrueObject(queryObject);
|
||||||
|
//org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
|
||||||
|
//Assert.assertEquals("/query/style_form/explode_true/object?id=12345&name=Hello%20World&category=class%20Category%20%7B%0A%20%20%20%20id%3A%20987%0A%20%20%20%20name%3A%20new%20category%0A%7D&photoUrls=http%3A%2F%2Fa.com&photoUrls=http%3A%2F%2Fb.com", p.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* <p>
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testQueryStyleFormExplodeTrueArrayString() throws ApiException {
|
||||||
|
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter q = new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter()
|
||||||
|
.values(Arrays.asList(new String[]{"hello world 1", "hello world 2"}));
|
||||||
|
|
||||||
|
String response = api.testQueryStyleFormExplodeTrueArrayString(q);
|
||||||
|
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
|
||||||
|
Assert.assertEquals("/query/style_form/explode_true/array_string?values=hello%20world%201&values=hello%20world%202", p.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* <p>
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testQueryIntegerBooleanString() throws ApiException {
|
||||||
|
String response = api.testQueryIntegerBooleanString(1, true, "Hello World");
|
||||||
|
org.openapitools.client.EchoServerResponseParser p = new org.openapitools.client.EchoServerResponseParser(response);
|
||||||
|
Assert.assertEquals("/query/integer/boolean/string?integer_query=1&boolean_query=true&string_query=Hello%20World", p.path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client;
|
||||||
|
|
||||||
|
public class EchoServerResponseParser {
|
||||||
|
public String method; // e.g. GET
|
||||||
|
public String path; // e.g. /query/style_form/explode_true/object?id=12345
|
||||||
|
public String protocol; // e.g. HTTP/1.1
|
||||||
|
public java.util.HashMap<String, String> headers = new java.util.HashMap<>();
|
||||||
|
|
||||||
|
public EchoServerResponseParser(String response) {
|
||||||
|
if (response == null) {
|
||||||
|
throw new RuntimeException("Echo server response cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] lines = response.split("\n");
|
||||||
|
boolean firstLine = true;
|
||||||
|
|
||||||
|
for (String line : lines) {
|
||||||
|
if (firstLine) {
|
||||||
|
String[] items = line.split(" ");
|
||||||
|
this.method = items[0];
|
||||||
|
this.path = items[1];
|
||||||
|
this.protocol = items[2];
|
||||||
|
firstLine = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// store the header key-value pair in headers
|
||||||
|
String[] keyValue = line.split(": ");
|
||||||
|
if (keyValue.length == 2) { // skip blank line, non key-value pair
|
||||||
|
this.headers.put(keyValue[0], keyValue[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Assert;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for PathApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class PathApiTest {
|
||||||
|
|
||||||
|
private final PathApi api = new PathApi();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test path parameter(s)
|
||||||
|
*
|
||||||
|
* Test path parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testsPathStringPathStringIntegerPathIntegerTest() throws ApiException {
|
||||||
|
String pathString = null;
|
||||||
|
Integer pathInteger = null;
|
||||||
|
String response = api.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.model.Pet;
|
||||||
|
import org.openapitools.client.model.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Assert;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.OffsetDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for QueryApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class QueryApiTest {
|
||||||
|
|
||||||
|
private final QueryApi api = new QueryApi();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testQueryIntegerBooleanStringTest() throws ApiException {
|
||||||
|
Integer integerQuery = null;
|
||||||
|
Boolean booleanQuery = null;
|
||||||
|
String stringQuery = null;
|
||||||
|
String response = api.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testQueryStyleFormExplodeTrueArrayStringTest() throws ApiException {
|
||||||
|
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = null;
|
||||||
|
String response = api.testQueryStyleFormExplodeTrueArrayString(queryObject);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* Test query parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testQueryStyleFormExplodeTrueObjectTest() throws ApiException {
|
||||||
|
Pet queryObject = null;
|
||||||
|
String response = api.testQueryStyleFormExplodeTrueObject(queryObject);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for Category
|
||||||
|
*/
|
||||||
|
public class CategoryTest {
|
||||||
|
private final Category model = new Category();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for Category
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCategory() {
|
||||||
|
// TODO: test Category
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'id'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void idTest() {
|
||||||
|
// TODO: test id
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'name'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void nameTest() {
|
||||||
|
// TODO: test name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.openapitools.client.model.Category;
|
||||||
|
import org.openapitools.client.model.Tag;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for Pet
|
||||||
|
*/
|
||||||
|
public class PetTest {
|
||||||
|
private final Pet model = new Pet();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for Pet
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testPet() {
|
||||||
|
// TODO: test Pet
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'id'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void idTest() {
|
||||||
|
// TODO: test id
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'name'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void nameTest() {
|
||||||
|
// TODO: test name
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'category'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void categoryTest() {
|
||||||
|
// TODO: test category
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'photoUrls'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void photoUrlsTest() {
|
||||||
|
// TODO: test photoUrls
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'tags'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void tagsTest() {
|
||||||
|
// TODO: test tags
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'status'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void statusTest() {
|
||||||
|
// TODO: test status
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for Tag
|
||||||
|
*/
|
||||||
|
public class TagTest {
|
||||||
|
private final Tag model = new Tag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for Tag
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testTag() {
|
||||||
|
// TODO: test Tag
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'id'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void idTest() {
|
||||||
|
// TODO: test id
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'name'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void nameTest() {
|
||||||
|
// TODO: test name
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
*/
|
||||||
|
public class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTest {
|
||||||
|
private final TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter model = new TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model tests for TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() {
|
||||||
|
// TODO: test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the property 'values'
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void valuesTest() {
|
||||||
|
// TODO: test values
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,6 +6,7 @@ api/openapi.yaml
|
|||||||
build.gradle
|
build.gradle
|
||||||
build.sbt
|
build.sbt
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
|
docs/PathApi.md
|
||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/QueryApi.md
|
docs/QueryApi.md
|
||||||
docs/Tag.md
|
docs/Tag.md
|
||||||
@ -28,6 +29,7 @@ src/main/java/org/openapitools/client/Pair.java
|
|||||||
src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
src/main/java/org/openapitools/client/RFC3339DateFormat.java
|
||||||
src/main/java/org/openapitools/client/ServerConfiguration.java
|
src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||||
src/main/java/org/openapitools/client/ServerVariable.java
|
src/main/java/org/openapitools/client/ServerVariable.java
|
||||||
|
src/main/java/org/openapitools/client/api/PathApi.java
|
||||||
src/main/java/org/openapitools/client/api/QueryApi.java
|
src/main/java/org/openapitools/client/api/QueryApi.java
|
||||||
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
|
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
|
||||||
src/main/java/org/openapitools/client/model/Category.java
|
src/main/java/org/openapitools/client/model/Category.java
|
||||||
|
@ -74,21 +74,22 @@ Please follow the [installation](#installation) instruction and execute the foll
|
|||||||
|
|
||||||
import org.openapitools.client.*;
|
import org.openapitools.client.*;
|
||||||
import org.openapitools.client.model.*;
|
import org.openapitools.client.model.*;
|
||||||
import org.openapitools.client.api.QueryApi;
|
import org.openapitools.client.api.PathApi;
|
||||||
|
|
||||||
public class QueryApiExample {
|
public class PathApiExample {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
// Configure clients using the `defaultClient` object, such as
|
// Configure clients using the `defaultClient` object, such as
|
||||||
// overriding the host and port, timeout, etc.
|
// overriding the host and port, timeout, etc.
|
||||||
QueryApi apiInstance = new QueryApi(defaultClient);
|
PathApi apiInstance = new PathApi(defaultClient);
|
||||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter queryObject = new HashMap(); // TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter |
|
String pathString = "pathString_example"; // String |
|
||||||
|
Integer pathInteger = 56; // Integer |
|
||||||
try {
|
try {
|
||||||
String result = apiInstance.testQueryStyleFormExplodeTrueArrayString(queryObject);
|
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
} catch (ApiException e) {
|
} catch (ApiException e) {
|
||||||
System.err.println("Exception when calling QueryApi#testQueryStyleFormExplodeTrueArrayString");
|
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||||
System.err.println("Status code: " + e.getCode());
|
System.err.println("Status code: " + e.getCode());
|
||||||
System.err.println("Reason: " + e.getResponseBody());
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
System.err.println("Response headers: " + e.getResponseHeaders());
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
@ -105,6 +106,10 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*PathApi* | [**testsPathStringPathStringIntegerPathInteger**](docs/PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||||
|
*PathApi* | [**testsPathStringPathStringIntegerPathIntegerWithHttpInfo**](docs/PathApi.md#testsPathStringPathStringIntegerPathIntegerWithHttpInfo) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s)
|
||||||
|
*QueryApi* | [**testQueryIntegerBooleanString**](docs/QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||||
|
*QueryApi* | [**testQueryIntegerBooleanStringWithHttpInfo**](docs/QueryApi.md#testQueryIntegerBooleanStringWithHttpInfo) | **GET** /query/integer/boolean/string | Test query parameter(s)
|
||||||
*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
*QueryApi* | [**testQueryStyleFormExplodeTrueArrayString**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||||
*QueryApi* | [**testQueryStyleFormExplodeTrueArrayStringWithHttpInfo**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayStringWithHttpInfo) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
*QueryApi* | [**testQueryStyleFormExplodeTrueArrayStringWithHttpInfo**](docs/QueryApi.md#testQueryStyleFormExplodeTrueArrayStringWithHttpInfo) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s)
|
||||||
*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
*QueryApi* | [**testQueryStyleFormExplodeTrueObject**](docs/QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s)
|
||||||
|
@ -11,6 +11,73 @@ info:
|
|||||||
servers:
|
servers:
|
||||||
- url: http://localhost:3000/
|
- url: http://localhost:3000/
|
||||||
paths:
|
paths:
|
||||||
|
/path/string/{path_string}/integer/{path_integer}:
|
||||||
|
get:
|
||||||
|
description: Test path parameter(s)
|
||||||
|
operationId: "tests/path/string/{path_string}/integer/{path_integer}"
|
||||||
|
parameters:
|
||||||
|
- explode: false
|
||||||
|
in: path
|
||||||
|
name: path_string
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
style: simple
|
||||||
|
- explode: false
|
||||||
|
in: path
|
||||||
|
name: path_integer
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
style: simple
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test path parameter(s)
|
||||||
|
tags:
|
||||||
|
- path
|
||||||
|
x-accepts: text/plain
|
||||||
|
/query/integer/boolean/string:
|
||||||
|
get:
|
||||||
|
description: Test query parameter(s)
|
||||||
|
operationId: test/query/integer/boolean/string
|
||||||
|
parameters:
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: integer_query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
style: form
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: boolean_query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: boolean
|
||||||
|
style: form
|
||||||
|
- explode: true
|
||||||
|
in: query
|
||||||
|
name: string_query
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
style: form
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
content:
|
||||||
|
text/plain:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
description: Successful operation
|
||||||
|
summary: Test query parameter(s)
|
||||||
|
tags:
|
||||||
|
- query
|
||||||
|
x-accepts: text/plain
|
||||||
/query/style_form/explode_true/array_string:
|
/query/style_form/explode_true/array_string:
|
||||||
get:
|
get:
|
||||||
description: Test query parameter(s)
|
description: Test query parameter(s)
|
||||||
|
148
samples/client/echo_api/java/native/docs/PathApi.md
Normal file
148
samples/client/echo_api/java/native/docs/PathApi.md
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
# PathApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost:3000*
|
||||||
|
|
||||||
|
| Method | HTTP request | Description |
|
||||||
|
|------------- | ------------- | -------------|
|
||||||
|
| [**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) |
|
||||||
|
| [**testsPathStringPathStringIntegerPathIntegerWithHttpInfo**](PathApi.md#testsPathStringPathStringIntegerPathIntegerWithHttpInfo) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## testsPathStringPathStringIntegerPathInteger
|
||||||
|
|
||||||
|
> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.PathApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
PathApi apiInstance = new PathApi(defaultClient);
|
||||||
|
String pathString = "pathString_example"; // String |
|
||||||
|
Integer pathInteger = 56; // Integer |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **pathString** | **String**| | |
|
||||||
|
| **pathInteger** | **Integer**| | |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
## testsPathStringPathStringIntegerPathIntegerWithHttpInfo
|
||||||
|
|
||||||
|
> ApiResponse<String> testsPathStringPathStringIntegerPathInteger testsPathStringPathStringIntegerPathIntegerWithHttpInfo(pathString, pathInteger)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
Test path parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.ApiResponse;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.PathApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
PathApi apiInstance = new PathApi(defaultClient);
|
||||||
|
String pathString = "pathString_example"; // String |
|
||||||
|
Integer pathInteger = 56; // Integer |
|
||||||
|
try {
|
||||||
|
ApiResponse<String> response = apiInstance.testsPathStringPathStringIntegerPathIntegerWithHttpInfo(pathString, pathInteger);
|
||||||
|
System.out.println("Status code: " + response.getStatusCode());
|
||||||
|
System.out.println("Response headers: " + response.getHeaders());
|
||||||
|
System.out.println("Response body: " + response.getData());
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **pathString** | **String**| | |
|
||||||
|
| **pathInteger** | **Integer**| | |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
ApiResponse<**String**>
|
||||||
|
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
@ -4,6 +4,8 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
|
|
||||||
| Method | HTTP request | Description |
|
| Method | HTTP request | Description |
|
||||||
|------------- | ------------- | -------------|
|
|------------- | ------------- | -------------|
|
||||||
|
| [**testQueryIntegerBooleanString**](QueryApi.md#testQueryIntegerBooleanString) | **GET** /query/integer/boolean/string | Test query parameter(s) |
|
||||||
|
| [**testQueryIntegerBooleanStringWithHttpInfo**](QueryApi.md#testQueryIntegerBooleanStringWithHttpInfo) | **GET** /query/integer/boolean/string | Test query parameter(s) |
|
||||||
| [**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
|
| [**testQueryStyleFormExplodeTrueArrayString**](QueryApi.md#testQueryStyleFormExplodeTrueArrayString) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
|
||||||
| [**testQueryStyleFormExplodeTrueArrayStringWithHttpInfo**](QueryApi.md#testQueryStyleFormExplodeTrueArrayStringWithHttpInfo) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
|
| [**testQueryStyleFormExplodeTrueArrayStringWithHttpInfo**](QueryApi.md#testQueryStyleFormExplodeTrueArrayStringWithHttpInfo) | **GET** /query/style_form/explode_true/array_string | Test query parameter(s) |
|
||||||
| [**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
|
| [**testQueryStyleFormExplodeTrueObject**](QueryApi.md#testQueryStyleFormExplodeTrueObject) | **GET** /query/style_form/explode_true/object | Test query parameter(s) |
|
||||||
@ -11,6 +13,148 @@ All URIs are relative to *http://localhost:3000*
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## testQueryIntegerBooleanString
|
||||||
|
|
||||||
|
> String testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.QueryApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||||
|
Integer integerQuery = 56; // Integer |
|
||||||
|
Boolean booleanQuery = true; // Boolean |
|
||||||
|
String stringQuery = "stringQuery_example"; // String |
|
||||||
|
try {
|
||||||
|
String result = apiInstance.testQueryIntegerBooleanString(integerQuery, booleanQuery, stringQuery);
|
||||||
|
System.out.println(result);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling QueryApi#testQueryIntegerBooleanString");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **integerQuery** | **Integer**| | [optional] |
|
||||||
|
| **booleanQuery** | **Boolean**| | [optional] |
|
||||||
|
| **stringQuery** | **String**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
## testQueryIntegerBooleanStringWithHttpInfo
|
||||||
|
|
||||||
|
> ApiResponse<String> testQueryIntegerBooleanString testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
Test query parameter(s)
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```java
|
||||||
|
// Import classes:
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.ApiResponse;
|
||||||
|
import org.openapitools.client.Configuration;
|
||||||
|
import org.openapitools.client.models.*;
|
||||||
|
import org.openapitools.client.api.QueryApi;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ApiClient defaultClient = Configuration.getDefaultApiClient();
|
||||||
|
defaultClient.setBasePath("http://localhost:3000");
|
||||||
|
|
||||||
|
QueryApi apiInstance = new QueryApi(defaultClient);
|
||||||
|
Integer integerQuery = 56; // Integer |
|
||||||
|
Boolean booleanQuery = true; // Boolean |
|
||||||
|
String stringQuery = "stringQuery_example"; // String |
|
||||||
|
try {
|
||||||
|
ApiResponse<String> response = apiInstance.testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery);
|
||||||
|
System.out.println("Status code: " + response.getStatusCode());
|
||||||
|
System.out.println("Response headers: " + response.getHeaders());
|
||||||
|
System.out.println("Response body: " + response.getData());
|
||||||
|
} catch (ApiException e) {
|
||||||
|
System.err.println("Exception when calling QueryApi#testQueryIntegerBooleanString");
|
||||||
|
System.err.println("Status code: " + e.getCode());
|
||||||
|
System.err.println("Response headers: " + e.getResponseHeaders());
|
||||||
|
System.err.println("Reason: " + e.getResponseBody());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
| Name | Type | Description | Notes |
|
||||||
|
|------------- | ------------- | ------------- | -------------|
|
||||||
|
| **integerQuery** | **Integer**| | [optional] |
|
||||||
|
| **booleanQuery** | **Boolean**| | [optional] |
|
||||||
|
| **stringQuery** | **String**| | [optional] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
ApiResponse<**String**>
|
||||||
|
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: text/plain
|
||||||
|
|
||||||
|
### HTTP response details
|
||||||
|
| Status code | Description | Response headers |
|
||||||
|
|-------------|-------------|------------------|
|
||||||
|
| **200** | Successful operation | - |
|
||||||
|
|
||||||
|
|
||||||
## testQueryStyleFormExplodeTrueArrayString
|
## testQueryStyleFormExplodeTrueArrayString
|
||||||
|
|
||||||
> String testQueryStyleFormExplodeTrueArrayString(queryObject)
|
> String testQueryStyleFormExplodeTrueArrayString(queryObject)
|
||||||
|
@ -0,0 +1,164 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiClient;
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.openapitools.client.ApiResponse;
|
||||||
|
import org.openapitools.client.Pair;
|
||||||
|
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
@javax.annotation.processing.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||||
|
public class PathApi {
|
||||||
|
private final HttpClient memberVarHttpClient;
|
||||||
|
private final ObjectMapper memberVarObjectMapper;
|
||||||
|
private final String memberVarBaseUri;
|
||||||
|
private final Consumer<HttpRequest.Builder> memberVarInterceptor;
|
||||||
|
private final Duration memberVarReadTimeout;
|
||||||
|
private final Consumer<HttpResponse<InputStream>> memberVarResponseInterceptor;
|
||||||
|
private final Consumer<HttpResponse<String>> memberVarAsyncResponseInterceptor;
|
||||||
|
|
||||||
|
public PathApi() {
|
||||||
|
this(new ApiClient());
|
||||||
|
}
|
||||||
|
|
||||||
|
public PathApi(ApiClient apiClient) {
|
||||||
|
memberVarHttpClient = apiClient.getHttpClient();
|
||||||
|
memberVarObjectMapper = apiClient.getObjectMapper();
|
||||||
|
memberVarBaseUri = apiClient.getBaseUri();
|
||||||
|
memberVarInterceptor = apiClient.getRequestInterceptor();
|
||||||
|
memberVarReadTimeout = apiClient.getReadTimeout();
|
||||||
|
memberVarResponseInterceptor = apiClient.getResponseInterceptor();
|
||||||
|
memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ApiException getApiException(String operationId, HttpResponse<InputStream> response) throws IOException {
|
||||||
|
String body = response.body() == null ? null : new String(response.body().readAllBytes());
|
||||||
|
String message = formatExceptionMessage(operationId, response.statusCode(), body);
|
||||||
|
return new ApiException(response.statusCode(), message, response.headers(), body);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatExceptionMessage(String operationId, int statusCode, String body) {
|
||||||
|
if (body == null || body.isEmpty()) {
|
||||||
|
body = "[no body]";
|
||||||
|
}
|
||||||
|
return operationId + " call failed with: " + statusCode + " - " + body;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test path parameter(s)
|
||||||
|
* Test path parameter(s)
|
||||||
|
* @param pathString (required)
|
||||||
|
* @param pathInteger (required)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testsPathStringPathStringIntegerPathInteger(String pathString, Integer pathInteger) throws ApiException {
|
||||||
|
ApiResponse<String> localVarResponse = testsPathStringPathStringIntegerPathIntegerWithHttpInfo(pathString, pathInteger);
|
||||||
|
return localVarResponse.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test path parameter(s)
|
||||||
|
* Test path parameter(s)
|
||||||
|
* @param pathString (required)
|
||||||
|
* @param pathInteger (required)
|
||||||
|
* @return ApiResponse<String>
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public ApiResponse<String> testsPathStringPathStringIntegerPathIntegerWithHttpInfo(String pathString, Integer pathInteger) throws ApiException {
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = testsPathStringPathStringIntegerPathIntegerRequestBuilder(pathString, pathInteger);
|
||||||
|
try {
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (memberVarResponseInterceptor != null) {
|
||||||
|
memberVarResponseInterceptor.accept(localVarResponse);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw getApiException("testsPathStringPathStringIntegerPathInteger", localVarResponse);
|
||||||
|
}
|
||||||
|
// for plain text response
|
||||||
|
InputStream responseBody = localVarResponse.body();
|
||||||
|
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||||
|
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||||
|
java.util.Scanner s = new java.util.Scanner(responseBody).useDelimiter("\\A");
|
||||||
|
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||||
|
return new ApiResponse<String>(
|
||||||
|
localVarResponse.statusCode(),
|
||||||
|
localVarResponse.headers().map(),
|
||||||
|
responseBodyText
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Error! The response Content-Type is supposed to be `text/plain` but it's not: " + localVarResponse);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpRequest.Builder testsPathStringPathStringIntegerPathIntegerRequestBuilder(String pathString, Integer pathInteger) throws ApiException {
|
||||||
|
// verify the required parameter 'pathString' is set
|
||||||
|
if (pathString == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'pathString' when calling testsPathStringPathStringIntegerPathInteger");
|
||||||
|
}
|
||||||
|
// verify the required parameter 'pathInteger' is set
|
||||||
|
if (pathInteger == null) {
|
||||||
|
throw new ApiException(400, "Missing the required parameter 'pathInteger' when calling testsPathStringPathStringIntegerPathInteger");
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/path/string/{path_string}/integer/{path_integer}"
|
||||||
|
.replace("{path_string}", ApiClient.urlEncode(pathString.toString()))
|
||||||
|
.replace("{path_integer}", ApiClient.urlEncode(pathInteger.toString()));
|
||||||
|
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "text/plain");
|
||||||
|
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
return localVarRequestBuilder;
|
||||||
|
}
|
||||||
|
}
|
@ -75,6 +75,97 @@ public class QueryApi {
|
|||||||
return operationId + " call failed with: " + statusCode + " - " + body;
|
return operationId + " call failed with: " + statusCode + " - " + body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param integerQuery (optional)
|
||||||
|
* @param booleanQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return String
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public String testQueryIntegerBooleanString(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws ApiException {
|
||||||
|
ApiResponse<String> localVarResponse = testQueryIntegerBooleanStringWithHttpInfo(integerQuery, booleanQuery, stringQuery);
|
||||||
|
return localVarResponse.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test query parameter(s)
|
||||||
|
* Test query parameter(s)
|
||||||
|
* @param integerQuery (optional)
|
||||||
|
* @param booleanQuery (optional)
|
||||||
|
* @param stringQuery (optional)
|
||||||
|
* @return ApiResponse<String>
|
||||||
|
* @throws ApiException if fails to make API call
|
||||||
|
*/
|
||||||
|
public ApiResponse<String> testQueryIntegerBooleanStringWithHttpInfo(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws ApiException {
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = testQueryIntegerBooleanStringRequestBuilder(integerQuery, booleanQuery, stringQuery);
|
||||||
|
try {
|
||||||
|
HttpResponse<InputStream> localVarResponse = memberVarHttpClient.send(
|
||||||
|
localVarRequestBuilder.build(),
|
||||||
|
HttpResponse.BodyHandlers.ofInputStream());
|
||||||
|
if (memberVarResponseInterceptor != null) {
|
||||||
|
memberVarResponseInterceptor.accept(localVarResponse);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (localVarResponse.statusCode()/ 100 != 2) {
|
||||||
|
throw getApiException("testQueryIntegerBooleanString", localVarResponse);
|
||||||
|
}
|
||||||
|
// for plain text response
|
||||||
|
InputStream responseBody = localVarResponse.body();
|
||||||
|
if (localVarResponse.headers().map().containsKey("Content-Type") &&
|
||||||
|
"text/plain".equalsIgnoreCase(localVarResponse.headers().map().get("Content-Type").get(0))) {
|
||||||
|
java.util.Scanner s = new java.util.Scanner(responseBody).useDelimiter("\\A");
|
||||||
|
String responseBodyText = s.hasNext() ? s.next() : "";
|
||||||
|
return new ApiResponse<String>(
|
||||||
|
localVarResponse.statusCode(),
|
||||||
|
localVarResponse.headers().map(),
|
||||||
|
responseBodyText
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Error! The response Content-Type is supposed to be `text/plain` but it's not: " + localVarResponse);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new ApiException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private HttpRequest.Builder testQueryIntegerBooleanStringRequestBuilder(Integer integerQuery, Boolean booleanQuery, String stringQuery) throws ApiException {
|
||||||
|
|
||||||
|
HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();
|
||||||
|
|
||||||
|
String localVarPath = "/query/integer/boolean/string";
|
||||||
|
|
||||||
|
List<Pair> localVarQueryParams = new ArrayList<>();
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("integer_query", integerQuery));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("boolean_query", booleanQuery));
|
||||||
|
localVarQueryParams.addAll(ApiClient.parameterToPairs("string_query", stringQuery));
|
||||||
|
|
||||||
|
if (!localVarQueryParams.isEmpty()) {
|
||||||
|
StringJoiner queryJoiner = new StringJoiner("&");
|
||||||
|
localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue()));
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString()));
|
||||||
|
} else {
|
||||||
|
localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));
|
||||||
|
}
|
||||||
|
|
||||||
|
localVarRequestBuilder.header("Accept", "text/plain");
|
||||||
|
|
||||||
|
localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody());
|
||||||
|
if (memberVarReadTimeout != null) {
|
||||||
|
localVarRequestBuilder.timeout(memberVarReadTimeout);
|
||||||
|
}
|
||||||
|
if (memberVarInterceptor != null) {
|
||||||
|
memberVarInterceptor.accept(localVarRequestBuilder);
|
||||||
|
}
|
||||||
|
return localVarRequestBuilder;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Test query parameter(s)
|
* Test query parameter(s)
|
||||||
* Test query parameter(s)
|
* Test query parameter(s)
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Echo Server API
|
||||||
|
* Echo Server API
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
* Contact: team@openapitools.org
|
||||||
|
*
|
||||||
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||||
|
* https://openapi-generator.tech
|
||||||
|
* Do not edit the class manually.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.openapitools.client.api;
|
||||||
|
|
||||||
|
import org.openapitools.client.ApiException;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.Ignore;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API tests for PathApi
|
||||||
|
*/
|
||||||
|
@Ignore
|
||||||
|
public class PathApiTest {
|
||||||
|
|
||||||
|
private final PathApi api = new PathApi();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test path parameter(s)
|
||||||
|
*
|
||||||
|
* Test path parameter(s)
|
||||||
|
*
|
||||||
|
* @throws ApiException
|
||||||
|
* if the Api call fails
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testsPathStringPathStringIntegerPathIntegerTest() throws ApiException {
|
||||||
|
String pathString = null;
|
||||||
|
Integer pathInteger = null;
|
||||||
|
String response =
|
||||||
|
api.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
|
||||||
|
|
||||||
|
// TODO: test validations
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -596,9 +596,11 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
List<Pair> params = new ArrayList<Pair>();
|
List<Pair> params = new ArrayList<Pair>();
|
||||||
|
|
||||||
// preconditions
|
// preconditions
|
||||||
if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params;
|
if (name == null || name.isEmpty() || value == null || value instanceof Collection) {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
params.add(new Pair(name, parameterToString(value)));
|
params.add(new Pair(name, escapeString(parameterToString(value))));
|
||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,6 +847,10 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
if (mimeType == null || isJsonMime(mimeType)) {
|
if (mimeType == null || isJsonMime(mimeType)) {
|
||||||
// Assume json if no mime type
|
// Assume json if no mime type
|
||||||
return objectMapper.readValue(entity.getContent(), valueType);
|
return objectMapper.readValue(entity.getContent(), valueType);
|
||||||
|
} else if ("text/plain".equalsIgnoreCase(mimeType)) {
|
||||||
|
// convert input stream to string
|
||||||
|
java.util.Scanner s = new java.util.Scanner(entity.getContent()).useDelimiter("\\A");
|
||||||
|
return (T) (s.hasNext() ? s.next() : "");
|
||||||
} else {
|
} else {
|
||||||
throw new ApiException(
|
throw new ApiException(
|
||||||
"Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'",
|
"Deserialization for content type '" + mimeType + "' not supported for type '" + valueType + "'",
|
||||||
@ -933,7 +939,8 @@ public class ApiClient extends JavaTimeFormatter {
|
|||||||
url.append("&");
|
url.append("&");
|
||||||
}
|
}
|
||||||
String value = parameterToString(param.getValue());
|
String value = parameterToString(param.getValue());
|
||||||
url.append(escapeString(param.getName())).append("=").append(escapeString(value));
|
// query parameter value already escaped as part of parameterToPair
|
||||||
|
url.append(escapeString(param.getName())).append("=").append(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user