Tabnine Logo
com.dropbox.core.v2
Code IndexAdd Tabnine to your IDE (free)

How to use com.dropbox.core.v2

Best Java code snippets using com.dropbox.core.v2 (Showing top 20 results out of 315)

origin: com.dropbox.core/dropbox-core-sdk

public static boolean isValid(String path)
{
  String error = findError(path);
  return (error == null);
}
origin: com.dropbox.core/dropbox-core-sdk

  @Override
  protected DbxRawClientV2 withPathRoot(PathRoot pathRoot) {
    return new DbxUserRawClientV2(
      this.getRequestConfig(),
      this.accessToken,
      this.getHost(),
      this.getUserId(),
      pathRoot
    );
  }
}
origin: com.dropbox.core/dropbox-core-sdk

  @Override
  protected DbxRawClientV2 withPathRoot(PathRoot pathRoot) {
    return new DbxTeamRawClientV2(
      this.getRequestConfig(),
      this.getHost(),
      this.accessToken,
      this.getUserId(),
      this.memberId,
      this.adminId,
      pathRoot
    );
  }
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * 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);
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Returns a new {@link DbxClientV2} that performs requests against Dropbox API
 * user endpoints relative to a namespace without including the namespace as
 * part of the path variable for every request.
 * (<a href="https://www.dropbox.com/developers/reference/namespace-guide#pathrootmodes">https://www.dropbox.com/developers/reference/namespace-guide#pathrootmodes</a>).
 *
 * <p> This method performs no validation of the namespace ID. </p>
 *
 * @param pathRoot  the path root for this client, never {@code null}.
 *
 * @return Dropbox client that issues requests with Dropbox-API-Path-Root header.
 *
 * @throws IllegalArgumentException  If {@code pathRoot} is {@code null}
 */
public DbxClientV2 withPathRoot(PathRoot pathRoot) {
  if (pathRoot == null) {
    throw new IllegalArgumentException("'pathRoot' should not be null");
  }
  return new DbxClientV2(_client.withPathRoot(pathRoot));
}
origin: org.apache.camel/camel-dropbox

/**
 * Obtain a new instance of DbxClient and store it in configuration.
 */
public void createClient() {
  DbxRequestConfig config = new DbxRequestConfig(clientIdentifier, Locale.getDefault().toString());
  this.client = new DbxClientV2(config, accessToken);
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Updates an existing Paper doc with the provided content.
 *
 *
 * @return Uploader used to upload the request body and finish request.
 */
DocsUpdateUploader docsUpdate(PaperDocUpdateArgs arg) throws DbxException {
  HttpRequestor.Uploader _uploader = this.client.uploadStyle(this.client.getHost().getApi(),
                                "2/paper/docs/update",
                                arg,
                                false,
                                PaperDocUpdateArgs.Serializer.INSTANCE);
  return new DocsUpdateUploader(_uploader, this.client.getUserId());
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Creates a new Paper doc with the provided content.
 *
 *
 * @return Uploader used to upload the request body and finish request.
 */
DocsCreateUploader docsCreate(PaperDocCreateArgs arg) throws DbxException {
  HttpRequestor.Uploader _uploader = this.client.uploadStyle(this.client.getHost().getApi(),
                                "2/paper/docs/create",
                                arg,
                                false,
                                PaperDocCreateArgs.Serializer.INSTANCE);
  return new DocsCreateUploader(_uploader, this.client.getUserId());
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Retries the execution at most a maximum number of times.
 *
 * <p> This method is an alternative implementation to {@code DbxRequestUtil.runAndRetry(..)}
 * that does <b>not</b> retry 500 errors ({@link com.dropbox.core.ServerException}). To maintain
 * behavior backwards compatibility in v1, we leave the old implementation in {@code
 * DbxRequestUtil} unchanged.
 */
private static <T> T executeRetriable(int maxRetries, RetriableExecution<T> execution) throws DbxWrappedException, DbxException {
  if (maxRetries == 0) {
    return execution.execute();
  }
  int retries = 0;
  while (true) {
    try {
      return execution.execute();
    } catch (RetryException ex) {
      if (retries < maxRetries) {
        ++retries;
        sleepQuietlyWithJitter(ex.getBackoffMillis());
      } else {
        throw ex;
      }
    }
  }
}
origin: iterate-ch/cyberduck

@Override
protected void logout() throws BackgroundException {
  try {
    ((DropboxCommonsHttpRequestExecutor) client.getRequestConfig().getHttpRequestor()).close();
  }
  catch(IOException e) {
    throw new DefaultIOExceptionMappingService().map(e);
  }
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Convenience method for {@link DbxUploader#uploadAndFinish(InputStream)}:
 *
 * <pre><code>
 *    builder.start().uploadAndFinish(in);
 * </code></pre>
 *
 * @param in {@code InputStream} containing data to upload
 *
 * @return Response from server
 *
 * @throws X if the server sent an error response for the request
 * @throws DbxException if an error occurs uploading the data or reading the response
 * @throws IOException if an error occurs reading the input stream.
 */
public R uploadAndFinish(InputStream in) throws X, DbxException, IOException
{
  return start().uploadAndFinish(in);
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Same as {@link #DbxAppClientV2(DbxRequestConfig, String, String)} except you can also set the
 * hostnames of the Dropbox API servers. This is used in testing. You don't normally need to
 * call this.
 *
 * @param requestConfig  Default attributes to use for each request
 * @param key Dropbox app key (e.g. consumer key in OAuth)
 * @param secret Dropbox app secret (e.g. consumer secret in OAuth)
 * @param host  Dropbox hosts to send requests to (used for mocking and
 *     testing)
 */
public DbxAppClientV2(DbxRequestConfig requestConfig, String key, String secret, DbxHost host) {
  super(new DbxAppRawClientV2(requestConfig, key, secret, host, null));
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Same as {@link #DbxClientV2(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 DbxClientV2(DbxRequestConfig requestConfig, String accessToken, DbxHost host, String userId) {
  super(new DbxUserRawClientV2(requestConfig, accessToken, host, userId, null));
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * 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;
}
origin: com.dropbox.core/dropbox-core-sdk

  /**
   * Convenience method for {@link DbxDownloader#download(OutputStream)}:
   *
   * <pre><code>
   *    builder.start().download(out);
   * </code></pre>
   *
   * @param out {@code OutputStream} to write response body to
   *
   * @return Response from server
   *
   * @throws DbxException if an error occurs reading the response or response body
   * @throws IOException if an error occurs writing the response body to the output stream.
   */
  public R download(OutputStream out) throws DbxException, IOException {
    return start().download(out);
  }
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * 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);
}
origin: adrian/upm-android

public static void init(String accessToken) {
  if (sDbxClient == null || DropboxClientFactory.accessToken != accessToken) {
    DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("upm")
        .withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient()))
        .build();
    sDbxClient = new DbxClientV2(requestConfig, accessToken);
    DropboxClientFactory.accessToken = accessToken;
  }
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Convenience method for {@link DbxUploader#uploadAndFinish(InputStream, long)}:
 *
 * <pre><code>
 *    builder.start().uploadAndFinish(in, limit);
 * </code></pre>
 *
 * @param in    {@code InputStream} containing data to upload
 * @param limit Maximum number of bytes to read from the given {@code InputStream}
 *
 * @return Response from server
 *
 * @throws X if the server sent an error response for the request
 * @throws DbxException if an error occurs uploading the data or reading the response
 * @throws IOException if an error occurs reading the input stream.
 */
public R uploadAndFinish(InputStream in, long limit) throws X, DbxException, IOException
{
  return start().uploadAndFinish(in, limit);
}
origin: com.dropbox.core/dropbox-core-sdk

/**
 * Same as {@link #DbxAppClientV2(DbxRequestConfig, String, String)} except you can also set the
 * hostnames of the Dropbox API servers. This is used in testing. You don't normally need to
 * call this.
 *
 * @param requestConfig  Default attributes to use for each request
 * @param key Dropbox app key (e.g. consumer key in OAuth)
 * @param secret Dropbox app secret (e.g. consumer secret in OAuth)
 * @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 DbxAppClientV2(DbxRequestConfig requestConfig, String key, String secret, DbxHost host, String userId) {
  super(new DbxAppRawClientV2(requestConfig, key, secret, host, userId));
}
origin: com.dropbox.core/dropbox-core-sdk

  /**
   * Convenience method for {@link DbxUploader#uploadAndFinish(InputStream, IOUtil.ProgressListener)}:
   *
   * <pre><code>
   *    builder.start().uploadAndFinish(in, progressListener);
   * </code></pre>
   *
   * @param in {@code InputStream} containing data to upload
   * @param progressListener {@code ProgressListener} to track the upload progress. Only support
   *  OKHttpRequester and StandardHttpRequester
   *
   * @return Response from server
   *
   * @throws X if the server sent an error response for the request
   * @throws DbxException if an error occurs uploading the data or reading the response
   * @throws IOException if an error occurs reading the input stream.
   */
  public R uploadAndFinish(InputStream in, IOUtil.ProgressListener progressListener)
      throws X, DbxException, IOException
  {
    return start().uploadAndFinish(in, progressListener);
  }
}
com.dropbox.core.v2

Most used classes

  • DbxClientV2
    Use this class to make remote calls to the Dropbox API user endpoints. User endpoints expose actions
  • DbxUserFilesRequests
    Routes in namespace "files".
  • UploadBuilder
    The request builder returned by DbxUserFilesRequests#uploadBuilder. Use this class to set optional r
  • FileMetadata
  • ListFolderResult
  • DbxUserUsersRequests,
  • DownloadBuilder,
  • SearchResult,
  • DbxUserAuthRequests,
  • SearchMatch,
  • DbxRawClientV2,
  • CommitInfo$Builder,
  • CommitInfo,
  • CreateFolderError,
  • CreateFolderResult,
  • DeleteError,
  • DownloadError,
  • GetMetadataError,
  • GetTemporaryLinkError
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now