/** * Creates and {@link AssetModel} out of the given {@link DeliverMediaModel} . * * @param model {@link DeliverMediaModel} * @return {@link AssetModel} */ public static AssetModel getMediaModel(DeliverMediaModel model) { final AssetModel asset = new AssetModel(); asset.setThumbnail(Uri.fromFile(new File(model.getThumbnail())).toString()); asset.setUrl(model.getImageUrl()); asset.setVideoUrl(model.getVideoUrl()); asset.setType(model.getMediaType().name().toLowerCase()); return asset; }
public CommentsCreateRequest( Context context, AlbumModel album, AssetModel asset, CommentModel comment, HttpCallback<ResponseModel<CommentModel>> callback) { super( context, RequestMethod.POST, new ResponseParser<CommentModel>(CommentModel.class), callback); if (album == null || TextUtils.isEmpty(album.getId())) { throw new IllegalArgumentException("Need to provide album ID"); } if (asset == null || TextUtils.isEmpty(asset.getId())) { throw new IllegalArgumentException("Need to provide asset ID"); } if (comment == null || TextUtils.isEmpty(comment.getCommentText())) { throw new IllegalArgumentException("Need to provide comment text"); } this.album = album; this.asset = asset; this.comment = comment; }
@Override protected String getUrl() { return String.format(RestConstants.URL_COMMENTS_CREATE, album.getId(), asset.getId()); }