Android SDK Request Constructor Structure

To build a request body, create an object with data using the SDK classes below:

  1. OperationBodyRequestBase — an empty abstract basic class, which should be inherited from when building a custom request body. This class is helpful if you struggle to build a request based on ready-made classes.

  2. OperationBodyRequest — inherits from OperationBodyRequestBase. This class contains the main fields that may be required to build an operation body. This can be helpful in building a request body for certain operations, e.g. in creating a customer account where you may need to pass a value to a certain field.

Request body constructor: structure

  1. CustomerRequest — a class to create and update customer data, offers
    two constructors based on whether you use fullName or a set of firstName, middleName, and lastName.

  2. Ids — a class to pass identifiers as Map<String, String>.
    To pass the MindboxID, use another constructor that accepts Int as an ID value, and Map<String, String> as the other values.

  3. CustomFields — a class to pass Map<String, Any> custom parameters.

  4. DateOnly — a class that inherits from Date to pass "yyyy-mm-dd" dates to the server.

If you decide to implement your own classes with DateOnly as a new field type, enter @JsonAdapter(DateOnlyAdapter::class) into the field when re-defining the classes.

  1. DateTime — a class that inherits from Date to pass date & time to the server.

If you decide to implement your own classes with DateTime as a new field type, enter @JsonAdapter(DateTimeAdapter::class) into the field when re-defining the classes.

  1. DiscountRequest — a class for discounts, offers 2 constructors based on whether you apply PromoCodeRequest or ExternalPromoActionRequest.

  2. LineRequest — a class with 2 constructors that differ by the "quantity" data type. The QuantityType is identified and passed into the request body based on the type of the quantity.

  3. ProductListItemRequest — a class with multiple constructors that differ by chosen fields.

To specify pricePerItem and ProductRequest:

ProductListItemRequest(12.0, ProductRequest(), 5.0, true)
new ProductListItemRequest(12.0, new ProductRequest(), 5.0, true);
  1. ViewProductRequest — a class with 2 constructors that differ by whether you need ProductRequest or ProductGroupRequest.