use of org.matrix.androidsdk.rest.model.URLPreview in project matrix-android-sdk by matrix-org.
the class EventsRestClient method getURLPreview.
/**
* Retrieve the URL preview information.
*
* @param url the URL
* @param ts the timestamp
* @param callback the asynchronous callback
*/
public void getURLPreview(final String url, final long ts, final ApiCallback<URLPreview> callback) {
final String description = "getURLPreview : URL " + url + " with ts " + ts;
mApi.getURLPreview(url, ts).enqueue(new RestAdapterCallback<Map<String, Object>>(description, null, false, new SimpleApiCallback<Map<String, Object>>(callback) {
@Override
public void onSuccess(Map<String, Object> map) {
if (null != callback) {
callback.onSuccess(new URLPreview(map, url));
}
}
}, new RestAdapterCallback.RequestRetryCallBack() {
@Override
public void onRetry() {
getURLPreview(url, ts, callback);
}
}));
}
Aggregations