Skip to content

Commit a7942d0

Browse files
committed
fresh samples
1 parent 96c31ae commit a7942d0

File tree

83 files changed

+2054
-2654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+2054
-2654
lines changed

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/JavaTimeFormatter.java

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,47 @@
2222
*/
2323
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
2424
public class JavaTimeFormatter {
25+
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
2526

26-
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
27+
/**
28+
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
29+
*
30+
* @return DateTimeFormatter
31+
*/
32+
public DateTimeFormatter getOffsetDateTimeFormatter() {
33+
return offsetDateTimeFormatter;
34+
}
2735

28-
/**
29-
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
30-
* @return DateTimeFormatter
31-
*/
32-
public DateTimeFormatter getOffsetDateTimeFormatter() {
33-
return offsetDateTimeFormatter;
34-
}
36+
/**
37+
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38+
*
39+
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
40+
*/
41+
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
42+
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
43+
}
3544

36-
/**
37-
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38-
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
39-
*/
40-
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
41-
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
45+
/**
46+
* Parse the given string into {@code OffsetDateTime} object.
47+
*
48+
* @param str String
49+
* @return {@code OffsetDateTime}
50+
*/
51+
public OffsetDateTime parseOffsetDateTime(String str) {
52+
try {
53+
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
54+
} catch (DateTimeParseException e) {
55+
throw new RuntimeException(e);
4256
}
57+
}
4358

44-
/**
45-
* Parse the given string into {@code OffsetDateTime} object.
46-
* @param str String
47-
* @return {@code OffsetDateTime}
48-
*/
49-
public OffsetDateTime parseOffsetDateTime(String str) {
50-
try {
51-
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
52-
} catch (DateTimeParseException e) {
53-
throw new RuntimeException(e);
54-
}
55-
}
56-
/**
57-
* Format the given {@code OffsetDateTime} object into string.
58-
* @param offsetDateTime {@code OffsetDateTime}
59-
* @return {@code OffsetDateTime} in string format
60-
*/
61-
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
62-
return offsetDateTimeFormatter.format(offsetDateTime);
63-
}
64-
}
59+
/**
60+
* Format the given {@code OffsetDateTime} object into string.
61+
*
62+
* @param offsetDateTime {@code OffsetDateTime}
63+
* @return {@code OffsetDateTime} in string format
64+
*/
65+
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
66+
return offsetDateTimeFormatter.format(offsetDateTime);
67+
}
68+
}

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/Pair.java

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,23 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
1717
public class Pair {
18-
private String name = "";
19-
private String value = "";
18+
private final String name;
19+
private final String value;
2020

21-
public Pair (String name, String value) {
22-
setName(name);
23-
setValue(value);
24-
}
21+
public Pair(String name, String value) {
22+
this.name = isValidString(name) ? name : "";
23+
this.value = isValidString(value) ? value : "";
24+
}
2525

26-
private void setName(String name) {
27-
if (!isValidString(name)) {
28-
return;
29-
}
26+
public String getName() {
27+
return this.name;
28+
}
3029

31-
this.name = name;
32-
}
30+
public String getValue() {
31+
return this.value;
32+
}
3333

34-
private void setValue(String value) {
35-
if (!isValidString(value)) {
36-
return;
37-
}
38-
39-
this.value = value;
40-
}
41-
42-
public String getName() {
43-
return this.name;
44-
}
45-
46-
public String getValue() {
47-
return this.value;
48-
}
49-
50-
private boolean isValidString(String arg) {
51-
if (arg == null) {
52-
return false;
53-
}
54-
55-
return true;
56-
}
34+
private static boolean isValidString(String arg) {
35+
return arg != null;
36+
}
5737
}

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/Authentication.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
import java.util.List;
2020

2121
public interface Authentication {
22-
/**
23-
* Apply authentication settings to header and query params.
24-
*
25-
* @param queryParams List of query parameters
26-
* @param headerParams Map of header parameters
27-
* @param cookieParams Map of cookie parameters
28-
*/
29-
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams);
22+
/**
23+
* Apply authentication settings to header and query params.
24+
*
25+
* @param queryParams List of query parameters
26+
* @param headerParams Map of header parameters
27+
* @param cookieParams Map of cookie parameters
28+
*/
29+
void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams);
3030
}

samples/client/echo_api/java/apache-httpclient/src/main/java/org/openapitools/client/auth/HttpBearerAuth.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import java.util.List;
1919
import java.util.Map;
20-
import java.util.Optional;
2120
import java.util.function.Supplier;
2221

2322
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
@@ -26,7 +25,7 @@ public class HttpBearerAuth implements Authentication {
2625
private Supplier<String> tokenSupplier;
2726

2827
public HttpBearerAuth(String scheme) {
29-
this.scheme = scheme;
28+
this.scheme = upperCaseBearer(scheme);
3029
}
3130

3231
/**
@@ -58,15 +57,14 @@ public void setBearerToken(Supplier<String> tokenSupplier) {
5857

5958
@Override
6059
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams) {
61-
String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null);
60+
String bearerToken = tokenSupplier != null ? tokenSupplier.get() : null;
6261
if (bearerToken == null) {
6362
return;
6463
}
65-
66-
headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken);
64+
headerParams.put("Authorization", (scheme != null ? scheme + " " : "") + bearerToken);
6765
}
6866

6967
private static String upperCaseBearer(String scheme) {
70-
return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme;
68+
return "bearer".equalsIgnoreCase(scheme) ? "Bearer" : scheme;
7169
}
7270
}

samples/client/echo_api/java/native/src/main/java/org/openapitools/client/Pair.java

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,23 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
1717
public class Pair {
18-
private String name = "";
19-
private String value = "";
18+
private final String name;
19+
private final String value;
2020

21-
public Pair (String name, String value) {
22-
setName(name);
23-
setValue(value);
24-
}
21+
public Pair(String name, String value) {
22+
this.name = isValidString(name) ? name : "";
23+
this.value = isValidString(value) ? value : "";
24+
}
2525

26-
private void setName(String name) {
27-
if (!isValidString(name)) {
28-
return;
29-
}
26+
public String getName() {
27+
return this.name;
28+
}
3029

31-
this.name = name;
32-
}
30+
public String getValue() {
31+
return this.value;
32+
}
3333

34-
private void setValue(String value) {
35-
if (!isValidString(value)) {
36-
return;
37-
}
38-
39-
this.value = value;
40-
}
41-
42-
public String getName() {
43-
return this.name;
44-
}
45-
46-
public String getValue() {
47-
return this.value;
48-
}
49-
50-
private boolean isValidString(String arg) {
51-
if (arg == null) {
52-
return false;
53-
}
54-
55-
return true;
56-
}
34+
private static boolean isValidString(String arg) {
35+
return arg != null;
36+
}
5737
}

samples/client/echo_api/java/okhttp-gson-user-defined-templates/src/main/java/org/openapitools/client/Pair.java

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,23 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
1717
public class Pair {
18-
private String name = "";
19-
private String value = "";
18+
private final String name;
19+
private final String value;
2020

21-
public Pair (String name, String value) {
22-
setName(name);
23-
setValue(value);
24-
}
21+
public Pair(String name, String value) {
22+
this.name = isValidString(name) ? name : "";
23+
this.value = isValidString(value) ? value : "";
24+
}
2525

26-
private void setName(String name) {
27-
if (!isValidString(name)) {
28-
return;
29-
}
26+
public String getName() {
27+
return this.name;
28+
}
3029

31-
this.name = name;
32-
}
30+
public String getValue() {
31+
return this.value;
32+
}
3333

34-
private void setValue(String value) {
35-
if (!isValidString(value)) {
36-
return;
37-
}
38-
39-
this.value = value;
40-
}
41-
42-
public String getName() {
43-
return this.name;
44-
}
45-
46-
public String getValue() {
47-
return this.value;
48-
}
49-
50-
private boolean isValidString(String arg) {
51-
if (arg == null) {
52-
return false;
53-
}
54-
55-
return true;
56-
}
34+
private static boolean isValidString(String arg) {
35+
return arg != null;
36+
}
5737
}

samples/client/echo_api/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,23 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0-SNAPSHOT")
1717
public class Pair {
18-
private String name = "";
19-
private String value = "";
18+
private final String name;
19+
private final String value;
2020

21-
public Pair (String name, String value) {
22-
setName(name);
23-
setValue(value);
24-
}
21+
public Pair(String name, String value) {
22+
this.name = isValidString(name) ? name : "";
23+
this.value = isValidString(value) ? value : "";
24+
}
2525

26-
private void setName(String name) {
27-
if (!isValidString(name)) {
28-
return;
29-
}
26+
public String getName() {
27+
return this.name;
28+
}
3029

31-
this.name = name;
32-
}
30+
public String getValue() {
31+
return this.value;
32+
}
3333

34-
private void setValue(String value) {
35-
if (!isValidString(value)) {
36-
return;
37-
}
38-
39-
this.value = value;
40-
}
41-
42-
public String getName() {
43-
return this.name;
44-
}
45-
46-
public String getValue() {
47-
return this.value;
48-
}
49-
50-
private boolean isValidString(String arg) {
51-
if (arg == null) {
52-
return false;
53-
}
54-
55-
return true;
56-
}
34+
private static boolean isValidString(String arg) {
35+
return arg != null;
36+
}
5737
}

0 commit comments

Comments
 (0)