{"action":"created","comment":{"url":"https://api.github.com/repos/transloadit/java-sdk/pulls/comments/172220428","pull_request_review_id":101199979,"id":172220428,"diff_hunk":"@@ -1,64 +1,100 @@\n package com.transloadit.sdk;\n \n-import com.transloadit.sdk.exceptions.RequestException;\n import com.transloadit.sdk.exceptions.LocalOperationException;\n+import com.transloadit.sdk.exceptions.RequestException;\n import com.transloadit.sdk.response.AssemblyResponse;\n import io.tus.java.client.*;\n \n import java.io.File;\n+import java.io.FileNotFoundException;\n import java.io.IOException;\n+import java.io.InputStream;\n import java.net.URL;\n+import java.util.ArrayList;\n import java.util.HashMap;\n+import java.util.List;\n import java.util.Map;\n \n /**\n  * This class represents a new assembly being created\n  */\n public class Assembly extends OptionsBuilder {\n+    private TusURLStore tusURLStore;\n+\n     protected Map<String, File> files;\n+    protected Map<String, InputStream> fileStreams;\n     protected TusClient tusClient;\n+    protected List<TusUpload> uploads;\n \n     public Assembly(Transloadit transloadit) {\n         this(transloadit, new Steps(), new HashMap<String, File>(), new HashMap<String, Object>());\n     }\n \n     /**\n-     *\n      * @param transloadit {@link Transloadit} the transloadit client.\n-     * @param steps {@link Steps} the steps to add to the assembly.\n-     * @param files is a map of file names and files that are meant to be uploaded.\n-     * @param options map of extra options to be sent along with the request.\n+     * @param steps       {@link Steps} the steps to add to the assembly.\n+     * @param files       is a map of file names and files that are meant to be uploaded.\n+     * @param options     map of extra options to be sent along with the request.\n      */\n     public Assembly(Transloadit transloadit, Steps steps, Map<String, File> files, Map<String, Object> options) {\n         this.transloadit = transloadit;\n         this.steps = steps;\n         this.files = files;\n         this.options = options;\n-        tusClient = null;\n+        tusClient = new TusClient();\n+        tusURLStore = new TusURLMemoryStore();\n+        uploads = new ArrayList<TusUpload>();\n+        fileStreams = new HashMap<String, InputStream>();\n     }\n \n     /**\n      * Adds a file to your assembly.\n      *\n      * @param file {@link File} the file to be uploaded.\n-     * @param name {@link String} the name you the file to be given in transloadit\n+     * @param name {@link String} the name you the file to be given in transloadit.\n      */\n-    public void addFile(File file, String name){\n+    public void addFile(File file, String name) {\n         files.put(name, file);\n+\n+        // remove duplicate key\n+        if (fileStreams.containsKey(name)) {\n+            fileStreams.remove(name);\n+        }\n     }\n \n     /**\n      * Adds a file to your assembly but automatically genarates the name of the file.\n      *\n      * @param file {@link File} the file to be uploaded.\n      */\n-    public void addFile(File file){\n+    public void addFile(File file) {\n         String name = \"file\";\n+        files.put(normalizeDuplicateName(name), file);\n+    }\n \n-        for (int i = files.size(); files.containsKey(name); i++) {\n-            name += \"_\" + i;\n+    /**\n+     * Adds a file to your assembly.\n+     *\n+     * @param inputStream {@link InputStream} the file to be uploaded.\n+     * @param name {@link String} the name you the file to be given in transloadit.\n+     */\n+    public void addFile(InputStream inputStream, String name) {\n+        fileStreams.put(name, inputStream);\n+\n+        // remove duplicate key\n+        if (files.containsKey(name)) {\n+            files.remove(name);","path":"src/main/java/com/transloadit/sdk/Assembly.java","position":98,"original_position":97,"commit_id":"e73c324f7421ebda940eaf586ebd38b7a3f99fb6","original_commit_id":"f0239f0b5d4a7ead77d465c91082489b44a21fe2","user":{"login":"Acconut","id":1375043,"avatar_url":"https://avatars3.githubusercontent.com/u/1375043?v=4","gravatar_id":"","url":"https://api.github.com/users/Acconut","html_url":"https://github.com/Acconut","followers_url":"https://api.github.com/users/Acconut/followers","following_url":"https://api.github.com/users/Acconut/following{/other_user}","gists_url":"https://api.github.com/users/Acconut/gists{/gist_id}","starred_url":"https://api.github.com/users/Acconut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Acconut/subscriptions","organizations_url":"https://api.github.com/users/Acconut/orgs","repos_url":"https://api.github.com/users/Acconut/repos","events_url":"https://api.github.com/users/Acconut/events{/privacy}","received_events_url":"https://api.github.com/users/Acconut/received_events","type":"User","site_admin":false},"body":"Ok, makes sense. Would you mind adding this to the method's JavaDoc?","created_at":"2018-03-05T15:18:58Z","updated_at":"2018-03-05T15:18:58Z","html_url":"https://github.com/transloadit/java-sdk/pull/19#discussion_r172220428","pull_request_url":"https://api.github.com/repos/transloadit/java-sdk/pulls/19","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/transloadit/java-sdk/pulls/comments/172220428"},"html":{"href":"https://github.com/transloadit/java-sdk/pull/19#discussion_r172220428"},"pull_request":{"href":"https://api.github.com/repos/transloadit/java-sdk/pulls/19"}},"in_reply_to_id":166040284},"pull_request":{"url":"https://api.github.com/repos/transloadit/java-sdk/pulls/19","id":156134001,"html_url":"https://github.com/transloadit/java-sdk/pull/19","diff_url":"https://github.com/transloadit/java-sdk/pull/19.diff","patch_url":"https://github.com/transloadit/java-sdk/pull/19.patch","issue_url":"https://api.github.com/repos/transloadit/java-sdk/issues/19","number":19,"state":"open","locked":false,"title":"Aync assembly functionality","user":{"login":"ifedapoolarewaju","id":8383781,"avatar_url":"https://avatars1.githubusercontent.com/u/8383781?v=4","gravatar_id":"","url":"https://api.github.com/users/ifedapoolarewaju","html_url":"https://github.com/ifedapoolarewaju","followers_url":"https://api.github.com/users/ifedapoolarewaju/followers","following_url":"https://api.github.com/users/ifedapoolarewaju/following{/other_user}","gists_url":"https://api.github.com/users/ifedapoolarewaju/gists{/gist_id}","starred_url":"https://api.github.com/users/ifedapoolarewaju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifedapoolarewaju/subscriptions","organizations_url":"https://api.github.com/users/ifedapoolarewaju/orgs","repos_url":"https://api.github.com/users/ifedapoolarewaju/repos","events_url":"https://api.github.com/users/ifedapoolarewaju/events{/privacy}","received_events_url":"https://api.github.com/users/ifedapoolarewaju/received_events","type":"User","site_admin":false},"body":"As I am working on the android SDK some of the changes came up for the project to be extended.\r\n\r\nThis PR adds an async functionality to assembly creation. So assemblies can be created, uploads paused and resumed asynchronously","created_at":"2017-12-04T08:18:34Z","updated_at":"2018-03-05T15:18:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"497d055fcad75042165400818ff0ab04903d185a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/transloadit/java-sdk/pulls/19/commits","review_comments_url":"https://api.github.com/repos/transloadit/java-sdk/pulls/19/comments","review_comment_url":"https://api.github.com/repos/transloadit/java-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/transloadit/java-sdk/issues/19/comments","statuses_url":"https://api.github.com/repos/transloadit/java-sdk/statuses/e73c324f7421ebda940eaf586ebd38b7a3f99fb6","head":{"label":"transloadit:refactorinternals","ref":"refactorinternals","sha":"e73c324f7421ebda940eaf586ebd38b7a3f99fb6","user":{"login":"transloadit","id":125754,"avatar_url":"https://avatars2.githubusercontent.com/u/125754?v=4","gravatar_id":"","url":"https://api.github.com/users/transloadit","html_url":"https://github.com/transloadit","followers_url":"https://api.github.com/users/transloadit/followers","following_url":"https://api.github.com/users/transloadit/following{/other_user}","gists_url":"https://api.github.com/users/transloadit/gists{/gist_id}","starred_url":"https://api.github.com/users/transloadit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transloadit/subscriptions","organizations_url":"https://api.github.com/users/transloadit/orgs","repos_url":"https://api.github.com/users/transloadit/repos","events_url":"https://api.github.com/users/transloadit/events{/privacy}","received_events_url":"https://api.github.com/users/transloadit/received_events","type":"Organization","site_admin":false},"repo":{"id":74448557,"name":"java-sdk","full_name":"transloadit/java-sdk","owner":{"login":"transloadit","id":125754,"avatar_url":"https://avatars2.githubusercontent.com/u/125754?v=4","gravatar_id":"","url":"https://api.github.com/users/transloadit","html_url":"https://github.com/transloadit","followers_url":"https://api.github.com/users/transloadit/followers","following_url":"https://api.github.com/users/transloadit/following{/other_user}","gists_url":"https://api.github.com/users/transloadit/gists{/gist_id}","starred_url":"https://api.github.com/users/transloadit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transloadit/subscriptions","organizations_url":"https://api.github.com/users/transloadit/orgs","repos_url":"https://api.github.com/users/transloadit/repos","events_url":"https://api.github.com/users/transloadit/events{/privacy}","received_events_url":"https://api.github.com/users/transloadit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/transloadit/java-sdk","description":"Java client for Transloadit upload service https://transloadit.com","fork":false,"url":"https://api.github.com/repos/transloadit/java-sdk","forks_url":"https://api.github.com/repos/transloadit/java-sdk/forks","keys_url":"https://api.github.com/repos/transloadit/java-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/transloadit/java-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/transloadit/java-sdk/teams","hooks_url":"https://api.github.com/repos/transloadit/java-sdk/hooks","issue_events_url":"https://api.github.com/repos/transloadit/java-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/transloadit/java-sdk/events","assignees_url":"https://api.github.com/repos/transloadit/java-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/transloadit/java-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/transloadit/java-sdk/tags","blobs_url":"https://api.github.com/repos/transloadit/java-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/transloadit/java-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/transloadit/java-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/transloadit/java-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/transloadit/java-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/transloadit/java-sdk/languages","stargazers_url":"https://api.github.com/repos/transloadit/java-sdk/stargazers","contributors_url":"https://api.github.com/repos/transloadit/java-sdk/contributors","subscribers_url":"https://api.github.com/repos/transloadit/java-sdk/subscribers","subscription_url":"https://api.github.com/repos/transloadit/java-sdk/subscription","commits_url":"https://api.github.com/repos/transloadit/java-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/transloadit/java-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/transloadit/java-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/transloadit/java-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/transloadit/java-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/transloadit/java-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/transloadit/java-sdk/merges","archive_url":"https://api.github.com/repos/transloadit/java-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/transloadit/java-sdk/downloads","issues_url":"https://api.github.com/repos/transloadit/java-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/transloadit/java-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/transloadit/java-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/transloadit/java-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/transloadit/java-sdk/labels{/name}","releases_url":"https://api.github.com/repos/transloadit/java-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/transloadit/java-sdk/deployments","created_at":"2016-11-22T07:59:43Z","updated_at":"2018-01-29T11:51:50Z","pushed_at":"2018-03-05T08:04:40Z","git_url":"git://github.com/transloadit/java-sdk.git","ssh_url":"git@github.com:transloadit/java-sdk.git","clone_url":"https://github.com/transloadit/java-sdk.git","svn_url":"https://github.com/transloadit/java-sdk","homepage":"","size":430,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":6,"watchers":2,"default_branch":"master"}},"base":{"label":"transloadit:master","ref":"master","sha":"a776cc4a677cf2b750df6a0c23bb2cca9a607461","user":{"login":"transloadit","id":125754,"avatar_url":"https://avatars2.githubusercontent.com/u/125754?v=4","gravatar_id":"","url":"https://api.github.com/users/transloadit","html_url":"https://github.com/transloadit","followers_url":"https://api.github.com/users/transloadit/followers","following_url":"https://api.github.com/users/transloadit/following{/other_user}","gists_url":"https://api.github.com/users/transloadit/gists{/gist_id}","starred_url":"https://api.github.com/users/transloadit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transloadit/subscriptions","organizations_url":"https://api.github.com/users/transloadit/orgs","repos_url":"https://api.github.com/users/transloadit/repos","events_url":"https://api.github.com/users/transloadit/events{/privacy}","received_events_url":"https://api.github.com/users/transloadit/received_events","type":"Organization","site_admin":false},"repo":{"id":74448557,"name":"java-sdk","full_name":"transloadit/java-sdk","owner":{"login":"transloadit","id":125754,"avatar_url":"https://avatars2.githubusercontent.com/u/125754?v=4","gravatar_id":"","url":"https://api.github.com/users/transloadit","html_url":"https://github.com/transloadit","followers_url":"https://api.github.com/users/transloadit/followers","following_url":"https://api.github.com/users/transloadit/following{/other_user}","gists_url":"https://api.github.com/users/transloadit/gists{/gist_id}","starred_url":"https://api.github.com/users/transloadit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/transloadit/subscriptions","organizations_url":"https://api.github.com/users/transloadit/orgs","repos_url":"https://api.github.com/users/transloadit/repos","events_url":"https://api.github.com/users/transloadit/events{/privacy}","received_events_url":"https://api.github.com/users/transloadit/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/transloadit/java-sdk","description":"Java client for Transloadit upload service https://transloadit.com","fork":false,"url":"https://api.github.com/repos/transloadit/java-sdk","forks_url":"https://api.github.com/repos/transloadit/java-sdk/forks","keys_url":"https://api.github.com/repos/transloadit/java-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/transloadit/java-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/transloadit/java-sdk/teams","hooks_url":"https://api.github.com/repos/transloadit/java-sdk/hooks","issue_events_url":"https://api.github.com/repos/transloadit/java-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/transloadit/java-sdk/events","assignees_url":"https://api.github.com/repos/transloadit/java-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/transloadit/java-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/transloadit/java-sdk/tags","blobs_url":"https://api.github.com/repos/transloadit/java-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/transloadit/java-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/transloadit/java-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/transloadit/java-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/transloadit/java-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/transloadit/java-sdk/languages","stargazers_url":"https://api.github.com/repos/transloadit/java-sdk/stargazers","contributors_url":"https://api.github.com/repos/transloadit/java-sdk/contributors","subscribers_url":"https://api.github.com/repos/transloadit/java-sdk/subscribers","subscription_url":"https://api.github.com/repos/transloadit/java-sdk/subscription","commits_url":"https://api.github.com/repos/transloadit/java-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/transloadit/java-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/transloadit/java-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/transloadit/java-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/transloadit/java-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/transloadit/java-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/transloadit/java-sdk/merges","archive_url":"https://api.github.com/repos/transloadit/java-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/transloadit/java-sdk/downloads","issues_url":"https://api.github.com/repos/transloadit/java-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/transloadit/java-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/transloadit/java-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/transloadit/java-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/transloadit/java-sdk/labels{/name}","releases_url":"https://api.github.com/repos/transloadit/java-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/transloadit/java-sdk/deployments","created_at":"2016-11-22T07:59:43Z","updated_at":"2018-01-29T11:51:50Z","pushed_at":"2018-03-05T08:04:40Z","git_url":"git://github.com/transloadit/java-sdk.git","ssh_url":"git@github.com:transloadit/java-sdk.git","clone_url":"https://github.com/transloadit/java-sdk.git","svn_url":"https://github.com/transloadit/java-sdk","homepage":"","size":430,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":6,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/transloadit/java-sdk/pulls/19"},"html":{"href":"https://github.com/transloadit/java-sdk/pull/19"},"issue":{"href":"https://api.github.com/repos/transloadit/java-sdk/issues/19"},"comments":{"href":"https://api.github.com/repos/transloadit/java-sdk/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/transloadit/java-sdk/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/transloadit/java-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/transloadit/java-sdk/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/transloadit/java-sdk/statuses/e73c324f7421ebda940eaf586ebd38b7a3f99fb6"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Acconut"}}