package com.transloadit.sdk;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.exceptions.UnirestException;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by ifedapo on 17/11/2016.
 */
public class Assembly {
    public Transloadit transloadit;

    public Assembly(Transloadit transloadit) {
        this.transloadit = transloadit;
    }

    public HttpResponse<JsonNode> list(Map options) throws UnirestException {
        Request request = new Request(transloadit);
        return request.get("/assemblies", options);
    }

    public HttpResponse<JsonNode> create(Map options, File[] files) throws UnirestException {
        Map extraData = new HashMap();
        for (int i = 0; i < files.length; i++) {
            extraData.put("file_" + i, files[i]);
        }
        Request request = new Request(transloadit);
        return request.post("/assemblies", options, extraData);
    }

    public HttpResponse<JsonNode> get(String id) throws UnirestException {
        Request request = new Request(transloadit);
        return request.get("/assemblies/" + id, new HashMap());
    }

}

@@ -59,123 +59,139 @@
 ttp.
-HttpResponse;%0Aimport com.mashape.unirest.http.JsonNode;%0Aimport com.mashape.unirest.http.exceptions.UnirestException
+exceptions.UnirestException;%0Aimport com.transloadit.sdk.response.AssemblyResponse;%0Aimport com.transloadit.sdk.response.ListResponse
 ;%0A%0Ai
@@ -270,41 +270,41 @@
 %0A * 
-Created by ifedapo on 17/11/2016.
+Model for Tranloadit Assembly Api
 %0A */
@@ -467,53 +467,222 @@
     
-public HttpResponse%3CJsonNode%3E list(Map option
+/**%0A     *%0A     * Creates a new assembly%0A     *%0A     * @param options%0A     * @param files array of files to upload.%0A     * @return%0A     */%0A    public AssemblyResponse create(Map%3CString, Object%3E options, File%5B%5D file
 s) t
@@ -769,32 +769,53 @@
      return 
+new AssemblyResponse(
 request.
 get(%22/assemb
@@ -794,34 +794,35 @@
 esponse(request.
-ge
+pos
 t(%22/assemblies%22,
@@ -833,86 +833,159 @@
 ions
-);%0A    %7D%0A%0A    public HttpResponse%3CJsonNode%3E create(Map options, File%5B%5D files) 
+, mapFiles(files)));%0A    %7D%0A%0A    /**%0A     * Returns a list of all assemblies under the user account%0A     *%0A     * @param options%0A     * @return%0A     * @
 thro
@@ -1007,158 +1007,100 @@
 tion
- %7B
 %0A     
-   Map extraData = new HashMap();%0A        for (int i = 0; i %3C files.length; i++) %7B%0A            extraData.put(%22file_%22 + i, files%5Bi%5D);%0A        %7D
+*/%0A    public ListResponse list(Map%3CString, Object%3E options) throws UnirestException %7B
 %0A   
@@ -1163,24 +1163,41 @@
  return 
+new ListResponse(
 request.
 post(%22/a
@@ -1180,35 +1180,34 @@
 esponse(request.
-pos
+ge
 t(%22/assemblies%22,
@@ -1218,62 +1218,198 @@
 ions
-, extraData);%0A
+));%0A    %7D%0A%0A    /**%0A     * Returns a single assembly.%0A 
     
-%7D%0A%0A
+*%0A 
     
-public HttpResponse%3CJsonNode%3E
+* @param id id of the Assebly to retrieve.%0A     * @return%0A     * @throws UnirestException%0A     */%0A    public AssemblyResponse
  get
@@ -1513,16 +1513,37 @@
  return 
+new AssemblyResponse(
 request.
@@ -1569,24 +1569,248 @@
 + id
-, new HashMap())
+));%0A    %7D%0A%0A    private Map%3CString, Object%3E mapFiles(File%5B%5D files)%7B%0A        Map%3CString, Object%3E map = new HashMap%3C%3E();%0A        for (int i = 0; i %3C files.length; i++) %7B%0A            map.put(%22file_%22 + i, files%5Bi%5D);%0A        %7D%0A%0A        return map
 ;%0A  

use transloadit tailored responses