Android SDK Request Constructor Structure
To build a request body, create an object with data using the SDK classes below:
-
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. -
OperationBodyRequest
— inherits fromOperationBodyRequestBase
. 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
-
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. -
Ids
— a class to pass identifiers asMap<String, String>
.
To pass theMindboxID
, use another constructor that accepts Int as an ID value, andMap<String, String>
as the other values. -
CustomFields
— a class to passMap<String, Any>
custom parameters. -
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.
- 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.
-
DiscountRequest
— a class for discounts, offers 2 constructors based on whether you applyPromoCodeRequest
orExternalPromoActionRequest
. -
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. -
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);
ViewProductRequest
— a class with 2 constructors that differ by whether you needProductRequest
orProductGroupRequest
.
Updated about 1 year ago