All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wallee.sdk.service.TransactionCompletionService Maven / Gradle / Ivy

There is a newer version: 8.1.1
Show newest version
package com.wallee.sdk.service;

import com.wallee.sdk.ApiClient;
import com.wallee.sdk.ErrorCode;
import com.wallee.sdk.WalleeSdkException;
import com.wallee.sdk.URIBuilderUtil;

import com.wallee.sdk.model.ClientError;
import com.wallee.sdk.model.EntityQuery;
import com.wallee.sdk.model.EntityQueryFilter;
import com.wallee.sdk.model.ServerError;
import com.wallee.sdk.model.TransactionCompletion;
import com.wallee.sdk.model.TransactionCompletionRequest;


import com.fasterxml.jackson.core.type.TypeReference;
import com.google.api.client.http.*;
import com.google.api.client.json.Json;

import org.apache.http.client.utils.URIBuilder;

import java.io.IOException;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;


public class TransactionCompletionService {
    private ApiClient apiClient;

    public TransactionCompletionService(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

  /**
    * completeOffline
    
    * This operation completes the transaction offline. The completion is not forwarded to the processor. This implies the processor does not do anything. This method is only here to fix manually the transaction state.
    * 

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param id The id of the transaction which should be completed. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completeOffline Documentation **/ public TransactionCompletion completeOffline(Long spaceId, Long id) throws IOException { HttpResponse response = completeOfflineForHttpResponse(spaceId, id); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * completeOffline * This operation completes the transaction offline. The completion is not forwarded to the processor. This implies the processor does not do anything. This method is only here to fix manually the transaction state. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param id The id of the transaction which should be completed. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completeOffline Documentation **/ public TransactionCompletion completeOffline(Long spaceId, Long id, Map params) throws IOException { HttpResponse response = completeOfflineForHttpResponse(spaceId, id, params); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse completeOfflineForHttpResponse(Long spaceId, Long id) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completeOffline"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling completeOffline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completeOffline"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } if (id != null) { String key = "id"; Object value = id; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(null); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse completeOfflineForHttpResponse(Long spaceId, Long id, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completeOffline"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling completeOffline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completeOffline"); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); // Add the required query param 'spaceId' to the map of query params allParams.put("spaceId", spaceId); // Add the required query param 'id' to the map of query params allParams.put("id", id); for (Map.Entry entryMap: allParams.entrySet()) { String key = entryMap.getKey(); Object value = entryMap.getValue(); if (key != null && value != null) { uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(null); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } /** * completeOnline * This operation completes the transaction online. The completion is forwarded to the processor. This implies that the processor may take some actions based on the completion. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param id The id of the transaction which should be completed. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completeOnline Documentation **/ public TransactionCompletion completeOnline(Long spaceId, Long id) throws IOException { HttpResponse response = completeOnlineForHttpResponse(spaceId, id); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * completeOnline * This operation completes the transaction online. The completion is forwarded to the processor. This implies that the processor may take some actions based on the completion. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param id The id of the transaction which should be completed. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completeOnline Documentation **/ public TransactionCompletion completeOnline(Long spaceId, Long id, Map params) throws IOException { HttpResponse response = completeOnlineForHttpResponse(spaceId, id, params); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse completeOnlineForHttpResponse(Long spaceId, Long id) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completeOnline"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling completeOnline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completeOnline"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } if (id != null) { String key = "id"; Object value = id; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(null); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse completeOnlineForHttpResponse(Long spaceId, Long id, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completeOnline"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling completeOnline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completeOnline"); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); // Add the required query param 'spaceId' to the map of query params allParams.put("spaceId", spaceId); // Add the required query param 'id' to the map of query params allParams.put("id", id); for (Map.Entry entryMap: allParams.entrySet()) { String key = entryMap.getKey(); Object value = entryMap.getValue(); if (key != null && value != null) { uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(null); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } /** * completePartiallyOffline * This operation can be used to partially complete the transaction offline. The completion is not forwarded to the processor. This implies the processor does not do anything. This method is only here to fix manually the transaction state. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param completion * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completePartiallyOffline Documentation **/ public TransactionCompletion completePartiallyOffline(Long spaceId, TransactionCompletionRequest completion) throws IOException { HttpResponse response = completePartiallyOfflineForHttpResponse(spaceId, completion); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * completePartiallyOffline * This operation can be used to partially complete the transaction offline. The completion is not forwarded to the processor. This implies the processor does not do anything. This method is only here to fix manually the transaction state. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param completion * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completePartiallyOffline Documentation **/ public TransactionCompletion completePartiallyOffline(Long spaceId, TransactionCompletionRequest completion, Map params) throws IOException { HttpResponse response = completePartiallyOfflineForHttpResponse(spaceId, completion, params); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse completePartiallyOfflineForHttpResponse(Long spaceId, TransactionCompletionRequest completion) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completePartiallyOffline"); } // verify the required parameter 'completion' is set if (completion == null) { throw new IllegalArgumentException("Missing the required parameter 'completion' when calling completePartiallyOffline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completePartiallyOffline"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(completion); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse completePartiallyOfflineForHttpResponse(Long spaceId, java.io.InputStream completion, String mediaType) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completePartiallyOffline"); } // verify the required parameter 'completion' is set if (completion == null) { throw new IllegalArgumentException("Missing the required parameter 'completion' when calling completePartiallyOffline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completePartiallyOffline"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = completion == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, completion); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse completePartiallyOfflineForHttpResponse(Long spaceId, TransactionCompletionRequest completion, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completePartiallyOffline"); } // verify the required parameter 'completion' is set if (completion == null) { throw new IllegalArgumentException("Missing the required parameter 'completion' when calling completePartiallyOffline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completePartiallyOffline"); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); // Add the required query param 'spaceId' to the map of query params allParams.put("spaceId", spaceId); for (Map.Entry entryMap: allParams.entrySet()) { String key = entryMap.getKey(); Object value = entryMap.getValue(); if (key != null && value != null) { uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(completion); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } /** * completePartiallyOnline * This operation can be used to partially complete the transaction online. The completion is forwarded to the processor. This implies that the processor may take some actions based on the completion. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param completion * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completePartiallyOnline Documentation **/ public TransactionCompletion completePartiallyOnline(Long spaceId, TransactionCompletionRequest completion) throws IOException { HttpResponse response = completePartiallyOnlineForHttpResponse(spaceId, completion); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * completePartiallyOnline * This operation can be used to partially complete the transaction online. The completion is forwarded to the processor. This implies that the processor may take some actions based on the completion. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param completion * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see completePartiallyOnline Documentation **/ public TransactionCompletion completePartiallyOnline(Long spaceId, TransactionCompletionRequest completion, Map params) throws IOException { HttpResponse response = completePartiallyOnlineForHttpResponse(spaceId, completion, params); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse completePartiallyOnlineForHttpResponse(Long spaceId, TransactionCompletionRequest completion) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completePartiallyOnline"); } // verify the required parameter 'completion' is set if (completion == null) { throw new IllegalArgumentException("Missing the required parameter 'completion' when calling completePartiallyOnline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completePartiallyOnline"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(completion); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse completePartiallyOnlineForHttpResponse(Long spaceId, java.io.InputStream completion, String mediaType) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completePartiallyOnline"); } // verify the required parameter 'completion' is set if (completion == null) { throw new IllegalArgumentException("Missing the required parameter 'completion' when calling completePartiallyOnline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completePartiallyOnline"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = completion == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, completion); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse completePartiallyOnlineForHttpResponse(Long spaceId, TransactionCompletionRequest completion, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling completePartiallyOnline"); } // verify the required parameter 'completion' is set if (completion == null) { throw new IllegalArgumentException("Missing the required parameter 'completion' when calling completePartiallyOnline"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/completePartiallyOnline"); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); // Add the required query param 'spaceId' to the map of query params allParams.put("spaceId", spaceId); for (Map.Entry entryMap: allParams.entrySet()) { String key = entryMap.getKey(); Object value = entryMap.getValue(); if (key != null && value != null) { uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(completion); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } /** * Count * Counts the number of items in the database as restricted by the given filter. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param filter The filter which restricts the entities which are used to calculate the count. * @return Long * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Count Documentation **/ public Long count(Long spaceId, EntityQueryFilter filter) throws IOException { HttpResponse response = countForHttpResponse(spaceId, filter); String returnType = "Long"; if(returnType.equals("String")){ return (Long) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * Count * Counts the number of items in the database as restricted by the given filter. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return Long * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Count Documentation **/ public Long count(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { HttpResponse response = countForHttpResponse(filter, spaceId, params); String returnType = "Long"; if(returnType.equals("String")){ return (Long) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (Long)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse countForHttpResponse(Long spaceId, EntityQueryFilter filter) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/count"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(filter); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse countForHttpResponse(Long spaceId, java.io.InputStream filter, String mediaType) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/count"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = filter == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, filter); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse countForHttpResponse(EntityQueryFilter filter, Long spaceId, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling count"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/count"); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); // Add the required query param 'spaceId' to the map of query params allParams.put("spaceId", spaceId); for (Map.Entry entryMap: allParams.entrySet()) { String key = entryMap.getKey(); Object value = entryMap.getValue(); if (key != null && value != null) { uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(filter); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } /** * Read * Reads the entity with the given 'id' and returns it. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param id The id of the transaction completions which should be returned. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Read Documentation **/ public TransactionCompletion read(Long spaceId, Long id) throws IOException { HttpResponse response = readForHttpResponse(spaceId, id); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * Read * Reads the entity with the given 'id' and returns it. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param id The id of the transaction completions which should be returned. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionCompletion * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Read Documentation **/ public TransactionCompletion read(Long spaceId, Long id, Map params) throws IOException { HttpResponse response = readForHttpResponse(spaceId, id, params); String returnType = "TransactionCompletion"; if(returnType.equals("String")){ return (TransactionCompletion) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (TransactionCompletion)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse readForHttpResponse(Long spaceId, Long id) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/read"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } if (id != null) { String key = "id"; Object value = id; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = null; HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); httpRequest.getHeaders().setContentType("*/*"); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse readForHttpResponse(Long spaceId, Long id, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling read"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling read"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/read"); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); // Add the required query param 'spaceId' to the map of query params allParams.put("spaceId", spaceId); // Add the required query param 'id' to the map of query params allParams.put("id", id); for (Map.Entry entryMap: allParams.entrySet()) { String key = entryMap.getKey(); Object value = entryMap.getValue(); if (key != null && value != null) { uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = null; HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.GET, genericUrl, content); httpRequest.getHeaders().setContentType("*/*"); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } /** * Search * Searches for the entities as specified by the given query. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param query The query restricts the transaction completions which are returned by the search. * @return List<TransactionCompletion> * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Search Documentation **/ public List search(Long spaceId, EntityQuery query) throws IOException { HttpResponse response = searchForHttpResponse(spaceId, query); String returnType = "List<TransactionCompletion>"; if(returnType.equals("String")){ return (List) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference>() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * Search * Searches for the entities as specified by the given query. *

200 - This status code indicates that a client request was successfully received, understood, and accepted. *

442 - This status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error. *

542 - This status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the client request. * @param spaceId * @param query The query restricts the transaction completions which are returned by the search. * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return List<TransactionCompletion> * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Search Documentation **/ public List search(Long spaceId, EntityQuery query, Map params) throws IOException { HttpResponse response = searchForHttpResponse(spaceId, query, params); String returnType = "List<TransactionCompletion>"; if(returnType.equals("String")){ return (List) (Object) response.parseAsString(); } TypeReference typeRef = new TypeReference>() {}; if (isNoBodyResponse(response)) { throw new WalleeSdkException(ErrorCode.ENTITY_NOT_FOUND, "Entity was not found for: " + typeRef.getType().getTypeName()); } return (List)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); } // verify the required parameter 'query' is set if (query == null) { throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/search"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(query); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse searchForHttpResponse(Long spaceId, java.io.InputStream query, String mediaType) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); } // verify the required parameter 'query' is set if (query == null) { throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/search"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = query == null ? apiClient.new JacksonJsonHttpContent(null) : new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, query); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } public HttpResponse searchForHttpResponse(Long spaceId, EntityQuery query, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling search"); } // verify the required parameter 'query' is set if (query == null) { throw new IllegalArgumentException("Missing the required parameter 'query' when calling search"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-completion/search"); // Copy the params argument if present, to allow passing in immutable maps Map allParams = params == null ? new HashMap() : new HashMap(params); // Add the required query param 'spaceId' to the map of query params allParams.put("spaceId", spaceId); for (Map.Entry entryMap: allParams.entrySet()) { String key = entryMap.getKey(); Object value = entryMap.getValue(); if (key != null && value != null) { uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } } GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder)); HttpContent content = apiClient.new JacksonJsonHttpContent(query); HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content); int readTimeOut = apiClient.getReadTimeOut() * 1000; httpRequest.setReadTimeout(readTimeOut); return httpRequest.execute(); } private boolean isNoBodyResponse(HttpResponse response) throws IOException { java.io.InputStream content = response.getContent(); return content.available() == 0; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy