public Account createAccount ( String email , String clientId , String clientSecret ) throws HelloSignException { HttpClient client = httpClient . withAuth ( auth ) . withPostField ( Account . ACCOUNT_EMAIL_ADDRESS , email ) ; if ( clientId != null && clientSecret != null ) { client = client . withPostField ( CLIENT_ID , clientId ) . withPostField ( CLIENT_SECRET , clientSecret ) ; } JSONObject response = client . post ( BASE_URI + ACCOUNT_CREATE_URI ) . asJson ( ) ; JSONObject copy ; try { copy = new JSONObject ( response . toString ( ) ) ; } catch ( JSONException e ) { throw new HelloSignException ( e ) ; } OauthData data = new OauthData ( copy ) ; Account account = new Account ( response ) ; account . setOauthData ( data ) ; return account ; }
Creates a new HelloSign account and provides OAuth app credentials to automatically generate an OAuth token with the user Account response .