public List < BoxTask . Info > getTasks ( String ... fields ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( fields . length > 0 ) { builder . appendParam ( "fields" , fields ) . toString ( ) ; } URL url = GET_TASKS_URL_TEMPLATE . buildWithQuery ( this . getAPI ( ) . getBaseURL ( ) , builder . toString ( ) , this . getID ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( this . getAPI ( ) , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; int totalCount = responseJSON . get ( "total_count" ) . asInt ( ) ; List < BoxTask . Info > tasks = new ArrayList < BoxTask . Info > ( totalCount ) ; JsonArray entries = responseJSON . get ( "entries" ) . asArray ( ) ; for ( JsonValue value : entries ) { JsonObject taskJSON = value . asObject ( ) ; BoxTask task = new BoxTask ( this . getAPI ( ) , taskJSON . get ( "id" ) . asString ( ) ) ; BoxTask . Info info = task . new Info ( taskJSON ) ; tasks . add ( info ) ; } return tasks ; }
Gets a list of any tasks on this file with requested fields .