Android SDK Response Constructor Structure

All classes in the "response" package have the predefined toString() method to cast all class data into a string:

  1. OperationResponseBase — this is a basic class for any response. It contains the status field.

  2. OperationResponse — a class with standard fields for responses to operations.
    The catalogProductList() method returns CatalogProductListResponse, which is associated with the productList field.
    The productListItems() method returns List<ProductListItemResponse>, which is associated with the productList field.

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

  4. CustomFields — a class to pass Map<String, Any> custom parameters. CustomFields contains a method that converts a CustomFields object into an object of any class.

/**
    * Convert [CustomFields] value to [T] typed object.
    *
    * @param classOfT Class type for result [CustomFields] object.
    */

fun <T> convertTo(classOfT: Class<T>): T?
val example = customFields.convertTo(Example::class.java)
final Example example = customFields.convertTo(Example.class);
  1. 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.

  2. 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.

Error classes

MindboxError — a class with responses to errors:

MindboxError.Validation — an error in validation at operation performance. This error has the validationMessages property to store information on error(s). MindboxError.Validation is returned if the server status field contains ValidationError.

MindboxError.Protocol — a protocol error (e.g., an incorrect operation name). MindboxError.Protocol is returned if the server status field contains ProtocolError.

MindboxError.InternalServer — an internal server error, returned if the server status field contains InternalServerError.

MindboxError.UnknownServer — this stands for the other errors returned from the server.

MindboxError.Unknown — an internal Mindbox SDK error. This error can contain Throwable for error details.