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

com.wallee.sdk.service.TransactionInvoiceCommentService 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.ServerError;
import com.wallee.sdk.model.TransactionInvoiceComment;
import com.wallee.sdk.model.TransactionInvoiceCommentActive;
import com.wallee.sdk.model.TransactionInvoiceCommentCreate;


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 TransactionInvoiceCommentService {
    private ApiClient apiClient;

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

  /**
    * Find by invoice
    
    * Returns all comments of the given transaction invoice.
    * 

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 invoiceId * @return List<TransactionInvoiceComment> * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Find by invoice Documentation **/ public List all(Long spaceId, Long invoiceId) throws IOException { HttpResponse response = allForHttpResponse(spaceId, invoiceId); String returnType = "List<TransactionInvoiceComment>"; 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); } /** * Find by invoice * Returns all comments of the given transaction invoice. *

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 invoiceId * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return List<TransactionInvoiceComment> * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Find by invoice Documentation **/ public List all(Long spaceId, Long invoiceId, Map params) throws IOException { HttpResponse response = allForHttpResponse(spaceId, invoiceId, params); String returnType = "List<TransactionInvoiceComment>"; 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 allForHttpResponse(Long spaceId, Long invoiceId) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling all"); } // verify the required parameter 'invoiceId' is set if (invoiceId == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceId' when calling all"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-invoice-comment/all"); if (spaceId != null) { String key = "spaceId"; Object value = spaceId; uriBuilder = URIBuilderUtil.applyQueryParam(uriBuilder, key, value); } if (invoiceId != null) { String key = "invoiceId"; Object value = invoiceId; 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 allForHttpResponse(Long spaceId, Long invoiceId, Map params) throws IOException { // verify the required parameter 'spaceId' is set if (spaceId == null) { throw new IllegalArgumentException("Missing the required parameter 'spaceId' when calling all"); } // verify the required parameter 'invoiceId' is set if (invoiceId == null) { throw new IllegalArgumentException("Missing the required parameter 'invoiceId' when calling all"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-invoice-comment/all"); // 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 'invoiceId' to the map of query params allParams.put("invoiceId", invoiceId); 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(); } /** * Create * Creates the comment 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 * @return TransactionInvoiceComment * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Create Documentation **/ public TransactionInvoiceComment create(Long spaceId, TransactionInvoiceCommentCreate entity) throws IOException { HttpResponse response = createForHttpResponse(spaceId, entity); String returnType = "TransactionInvoiceComment"; if(returnType.equals("String")){ return (TransactionInvoiceComment) (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 (TransactionInvoiceComment)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * Create * Creates the comment 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 * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionInvoiceComment * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Create Documentation **/ public TransactionInvoiceComment create(Long spaceId, TransactionInvoiceCommentCreate entity, Map params) throws IOException { HttpResponse response = createForHttpResponse(spaceId, entity, params); String returnType = "TransactionInvoiceComment"; if(returnType.equals("String")){ return (TransactionInvoiceComment) (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 (TransactionInvoiceComment)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse createForHttpResponse(Long spaceId, TransactionInvoiceCommentCreate 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() + "/transaction-invoice-comment/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() + "/transaction-invoice-comment/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, TransactionInvoiceCommentCreate 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() + "/transaction-invoice-comment/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 comment 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 comment 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() + "/transaction-invoice-comment/delete"); 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 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() + "/transaction-invoice-comment/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); // 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(); } /** * Pin * Pins the comment to the top. *

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 Pin Documentation **/ public void pin(Long spaceId, Long id) throws IOException { pinForHttpResponse(spaceId, id); } /** * Pin * Pins the comment to the top. *

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 Pin Documentation **/ public void pin(Long spaceId, Long id, Map params) throws IOException { pinForHttpResponse(spaceId, id, params); } public HttpResponse pinForHttpResponse(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 pin"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling pin"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-invoice-comment/pin"); 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 pinForHttpResponse(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 pin"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling pin"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-invoice-comment/pin"); // 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(); } /** * Read * Reads the comment 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 * @return TransactionInvoiceComment * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Read Documentation **/ public TransactionInvoiceComment read(Long spaceId, Long id) throws IOException { HttpResponse response = readForHttpResponse(spaceId, id); String returnType = "TransactionInvoiceComment"; if(returnType.equals("String")){ return (TransactionInvoiceComment) (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 (TransactionInvoiceComment)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * Read * Reads the comment 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 * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionInvoiceComment * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Read Documentation **/ public TransactionInvoiceComment read(Long spaceId, Long id, Map params) throws IOException { HttpResponse response = readForHttpResponse(spaceId, id, params); String returnType = "TransactionInvoiceComment"; if(returnType.equals("String")){ return (TransactionInvoiceComment) (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 (TransactionInvoiceComment)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-invoice-comment/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-invoice-comment/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(); } /** * Unpin * Unpins the comment from the top. *

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 Unpin Documentation **/ public void unpin(Long spaceId, Long id) throws IOException { unpinForHttpResponse(spaceId, id); } /** * Unpin * Unpins the comment from the top. *

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 Unpin Documentation **/ public void unpin(Long spaceId, Long id, Map params) throws IOException { unpinForHttpResponse(spaceId, id, params); } public HttpResponse unpinForHttpResponse(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 unpin"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling unpin"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-invoice-comment/unpin"); 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 unpinForHttpResponse(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 unpin"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException("Missing the required parameter 'id' when calling unpin"); } URIBuilder uriBuilder = URIBuilderUtil.create(apiClient.getBasePath() + "/transaction-invoice-comment/unpin"); // 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(); } /** * Update * This updates the comment with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the comment. *

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 * @return TransactionInvoiceComment * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Update Documentation **/ public TransactionInvoiceComment update(Long spaceId, TransactionInvoiceCommentActive entity) throws IOException { HttpResponse response = updateForHttpResponse(spaceId, entity); String returnType = "TransactionInvoiceComment"; if(returnType.equals("String")){ return (TransactionInvoiceComment) (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 (TransactionInvoiceComment)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } /** * Update * This updates the comment with the given properties. Only those properties which should be updated can be provided. The 'id' and 'version' are required to identify the comment. *

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 * @param params Map of query params. A collection will be interpreted as passing in multiple instances of the same query param. * @return TransactionInvoiceComment * @throws IOException if an error occurs while attempting to invoke the API * For more information visit this link. * @see Update Documentation **/ public TransactionInvoiceComment update(Long spaceId, TransactionInvoiceCommentActive entity, Map params) throws IOException { HttpResponse response = updateForHttpResponse(spaceId, entity, params); String returnType = "TransactionInvoiceComment"; if(returnType.equals("String")){ return (TransactionInvoiceComment) (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 (TransactionInvoiceComment)apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } public HttpResponse updateForHttpResponse(Long spaceId, TransactionInvoiceCommentActive 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() + "/transaction-invoice-comment/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() + "/transaction-invoice-comment/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, TransactionInvoiceCommentActive 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() + "/transaction-invoice-comment/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; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy