Skip to content

Latest commit

 

History

History
83 lines (63 loc) · 4.23 KB

README.md

File metadata and controls

83 lines (63 loc) · 4.23 KB

ProfitAndLoss

(accounting().profitAndLoss())

Overview

Available Operations

  • get - Get Profit and Loss

get

Get Profit and Loss

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.ProfitAndLossFilter;
import com.apideck.unify.models.errors.BadRequestResponse;
import com.apideck.unify.models.errors.NotFoundResponse;
import com.apideck.unify.models.errors.PaymentRequiredResponse;
import com.apideck.unify.models.errors.UnauthorizedResponse;
import com.apideck.unify.models.errors.UnprocessableResponse;
import com.apideck.unify.models.operations.AccountingProfitAndLossOneRequest;
import com.apideck.unify.models.operations.AccountingProfitAndLossOneResponse;
import java.lang.Exception;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws BadRequestResponse, UnauthorizedResponse, PaymentRequiredResponse, NotFoundResponse, UnprocessableResponse, Exception {

        Apideck sdk = Apideck.builder()
                .apiKey("<YOUR_API_KEY_HERE>")
                .consumerId("test-consumer")
                .appId("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX")
            .build();

        AccountingProfitAndLossOneRequest req = AccountingProfitAndLossOneRequest.builder()
                .serviceId("salesforce")
                .filter(ProfitAndLossFilter.builder()
                    .customerId("123abc")
                    .startDate("2021-01-01")
                    .endDate("2021-12-31")
                    .build())
                .passThrough(Map.ofEntries(
                    Map.entry("search", "San Francisco")))
                .fields("id,updated_at")
                .build();

        AccountingProfitAndLossOneResponse res = sdk.accounting().profitAndLoss().get()
                .request(req)
                .call();

        if (res.getProfitAndLossResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request AccountingProfitAndLossOneRequest ✔️ The request object to use for the request.

Response

AccountingProfitAndLossOneResponse

Errors

Error Type Status Code Content Type
models/errors/BadRequestResponse 400 application/json
models/errors/UnauthorizedResponse 401 application/json
models/errors/PaymentRequiredResponse 402 application/json
models/errors/NotFoundResponse 404 application/json
models/errors/UnprocessableResponse 422 application/json
models/errors/APIException 4XX, 5XX */*