package com.transloadit.sdk;

import com.mashape.unirest.http.exceptions.UnirestException;
import com.transloadit.sdk.response.AssemblyResponse;
import com.transloadit.sdk.response.ListResponse;

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

public class Main {

    public static void main(String[] args) {
        Transloadit transloadit = new Transloadit("KEY", "SECRET", 3600);
        Assembly assemblyApi = transloadit.assembly();

        try {
            File[] files = new File[1];
            files[0] = new File("LICENSE");

            Map options = new HashMap();
            Steps steps = new Steps();
            steps.addStep("encode", "/video/encode", new HashMap());
            options.put("steps", steps.asHash());

            AssemblyResponse assembly = assemblyApi.create(options, files);

            System.out.println(assembly.id);
            System.out.println(assembly.url);
            System.out.println(assembly.json());

            ListResponse list = assemblyApi.list(new HashMap());

            System.out.println(list.json());
            System.out.println(list.items.get(0));
            System.out.println(list.size);

        } catch (UnirestException e) {
            e.printStackTrace();
        }
    }
}

@@ -27,69 +27,8 @@
 k;%0A%0A
-import com.mashape.unirest.http.exceptions.UnirestException;%0A
 impo
@@ -178,30 +178,8 @@
 Map;
-%0Aimport java.util.Map;
 %0A%0Apu
@@ -332,16 +332,19 @@
 Assembly
+Api
  assembl
@@ -370,16 +370,19 @@
 assembly
+Api
 ();%0A%0A   
@@ -408,157 +408,56 @@
     
-File%5B%5D files = new File%5B1%5D;%0A            files%5B0%5D = new File(%22LICENSE%22);%0A%0A            Map options = new HashMap();%0A            Steps steps = new Steps
+AssemblyApi.Assembly assembly = assemblyApi.new_
 ();%0A
@@ -468,21 +468,24 @@
         
-steps
+assembly
 .addStep
@@ -544,42 +544,43 @@
     
-options.put(%22steps%22, steps.asHash(
+assembly.addFile(new File(%22LICENSE%22
 ));%0A
@@ -608,29 +608,24 @@
 Response ass
-embly
  = assemblyA
@@ -627,33 +627,14 @@
 mbly
-Api.create(options, files
+.save(
 );%0A%0A
@@ -667,21 +667,16 @@
 ntln(ass
-embly
 .id);%0A  
@@ -707,21 +707,16 @@
 ntln(ass
-embly
 .url);%0A 
@@ -748,21 +748,16 @@
 ntln(ass
-embly
 .json())
@@ -808,29 +808,16 @@
 pi.list(
-new HashMap()
 );%0A%0A    
@@ -973,12 +973,23 @@
 ch (
-Unir
+TransloaditRequ
 estE

update Main example code