public AssemblyResponse save ( boolean isResumable ) throws RequestException , LocalOperationException { Request request = new Request ( getClient ( ) ) ; options . put ( "steps" , steps . toMap ( ) ) ; // only do tus uploads if files will be uploaded if ( isResumable && getFilesCount ( ) > 0 ) { Map < String , String > tusOptions = new HashMap < String , String > ( ) ; tusOptions . put ( "tus_num_expected_upload_files" , Integer . toString ( getFilesCount ( ) ) ) ; AssemblyResponse response = new AssemblyResponse ( request . post ( "/assemblies" , options , tusOptions , null , null ) , true ) ; // check if the assembly returned an error if ( response . hasError ( ) ) { throw new RequestException ( "Request to Assembly failed: " + response . json ( ) . getString ( "error" ) ) ; } try { handleTusUpload ( response ) ; } catch ( IOException e ) { throw new LocalOperationException ( e ) ; } catch ( ProtocolException e ) { throw new RequestException ( e ) ; } return response ; } else { return new AssemblyResponse ( request . post ( "/assemblies" , options , null , files , fileStreams ) ) ; } }
Submits the configured assembly to Transloadit for processing .