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 the status field. -
OperationResponse
— a class with standard fields for responses to operations.
ThecatalogProductList()
method returnsCatalogProductListResponse
, which is associated with theproductList
field.
TheproductListItems()
method returnsList<ProductListItemResponse>
, which is associated with theproductList
field. -
Ids
— a class to pass various IDs as aMap<String, String>
structure.
To pass aMindboxID
, 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.CustomFields
contains a method that converts aCustomFields
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);
-
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
— 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.
Updated about 1 year ago