/// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
 /// </summary>
 /// <param name="oauth2AccessToken">The oauth2 access token for making client requests.</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxClient(string oauth2AccessToken, DropboxClientConfig config)
     : this(new DropboxRequestHandlerOptions(oauth2AccessToken, config.MaxRetriesOnError, config.UserAgent, httpClient : config.HttpClient))
 {
     if (oauth2AccessToken == null)
     {
         throw new ArgumentNullException("oauth2AccessToken");
     }
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
 /// </summary>
 /// <param name="oauth2AccessToken">The oauth2 access token for making client requests.</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxClient(string oauth2AccessToken, DropboxClientConfig config)
     : this(new DropboxRequestHandlerOptions(config, oauth2AccessToken))
 {
     if (oauth2AccessToken == null)
     {
         throw new ArgumentNullException("oauth2AccessToken");
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
        /// </summary>
        /// <param name="oauth2AccessToken">The oauth2 access token for making client requests.</param>
        /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
        public DropboxTeamClient(string oauth2AccessToken, DropboxClientConfig config)
        {
            if (oauth2AccessToken == null)
            {
                throw new ArgumentNullException("oauth2AccessToken");
            }

            this.options = new DropboxRequestHandlerOptions(oauth2AccessToken, config.MaxRetriesOnError, config.UserAgent, httpClient: config.HttpClient);
            this.InitializeRoutes(new DropboxRequestHandler(this.options));
        }
Exemple #4
0
 public DropboxRequestHandlerOptions(DropboxClientConfig config, string oauth2AccessToken)
     : this(
         oauth2AccessToken,
         config.MaxRetriesOnError,
         config.UserAgent,
         DefaultApiDomain,
         DefaultApiContentDomain,
         DefaultApiNotifyDomain,
         config.HttpClient,
         config.LongPollHttpClient)
 {
 }
Exemple #5
0
 public DropboxRequestHandlerOptions(DropboxClientConfig config, string oauth2AccessToken, string oauth2RefreshToken, Nullable <DateTime> oauth2AccessTokenExpiresAt, string appKey, string appSecret)
     : this(
         oauth2AccessToken,
         oauth2RefreshToken,
         oauth2AccessTokenExpiresAt,
         appKey,
         appSecret,
         config.MaxRetriesOnError,
         config.UserAgent,
         DefaultApiDomain,
         DefaultApiContentDomain,
         DefaultApiNotifyDomain,
         config.HttpClient,
         config.LongPollHttpClient)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
        /// </summary>
        /// <param name="appKey">The Dropbox app key (e.g. consumer key in OAuth).</param>
        /// <param name="appSecret">The Dropbox app secret (e.g. consumer secret in OAuth).</param>
        /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
        public DropboxAppClient(string appKey, string appSecret, DropboxClientConfig config)
        {
            if (appKey == null)
            {
                throw new ArgumentNullException("appKey");
            }

            if (appSecret == null)
            {
                throw new ArgumentNullException("appSecret");
            }

            var options = new DropboxRequestHandlerOptions(
                GetBasicAuthHeader(appKey, appSecret),
                config.MaxRetriesOnError,
                config.UserAgent,
                httpClient: config.HttpClient);

            this.InitializeRoutes(new DropboxRequestHandler(options));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxAppClient"/> class.
 /// </summary>
 /// <param name="appKey">The Dropbox app key (e.g. consumer key in OAuth).</param>
 /// <param name="appSecret">The Dropbox app secret (e.g. consumer secret in OAuth).</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxAppClient(string appKey, string appSecret, DropboxClientConfig config)
     : this(new DropboxRequestHandlerOptions(config, GetBasicAuthHeader(appKey, appSecret), null, null, null, null))
 {
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
 /// </summary>
 /// <param name="oauth2AccessToken">The oauth2 access token for making client requests.</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxTeamClient(string oauth2AccessToken, DropboxClientConfig config)
     : this(oauth2AccessToken, null, null, null, config)
 {
 }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
 /// </summary>
 /// <param name="oauth2RefreshToken">The oauth2 refresh token for refreshing access tokens</param>
 /// <param name="appKey">The app key to be used for refreshing tokens</param>
 /// <param name="appSecret">The app secret to be used for refreshing tokens</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxTeamClient(string oauth2RefreshToken, string appKey, string appSecret, DropboxClientConfig config)
     : this(null, oauth2RefreshToken, appKey, appSecret, config)
 {
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
 /// </summary>
 /// <param name="oauth2AccessToken">The oauth2 access token for making client requests.</param>
 /// <param name="oauth2RefreshToken">The oauth2 refresh token for refreshing access tokens</param>
 /// <param name="appKey">The app key to be used for refreshing tokens</param>
 /// <param name="appSecret">The app secret to be used for refreshing tokens</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxTeamClient(string oauth2AccessToken, string oauth2RefreshToken, string appKey, string appSecret, DropboxClientConfig config)
     : this(new DropboxRequestHandlerOptions(config, oauth2AccessToken, oauth2RefreshToken, null, appKey, appSecret))
 {
     if (oauth2AccessToken == null && oauth2RefreshToken == null)
     {
         throw new ArgumentException("Cannot pass in both null access and refresh token");
     }
 }
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
 /// </summary>
 /// <param name="oauth2AccessToken">The oauth2 access token for making client requests.</param>
 /// <param name="oauth2AccessTokenExpiresAt">The time when the current access token expires, can be null if using long-lived tokens</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxTeamClient(string oauth2AccessToken, DateTime oauth2AccessTokenExpiresAt, DropboxClientConfig config)
     : this(oauth2AccessToken, null, oauth2AccessTokenExpiresAt, null, null, config)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
 /// </summary>
 /// <param name="oauth2RefreshToken">The oauth2 access token for making client requests.</param>
 /// <param name="appKey">The app key to be used for refreshing tokens</param>
 /// <param name="config">The <see cref="DropboxClientConfig"/>.</param>
 public DropboxClient(string oauth2RefreshToken, string appKey, DropboxClientConfig config)
     : this(null, oauth2RefreshToken, appKey, null, config)
 {
 }