public static List < BoxTermsOfService . Info > getAllTermsOfServices ( final BoxAPIConnection api , BoxTermsOfService . TermsOfServiceType termsOfServiceType ) { QueryStringBuilder builder = new QueryStringBuilder ( ) ; if ( termsOfServiceType != null ) { builder . appendParam ( "tos_type" , termsOfServiceType . toString ( ) ) ; } URL url = ALL_TERMS_OF_SERVICES_URL_TEMPLATE . buildWithQuery ( api . getBaseURL ( ) , builder . toString ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , "GET" ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; JsonObject responseJSON = JsonObject . readFrom ( response . getJSON ( ) ) ; int totalCount = responseJSON . get ( "total_count" ) . asInt ( ) ; List < BoxTermsOfService . Info > termsOfServices = new ArrayList < BoxTermsOfService . Info > ( totalCount ) ; JsonArray entries = responseJSON . get ( "entries" ) . asArray ( ) ; for ( JsonValue value : entries ) { JsonObject termsOfServiceJSON = value . asObject ( ) ; BoxTermsOfService termsOfService = new BoxTermsOfService ( api , termsOfServiceJSON . get ( "id" ) . asString ( ) ) ; BoxTermsOfService . Info info = termsOfService . new Info ( termsOfServiceJSON ) ; termsOfServices . add ( info ) ; } return termsOfServices ; }
Retrieves a list of Terms of Service that belong to your Enterprise as an Iterable .