();
+ }
+
+ /**
+ * Get base path
+ * @return Base path
+ */
+ public String getBasePath() {
+ return basePath;
+ }
+
+ /**
+ * Set base path
+ * @param basePath Base path of the URL (e.g http://localhost:8080
+ * @return An instance of OkHttpClient
+ */
+ public ApiClient setBasePath(String basePath) {
+ this.basePath = basePath;
+ return this;
+ }
+
+ /**
+ * Get HTTP client
+ * @return An instance of OkHttpClient
+ */
+ public OkHttpClient getHttpClient() {
+ return httpClient;
+ }
+
+ /**
+ * Set HTTP client, which must never be null.
+ * @param newHttpClient An instance of OkHttpClient
+ * @return Api Client
+ * @throws java.lang.NullPointerException when newHttpClient is null
+ */
+ public ApiClient setHttpClient(OkHttpClient newHttpClient) {
+ this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!");
+ return this;
+ }
+
+ /**
+ * Get JSON
+ * @return JSON object
+ */
+ public JSON getJSON() {
+ return json;
+ }
+
+ /**
+ * Set JSON
+ * @param json JSON object
+ * @return Api client
+ */
+ public ApiClient setJSON(JSON json) {
+ this.json = json;
+ return this;
+ }
+
+ /**
+ * True if isVerifyingSsl flag is on
+ * @return True if isVerifySsl flag is on
+ */
+ public boolean isVerifyingSsl() {
+ return verifyingSsl;
+ }
+
+ /**
+ * Configure whether to verify certificate and hostname when making https requests.
+ * Default to true. NOTE: Do NOT set to false in production code, otherwise you would
+ * face multiple types of cryptographic attacks.
+ * @param verifyingSsl True to verify TLS/SSL connection
+ * @return ApiClient
+ */
+ public ApiClient setVerifyingSsl(boolean verifyingSsl) {
+ this.verifyingSsl = verifyingSsl;
+ applySslSettings();
+ return this;
+ }
+
+ /**
+ * Get SSL CA cert.
+ * @return Input stream to the SSL CA cert
+ */
+ public InputStream getSslCaCert() {
+ return sslCaCert;
+ }
+
+ /**
+ * Configure the CA certificate to be trusted when making https requests. Use null to
+ * reset to default.
+ * @param sslCaCert input stream for SSL CA cert
+ * @return ApiClient
+ */
+ public ApiClient setSslCaCert(InputStream sslCaCert) {
+ this.sslCaCert = sslCaCert;
+ applySslSettings();
+ return this;
+ }
+
+ /**
+ *
+ * Getter for the field keyManagers
.
+ *
+ * @return an array of {@link javax.net.ssl.KeyManager} objects
+ */
+ public KeyManager[] getKeyManagers() {
+ return keyManagers;
+ }
+
+ /**
+ * Configure client keys to use for authorization in an SSL session. Use null to reset
+ * to default.
+ * @param managers The KeyManagers to use
+ * @return ApiClient
+ */
+ public ApiClient setKeyManagers(KeyManager[] managers) {
+ this.keyManagers = managers;
+ applySslSettings();
+ return this;
+ }
+
+ /**
+ *
+ * Getter for the field dateFormat
.
+ *
+ * @return a {@link java.text.DateFormat} object
+ */
+ public DateFormat getDateFormat() {
+ return dateFormat;
+ }
+
+ /**
+ *
+ * Setter for the field dateFormat
.
+ *
+ * @param dateFormat a {@link java.text.DateFormat} object
+ * @return a {@link org.openapitools.client.ApiClient} object
+ */
+ public ApiClient setDateFormat(DateFormat dateFormat) {
+ this.json.setDateFormat(dateFormat);
+ return this;
+ }
+
+ /**
+ *
+ * Set SqlDateFormat.
+ *
+ * @param dateFormat a {@link java.text.DateFormat} object
+ * @return a {@link org.openapitools.client.ApiClient} object
+ */
+ public ApiClient setSqlDateFormat(DateFormat dateFormat) {
+ this.json.setSqlDateFormat(dateFormat);
+ return this;
+ }
+
+ /**
+ *
+ * Set LenientOnJson.
+ *
+ * @param lenientOnJson a boolean
+ * @return a {@link org.openapitools.client.ApiClient} object
+ */
+ public ApiClient setLenientOnJson(boolean lenientOnJson) {
+ this.json.setLenientOnJson(lenientOnJson);
+ return this;
+ }
+
+ /**
+ * Get authentications (key: authentication name, value: authentication).
+ * @return Map of authentication objects
+ */
+ public Map 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);
+ }
+
+ /**
+ * Helper method to set username for the first HTTP basic authentication.
+ * @param username Username
+ */
+ public void setUsername(String username) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setUsername(username);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
+ }
+
+ /**
+ * Helper method to set password for the first HTTP basic authentication.
+ * @param password Password
+ */
+ public void setPassword(String password) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof HttpBasicAuth) {
+ ((HttpBasicAuth) auth).setPassword(password);
+ return;
+ }
+ }
+ throw new RuntimeException("No HTTP basic authentication configured!");
+ }
+
+ /**
+ * Helper method to set API key value for the first API key authentication.
+ * @param apiKey API key
+ */
+ public void setApiKey(String apiKey) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof ApiKeyAuth) {
+ ((ApiKeyAuth) auth).setApiKey(apiKey);
+ return;
+ }
+ }
+ throw new RuntimeException("No API key authentication configured!");
+ }
+
+ /**
+ * Helper method to set API key prefix for the first API key authentication.
+ * @param apiKeyPrefix API key prefix
+ */
+ public void setApiKeyPrefix(String apiKeyPrefix) {
+ for (Authentication auth : authentications.values()) {
+ if (auth instanceof ApiKeyAuth) {
+ ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix);
+ return;
+ }
+ }
+ throw new RuntimeException("No API key authentication configured!");
+ }
+
+ /**
+ * Helper method to set access token for the first OAuth2 authentication.
+ * @param accessToken Access token
+ */
+ public void setAccessToken(String accessToken) {
+ throw new RuntimeException("No OAuth2 authentication configured!");
+ }
+
+ /**
+ * Set the User-Agent header's value (by adding to the default header map).
+ * @param userAgent HTTP request's user agent
+ * @return ApiClient
+ */
+ public ApiClient setUserAgent(String userAgent) {
+ addDefaultHeader("User-Agent", userAgent);
+ return this;
+ }
+
+ /**
+ * Add a default header.
+ * @param key The header's key
+ * @param value The header's value
+ * @return ApiClient
+ */
+ 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 ApiClient
+ */
+ 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 enabled, false otherwise.
+ */
+ public boolean isDebugging() {
+ return debugging;
+ }
+
+ /**
+ * Enable/disable debugging for this API client.
+ * @param debugging To enable (true) or disable (false) debugging
+ * @return ApiClient
+ */
+ public ApiClient setDebugging(boolean debugging) {
+ if (debugging != this.debugging) {
+ if (debugging) {
+ loggingInterceptor = new HttpLoggingInterceptor();
+ loggingInterceptor.setLevel(Level.BODY);
+ httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build();
+ }
+ else {
+ final OkHttpClient.Builder builder = httpClient.newBuilder();
+ builder.interceptors().remove(loggingInterceptor);
+ httpClient = builder.build();
+ loggingInterceptor = null;
+ }
+ }
+ this.debugging = debugging;
+ return this;
+ }
+
+ /**
+ * The path of temporary folder used to store downloaded files from endpoints with
+ * file response. The default value is null
, i.e. using the system's
+ * default temporary folder.
+ *
+ * @see createTempFile
+ * @return Temporary folder path
+ */
+ public String getTempFolderPath() {
+ return tempFolderPath;
+ }
+
+ /**
+ * Set the temporary folder path (for downloading files)
+ * @param tempFolderPath Temporary folder path
+ * @return ApiClient
+ */
+ public ApiClient setTempFolderPath(String tempFolderPath) {
+ this.tempFolderPath = tempFolderPath;
+ return this;
+ }
+
+ /**
+ * Get connection timeout (in milliseconds).
+ * @return Timeout in milliseconds
+ */
+ public int getConnectTimeout() {
+ return httpClient.connectTimeoutMillis();
+ }
+
+ /**
+ * Sets the connect timeout (in milliseconds). A value of 0 means no timeout,
+ * otherwise values must be between 1 and {@link java.lang.Integer#MAX_VALUE}.
+ * @param connectionTimeout connection timeout in milliseconds
+ * @return Api client
+ */
+ public ApiClient setConnectTimeout(int connectionTimeout) {
+ httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build();
+ return this;
+ }
+
+ /**
+ * Get read timeout (in milliseconds).
+ * @return Timeout in milliseconds
+ */
+ public int getReadTimeout() {
+ return httpClient.readTimeoutMillis();
+ }
+
+ /**
+ * Sets the read timeout (in milliseconds). A value of 0 means no timeout, otherwise
+ * values must be between 1 and {@link java.lang.Integer#MAX_VALUE}.
+ * @param readTimeout read timeout in milliseconds
+ * @return Api client
+ */
+ public ApiClient setReadTimeout(int readTimeout) {
+ httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build();
+ return this;
+ }
+
+ /**
+ * Get write timeout (in milliseconds).
+ * @return Timeout in milliseconds
+ */
+ public int getWriteTimeout() {
+ return httpClient.writeTimeoutMillis();
+ }
+
+ /**
+ * Sets the write timeout (in milliseconds). A value of 0 means no timeout, otherwise
+ * values must be between 1 and {@link java.lang.Integer#MAX_VALUE}.
+ * @param writeTimeout connection timeout in milliseconds
+ * @return Api client
+ */
+ public ApiClient setWriteTimeout(int writeTimeout) {
+ httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build();
+ return this;
+ }
+
+ /**
+ * Format the given parameter object into string.
+ * @param param Parameter
+ * @return String representation of the parameter
+ */
+ public String parameterToString(Object param) {
+ if (param == null) {
+ return "";
+ }
+ else if (param instanceof Date) {
+ // Serialize to json string and remove the " enclosing characters
+ String jsonStr = json.serialize(param);
+ return jsonStr.substring(1, jsonStr.length() - 1);
+ }
+ 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 parameterToPair(String name, Object value) {
+ List params = new ArrayList();
+
+ // preconditions
+ if (name == null || name.isEmpty() || value == null || value instanceof Collection) {
+ return params;
+ }
+
+ params.add(new Pair(name, 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 parameterToPairs(String collectionFormat, String name, Collection value) {
+ List params = new ArrayList();
+
+ // preconditions
+ if (name == null || name.isEmpty() || value == null || value.isEmpty()) {
+ 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;
+ }
+
+ /**
+ * Formats the specified collection path parameter to a string value.
+ * @param collectionFormat The collection format of the parameter.
+ * @param value The value of the parameter.
+ * @return String representation of the parameter
+ */
+ public String collectionPathParameterToString(String collectionFormat, Collection value) {
+ // create the value based on the collection format
+ if ("multi".equals(collectionFormat)) {
+ // not valid for path params
+ return parameterToString(value);
+ }
+
+ // collectionFormat is assumed to be "csv" by default
+ String delimiter = ",";
+
+ if ("ssv".equals(collectionFormat)) {
+ delimiter = " ";
+ }
+ else if ("tsv".equals(collectionFormat)) {
+ delimiter = "\t";
+ }
+ else if ("pipes".equals(collectionFormat)) {
+ delimiter = "|";
+ }
+
+ StringBuilder sb = new StringBuilder();
+ for (Object item : value) {
+ sb.append(delimiter);
+ sb.append(parameterToString(item));
+ }
+
+ return sb.substring(delimiter.length());
+ }
+
+ /**
+ * Sanitize filename by removing path. e.g. ../../sun.gif becomes sun.gif
+ * @param filename The filename to be sanitized
+ * @return The sanitized filename
+ */
+ public String sanitizeFilename(String filename) {
+ return filename.replaceAll(".*[/\\\\]", "");
+ }
+
+ /**
+ * Check if the given MIME is a JSON MIME. JSON MIME examples: application/json
+ * application/json; charset=UTF8 APPLICATION/JSON application/vnd.company+json "* /
+ * *" is also default to JSON
+ * @param mime MIME (Multipurpose Internet Mail Extensions)
+ * @return True if the given MIME is JSON, false otherwise.
+ */
+ 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, returns null.
+ * If it matches "any", JSON will be used.
+ */
+ public String selectHeaderContentType(String[] contentTypes) {
+ if (contentTypes.length == 0) {
+ return null;
+ }
+
+ if (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 to be escaped
+ * @return Escaped string
+ */
+ public String escapeString(String str) {
+ try {
+ return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20");
+ }
+ catch (UnsupportedEncodingException e) {
+ return str;
+ }
+ }
+
+ /**
+ * Deserialize response body to Java object, according to the return type and the
+ * Content-Type response header.
+ * @param Type
+ * @param response HTTP response
+ * @param returnType The type of the Java object
+ * @return The deserialized Java object
+ * @throws org.openapitools.client.ApiException If fail to deserialize response body,
+ * i.e. cannot read response body or the Content-Type of the response is not
+ * supported.
+ */
+ @SuppressWarnings("unchecked")
+ public T deserialize(Response response, Type returnType) throws ApiException {
+ if (response == null || returnType == null) {
+ return null;
+ }
+
+ if ("byte[]".equals(returnType.toString())) {
+ // Handle binary response (byte array).
+ try {
+ return (T) response.body().bytes();
+ }
+ catch (IOException e) {
+ throw new ApiException(e);
+ }
+ }
+ else if (returnType.equals(File.class)) {
+ // Handle file downloading.
+ return (T) downloadFileFromResponse(response);
+ }
+
+ String respBody;
+ try {
+ if (response.body() != null)
+ respBody = response.body().string();
+ else
+ respBody = null;
+ }
+ catch (IOException e) {
+ throw new ApiException(e);
+ }
+
+ if (respBody == null || "".equals(respBody)) {
+ return null;
+ }
+
+ String contentType = response.headers().get("Content-Type");
+ if (contentType == null) {
+ // ensuring a default content type
+ contentType = "application/json";
+ }
+ if (isJsonMime(contentType)) {
+ return json.deserialize(respBody, returnType);
+ }
+ else if (returnType.equals(String.class)) {
+ // Expecting string, return the raw response body.
+ return (T) respBody;
+ }
+ else {
+ throw new ApiException("Content type \"" + contentType + "\" is not supported for type: " + returnType,
+ response.code(), response.headers().toMultimap(), respBody);
+ }
+ }
+
+ /**
+ * Serialize the given Java object into request body according to the object's class
+ * and the request Content-Type.
+ * @param obj The Java object
+ * @param contentType The request Content-Type
+ * @return The serialized request body
+ * @throws org.openapitools.client.ApiException If fail to serialize the given object
+ */
+ public RequestBody serialize(Object obj, String contentType) throws ApiException {
+ if (obj instanceof byte[]) {
+ // Binary (byte array) body parameter support.
+ return RequestBody.create((byte[]) obj, MediaType.parse(contentType));
+ }
+ else if (obj instanceof File) {
+ // File body parameter support.
+ return RequestBody.create((File) obj, MediaType.parse(contentType));
+ }
+ else if ("text/plain".equals(contentType) && obj instanceof String) {
+ return RequestBody.create((String) obj, MediaType.parse(contentType));
+ }
+ else if (isJsonMime(contentType)) {
+ String content;
+ if (obj != null) {
+ content = json.serialize(obj);
+ }
+ else {
+ content = null;
+ }
+ return RequestBody.create(content, MediaType.parse(contentType));
+ }
+ else {
+ throw new ApiException("Content type \"" + contentType + "\" is not supported");
+ }
+ }
+
+ /**
+ * Download file from the given response.
+ * @param response An instance of the Response object
+ * @throws org.openapitools.client.ApiException If fail to read file content from
+ * response and write to disk
+ * @return Downloaded file
+ */
+ public File downloadFileFromResponse(Response response) throws ApiException {
+ try {
+ File file = prepareDownloadFile(response);
+ BufferedSink sink = Okio.buffer(Okio.sink(file));
+ sink.writeAll(response.body().source());
+ sink.close();
+ return file;
+ }
+ catch (IOException e) {
+ throw new ApiException(e);
+ }
+ }
+
+ /**
+ * Prepare file for download
+ * @param response An instance of the Response object
+ * @return Prepared file for the download
+ * @throws java.io.IOException If fail to prepare file for download
+ */
+ public File prepareDownloadFile(Response response) throws IOException {
+ String filename = null;
+ String contentDisposition = response.header("Content-Disposition");
+ 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 = sanitizeFilename(matcher.group(1));
+ }
+ }
+
+ String prefix = null;
+ 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();
+ }
+
+ /**
+ * {@link #execute(Call, Type)}
+ * @param Type
+ * @param call An instance of the Call object
+ * @return ApiResponse<T>
+ * @throws org.openapitools.client.ApiException If fail to execute the call
+ */
+ public ApiResponse execute(Call call) throws ApiException {
+ return execute(call, null);
+ }
+
+ /**
+ * Execute HTTP call and deserialize the HTTP response body into the given return
+ * type.
+ * @param returnType The return type used to deserialize HTTP response body
+ * @param The return type corresponding to (same with) returnType
+ * @param call Call
+ * @return ApiResponse object containing response status, headers and data, which is a
+ * Java object deserialized from response body and would be null when returnType is
+ * null.
+ * @throws org.openapitools.client.ApiException If fail to execute the call
+ */
+ public ApiResponse execute(Call call, Type returnType) throws ApiException {
+ try {
+ Response response = call.execute();
+ T data = handleResponse(response, returnType);
+ return new ApiResponse(response.code(), response.headers().toMultimap(), data);
+ }
+ catch (IOException e) {
+ throw new ApiException(e);
+ }
+ }
+
+ /**
+ * {@link #executeAsync(Call, Type, ApiCallback)}
+ * @param Type
+ * @param call An instance of the Call object
+ * @param callback ApiCallback<T>
+ */
+ public void executeAsync(Call call, ApiCallback callback) {
+ executeAsync(call, null, callback);
+ }
+
+ /**
+ * Execute HTTP call asynchronously.
+ * @param Type
+ * @param call The callback to be executed when the API call finishes
+ * @param returnType Return type
+ * @param callback ApiCallback
+ * @see #execute(Call, Type)
+ */
+ @SuppressWarnings("unchecked")
+ public void executeAsync(Call call, final Type returnType, final ApiCallback callback) {
+ call.enqueue(new Callback() {
+ @Override
+ public void onFailure(Call call, IOException e) {
+ callback.onFailure(new ApiException(e), 0, null);
+ }
+
+ @Override
+ public void onResponse(Call call, Response response) throws IOException {
+ T result;
+ try {
+ result = (T) handleResponse(response, returnType);
+ }
+ catch (ApiException e) {
+ callback.onFailure(e, response.code(), response.headers().toMultimap());
+ return;
+ }
+ catch (Exception e) {
+ callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap());
+ return;
+ }
+ callback.onSuccess(result, response.code(), response.headers().toMultimap());
+ }
+ });
+ }
+
+ /**
+ * Handle the given response, return the deserialized object when the response is
+ * successful.
+ * @param Type
+ * @param response Response
+ * @param returnType Return type
+ * @return Type
+ * @throws org.openapitools.client.ApiException If the response has an unsuccessful
+ * status code or fail to deserialize the response body
+ */
+ public T handleResponse(Response response, Type returnType) throws ApiException {
+ if (response.isSuccessful()) {
+ if (returnType == null || response.code() == 204) {
+ // returning null if the returnType is not defined,
+ // or the status code is 204 (No Content)
+ if (response.body() != null) {
+ try {
+ response.body().close();
+ }
+ catch (Exception e) {
+ throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
+ }
+ }
+ return null;
+ }
+ else {
+ return deserialize(response, returnType);
+ }
+ }
+ else {
+ String respBody = null;
+ if (response.body() != null) {
+ try {
+ respBody = response.body().string();
+ }
+ catch (IOException e) {
+ throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap());
+ }
+ }
+ throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody);
+ }
+ }
+
+ /**
+ * Build HTTP call with the given options.
+ * @param path The sub-path of the HTTP URL
+ * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT",
+ * "PATCH" and "DELETE"
+ * @param queryParams The query parameters
+ * @param collectionQueryParams The collection query parameters
+ * @param body The request body object
+ * @param headerParams The header parameters
+ * @param cookieParams The cookie parameters
+ * @param formParams The form parameters
+ * @param authNames The authentications to apply
+ * @param callback Callback for upload/download progress
+ * @return The HTTP call
+ * @throws org.openapitools.client.ApiException If fail to serialize the request body
+ * object
+ */
+ public Call buildCall(String baseUrl, String path, String method, List queryParams,
+ List collectionQueryParams, Object body, Map headerParams,
+ Map cookieParams, Map formParams, String[] authNames, ApiCallback callback)
+ throws ApiException {
+ Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams,
+ cookieParams, formParams, authNames, callback);
+
+ return httpClient.newCall(request);
+ }
+
+ /**
+ * Build an HTTP request with the given options.
+ * @param path The sub-path of the HTTP URL
+ * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT",
+ * "PATCH" and "DELETE"
+ * @param queryParams The query parameters
+ * @param collectionQueryParams The collection query parameters
+ * @param body The request body object
+ * @param headerParams The header parameters
+ * @param cookieParams The cookie parameters
+ * @param formParams The form parameters
+ * @param authNames The authentications to apply
+ * @param callback Callback for upload/download progress
+ * @return The HTTP request
+ * @throws org.openapitools.client.ApiException If fail to serialize the request body
+ * object
+ */
+ public Request buildRequest(String baseUrl, String path, String method, List queryParams,
+ List collectionQueryParams, Object body, Map headerParams,
+ Map cookieParams, Map formParams, String[] authNames, ApiCallback callback)
+ throws ApiException {
+ // aggregate queryParams (non-collection) and collectionQueryParams into
+ // allQueryParams
+ List allQueryParams = new ArrayList(queryParams);
+ allQueryParams.addAll(collectionQueryParams);
+
+ final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);
+
+ // prepare HTTP request body
+ RequestBody reqBody;
+ String contentType = headerParams.get("Content-Type");
+
+ if (!HttpMethod.permitsRequestBody(method)) {
+ reqBody = null;
+ }
+ else if ("application/x-www-form-urlencoded".equals(contentType)) {
+ reqBody = buildRequestBodyFormEncoding(formParams);
+ }
+ else if ("multipart/form-data".equals(contentType)) {
+ reqBody = buildRequestBodyMultipart(formParams);
+ }
+ else if (body == null) {
+ if ("DELETE".equals(method)) {
+ // allow calling DELETE without sending a request body
+ reqBody = null;
+ }
+ else {
+ // use an empty request body (for POST, PUT and PATCH)
+ reqBody = RequestBody.create("", MediaType.parse(contentType));
+ }
+ }
+ else {
+ reqBody = serialize(body, contentType);
+ }
+
+ // update parameters with authentication settings
+ updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method,
+ URI.create(url));
+
+ final Request.Builder reqBuilder = new Request.Builder().url(url);
+ processHeaderParams(headerParams, reqBuilder);
+ processCookieParams(cookieParams, reqBuilder);
+
+ // Associate callback with request (if not null) so interceptor can
+ // access it when creating ProgressResponseBody
+ reqBuilder.tag(callback);
+
+ Request request = null;
+
+ if (callback != null && reqBody != null) {
+ ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback);
+ request = reqBuilder.method(method, progressRequestBody).build();
+ }
+ else {
+ request = reqBuilder.method(method, reqBody).build();
+ }
+
+ return request;
+ }
+
+ /**
+ * 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
+ */
+ public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) {
+ final StringBuilder url = new StringBuilder();
+ if (baseUrl != null) {
+ url.append(baseUrl).append(path);
+ }
+ else {
+ url.append(basePath).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());
+ url.append(escapeString(param.getName())).append("=").append(escapeString(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();
+ }
+
+ /**
+ * Set header parameters to the request builder, including default headers.
+ * @param headerParams Header parameters in the form of Map
+ * @param reqBuilder Request.Builder
+ */
+ public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) {
+ for (Entry param : headerParams.entrySet()) {
+ reqBuilder.header(param.getKey(), parameterToString(param.getValue()));
+ }
+ for (Entry header : defaultHeaderMap.entrySet()) {
+ if (!headerParams.containsKey(header.getKey())) {
+ reqBuilder.header(header.getKey(), parameterToString(header.getValue()));
+ }
+ }
+ }
+
+ /**
+ * Set cookie parameters to the request builder, including default cookies.
+ * @param cookieParams Cookie parameters in the form of Map
+ * @param reqBuilder Request.Builder
+ */
+ public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) {
+ for (Entry param : cookieParams.entrySet()) {
+ reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue()));
+ }
+ for (Entry param : defaultCookieMap.entrySet()) {
+ if (!cookieParams.containsKey(param.getKey())) {
+ reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue()));
+ }
+ }
+ }
+
+ /**
+ * Update query and header parameters based on authentication settings.
+ * @param authNames The authentications to apply
+ * @param queryParams List of query parameters
+ * @param headerParams Map of header parameters
+ * @param cookieParams Map of cookie parameters
+ * @param payload HTTP request body
+ * @param method HTTP method
+ * @param uri URI
+ */
+ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams,
+ Map cookieParams, String payload, String method, URI uri) throws ApiException {
+ for (String authName : authNames) {
+ Authentication auth = authentications.get(authName);
+ if (auth == null) {
+ throw new RuntimeException("Authentication undefined: " + authName);
+ }
+ auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri);
+ }
+ }
+
+ /**
+ * Build a form-encoding request body with the given form parameters.
+ * @param formParams Form parameters in the form of Map
+ * @return RequestBody
+ */
+ public RequestBody buildRequestBodyFormEncoding(Map formParams) {
+ okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder();
+ for (Entry param : formParams.entrySet()) {
+ formBuilder.add(param.getKey(), parameterToString(param.getValue()));
+ }
+ return formBuilder.build();
+ }
+
+ /**
+ * Build a multipart (file uploading) request body with the given form parameters,
+ * which could contain text fields and file fields.
+ * @param formParams Form parameters in the form of Map
+ * @return RequestBody
+ */
+ public RequestBody buildRequestBodyMultipart(Map formParams) {
+ MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM);
+ for (Entry param : formParams.entrySet()) {
+ if (param.getValue() instanceof File) {
+ File file = (File) param.getValue();
+ Headers partHeaders = Headers.of("Content-Disposition",
+ "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\"");
+ MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file));
+ mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType));
+ }
+ else {
+ Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"");
+ mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null));
+ }
+ }
+ return mpBuilder.build();
+ }
+
+ /**
+ * Guess Content-Type header from the given file (defaults to
+ * "application/octet-stream").
+ * @param file The given file
+ * @return The guessed Content-Type
+ */
+ public String guessContentTypeFromFile(File file) {
+ String contentType = URLConnection.guessContentTypeFromName(file.getName());
+ if (contentType == null) {
+ return "application/octet-stream";
+ }
+ else {
+ return contentType;
+ }
+ }
+
+ /**
+ * Get network interceptor to add it to the httpClient to track download progress for
+ * async requests.
+ */
+ private Interceptor getProgressInterceptor() {
+ return new Interceptor() {
+ @Override
+ public Response intercept(Interceptor.Chain chain) throws IOException {
+ final Request request = chain.request();
+ final Response originalResponse = chain.proceed(request);
+ if (request.tag() instanceof ApiCallback) {
+ final ApiCallback callback = (ApiCallback) request.tag();
+ return originalResponse.newBuilder()
+ .body(new ProgressResponseBody(originalResponse.body(), callback)).build();
+ }
+ return originalResponse;
+ }
+ };
+ }
+
+ /**
+ * Apply SSL related settings to httpClient according to the current values of
+ * verifyingSsl and sslCaCert.
+ */
+ private void applySslSettings() {
+ try {
+ TrustManager[] trustManagers;
+ HostnameVerifier hostnameVerifier;
+ if (!verifyingSsl) {
+ trustManagers = new TrustManager[] { new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType)
+ throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType)
+ throws CertificateException {
+ }
+
+ @Override
+ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+ return new java.security.cert.X509Certificate[] {};
+ }
+ } };
+ hostnameVerifier = new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ };
+ }
+ else {
+ TrustManagerFactory trustManagerFactory = TrustManagerFactory
+ .getInstance(TrustManagerFactory.getDefaultAlgorithm());
+
+ if (sslCaCert == null) {
+ trustManagerFactory.init((KeyStore) null);
+ }
+ else {
+ char[] password = null; // Any password will work.
+ CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509");
+ Collection extends Certificate> certificates = certificateFactory.generateCertificates(sslCaCert);
+ if (certificates.isEmpty()) {
+ throw new IllegalArgumentException("expected non-empty set of trusted certificates");
+ }
+ KeyStore caKeyStore = newEmptyKeyStore(password);
+ int index = 0;
+ for (Certificate certificate : certificates) {
+ String certificateAlias = "ca" + Integer.toString(index++);
+ caKeyStore.setCertificateEntry(certificateAlias, certificate);
+ }
+ trustManagerFactory.init(caKeyStore);
+ }
+ trustManagers = trustManagerFactory.getTrustManagers();
+ hostnameVerifier = OkHostnameVerifier.INSTANCE;
+ }
+
+ SSLContext sslContext = SSLContext.getInstance("TLS");
+ sslContext.init(keyManagers, trustManagers, new SecureRandom());
+ httpClient = httpClient.newBuilder()
+ .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0])
+ .hostnameVerifier(hostnameVerifier).build();
+ }
+ catch (GeneralSecurityException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException {
+ try {
+ KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
+ keyStore.load(null, password);
+ return keyStore;
+ }
+ catch (IOException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ /**
+ * Convert the HTTP request body to a string.
+ * @param request The HTTP request object
+ * @return The string representation of the HTTP request body
+ * @throws org.openapitools.client.ApiException If fail to serialize the request body
+ * object into a string
+ */
+ private String requestBodyToString(RequestBody requestBody) throws ApiException {
+ if (requestBody != null) {
+ try {
+ final Buffer buffer = new Buffer();
+ requestBody.writeTo(buffer);
+ return buffer.readUtf8();
+ }
+ catch (final IOException e) {
+ throw new ApiException(e);
+ }
+ }
+
+ // empty http request body
+ return "";
+ }
+
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiException.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiException.java
index 8873a1222..e0de23a67 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiException.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiException.java
@@ -3,152 +3,166 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import java.util.Map;
import java.util.List;
/**
- * ApiException class.
+ *
+ * ApiException class.
+ *
*/
@SuppressWarnings("serial")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class ApiException extends Exception {
- private int code = 0;
- private Map> responseHeaders = null;
- private String responseBody = null;
-
- /**
- * Constructor for ApiException.
- */
- public ApiException() {}
-
- /**
- * Constructor for ApiException.
- *
- * @param throwable a {@link java.lang.Throwable} object
- */
- public ApiException(Throwable throwable) {
- super(throwable);
- }
-
- /**
- * Constructor for ApiException.
- *
- * @param message the error message
- */
- public ApiException(String message) {
- super(message);
- }
-
- /**
- * Constructor for ApiException.
- *
- * @param message the error message
- * @param throwable a {@link java.lang.Throwable} object
- * @param code HTTP status code
- * @param responseHeaders a {@link java.util.Map} of HTTP response headers
- * @param responseBody the response body
- */
- public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) {
- super(message, throwable);
- this.code = code;
- this.responseHeaders = responseHeaders;
- this.responseBody = responseBody;
- }
-
- /**
- * Constructor for ApiException.
- *
- * @param message the error message
- * @param code HTTP status code
- * @param responseHeaders a {@link java.util.Map} of HTTP response headers
- * @param responseBody the response body
- */
- public ApiException(String message, int code, Map> responseHeaders, String responseBody) {
- this(message, (Throwable) null, code, responseHeaders, responseBody);
- }
-
- /**
- * Constructor for ApiException.
- *
- * @param message the error message
- * @param throwable a {@link java.lang.Throwable} object
- * @param code HTTP status code
- * @param responseHeaders a {@link java.util.Map} of HTTP response headers
- */
- public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) {
- this(message, throwable, code, responseHeaders, null);
- }
-
- /**
- * Constructor for ApiException.
- *
- * @param code HTTP status code
- * @param responseHeaders a {@link java.util.Map} of HTTP response headers
- * @param responseBody the response body
- */
- public ApiException(int code, Map> responseHeaders, String responseBody) {
- this((String) null, (Throwable) null, code, responseHeaders, responseBody);
- }
-
- /**
- * Constructor for ApiException.
- *
- * @param code HTTP status code
- * @param message a {@link java.lang.String} object
- */
- public ApiException(int code, String message) {
- super(message);
- this.code = code;
- }
-
- /**
- * Constructor for ApiException.
- *
- * @param code HTTP status code
- * @param message the error message
- * @param responseHeaders a {@link java.util.Map} of HTTP response headers
- * @param responseBody the response body
- */
- public ApiException(int code, String message, Map> 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> getResponseHeaders() {
- return responseHeaders;
- }
-
- /**
- * Get the HTTP response body.
- *
- * @return Response body in the form of string
- */
- public String getResponseBody() {
- return responseBody;
- }
+
+ private int code = 0;
+
+ private Map> responseHeaders = null;
+
+ private String responseBody = null;
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ */
+ public ApiException() {
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param throwable a {@link java.lang.Throwable} object
+ */
+ public ApiException(Throwable throwable) {
+ super(throwable);
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param message the error message
+ */
+ public ApiException(String message) {
+ super(message);
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param message the error message
+ * @param throwable a {@link java.lang.Throwable} object
+ * @param code HTTP status code
+ * @param responseHeaders a {@link java.util.Map} of HTTP response headers
+ * @param responseBody the response body
+ */
+ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders,
+ String responseBody) {
+ super(message, throwable);
+ this.code = code;
+ this.responseHeaders = responseHeaders;
+ this.responseBody = responseBody;
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param message the error message
+ * @param code HTTP status code
+ * @param responseHeaders a {@link java.util.Map} of HTTP response headers
+ * @param responseBody the response body
+ */
+ public ApiException(String message, int code, Map> responseHeaders, String responseBody) {
+ this(message, (Throwable) null, code, responseHeaders, responseBody);
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param message the error message
+ * @param throwable a {@link java.lang.Throwable} object
+ * @param code HTTP status code
+ * @param responseHeaders a {@link java.util.Map} of HTTP response headers
+ */
+ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) {
+ this(message, throwable, code, responseHeaders, null);
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param code HTTP status code
+ * @param responseHeaders a {@link java.util.Map} of HTTP response headers
+ * @param responseBody the response body
+ */
+ public ApiException(int code, Map> responseHeaders, String responseBody) {
+ this((String) null, (Throwable) null, code, responseHeaders, responseBody);
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param code HTTP status code
+ * @param message a {@link java.lang.String} object
+ */
+ public ApiException(int code, String message) {
+ super(message);
+ this.code = code;
+ }
+
+ /**
+ *
+ * Constructor for ApiException.
+ *
+ * @param code HTTP status code
+ * @param message the error message
+ * @param responseHeaders a {@link java.util.Map} of HTTP response headers
+ * @param responseBody the response body
+ */
+ public ApiException(int code, String message, Map> 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> getResponseHeaders() {
+ return responseHeaders;
+ }
+
+ /**
+ * Get the HTTP response body.
+ * @return Response body in the form of string
+ */
+ public String getResponseBody() {
+ return responseBody;
+ }
+
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiResponse.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiResponse.java
index 1037b2758..6146b74ec 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiResponse.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ApiResponse.java
@@ -3,14 +3,13 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import java.util.List;
@@ -20,57 +19,66 @@
* API response returned by API call.
*/
public class ApiResponse {
- final private int statusCode;
- final private Map> headers;
- final private T data;
- /**
- * Constructor for ApiResponse.
- *
- * @param statusCode The status code of HTTP response
- * @param headers The headers of HTTP response
- */
- public ApiResponse(int statusCode, Map> headers) {
- this(statusCode, headers, null);
- }
+ final private int statusCode;
+
+ final private Map> headers;
+
+ final private T data;
+
+ /**
+ *
+ * Constructor for ApiResponse.
+ *
+ * @param statusCode The status code of HTTP response
+ * @param headers The headers of HTTP response
+ */
+ public ApiResponse(int statusCode, Map> headers) {
+ this(statusCode, headers, null);
+ }
+
+ /**
+ *
+ * Constructor for ApiResponse.
+ *
+ * @param statusCode The status code of HTTP response
+ * @param headers The headers of HTTP response
+ * @param data The object deserialized from response bod
+ */
+ public ApiResponse(int statusCode, Map> headers, T data) {
+ this.statusCode = statusCode;
+ this.headers = headers;
+ this.data = data;
+ }
- /**
- * Constructor for ApiResponse.
- *
- * @param statusCode The status code of HTTP response
- * @param headers The headers of HTTP response
- * @param data The object deserialized from response bod
- */
- public ApiResponse(int statusCode, Map> headers, T data) {
- this.statusCode = statusCode;
- this.headers = headers;
- this.data = data;
- }
+ /**
+ *
+ * Get the status code
.
+ *
+ * @return the status code
+ */
+ public int getStatusCode() {
+ return statusCode;
+ }
- /**
- * Get the status code
.
- *
- * @return the status code
- */
- public int getStatusCode() {
- return statusCode;
- }
+ /**
+ *
+ * Get the headers
.
+ *
+ * @return a {@link java.util.Map} of headers
+ */
+ public Map> getHeaders() {
+ return headers;
+ }
- /**
- * Get the headers
.
- *
- * @return a {@link java.util.Map} of headers
- */
- public Map> getHeaders() {
- return headers;
- }
+ /**
+ *
+ * Get the data
.
+ *
+ * @return the data
+ */
+ public T getData() {
+ return data;
+ }
- /**
- * Get the data
.
- *
- * @return the data
- */
- public T getData() {
- return data;
- }
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Configuration.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Configuration.java
index de69ab7bc..a3db7e1bf 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Configuration.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Configuration.java
@@ -3,37 +3,36 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
@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;
- }
+ 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;
+ }
- /**
- * 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;
- }
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/GzipRequestInterceptor.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/GzipRequestInterceptor.java
index fbd160ae5..c0c907d49 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/GzipRequestInterceptor.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/GzipRequestInterceptor.java
@@ -3,14 +3,13 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import okhttp3.*;
@@ -27,59 +26,59 @@
* Taken from https://github.com/square/okhttp/issues/350
*/
class GzipRequestInterceptor implements Interceptor {
- @Override
- public Response intercept(Chain chain) throws IOException {
- Request originalRequest = chain.request();
- if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
- return chain.proceed(originalRequest);
- }
- Request compressedRequest = originalRequest.newBuilder()
- .header("Content-Encoding", "gzip")
- .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body())))
- .build();
- return chain.proceed(compressedRequest);
- }
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request originalRequest = chain.request();
+ if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) {
+ return chain.proceed(originalRequest);
+ }
+
+ Request compressedRequest = originalRequest.newBuilder().header("Content-Encoding", "gzip")
+ .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))).build();
+ return chain.proceed(compressedRequest);
+ }
+
+ private RequestBody forceContentLength(final RequestBody requestBody) throws IOException {
+ final Buffer buffer = new Buffer();
+ requestBody.writeTo(buffer);
+ return new RequestBody() {
+ @Override
+ public MediaType contentType() {
+ return requestBody.contentType();
+ }
- private RequestBody forceContentLength(final RequestBody requestBody) throws IOException {
- final Buffer buffer = new Buffer();
- requestBody.writeTo(buffer);
- return new RequestBody() {
- @Override
- public MediaType contentType() {
- return requestBody.contentType();
- }
+ @Override
+ public long contentLength() {
+ return buffer.size();
+ }
- @Override
- public long contentLength() {
- return buffer.size();
- }
+ @Override
+ public void writeTo(BufferedSink sink) throws IOException {
+ sink.write(buffer.snapshot());
+ }
+ };
+ }
- @Override
- public void writeTo(BufferedSink sink) throws IOException {
- sink.write(buffer.snapshot());
- }
- };
- }
+ private RequestBody gzip(final RequestBody body) {
+ return new RequestBody() {
+ @Override
+ public MediaType contentType() {
+ return body.contentType();
+ }
- private RequestBody gzip(final RequestBody body) {
- return new RequestBody() {
- @Override
- public MediaType contentType() {
- return body.contentType();
- }
+ @Override
+ public long contentLength() {
+ return -1; // We don't know the compressed length in advance!
+ }
- @Override
- public long contentLength() {
- return -1; // We don't know the compressed length in advance!
- }
+ @Override
+ public void writeTo(BufferedSink sink) throws IOException {
+ BufferedSink gzipSink = Okio.buffer(new GzipSink(sink));
+ body.writeTo(gzipSink);
+ gzipSink.close();
+ }
+ };
+ }
- @Override
- public void writeTo(BufferedSink sink) throws IOException {
- BufferedSink gzipSink = Okio.buffer(new GzipSink(sink));
- body.writeTo(gzipSink);
- gzipSink.close();
- }
- };
- }
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/JSON.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/JSON.java
index 370f65cbf..b4acf6b1d 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/JSON.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/JSON.java
@@ -3,14 +3,13 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import com.google.gson.Gson;
@@ -39,270 +38,284 @@
import java.util.HashMap;
public class JSON {
- private Gson gson;
- private boolean isLenientOnJson = false;
- private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
- private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
- private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
-
- @SuppressWarnings("unchecked")
- public static GsonBuilder createGson() {
- GsonFireBuilder fireBuilder = new GsonFireBuilder()
- ;
- GsonBuilder builder = fireBuilder.createGsonBuilder();
- return builder;
- }
-
- private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {
- JsonElement element = readElement.getAsJsonObject().get(discriminatorField);
- if (null == element) {
- throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">");
- }
- return element.getAsString();
- }
-
- /**
- * Returns the Java class that implements the OpenAPI schema for the specified discriminator value.
- *
- * @param classByDiscriminatorValue The map of discriminator values to Java classes.
- * @param discriminatorValue The value of the OpenAPI discriminator in the input data.
- * @return The Java class that implements the OpenAPI schema
- */
- private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) {
- Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue);
- if (null == clazz) {
- throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">");
- }
- return clazz;
- }
-
- public JSON() {
- gson = createGson()
- .registerTypeAdapter(Date.class, dateTypeAdapter)
- .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter)
- .registerTypeAdapter(byte[].class, byteArrayAdapter)
- .create();
- }
-
- /**
- * Get Gson.
- *
- * @return Gson
- */
- public Gson getGson() {
- return gson;
- }
-
- /**
- * Set Gson.
- *
- * @param gson Gson
- * @return JSON
- */
- public JSON setGson(Gson gson) {
- this.gson = gson;
- return this;
- }
-
- /**
- * Configure the parser to be liberal in what it accepts.
- *
- * @param lenientOnJson Set it to true to ignore some syntax errors
- * @return JSON
- * @see https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/stream/JsonReader.html
- */
- public JSON setLenientOnJson(boolean lenientOnJson) {
- isLenientOnJson = lenientOnJson;
- return this;
- }
-
- /**
- * Serialize the given Java object into JSON string.
- *
- * @param obj Object
- * @return String representation of the JSON
- */
- public String serialize(Object obj) {
- return gson.toJson(obj);
- }
-
- /**
- * Deserialize the given JSON string to Java object.
- *
- * @param Type
- * @param body The JSON string
- * @param returnType The type to deserialize into
- * @return The deserialized Java object
- */
- @SuppressWarnings("unchecked")
- public T deserialize(String body, Type returnType) {
- try {
- if (isLenientOnJson) {
- JsonReader jsonReader = new JsonReader(new StringReader(body));
- // see https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/stream/JsonReader.html
- jsonReader.setLenient(true);
- return gson.fromJson(jsonReader, returnType);
- } else {
- return gson.fromJson(body, returnType);
- }
- } catch (JsonParseException e) {
- // Fallback processing when failed to parse JSON form response body:
- // return the response body string directly for the String return type;
- if (returnType.equals(String.class)) {
- return (T) body;
- } else {
- throw (e);
- }
- }
- }
-
- /**
- * Gson TypeAdapter for Byte Array type
- */
- public class ByteArrayAdapter extends TypeAdapter {
-
- @Override
- public void write(JsonWriter out, byte[] value) throws IOException {
- if (value == null) {
- out.nullValue();
- } else {
- out.value(ByteString.of(value).base64());
- }
- }
-
- @Override
- public byte[] read(JsonReader in) throws IOException {
- switch (in.peek()) {
- case NULL:
- in.nextNull();
- return null;
- default:
- String bytesAsBase64 = in.nextString();
- ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
- return byteString.toByteArray();
- }
- }
- }
-
- /**
- * Gson TypeAdapter for java.sql.Date type
- * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used
- * (more efficient than SimpleDateFormat).
- */
- public static class SqlDateTypeAdapter extends TypeAdapter {
-
- private DateFormat dateFormat;
-
- public SqlDateTypeAdapter() {}
-
- public SqlDateTypeAdapter(DateFormat dateFormat) {
- this.dateFormat = dateFormat;
- }
-
- public void setFormat(DateFormat dateFormat) {
- this.dateFormat = dateFormat;
- }
-
- @Override
- public void write(JsonWriter out, java.sql.Date date) throws IOException {
- if (date == null) {
- out.nullValue();
- } else {
- String value;
- if (dateFormat != null) {
- value = dateFormat.format(date);
- } else {
- value = date.toString();
- }
- out.value(value);
- }
- }
-
- @Override
- public java.sql.Date read(JsonReader in) throws IOException {
- switch (in.peek()) {
- case NULL:
- in.nextNull();
- return null;
- default:
- String date = in.nextString();
- try {
- if (dateFormat != null) {
- return new java.sql.Date(dateFormat.parse(date).getTime());
- }
- return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
- } catch (ParseException e) {
- throw new JsonParseException(e);
- }
- }
- }
- }
-
- /**
- * Gson TypeAdapter for java.util.Date type
- * If the dateFormat is null, ISO8601Utils will be used.
- */
- public static class DateTypeAdapter extends TypeAdapter {
-
- private DateFormat dateFormat;
-
- public DateTypeAdapter() {}
-
- public DateTypeAdapter(DateFormat dateFormat) {
- this.dateFormat = dateFormat;
- }
-
- public void setFormat(DateFormat dateFormat) {
- this.dateFormat = dateFormat;
- }
-
- @Override
- public void write(JsonWriter out, Date date) throws IOException {
- if (date == null) {
- out.nullValue();
- } else {
- String value;
- if (dateFormat != null) {
- value = dateFormat.format(date);
- } else {
- value = ISO8601Utils.format(date, true);
- }
- out.value(value);
- }
- }
-
- @Override
- public Date read(JsonReader in) throws IOException {
- try {
- switch (in.peek()) {
- case NULL:
- in.nextNull();
- return null;
- default:
- String date = in.nextString();
- try {
- if (dateFormat != null) {
- return dateFormat.parse(date);
- }
- return ISO8601Utils.parse(date, new ParsePosition(0));
- } catch (ParseException e) {
- throw new JsonParseException(e);
- }
- }
- } catch (IllegalArgumentException e) {
- throw new JsonParseException(e);
- }
- }
- }
-
- public JSON setDateFormat(DateFormat dateFormat) {
- dateTypeAdapter.setFormat(dateFormat);
- return this;
- }
-
- public JSON setSqlDateFormat(DateFormat dateFormat) {
- sqlDateTypeAdapter.setFormat(dateFormat);
- return this;
- }
+
+ private Gson gson;
+
+ private boolean isLenientOnJson = false;
+
+ private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter();
+
+ private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter();
+
+ private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter();
+
+ @SuppressWarnings("unchecked")
+ public static GsonBuilder createGson() {
+ GsonFireBuilder fireBuilder = new GsonFireBuilder();
+ GsonBuilder builder = fireBuilder.createGsonBuilder();
+ return builder;
+ }
+
+ private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) {
+ JsonElement element = readElement.getAsJsonObject().get(discriminatorField);
+ if (null == element) {
+ throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">");
+ }
+ return element.getAsString();
+ }
+
+ /**
+ * Returns the Java class that implements the OpenAPI schema for the specified
+ * discriminator value.
+ * @param classByDiscriminatorValue The map of discriminator values to Java classes.
+ * @param discriminatorValue The value of the OpenAPI discriminator in the input data.
+ * @return The Java class that implements the OpenAPI schema
+ */
+ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) {
+ Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue);
+ if (null == clazz) {
+ throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">");
+ }
+ return clazz;
+ }
+
+ public JSON() {
+ gson = createGson().registerTypeAdapter(Date.class, dateTypeAdapter)
+ .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter)
+ .registerTypeAdapter(byte[].class, byteArrayAdapter).create();
+ }
+
+ /**
+ * Get Gson.
+ * @return Gson
+ */
+ public Gson getGson() {
+ return gson;
+ }
+
+ /**
+ * Set Gson.
+ * @param gson Gson
+ * @return JSON
+ */
+ public JSON setGson(Gson gson) {
+ this.gson = gson;
+ return this;
+ }
+
+ /**
+ * Configure the parser to be liberal in what it accepts.
+ * @param lenientOnJson Set it to true to ignore some syntax errors
+ * @return JSON
+ * @see https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/stream/JsonReader.html
+ */
+ public JSON setLenientOnJson(boolean lenientOnJson) {
+ isLenientOnJson = lenientOnJson;
+ return this;
+ }
+
+ /**
+ * Serialize the given Java object into JSON string.
+ * @param obj Object
+ * @return String representation of the JSON
+ */
+ public String serialize(Object obj) {
+ return gson.toJson(obj);
+ }
+
+ /**
+ * Deserialize the given JSON string to Java object.
+ * @param Type
+ * @param body The JSON string
+ * @param returnType The type to deserialize into
+ * @return The deserialized Java object
+ */
+ @SuppressWarnings("unchecked")
+ public T deserialize(String body, Type returnType) {
+ try {
+ if (isLenientOnJson) {
+ JsonReader jsonReader = new JsonReader(new StringReader(body));
+ // see
+ // https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.5/com/google/gson/stream/JsonReader.html
+ jsonReader.setLenient(true);
+ return gson.fromJson(jsonReader, returnType);
+ }
+ else {
+ return gson.fromJson(body, returnType);
+ }
+ }
+ catch (JsonParseException e) {
+ // Fallback processing when failed to parse JSON form response body:
+ // return the response body string directly for the String return type;
+ if (returnType.equals(String.class)) {
+ return (T) body;
+ }
+ else {
+ throw (e);
+ }
+ }
+ }
+
+ /**
+ * Gson TypeAdapter for Byte Array type
+ */
+ public class ByteArrayAdapter extends TypeAdapter {
+
+ @Override
+ public void write(JsonWriter out, byte[] value) throws IOException {
+ if (value == null) {
+ out.nullValue();
+ }
+ else {
+ out.value(ByteString.of(value).base64());
+ }
+ }
+
+ @Override
+ public byte[] read(JsonReader in) throws IOException {
+ switch (in.peek()) {
+ case NULL:
+ in.nextNull();
+ return null;
+ default:
+ String bytesAsBase64 = in.nextString();
+ ByteString byteString = ByteString.decodeBase64(bytesAsBase64);
+ return byteString.toByteArray();
+ }
+ }
+
+ }
+
+ /**
+ * Gson TypeAdapter for java.sql.Date type If the dateFormat is null, a simple
+ * "yyyy-MM-dd" format will be used (more efficient than SimpleDateFormat).
+ */
+ public static class SqlDateTypeAdapter extends TypeAdapter {
+
+ private DateFormat dateFormat;
+
+ public SqlDateTypeAdapter() {
+ }
+
+ public SqlDateTypeAdapter(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ public void setFormat(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ @Override
+ public void write(JsonWriter out, java.sql.Date date) throws IOException {
+ if (date == null) {
+ out.nullValue();
+ }
+ else {
+ String value;
+ if (dateFormat != null) {
+ value = dateFormat.format(date);
+ }
+ else {
+ value = date.toString();
+ }
+ out.value(value);
+ }
+ }
+
+ @Override
+ public java.sql.Date read(JsonReader in) throws IOException {
+ switch (in.peek()) {
+ case NULL:
+ in.nextNull();
+ return null;
+ default:
+ String date = in.nextString();
+ try {
+ if (dateFormat != null) {
+ return new java.sql.Date(dateFormat.parse(date).getTime());
+ }
+ return new java.sql.Date(ISO8601Utils.parse(date, new ParsePosition(0)).getTime());
+ }
+ catch (ParseException e) {
+ throw new JsonParseException(e);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Gson TypeAdapter for java.util.Date type If the dateFormat is null, ISO8601Utils
+ * will be used.
+ */
+ public static class DateTypeAdapter extends TypeAdapter {
+
+ private DateFormat dateFormat;
+
+ public DateTypeAdapter() {
+ }
+
+ public DateTypeAdapter(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ public void setFormat(DateFormat dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ @Override
+ public void write(JsonWriter out, Date date) throws IOException {
+ if (date == null) {
+ out.nullValue();
+ }
+ else {
+ String value;
+ if (dateFormat != null) {
+ value = dateFormat.format(date);
+ }
+ else {
+ value = ISO8601Utils.format(date, true);
+ }
+ out.value(value);
+ }
+ }
+
+ @Override
+ public Date read(JsonReader in) throws IOException {
+ try {
+ switch (in.peek()) {
+ case NULL:
+ in.nextNull();
+ return null;
+ default:
+ String date = in.nextString();
+ try {
+ if (dateFormat != null) {
+ return dateFormat.parse(date);
+ }
+ return ISO8601Utils.parse(date, new ParsePosition(0));
+ }
+ catch (ParseException e) {
+ throw new JsonParseException(e);
+ }
+ }
+ }
+ catch (IllegalArgumentException e) {
+ throw new JsonParseException(e);
+ }
+ }
+
+ }
+
+ public JSON setDateFormat(DateFormat dateFormat) {
+ dateTypeAdapter.setFormat(dateFormat);
+ return this;
+ }
+
+ public JSON setSqlDateFormat(DateFormat dateFormat) {
+ sqlDateTypeAdapter.setFormat(dateFormat);
+ return this;
+ }
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/LoginApi.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/LoginApi.java
index f80ac2fa7..2212d7cc1 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/LoginApi.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/LoginApi.java
@@ -3,14 +3,13 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import com.redhat.parodos.sdk.api.ApiCallback;
@@ -26,8 +25,6 @@
import java.io.IOException;
-
-
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
@@ -35,158 +32,213 @@
import java.util.Map;
public class LoginApi {
- private ApiClient localVarApiClient;
- private int localHostIndex;
- private String localCustomBaseUrl;
-
- public LoginApi() {
- this(Configuration.getDefaultApiClient());
- }
-
- public LoginApi(ApiClient apiClient) {
- this.localVarApiClient = apiClient;
- }
-
- public ApiClient getApiClient() {
- return localVarApiClient;
- }
-
- public void setApiClient(ApiClient apiClient) {
- this.localVarApiClient = apiClient;
- }
-
- public int getHostIndex() {
- return localHostIndex;
- }
-
- public void setHostIndex(int hostIndex) {
- this.localHostIndex = hostIndex;
- }
-
- public String getCustomBaseUrl() {
- return localCustomBaseUrl;
- }
-
- public void setCustomBaseUrl(String customBaseUrl) {
- this.localCustomBaseUrl = customBaseUrl;
- }
-
- /**
- * Build call for login
- * @param _callback Callback for upload/download progress
- * @return Call to execute
- * @throws ApiException If fail to serialize the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
-
- */
- public okhttp3.Call loginCall(final ApiCallback _callback) throws ApiException {
- String basePath = null;
-
- // Operation Servers
- String[] localBasePaths = new String[] { };
-
- // Determine Base Path to Use
- if (localCustomBaseUrl != null){
- basePath = localCustomBaseUrl;
- } else if ( localBasePaths.length > 0 ) {
- basePath = localBasePaths[localHostIndex];
- } else {
- basePath = null;
- }
-
- Object localVarPostBody = null;
-
- // create path and map variables
- String localVarPath = "/api/v1/login";
-
- List localVarQueryParams = new ArrayList();
- List localVarCollectionQueryParams = new ArrayList();
- Map localVarHeaderParams = new HashMap();
- Map localVarCookieParams = new HashMap();
- Map localVarFormParams = new HashMap();
-
- final String[] localVarAccepts = {
-
- };
- final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
- if (localVarAccept != null) {
- localVarHeaderParams.put("Accept", localVarAccept);
- }
-
- final String[] localVarContentTypes = {
-
- };
- final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
- if (localVarContentType != null) {
- localVarHeaderParams.put("Content-Type", localVarContentType);
- }
-
- String[] localVarAuthNames = new String[] { };
- return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
- }
-
- @SuppressWarnings("rawtypes")
- private okhttp3.Call loginValidateBeforeCall(final ApiCallback _callback) throws ApiException {
-
-
- okhttp3.Call localVarCall = loginCall(_callback);
- return localVarCall;
-
- }
-
- /**
- * Login
- *
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
-
- */
- public void login() throws ApiException {
- loginWithHttpInfo();
- }
-
- /**
- * Login
- *
- * @return ApiResponse<Void>
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
-
- */
- public ApiResponse loginWithHttpInfo() throws ApiException {
- okhttp3.Call localVarCall = loginValidateBeforeCall(null);
- return localVarApiClient.execute(localVarCall);
- }
-
- /**
- * Login (asynchronously)
- *
- * @param _callback The callback to be executed when the API call finishes
- * @return The request call
- * @throws ApiException If fail to process the API call, e.g. serializing the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
-
- */
- public okhttp3.Call loginAsync(final ApiCallback _callback) throws ApiException {
-
- okhttp3.Call localVarCall = loginValidateBeforeCall(_callback);
- localVarApiClient.executeAsync(localVarCall, _callback);
- return localVarCall;
- }
+
+ private ApiClient localVarApiClient;
+
+ private int localHostIndex;
+
+ private String localCustomBaseUrl;
+
+ public LoginApi() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public LoginApi(ApiClient apiClient) {
+ this.localVarApiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return localVarApiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.localVarApiClient = apiClient;
+ }
+
+ public int getHostIndex() {
+ return localHostIndex;
+ }
+
+ public void setHostIndex(int hostIndex) {
+ this.localHostIndex = hostIndex;
+ }
+
+ public String getCustomBaseUrl() {
+ return localCustomBaseUrl;
+ }
+
+ public void setCustomBaseUrl(String customBaseUrl) {
+ this.localCustomBaseUrl = customBaseUrl;
+ }
+
+ /**
+ * Build call for login
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 200 |
+ * Succeeded |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public okhttp3.Call loginCall(final ApiCallback _callback) throws ApiException {
+ String basePath = null;
+
+ // Operation Servers
+ String[] localBasePaths = new String[] {};
+
+ // Determine Base Path to Use
+ if (localCustomBaseUrl != null) {
+ basePath = localCustomBaseUrl;
+ }
+ else if (localBasePaths.length > 0) {
+ basePath = localBasePaths[localHostIndex];
+ }
+ else {
+ basePath = null;
+ }
+
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/api/v1/login";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = {
+
+ };
+ final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {
+
+ };
+ final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
+ if (localVarContentType != null) {
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+ }
+
+ String[] localVarAuthNames = new String[] {};
+ return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams,
+ localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams,
+ localVarFormParams, localVarAuthNames, _callback);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call loginValidateBeforeCall(final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = loginCall(_callback);
+ return localVarCall;
+
+ }
+
+ /**
+ * Login
+ * @throws ApiException If fail to call the API, e.g. server error or cannot
+ * deserialize the response body
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 200 |
+ * Succeeded |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public void login() throws ApiException {
+ loginWithHttpInfo();
+ }
+
+ /**
+ * Login
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot
+ * deserialize the response body
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 200 |
+ * Succeeded |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public ApiResponse loginWithHttpInfo() throws ApiException {
+ okhttp3.Call localVarCall = loginValidateBeforeCall(null);
+ return localVarApiClient.execute(localVarCall);
+ }
+
+ /**
+ * Login (asynchronously)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request
+ * body object
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 200 |
+ * Succeeded |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public okhttp3.Call loginAsync(final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = loginValidateBeforeCall(_callback);
+ localVarApiClient.executeAsync(localVarCall, _callback);
+ return localVarCall;
+ }
+
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Pair.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Pair.java
index f8d4dd024..5a257eb74 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Pair.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/Pair.java
@@ -3,55 +3,57 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
@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 String name = "";
+
+ private String value = "";
+
+ public Pair(String name, String value) {
+ setName(name);
+ setValue(value);
+ }
+
+ private void setName(String name) {
+ if (!isValidString(name)) {
+ return;
+ }
- private void setName(String name) {
- if (!isValidString(name)) {
- return;
- }
+ this.name = name;
+ }
- this.name = name;
- }
+ private void setValue(String value) {
+ if (!isValidString(value)) {
+ return;
+ }
- private void setValue(String value) {
- if (!isValidString(value)) {
- return;
- }
+ this.value = value;
+ }
- this.value = value;
- }
+ public String getName() {
+ return this.name;
+ }
- public String getName() {
- return this.name;
- }
+ public String getValue() {
+ return this.value;
+ }
- public String getValue() {
- return this.value;
- }
+ private boolean isValidString(String arg) {
+ if (arg == null) {
+ return false;
+ }
- private boolean isValidString(String arg) {
- if (arg == null) {
- return false;
- }
+ return true;
+ }
- return true;
- }
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressRequestBody.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressRequestBody.java
index 94f77b367..0548564f9 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressRequestBody.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressRequestBody.java
@@ -3,14 +3,13 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import okhttp3.MediaType;
@@ -26,48 +25,50 @@
public class ProgressRequestBody extends RequestBody {
- private final RequestBody requestBody;
-
- private final ApiCallback callback;
-
- public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) {
- this.requestBody = requestBody;
- this.callback = callback;
- }
-
- @Override
- public MediaType contentType() {
- return requestBody.contentType();
- }
-
- @Override
- public long contentLength() throws IOException {
- return requestBody.contentLength();
- }
-
- @Override
- public void writeTo(BufferedSink sink) throws IOException {
- BufferedSink bufferedSink = Okio.buffer(sink(sink));
- requestBody.writeTo(bufferedSink);
- bufferedSink.flush();
- }
-
- private Sink sink(Sink sink) {
- return new ForwardingSink(sink) {
-
- long bytesWritten = 0L;
- long contentLength = 0L;
-
- @Override
- public void write(Buffer source, long byteCount) throws IOException {
- super.write(source, byteCount);
- if (contentLength == 0) {
- contentLength = contentLength();
- }
-
- bytesWritten += byteCount;
- callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength);
- }
- };
- }
+ private final RequestBody requestBody;
+
+ private final ApiCallback callback;
+
+ public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) {
+ this.requestBody = requestBody;
+ this.callback = callback;
+ }
+
+ @Override
+ public MediaType contentType() {
+ return requestBody.contentType();
+ }
+
+ @Override
+ public long contentLength() throws IOException {
+ return requestBody.contentLength();
+ }
+
+ @Override
+ public void writeTo(BufferedSink sink) throws IOException {
+ BufferedSink bufferedSink = Okio.buffer(sink(sink));
+ requestBody.writeTo(bufferedSink);
+ bufferedSink.flush();
+ }
+
+ private Sink sink(Sink sink) {
+ return new ForwardingSink(sink) {
+
+ long bytesWritten = 0L;
+
+ long contentLength = 0L;
+
+ @Override
+ public void write(Buffer source, long byteCount) throws IOException {
+ super.write(source, byteCount);
+ if (contentLength == 0) {
+ contentLength = contentLength();
+ }
+
+ bytesWritten += byteCount;
+ callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength);
+ }
+ };
+ }
+
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressResponseBody.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressResponseBody.java
index 87b06e614..330665545 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressResponseBody.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProgressResponseBody.java
@@ -3,14 +3,13 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import okhttp3.MediaType;
@@ -26,45 +25,49 @@
public class ProgressResponseBody extends ResponseBody {
- private final ResponseBody responseBody;
- private final ApiCallback callback;
- private BufferedSource bufferedSource;
+ private final ResponseBody responseBody;
+
+ private final ApiCallback callback;
+
+ private BufferedSource bufferedSource;
+
+ public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
+ this.responseBody = responseBody;
+ this.callback = callback;
+ }
- public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) {
- this.responseBody = responseBody;
- this.callback = callback;
- }
+ @Override
+ public MediaType contentType() {
+ return responseBody.contentType();
+ }
- @Override
- public MediaType contentType() {
- return responseBody.contentType();
- }
+ @Override
+ public long contentLength() {
+ return responseBody.contentLength();
+ }
- @Override
- public long contentLength() {
- return responseBody.contentLength();
- }
+ @Override
+ public BufferedSource source() {
+ if (bufferedSource == null) {
+ bufferedSource = Okio.buffer(source(responseBody.source()));
+ }
+ return bufferedSource;
+ }
- @Override
- public BufferedSource source() {
- if (bufferedSource == null) {
- bufferedSource = Okio.buffer(source(responseBody.source()));
- }
- return bufferedSource;
- }
+ private Source source(Source source) {
+ return new ForwardingSource(source) {
+ long totalBytesRead = 0L;
- private Source source(Source source) {
- return new ForwardingSource(source) {
- long totalBytesRead = 0L;
+ @Override
+ public long read(Buffer sink, long byteCount) throws IOException {
+ long bytesRead = super.read(sink, byteCount);
+ // read() returns the number of bytes read, or -1 if this source is
+ // exhausted.
+ totalBytesRead += bytesRead != -1 ? bytesRead : 0;
+ callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
+ return bytesRead;
+ }
+ };
+ }
- @Override
- public long read(Buffer sink, long byteCount) throws IOException {
- long bytesRead = super.read(sink, byteCount);
- // read() returns the number of bytes read, or -1 if this source is exhausted.
- totalBytesRead += bytesRead != -1 ? bytesRead : 0;
- callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
- return bytesRead;
- }
- };
- }
}
diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProjectApi.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProjectApi.java
index 7fa7aafe1..bccae07cc 100644
--- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProjectApi.java
+++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/ProjectApi.java
@@ -3,14 +3,13 @@
* This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option.
*
* The version of the OpenAPI document: v1.0.0
- *
+ *
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
-
package com.redhat.parodos.sdk.api;
import com.redhat.parodos.sdk.api.ApiCallback;
@@ -26,7 +25,6 @@
import java.io.IOException;
-
import com.redhat.parodos.sdk.model.ProjectRequestDTO;
import com.redhat.parodos.sdk.model.ProjectResponseDTO;
@@ -37,433 +35,628 @@
import java.util.Map;
public class ProjectApi {
- private ApiClient localVarApiClient;
- private int localHostIndex;
- private String localCustomBaseUrl;
-
- public ProjectApi() {
- this(Configuration.getDefaultApiClient());
- }
-
- public ProjectApi(ApiClient apiClient) {
- this.localVarApiClient = apiClient;
- }
-
- public ApiClient getApiClient() {
- return localVarApiClient;
- }
-
- public void setApiClient(ApiClient apiClient) {
- this.localVarApiClient = apiClient;
- }
-
- public int getHostIndex() {
- return localHostIndex;
- }
-
- public void setHostIndex(int hostIndex) {
- this.localHostIndex = hostIndex;
- }
-
- public String getCustomBaseUrl() {
- return localCustomBaseUrl;
- }
-
- public void setCustomBaseUrl(String customBaseUrl) {
- this.localCustomBaseUrl = customBaseUrl;
- }
-
- /**
- * Build call for createProject
- * @param projectRequestDTO (required)
- * @param _callback Callback for upload/download progress
- * @return Call to execute
- * @throws ApiException If fail to serialize the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 201 | Created | - |
- 401 | Unauthorized | - |
-
- */
- public okhttp3.Call createProjectCall(ProjectRequestDTO projectRequestDTO, final ApiCallback _callback) throws ApiException {
- String basePath = null;
-
- // Operation Servers
- String[] localBasePaths = new String[] { };
-
- // Determine Base Path to Use
- if (localCustomBaseUrl != null){
- basePath = localCustomBaseUrl;
- } else if ( localBasePaths.length > 0 ) {
- basePath = localBasePaths[localHostIndex];
- } else {
- basePath = null;
- }
-
- Object localVarPostBody = projectRequestDTO;
-
- // create path and map variables
- String localVarPath = "/api/v1/projects";
-
- List localVarQueryParams = new ArrayList();
- List localVarCollectionQueryParams = new ArrayList();
- Map localVarHeaderParams = new HashMap();
- Map localVarCookieParams = new HashMap();
- Map localVarFormParams = new HashMap();
-
- final String[] localVarAccepts = {
- "application/json"
- };
- final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
- if (localVarAccept != null) {
- localVarHeaderParams.put("Accept", localVarAccept);
- }
-
- final String[] localVarContentTypes = {
- "application/json"
- };
- final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
- if (localVarContentType != null) {
- localVarHeaderParams.put("Content-Type", localVarContentType);
- }
-
- String[] localVarAuthNames = new String[] { };
- return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
- }
-
- @SuppressWarnings("rawtypes")
- private okhttp3.Call createProjectValidateBeforeCall(ProjectRequestDTO projectRequestDTO, final ApiCallback _callback) throws ApiException {
-
- // verify the required parameter 'projectRequestDTO' is set
- if (projectRequestDTO == null) {
- throw new ApiException("Missing the required parameter 'projectRequestDTO' when calling createProject(Async)");
- }
-
-
- okhttp3.Call localVarCall = createProjectCall(projectRequestDTO, _callback);
- return localVarCall;
-
- }
-
- /**
- * Creates a new project
- *
- * @param projectRequestDTO (required)
- * @return ProjectResponseDTO
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 201 | Created | - |
- 401 | Unauthorized | - |
-
- */
- public ProjectResponseDTO createProject(ProjectRequestDTO projectRequestDTO) throws ApiException {
- ApiResponse localVarResp = createProjectWithHttpInfo(projectRequestDTO);
- return localVarResp.getData();
- }
-
- /**
- * Creates a new project
- *
- * @param projectRequestDTO (required)
- * @return ApiResponse<ProjectResponseDTO>
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 201 | Created | - |
- 401 | Unauthorized | - |
-
- */
- public ApiResponse createProjectWithHttpInfo(ProjectRequestDTO projectRequestDTO) throws ApiException {
- okhttp3.Call localVarCall = createProjectValidateBeforeCall(projectRequestDTO, null);
- Type localVarReturnType = new TypeToken(){}.getType();
- return localVarApiClient.execute(localVarCall, localVarReturnType);
- }
-
- /**
- * Creates a new project (asynchronously)
- *
- * @param projectRequestDTO (required)
- * @param _callback The callback to be executed when the API call finishes
- * @return The request call
- * @throws ApiException If fail to process the API call, e.g. serializing the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 201 | Created | - |
- 401 | Unauthorized | - |
-
- */
- public okhttp3.Call createProjectAsync(ProjectRequestDTO projectRequestDTO, final ApiCallback _callback) throws ApiException {
-
- okhttp3.Call localVarCall = createProjectValidateBeforeCall(projectRequestDTO, _callback);
- Type localVarReturnType = new TypeToken(){}.getType();
- localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
- return localVarCall;
- }
- /**
- * Build call for getProjectById
- * @param id (required)
- * @param _callback Callback for upload/download progress
- * @return Call to execute
- * @throws ApiException If fail to serialize the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 404 | Not found | - |
-
- */
- public okhttp3.Call getProjectByIdCall(String id, final ApiCallback _callback) throws ApiException {
- String basePath = null;
-
- // Operation Servers
- String[] localBasePaths = new String[] { };
-
- // Determine Base Path to Use
- if (localCustomBaseUrl != null){
- basePath = localCustomBaseUrl;
- } else if ( localBasePaths.length > 0 ) {
- basePath = localBasePaths[localHostIndex];
- } else {
- basePath = null;
- }
-
- Object localVarPostBody = null;
-
- // create path and map variables
- String localVarPath = "/api/v1/projects/{id}"
- .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString()));
-
- List localVarQueryParams = new ArrayList();
- List localVarCollectionQueryParams = new ArrayList();
- Map localVarHeaderParams = new HashMap();
- Map localVarCookieParams = new HashMap();
- Map localVarFormParams = new HashMap();
-
- final String[] localVarAccepts = {
- "application/json"
- };
- final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
- if (localVarAccept != null) {
- localVarHeaderParams.put("Accept", localVarAccept);
- }
-
- final String[] localVarContentTypes = {
-
- };
- final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
- if (localVarContentType != null) {
- localVarHeaderParams.put("Content-Type", localVarContentType);
- }
-
- String[] localVarAuthNames = new String[] { };
- return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
- }
-
- @SuppressWarnings("rawtypes")
- private okhttp3.Call getProjectByIdValidateBeforeCall(String id, final ApiCallback _callback) throws ApiException {
-
- // verify the required parameter 'id' is set
- if (id == null) {
- throw new ApiException("Missing the required parameter 'id' when calling getProjectById(Async)");
- }
-
-
- okhttp3.Call localVarCall = getProjectByIdCall(id, _callback);
- return localVarCall;
-
- }
-
- /**
- * Returns information about a specified project
- *
- * @param id (required)
- * @return ProjectResponseDTO
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 404 | Not found | - |
-
- */
- public ProjectResponseDTO getProjectById(String id) throws ApiException {
- ApiResponse localVarResp = getProjectByIdWithHttpInfo(id);
- return localVarResp.getData();
- }
-
- /**
- * Returns information about a specified project
- *
- * @param id (required)
- * @return ApiResponse<ProjectResponseDTO>
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 404 | Not found | - |
-
- */
- public ApiResponse getProjectByIdWithHttpInfo(String id) throws ApiException {
- okhttp3.Call localVarCall = getProjectByIdValidateBeforeCall(id, null);
- Type localVarReturnType = new TypeToken(){}.getType();
- return localVarApiClient.execute(localVarCall, localVarReturnType);
- }
-
- /**
- * Returns information about a specified project (asynchronously)
- *
- * @param id (required)
- * @param _callback The callback to be executed when the API call finishes
- * @return The request call
- * @throws ApiException If fail to process the API call, e.g. serializing the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 404 | Not found | - |
-
- */
- public okhttp3.Call getProjectByIdAsync(String id, final ApiCallback _callback) throws ApiException {
-
- okhttp3.Call localVarCall = getProjectByIdValidateBeforeCall(id, _callback);
- Type localVarReturnType = new TypeToken(){}.getType();
- localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
- return localVarCall;
- }
- /**
- * Build call for getProjects
- * @param _callback Callback for upload/download progress
- * @return Call to execute
- * @throws ApiException If fail to serialize the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 403 | Forbidden | - |
-
- */
- public okhttp3.Call getProjectsCall(final ApiCallback _callback) throws ApiException {
- String basePath = null;
-
- // Operation Servers
- String[] localBasePaths = new String[] { };
-
- // Determine Base Path to Use
- if (localCustomBaseUrl != null){
- basePath = localCustomBaseUrl;
- } else if ( localBasePaths.length > 0 ) {
- basePath = localBasePaths[localHostIndex];
- } else {
- basePath = null;
- }
-
- Object localVarPostBody = null;
-
- // create path and map variables
- String localVarPath = "/api/v1/projects";
-
- List localVarQueryParams = new ArrayList();
- List localVarCollectionQueryParams = new ArrayList();
- Map localVarHeaderParams = new HashMap();
- Map localVarCookieParams = new HashMap();
- Map localVarFormParams = new HashMap();
-
- final String[] localVarAccepts = {
- "application/json"
- };
- final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
- if (localVarAccept != null) {
- localVarHeaderParams.put("Accept", localVarAccept);
- }
-
- final String[] localVarContentTypes = {
-
- };
- final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
- if (localVarContentType != null) {
- localVarHeaderParams.put("Content-Type", localVarContentType);
- }
-
- String[] localVarAuthNames = new String[] { };
- return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
- }
-
- @SuppressWarnings("rawtypes")
- private okhttp3.Call getProjectsValidateBeforeCall(final ApiCallback _callback) throws ApiException {
-
-
- okhttp3.Call localVarCall = getProjectsCall(_callback);
- return localVarCall;
-
- }
-
- /**
- * Returns a list of project
- *
- * @return List<ProjectResponseDTO>
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 403 | Forbidden | - |
-
- */
- public List getProjects() throws ApiException {
- ApiResponse> localVarResp = getProjectsWithHttpInfo();
- return localVarResp.getData();
- }
-
- /**
- * Returns a list of project
- *
- * @return ApiResponse<List<ProjectResponseDTO>>
- * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 403 | Forbidden | - |
-
- */
- public ApiResponse> getProjectsWithHttpInfo() throws ApiException {
- okhttp3.Call localVarCall = getProjectsValidateBeforeCall(null);
- Type localVarReturnType = new TypeToken>(){}.getType();
- return localVarApiClient.execute(localVarCall, localVarReturnType);
- }
-
- /**
- * Returns a list of project (asynchronously)
- *
- * @param _callback The callback to be executed when the API call finishes
- * @return The request call
- * @throws ApiException If fail to process the API call, e.g. serializing the request body object
- * @http.response.details
-
- Status Code | Description | Response Headers |
- 200 | Succeeded | - |
- 401 | Unauthorized | - |
- 403 | Forbidden | - |
-
- */
- public okhttp3.Call getProjectsAsync(final ApiCallback> _callback) throws ApiException {
-
- okhttp3.Call localVarCall = getProjectsValidateBeforeCall(_callback);
- Type localVarReturnType = new TypeToken>(){}.getType();
- localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
- return localVarCall;
- }
+
+ private ApiClient localVarApiClient;
+
+ private int localHostIndex;
+
+ private String localCustomBaseUrl;
+
+ public ProjectApi() {
+ this(Configuration.getDefaultApiClient());
+ }
+
+ public ProjectApi(ApiClient apiClient) {
+ this.localVarApiClient = apiClient;
+ }
+
+ public ApiClient getApiClient() {
+ return localVarApiClient;
+ }
+
+ public void setApiClient(ApiClient apiClient) {
+ this.localVarApiClient = apiClient;
+ }
+
+ public int getHostIndex() {
+ return localHostIndex;
+ }
+
+ public void setHostIndex(int hostIndex) {
+ this.localHostIndex = hostIndex;
+ }
+
+ public String getCustomBaseUrl() {
+ return localCustomBaseUrl;
+ }
+
+ public void setCustomBaseUrl(String customBaseUrl) {
+ this.localCustomBaseUrl = customBaseUrl;
+ }
+
+ /**
+ * Build call for createProject
+ * @param projectRequestDTO (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 201 |
+ * Created |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public okhttp3.Call createProjectCall(ProjectRequestDTO projectRequestDTO, final ApiCallback _callback)
+ throws ApiException {
+ String basePath = null;
+
+ // Operation Servers
+ String[] localBasePaths = new String[] {};
+
+ // Determine Base Path to Use
+ if (localCustomBaseUrl != null) {
+ basePath = localCustomBaseUrl;
+ }
+ else if (localBasePaths.length > 0) {
+ basePath = localBasePaths[localHostIndex];
+ }
+ else {
+ basePath = null;
+ }
+
+ Object localVarPostBody = projectRequestDTO;
+
+ // create path and map variables
+ String localVarPath = "/api/v1/projects";
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+
+ final String[] localVarAccepts = { "application/json" };
+ final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = { "application/json" };
+ final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
+ if (localVarContentType != null) {
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+ }
+
+ String[] localVarAuthNames = new String[] {};
+ return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams,
+ localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams,
+ localVarFormParams, localVarAuthNames, _callback);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call createProjectValidateBeforeCall(ProjectRequestDTO projectRequestDTO,
+ final ApiCallback _callback) throws ApiException {
+
+ // verify the required parameter 'projectRequestDTO' is set
+ if (projectRequestDTO == null) {
+ throw new ApiException(
+ "Missing the required parameter 'projectRequestDTO' when calling createProject(Async)");
+ }
+
+ okhttp3.Call localVarCall = createProjectCall(projectRequestDTO, _callback);
+ return localVarCall;
+
+ }
+
+ /**
+ * Creates a new project
+ * @param projectRequestDTO (required)
+ * @return ProjectResponseDTO
+ * @throws ApiException If fail to call the API, e.g. server error or cannot
+ * deserialize the response body
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 201 |
+ * Created |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public ProjectResponseDTO createProject(ProjectRequestDTO projectRequestDTO) throws ApiException {
+ ApiResponse localVarResp = createProjectWithHttpInfo(projectRequestDTO);
+ return localVarResp.getData();
+ }
+
+ /**
+ * Creates a new project
+ * @param projectRequestDTO (required)
+ * @return ApiResponse<ProjectResponseDTO>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot
+ * deserialize the response body
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 201 |
+ * Created |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public ApiResponse createProjectWithHttpInfo(ProjectRequestDTO projectRequestDTO)
+ throws ApiException {
+ okhttp3.Call localVarCall = createProjectValidateBeforeCall(projectRequestDTO, null);
+ Type localVarReturnType = new TypeToken() {
+ }.getType();
+ return localVarApiClient.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * Creates a new project (asynchronously)
+ * @param projectRequestDTO (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request
+ * body object
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 201 |
+ * Created |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ */
+ public okhttp3.Call createProjectAsync(ProjectRequestDTO projectRequestDTO,
+ final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = createProjectValidateBeforeCall(projectRequestDTO, _callback);
+ Type localVarReturnType = new TypeToken() {
+ }.getType();
+ localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
+
+ /**
+ * Build call for getProjectById
+ * @param id (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+ *
+ *
+ * Status Code |
+ * Description |
+ * Response Headers |
+ *
+ *
+ * 200 |
+ * Succeeded |
+ * - |
+ *
+ *
+ * 401 |
+ * Unauthorized |
+ * - |
+ *
+ *
+ * 404 |
+ * Not found |
+ * - |
+ *
+ *
+ */
+ public okhttp3.Call getProjectByIdCall(String id, final ApiCallback _callback) throws ApiException {
+ String basePath = null;
+
+ // Operation Servers
+ String[] localBasePaths = new String[] {};
+
+ // Determine Base Path to Use
+ if (localCustomBaseUrl != null) {
+ basePath = localCustomBaseUrl;
+ }
+ else if (localBasePaths.length > 0) {
+ basePath = localBasePaths[localHostIndex];
+ }
+ else {
+ basePath = null;
+ }
+
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/api/v1/projects/{id}".replaceAll("\\{" + "id" + "\\}",
+ localVarApiClient.escapeString(id.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap