/** * Returns a {@link DbxClientV2} that performs requests against Dropbox API * user endpoints as the given team admin. * * <p> This method performs no validation of the team admin ID. </p> * * @param adminId Team member ID of the admin in client's team, never * {@code null}. * * @return Dropbox client that issues requests to user endpoints as the * given team Admin. * * @throws IllegalArgumentException If {@code adminId} is {@code null} */ public DbxClientV2 asAdmin(String adminId) { if (adminId == null) { throw new IllegalArgumentException("'adminId' should not be null"); } DbxRawClientV2 asAdminClient = new DbxTeamRawClientV2( _client.getRequestConfig(), _client.getHost(), accessToken, _client.getUserId(), null, adminId, null ); return new DbxClientV2(asAdminClient); }
/** * Returns a {@link DbxClientV2} that performs requests against Dropbox API * user endpoints as the given team member. * * <p> This method performs no validation of the team member ID. </p> * * @param memberId Team member ID of member in this client's team, never * {@code null}. * * @return Dropbox client that issues requests to user endpoints as the * given team member * * @throws IllegalArgumentException If {@code memberId} is {@code null} */ public DbxClientV2 asMember(String memberId) { if (memberId == null) { throw new IllegalArgumentException("'memberId' should not be null"); } DbxRawClientV2 asMemberClient = new DbxTeamRawClientV2( _client.getRequestConfig(), _client.getHost(), accessToken, _client.getUserId(), memberId, null, null ); return new DbxClientV2(asMemberClient); }
/** * Same as {@link #DbxTeamClientV2(DbxRequestConfig, String, DbxHost)} except you can * also set the userId for multiple Dropbox accounts. * * @param requestConfig Default attributes to use for each request * @param accessToken OAuth 2 access token (that you got from Dropbox) that * gives your app the ability to make Dropbox API calls. Typically * acquired through {@link com.dropbox.core.DbxWebAuth} * @param host Dropbox hosts to send requests to (used for mocking and * testing) * @param userId The user ID of the current Dropbox account. Used for * multi-Dropbox account use-case. */ public DbxTeamClientV2(DbxRequestConfig requestConfig, String accessToken, DbxHost host, String userId) { super(new DbxTeamRawClientV2(requestConfig, host, accessToken, userId, null, null, null)); this.accessToken = accessToken; }
@Override protected DbxRawClientV2 withPathRoot(PathRoot pathRoot) { return new DbxTeamRawClientV2( this.getRequestConfig(), this.getHost(), this.accessToken, this.getUserId(), this.memberId, this.adminId, pathRoot ); } }