com.wallee.sdk.service.DebtCollectionCaseService Maven / Gradle / Ivy
Show all versions of wallee-java-sdk Show documentation
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 java.math.BigDecimal;
import com.wallee.sdk.model.ClientError;
import com.wallee.sdk.model.DebtCollectionCase;
import com.wallee.sdk.model.DebtCollectionCaseCreate;
import com.wallee.sdk.model.DebtCollectionCaseDocument;
import com.wallee.sdk.model.DebtCollectionCaseUpdate;
import com.wallee.sdk.model.DebtCollectionReceipt;
import com.wallee.sdk.model.EntityQuery;
import com.wallee.sdk.model.EntityQueryFilter;
import com.wallee.sdk.model.ServerError;
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 DebtCollectionCaseService {
private ApiClient apiClient;
public DebtCollectionCaseService(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Add Collected Amount
* Adds a new collected amount to the case, creating a new payment receipt.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case for which the amount should be added.
* @param collectedAmount The amount that has been collected.
* @param externalId The unique external id of this payment receipt.
* @return DebtCollectionReceipt
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Add Collected Amount Documentation
**/
public DebtCollectionReceipt addCollectedAmount(Long spaceId, Long id, BigDecimal collectedAmount, String externalId) throws IOException {
HttpResponse response = addCollectedAmountForHttpResponse(spaceId, id, collectedAmount, externalId);
String returnType = "DebtCollectionReceipt";
if(returnType.equals("String")){
return (DebtCollectionReceipt) (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 (DebtCollectionReceipt)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Add Collected Amount
* Adds a new collected amount to the case, creating a new payment receipt.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case for which the amount should be added.
* @param collectedAmount The amount that has been collected.
* @param externalId The unique external id of this payment receipt.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return DebtCollectionReceipt
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Add Collected Amount Documentation
**/
public DebtCollectionReceipt addCollectedAmount(Long spaceId, Long id, BigDecimal collectedAmount, String externalId, Map params) throws IOException {
HttpResponse response = addCollectedAmountForHttpResponse(spaceId, id, collectedAmount, externalId, params);
String returnType = "DebtCollectionReceipt";
if(returnType.equals("String")){
return (DebtCollectionReceipt) (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 (DebtCollectionReceipt)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse addCollectedAmountForHttpResponse(Long spaceId, Long id, BigDecimal collectedAmount, String externalId) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling addCollectedAmount");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling addCollectedAmount");
}
// verify the required parameter 'collectedAmount' is set
if (collectedAmount == null) {
throw new IllegalArgumentException("Missing the required parameter 'collectedAmount' when calling addCollectedAmount");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling addCollectedAmount");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/addCollectedAmount");
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);
}
if (collectedAmount != null) {
String key = "collectedAmount";
Object value = collectedAmount;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (externalId != null) {
String key = "externalId";
Object value = externalId;
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 addCollectedAmountForHttpResponse(Long spaceId, Long id, BigDecimal collectedAmount, String externalId, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling addCollectedAmount");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling addCollectedAmount");
}
// verify the required parameter 'collectedAmount' is set
if (collectedAmount == null) {
throw new IllegalArgumentException("Missing the required parameter 'collectedAmount' when calling addCollectedAmount");
}
// verify the required parameter 'externalId' is set
if (externalId == null) {
throw new IllegalArgumentException("Missing the required parameter 'externalId' when calling addCollectedAmount");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/addCollectedAmount");
// 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);
// Add the required query param 'collectedAmount' to the map of query params
allParams.put("collectedAmount", collectedAmount);
// Add the required query param 'externalId' to the map of query params
allParams.put("externalId", externalId);
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();
}
/**
* Attach Document
* Attach an additional supporting document to the case.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case.
* @param fileName The file name of the document that is uploaded.
* @param contentBase64 The BASE64 encoded contents of the document.
* @return DebtCollectionCaseDocument
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Attach Document Documentation
**/
public DebtCollectionCaseDocument attachDocument(Long spaceId, Long id, String fileName, String contentBase64) throws IOException {
HttpResponse response = attachDocumentForHttpResponse(spaceId, id, fileName, contentBase64);
String returnType = "DebtCollectionCaseDocument";
if(returnType.equals("String")){
return (DebtCollectionCaseDocument) (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 (DebtCollectionCaseDocument)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Attach Document
* Attach an additional supporting document to the case.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case.
* @param fileName The file name of the document that is uploaded.
* @param contentBase64 The BASE64 encoded contents of the document.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return DebtCollectionCaseDocument
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Attach Document Documentation
**/
public DebtCollectionCaseDocument attachDocument(Long spaceId, Long id, String fileName, String contentBase64, Map params) throws IOException {
HttpResponse response = attachDocumentForHttpResponse(spaceId, id, fileName, contentBase64, params);
String returnType = "DebtCollectionCaseDocument";
if(returnType.equals("String")){
return (DebtCollectionCaseDocument) (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 (DebtCollectionCaseDocument)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse attachDocumentForHttpResponse(Long spaceId, Long id, String fileName, String contentBase64) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling attachDocument");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling attachDocument");
}
// verify the required parameter 'fileName' is set
if (fileName == null) {
throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling attachDocument");
}
// verify the required parameter 'contentBase64' is set
if (contentBase64 == null) {
throw new IllegalArgumentException("Missing the required parameter 'contentBase64' when calling attachDocument");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/attachDocument");
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);
}
if (fileName != null) {
String key = "fileName";
Object value = fileName;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
if (contentBase64 != null) {
String key = "contentBase64";
Object value = contentBase64;
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 attachDocumentForHttpResponse(Long spaceId, Long id, String fileName, String contentBase64, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling attachDocument");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling attachDocument");
}
// verify the required parameter 'fileName' is set
if (fileName == null) {
throw new IllegalArgumentException("Missing the required parameter 'fileName' when calling attachDocument");
}
// verify the required parameter 'contentBase64' is set
if (contentBase64 == null) {
throw new IllegalArgumentException("Missing the required parameter 'contentBase64' when calling attachDocument");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/attachDocument");
// 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);
// Add the required query param 'fileName' to the map of query params
allParams.put("fileName", fileName);
// Add the required query param 'contentBase64' to the map of query params
allParams.put("contentBase64", contentBase64);
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();
}
/**
* Close
* Closes the debt collection case, meaning no further money can be collected.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case which should be closed.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Close Documentation
**/
public DebtCollectionCase close(Long spaceId, Long id) throws IOException {
HttpResponse response = closeForHttpResponse(spaceId, id);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Close
* Closes the debt collection case, meaning no further money can be collected.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case which should be closed.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Close Documentation
**/
public DebtCollectionCase close(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = closeForHttpResponse(spaceId, id, params);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse closeForHttpResponse(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 close");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling close");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/close");
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 closeForHttpResponse(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 close");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling close");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/close");
// 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();
}
/**
* 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() + "/debt-collection-case/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() + "/debt-collection-case/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() + "/debt-collection-case/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();
}
/**
* Create
* Creates the entity with the given properties.
* 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 entity The debt collection case object with the properties which should be created.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Create Documentation
**/
public DebtCollectionCase create(Long spaceId, DebtCollectionCaseCreate entity) throws IOException {
HttpResponse response = createForHttpResponse(spaceId, entity);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Create
* Creates the entity with the given properties.
* 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 entity The debt collection case object with the properties which should be created.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Create Documentation
**/
public DebtCollectionCase create(Long spaceId, DebtCollectionCaseCreate entity, Map params) throws IOException {
HttpResponse response = createForHttpResponse(spaceId, entity, params);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse createForHttpResponse(Long spaceId, DebtCollectionCaseCreate entity) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling create");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/create");
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(entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse createForHttpResponse(Long spaceId, java.io.InputStream entity, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling create");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/create");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = entity == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse createForHttpResponse(Long spaceId, DebtCollectionCaseCreate entity, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling create");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling create");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/create");
// 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(entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Delete
* Deletes the entity with the given id.
* 409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Delete Documentation
**/
public void delete(Long spaceId, Long id) throws IOException {
deleteForHttpResponse(spaceId, id);
}
/**
* Delete
* Deletes the entity with the given id.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Delete Documentation
**/
public void delete(Long spaceId, Long id, Map params) throws IOException {
deleteForHttpResponse(spaceId, id, params);
}
public HttpResponse deleteForHttpResponse(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 delete");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling delete");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/delete");
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(id);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse deleteForHttpResponse(Long spaceId, java.io.InputStream id, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling delete");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling delete");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/delete");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = id == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, id);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse deleteForHttpResponse(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 delete");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling delete");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/delete");
// 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(id);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
/**
* Documents
* Returns all documents that are attached to a debt collection case.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case for which the attached documents are returned.
* @return List<DebtCollectionCaseDocument>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Documents Documentation
**/
public List documents(Long spaceId, Long id) throws IOException {
HttpResponse response = documentsForHttpResponse(spaceId, id);
String returnType = "List<DebtCollectionCaseDocument>";
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);
}
/**
* Documents
* Returns all documents that are attached to a debt collection case.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case for which the attached documents are returned.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return List<DebtCollectionCaseDocument>
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Documents Documentation
**/
public List documents(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = documentsForHttpResponse(spaceId, id, params);
String returnType = "List<DebtCollectionCaseDocument>";
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 documentsForHttpResponse(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 documents");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling documents");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/documents");
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 documentsForHttpResponse(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 documents");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling documents");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/documents");
// 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();
}
/**
* Mark Case As Prepared
* This operation will mark a debt collection case as prepared and allow the collection process to proceed.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case which should be marked as prepared.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Mark Case As Prepared Documentation
**/
public DebtCollectionCase markAsPrepared(Long spaceId, Long id) throws IOException {
HttpResponse response = markAsPreparedForHttpResponse(spaceId, id);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Mark Case As Prepared
* This operation will mark a debt collection case as prepared and allow the collection process to proceed.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case which should be marked as prepared.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Mark Case As Prepared Documentation
**/
public DebtCollectionCase markAsPrepared(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = markAsPreparedForHttpResponse(spaceId, id, params);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse markAsPreparedForHttpResponse(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 markAsPrepared");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling markAsPrepared");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/markAsPrepared");
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 markAsPreparedForHttpResponse(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 markAsPrepared");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling markAsPrepared");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/markAsPrepared");
// 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();
}
/**
* Mark Case As Reviewed
* This operation will mark a debt collection case as reviewed and allow the collection process to proceed.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case which should be reviewed.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Mark Case As Reviewed Documentation
**/
public DebtCollectionCase markAsReviewed(Long spaceId, Long id) throws IOException {
HttpResponse response = markAsReviewedForHttpResponse(spaceId, id);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Mark Case As Reviewed
* This operation will mark a debt collection case as reviewed and allow the collection process to proceed.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 debt collection case which should be reviewed.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Mark Case As Reviewed Documentation
**/
public DebtCollectionCase markAsReviewed(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = markAsReviewedForHttpResponse(spaceId, id, params);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse markAsReviewedForHttpResponse(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 markAsReviewed");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling markAsReviewed");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/markAsReviewed");
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 markAsReviewedForHttpResponse(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 markAsReviewed");
}
// verify the required parameter 'id' is set
if (id == null) {
throw new IllegalArgumentException("Missing the required parameter 'id' when calling markAsReviewed");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/markAsReviewed");
// 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();
}
/**
* 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 debt collection case which should be returned.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Read Documentation
**/
public DebtCollectionCase read(Long spaceId, Long id) throws IOException {
HttpResponse response = readForHttpResponse(spaceId, id);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)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 debt collection case 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 DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Read Documentation
**/
public DebtCollectionCase read(Long spaceId, Long id, Map params) throws IOException {
HttpResponse response = readForHttpResponse(spaceId, id, params);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)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() + "/debt-collection-case/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() + "/debt-collection-case/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 cases which are returned by the search.
* @return List<DebtCollectionCase>
* @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<DebtCollectionCase>";
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 cases 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<DebtCollectionCase>
* @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<DebtCollectionCase>";
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() + "/debt-collection-case/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() + "/debt-collection-case/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() + "/debt-collection-case/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();
}
/**
* Update
* This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 entity The object with all the properties which should be updated. The id and the version are required properties.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Documentation
**/
public DebtCollectionCase update(Long spaceId, DebtCollectionCaseUpdate entity) throws IOException {
HttpResponse response = updateForHttpResponse(spaceId, entity);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
/**
* Update
* This updates the entity with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the entity.
* 200 - This status code indicates that a client request was successfully received, understood, and accepted.
*
409 - This status code indicates that there was a conflict with the current version of the data in the database and the provided data in the request.
*
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 entity The object with all the properties which should be updated. The id and the version are required properties.
* @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param.
* @return DebtCollectionCase
* @throws IOException if an error occurs while attempting to invoke the API
* For more information visit this link.
* @see Update Documentation
**/
public DebtCollectionCase update(Long spaceId, DebtCollectionCaseUpdate entity, Map params) throws IOException {
HttpResponse response = updateForHttpResponse(spaceId, entity, params);
String returnType = "DebtCollectionCase";
if(returnType.equals("String")){
return (DebtCollectionCase) (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 (DebtCollectionCase)apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
}
public HttpResponse updateForHttpResponse(Long spaceId, DebtCollectionCaseUpdate entity) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/update");
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(entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse updateForHttpResponse(Long spaceId, java.io.InputStream entity, String mediaType) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/update");
if (spaceId != null) {
String key = "spaceId";
Object value = spaceId;
uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value);
}
GenericUrl genericUrl = new GenericUrl(URIBuilderUtil.build(uriBuilder));
HttpContent content = entity == null ?
apiClient.new JacksonJsonHttpContent(null) :
new InputStreamContent(mediaType == null ? Json.MEDIA_TYPE : mediaType, entity);
HttpRequest httpRequest = apiClient.getHttpRequestFactory().buildRequest(HttpMethods.POST, genericUrl, content);
int readTimeOut = apiClient.getReadTimeOut() * 1000;
httpRequest.setReadTimeout(readTimeOut);
return httpRequest.execute();
}
public HttpResponse updateForHttpResponse(Long spaceId, DebtCollectionCaseUpdate entity, Map params) throws IOException {
// verify the required parameter 'spaceId' is set
if (spaceId == null) {
throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling update");
}
// verify the required parameter 'entity' is set
if (entity == null) {
throw new IllegalArgumentException("Missing the required parameter 'entity' when calling update");
}
URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/debt-collection-case/update");
// 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(entity);
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;
}
}