Tabnine Logo
DbxClientV2.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.dropbox.core.v2.DbxClientV2
constructor

Best Java code snippets using com.dropbox.core.v2.DbxClientV2.<init> (Showing top 12 results out of 315)

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

/**
 * 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: sebbrudzinski/Open-LaTeX-Studio

public static DbxClientV2 getDbxClient() {
  String accessToken = (String) ApplicationSettings.Setting.DROPBOX_TOKEN.getValue();
  if (accessToken == null) {
    JOptionPane.showMessageDialog(null, 
      "The authentication token has not been set.\n"
          + "Please connect the application to your Dropbox account first!", 
      "Dropbox authentication token not found", JOptionPane.ERROR_MESSAGE
    );
    return null;
  }
  return new DbxClientV2(getDbxConfig(), accessToken); 
}

origin: quebic-source/microservices-sample-project

@Override
public ResponseEntity<StreamingResponseBody> readFile(String fileLocation, String imageDir, String id,
    String fileName) {
  
  StreamingResponseBody streamingResponseBody = new StreamingResponseBody() {
    @Override
    public void writeTo(OutputStream outputStream) {
      try {
        String fileStr = SEPARATOR + imageDir + SEPARATOR + id + SEPARATOR + fileName;
        DbxRequestConfig config = new DbxRequestConfig(APP_IDENTIFIER);
        DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
        client.files().download(fileStr).download(outputStream);
      } catch (Exception e) {
        logger.error(e.getMessage());
        throw new ResourceNotFoundException("Image Not Found : " + id + "/" + fileName);
      }
    }
  };
  HttpHeaders headers = new HttpHeaders();
  headers.add(HttpHeaders.CONTENT_TYPE, "image/*");
  return new ResponseEntity<StreamingResponseBody>(streamingResponseBody, headers, HttpStatus.OK);
}
origin: quebic-source/microservices-sample-project

  @Override
  public void writeTo(OutputStream outputStream) {
    try {
      String fileStr = SEPARATOR + imageDir + SEPARATOR + id + SEPARATOR + fileName;
      DbxRequestConfig config = new DbxRequestConfig(APP_IDENTIFIER);
      DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
      client.files().download(fileStr).download(outputStream);
    } catch (Exception e) {
      logger.error(e.getMessage());
      throw new ResourceNotFoundException("Image Not Found : " + id + "/" + fileName);
    }
  }
};
origin: io.syndesis.connector/connector-dropbox

private void verifyCredentials(ResultBuilder builder, Map<String, Object> parameters) {
  String token = (String) parameters.get("accessToken");
  String clientId = (String) parameters.get("clientIdentifier");
  try {
    // Create Dropbox client
    DbxRequestConfig config = new DbxRequestConfig(clientId, Locale.getDefault().toString());
    DbxClientV2 client = new DbxClientV2(config, token);
    client.users().getCurrentAccount();
  } catch (DbxException e) {
    builder.error(ResultErrorBuilder
        .withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION,
            "Invalid client identifier and/or access token")
        .parameterKey("accessToken").parameterKey("clientIdentifier").build());
  }
}
origin: org.apache.camel/camel-dropbox

private void verifyCredentials(ResultBuilder builder, Map<String, Object> parameters) {
  String token = (String) parameters.get("accessToken");
  String clientId = (String) parameters.get("clientIdentifier");
  try {
    // Create Dropbox client
    DbxRequestConfig config = new DbxRequestConfig(clientId, Locale.getDefault().toString());
    DbxClientV2 client = new DbxClientV2(config, token);
    client.users().getCurrentAccount();
    client = null;
  } catch (Exception e) {
    builder.error(ResultErrorBuilder
        .withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION,
            "Invalid client identifier and/or access token")
        .parameterKey("accessToken").parameterKey("clientIdentifier").build());
  }
}
origin: quebic-source/microservices-sample-project

private FileMetadata dropBoxSave(String uploadPath, InputStream inputStream)throws Exception{
  DbxRequestConfig config = new DbxRequestConfig(APP_IDENTIFIER);
  DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
  return client.files().uploadBuilder(uploadPath).uploadAndFinish(inputStream);
}
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 {@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: dsolonenko/financisto

private boolean authSession() {
  String accessToken = MyPreferences.getDropboxAuthToken(context);
  if (accessToken != null) {
    if (dropboxClient == null) {
      DbxRequestConfig requestConfig = DbxRequestConfig.newBuilder("financisto")
          .withHttpRequestor(new OkHttp3Requestor(OkHttp3Requestor.defaultOkHttpClient()))
          .build();
      dropboxClient = new DbxClientV2(requestConfig, accessToken);
    }
    return true;
  }
  return false;
}
com.dropbox.core.v2DbxClientV2<init>

Javadoc

Creates a client that uses the given OAuth 2 access token as authorization when performing requests against the default Dropbox hosts.

Popular methods of DbxClientV2

  • files
  • users
  • auth

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • findViewById (Activity)
  • addToBackStack (FragmentTransaction)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Runner (org.openjdk.jmh.runner)
  • CodeWhisperer alternatives
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