Commit 28969573 authored by Spiros Koulouzis's avatar Spiros Koulouzis

added method to get interface instance with default values

parent adf701b9
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
package nl.uva.sne.drip.sure.tosca.client; package nl.uva.sne.drip.sure.tosca.client;
...@@ -23,12 +21,15 @@ import java.util.List; ...@@ -23,12 +21,15 @@ import java.util.List;
* @param <T> The return type * @param <T> The return type
*/ */
public interface ApiCallback<T> { public interface ApiCallback<T> {
/** /**
* This is called when the API call fails. * This is called when the API call fails.
* *
* @param e The exception causing the failure * @param e The exception causing the failure
* @param statusCode Status code of the response if available, otherwise it would be 0 * @param statusCode Status code of the response if available, otherwise it
* @param responseHeaders Headers of the response if available, otherwise it would be null * would be 0
* @param responseHeaders Headers of the response if available, otherwise it
* would be null
*/ */
void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders); void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders);
......
...@@ -9,20 +9,20 @@ ...@@ -9,20 +9,20 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
package nl.uva.sne.drip.sure.tosca.client; package nl.uva.sne.drip.sure.tosca.client;
import java.util.Map; import java.util.Map;
import java.util.List; import java.util.List;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z") @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class ApiException extends Exception { public class ApiException extends Exception {
private int code = 0; private int code = 0;
private Map<String, List<String>> responseHeaders = null; private Map<String, List<String>> responseHeaders = null;
private String responseBody = null; private String responseBody = null;
public ApiException() {} public ApiException() {
}
public ApiException(Throwable throwable) { public ApiException(Throwable throwable) {
super(throwable); super(throwable);
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
package nl.uva.sne.drip.sure.tosca.client; package nl.uva.sne.drip.sure.tosca.client;
import java.util.List; import java.util.List;
...@@ -22,6 +20,7 @@ import java.util.Map; ...@@ -22,6 +20,7 @@ import java.util.Map;
* @param <T> The type of data that is deserialized from response body * @param <T> The type of data that is deserialized from response body
*/ */
public class ApiResponse<T> { public class ApiResponse<T> {
final private int statusCode; final private int statusCode;
final private Map<String, List<String>> headers; final private Map<String, List<String>> headers;
final private T data; final private T data;
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
package nl.uva.sne.drip.sure.tosca.client; package nl.uva.sne.drip.sure.tosca.client;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z") @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class Configuration { public class Configuration {
private static ApiClient defaultApiClient = new ApiClient(); private static ApiClient defaultApiClient = new ApiClient();
/** /**
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
package nl.uva.sne.drip.sure.tosca.client; package nl.uva.sne.drip.sure.tosca.client;
import com.google.gson.Gson; import com.google.gson.Gson;
...@@ -23,7 +25,7 @@ import io.gsonfire.GsonFireBuilder; ...@@ -23,7 +25,7 @@ import io.gsonfire.GsonFireBuilder;
import org.threeten.bp.LocalDate; import org.threeten.bp.LocalDate;
import org.threeten.bp.OffsetDateTime; import org.threeten.bp.OffsetDateTime;
import org.threeten.bp.format.DateTimeFormatter; import org.threeten.bp.format.DateTimeFormatter;
;
import okio.ByteString; import okio.ByteString;
import java.io.IOException; import java.io.IOException;
...@@ -35,10 +37,7 @@ import java.text.ParsePosition; ...@@ -35,10 +37,7 @@ import java.text.ParsePosition;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
public class JSON { public class JSON {
private Gson gson; private Gson gson;
private boolean isLenientOnJson = false; private boolean isLenientOnJson = false;
private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
...@@ -48,14 +47,15 @@ public class JSON { ...@@ -48,14 +47,15 @@ public class JSON {
private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
public static GsonBuilder createGson() { public static GsonBuilder createGson() {
GsonFireBuilder fireBuilder = new GsonFireBuilder(); GsonFireBuilder fireBuilder = new GsonFireBuilder()
;
GsonBuilder builder = fireBuilder.createGsonBuilder(); GsonBuilder builder = fireBuilder.createGsonBuilder();
return builder; return builder;
} }
private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {
JsonElement element = readElement.getAsJsonObject().get(discriminatorField); JsonElement element = readElement.getAsJsonObject().get(discriminatorField);
if (null == element) { if(null == element) {
throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">");
} }
return element.getAsString(); return element.getAsString();
...@@ -63,7 +63,7 @@ public class JSON { ...@@ -63,7 +63,7 @@ public class JSON {
private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) {
Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase()); Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase());
if (null == clazz) { if(null == clazz) {
throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">");
} }
return clazz; return clazz;
...@@ -136,11 +136,9 @@ public class JSON { ...@@ -136,11 +136,9 @@ public class JSON {
} catch (JsonParseException e) { } catch (JsonParseException e) {
// Fallback processing when failed to parse JSON form response body: // Fallback processing when failed to parse JSON form response body:
// return the response body string directly for the String return type; // return the response body string directly for the String return type;
if (returnType.equals(String.class)) { if (returnType.equals(String.class))
return (T) body; return (T) body;
} else { else throw (e);
throw (e);
}
} }
} }
...@@ -209,7 +207,7 @@ public class JSON { ...@@ -209,7 +207,7 @@ public class JSON {
default: default:
String date = in.nextString(); String date = in.nextString();
if (date.endsWith("+0000")) { if (date.endsWith("+0000")) {
date = date.substring(0, date.length() - 5) + "Z"; date = date.substring(0, date.length()-5) + "Z";
} }
return OffsetDateTime.parse(date, formatter); return OffsetDateTime.parse(date, formatter);
} }
...@@ -268,9 +266,9 @@ public class JSON { ...@@ -268,9 +266,9 @@ public class JSON {
} }
/** /**
* Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a * Gson TypeAdapter for java.sql.Date type
* simple "yyyy-MM-dd" format will be used (more efficient than * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used
* SimpleDateFormat). * (more efficient than SimpleDateFormat).
*/ */
public static class SqlDateTypeAdapter extends TypeAdapter<java.sql.Date> { public static class SqlDateTypeAdapter extends TypeAdapter<java.sql.Date> {
...@@ -323,8 +321,8 @@ public class JSON { ...@@ -323,8 +321,8 @@ public class JSON {
} }
/** /**
* Gson TypeAdapter for java.util.Date type If the dateFormat is null, * Gson TypeAdapter for java.util.Date type
* ISO8601Utils will be used. * If the dateFormat is null, ISO8601Utils will be used.
*/ */
public static class DateTypeAdapter extends TypeAdapter<Date> { public static class DateTypeAdapter extends TypeAdapter<Date> {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
package nl.uva.sne.drip.sure.tosca.client; package nl.uva.sne.drip.sure.tosca.client;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z") @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class Pair { public class Pair {
private String name = ""; private String name = "";
private String value = ""; private String value = "";
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
package nl.uva.sne.drip.sure.tosca.client; package nl.uva.sne.drip.sure.tosca.client;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-25T13:58:54.535Z") @javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2019-12-28T19:11:27.492Z")
public class StringUtil { public class StringUtil {
/** /**
* Check if the given array contains the given value (with case-insensitive comparison). * Check if the given array contains the given value (with case-insensitive comparison).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment