Android SDK Response Constructor Structure
All classes in the "response" package have the predefined toString() method to cast all class data into a string:
-
OperationResponseBase— this is a basic class for any response. It contains thestatusfield. -
OperationResponse— a class with standard fields for responses to operations.
ThecatalogProductList()method returnsCatalogProductListResponse, which is associated with theproductListfield.
TheproductListItems()method returnsList<ProductListItemResponse>, which is associated with theproductListfield. -
Ids— a class to pass various IDs as aMap<String, String>structure.
To pass awebsiteID, 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.CustomFieldscontains a method that converts aCustomFieldsobject 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);-
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.
Error classes
MindboxError — a class with responses to errors:
MindboxError.Validation — a validation error that occurs during operation execution. 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 method 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 Maestra SDK error. This error can contain Throwable for error details.
Updated 6 months ago

