Skip to content

Latest commit

 

History

History
159 lines (122 loc) · 7.89 KB

README.md

File metadata and controls

159 lines (122 loc) · 7.89 KB

Orders

(ecommerce().orders())

Overview

Available Operations

  • list - List Orders
  • get - Get Order

list

List Orders

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
import com.apideck.unify.models.components.EcommerceOrdersFilter;
import com.apideck.unify.models.components.OrdersSort;
import com.apideck.unify.models.components.OrdersSortBy;
import com.apideck.unify.models.components.SortDirection;
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.EcommerceOrdersAllRequest;
import com.apideck.unify.models.operations.EcommerceOrdersAllResponse;
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();

        EcommerceOrdersAllRequest req = EcommerceOrdersAllRequest.builder()
                .serviceId("salesforce")
                .filter(EcommerceOrdersFilter.builder()
                    .email("[email protected]")
                    .customerId("123")
                    .updatedSince("2020-09-30T07:43:32.000Z")
                    .createdSince("2020-09-30T07:43:32.000Z")
                    .build())
                .sort(OrdersSort.builder()
                    .by(OrdersSortBy.CREATED_AT)
                    .direction(SortDirection.DESC)
                    .build())
                .passThrough(Map.ofEntries(
                    Map.entry("search", "San Francisco")))
                .fields("id,updated_at")
                .build();

        EcommerceOrdersAllResponse res = sdk.ecommerce().orders().list()
                .request(req)
                .call();

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

Parameters

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

Response

EcommerceOrdersAllResponse

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 */*

get

Get Order

Example Usage

package hello.world;

import com.apideck.unify.Apideck;
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.EcommerceOrdersOneRequest;
import com.apideck.unify.models.operations.EcommerceOrdersOneResponse;
import java.lang.Exception;

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();

        EcommerceOrdersOneRequest req = EcommerceOrdersOneRequest.builder()
                .id("<id>")
                .serviceId("salesforce")
                .fields("id,updated_at")
                .build();

        EcommerceOrdersOneResponse res = sdk.ecommerce().orders().get()
                .request(req)
                .call();

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

Parameters

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

Response

EcommerceOrdersOneResponse

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 */*