예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
 /// </summary>
 /// <param name="options">The request handler options.</param>
 /// <param name="selectUser">The member id of the selected user. If provided together with
 /// a team access token, actions will be performed on this this user's Dropbox.</param>
 /// <param name="selectAdmin">The member id of the selected admin. If provided together with
 /// a team access token, access is allowed for all team owned contents.</param>
 /// <param name="pathRoot">The path root value used as Dropbox-Api-Path-Root header.</param>
 internal DropboxClient(
     DropboxRequestHandlerOptions options,
     string selectUser  = null,
     string selectAdmin = null,
     PathRoot pathRoot  = null)
     : this(new DropboxRequestHandler(options, selectUser : selectUser, selectAdmin : selectAdmin, pathRoot : pathRoot))
 {
 }
        /// <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));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxRequestHandler"/> class.
        /// </summary>
        /// <param name="options">The configuration options for dropbox client.</param>
        /// <param name="selectUser">The member id of the selected user.</param>
        public DropboxRequestHandler(
            DropboxRequestHandlerOptions options,
            string selectUser = null)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.options    = options;
            this.selectUser = selectUser;
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
        /// </summary>
        /// <param name="oauth2AccessToken">The team oauth2 access token for making client requests.</param>
        /// <param name="maxRetriesOnError">The maximum retries on a 5xx error.</param>
        /// <param name="userAgent">The user agent to use when making requests.</param>
        /// <param name="httpClient">The custom http client. If not provided, a default
        /// http client will be created.</param>
        /// <remarks>
        /// The <paramref name="userAgent"/> helps Dropbox to identify requests coming from your application.
        /// We recommend that you use the format <c>"AppName/Version"</c>; if a value is supplied, the string
        /// <c>"/OfficialDropboxDotNetV2SDK/__version__"</c> is appended to the user agent.
        /// </remarks>
        public DropboxTeamClient(
            string oauth2AccessToken,
            int maxRetriesOnError = 4,
            string userAgent      = null,
            HttpClient httpClient = null)
        {
            if (oauth2AccessToken == null)
            {
                throw new ArgumentNullException("oauth2AccessToken");
            }

            this.options = new DropboxRequestHandlerOptions(oauth2AccessToken, maxRetriesOnError, userAgent, httpClient: httpClient);
            this.InitializeRoutes(new DropboxRequestHandler(this.options));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxRequestHandler"/> class.
        /// </summary>
        /// <param name="options">The configuration options for dropbox client.</param>
        /// <param name="selectUser">The member id of the selected user.</param>
        /// <param name="selectAdmin">The member id of the selected admin.</param>
        public DropboxRequestHandler(
            DropboxRequestHandlerOptions options,
            string selectUser  = null,
            string selectAdmin = null,
            PathRoot pathRoot  = null)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            this.options     = options;
            this.selectUser  = selectUser;
            this.selectAdmin = selectAdmin;
            this.pathRoot    = pathRoot;
        }
        /// <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="options">The request handler options.</param>
 private DropboxAppClient(DropboxRequestHandlerOptions options)
     : base(new DropboxRequestHandler(options))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
 /// </summary>
 /// <param name="options">The request handler options.</param>
 /// <param name="selectUser">The member id of the selected user. If provided together with
 /// a team access token, actions will be performed on this this user's Dropbox.</param>
 internal DropboxClient(DropboxRequestHandlerOptions options, string selectUser = null)
 {
     this.InitializeRoutes(new DropboxRequestHandler(options, selectUser));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
 /// </summary>
 /// <param name="options">The request handler options.</param>
 private DropboxTeamClient(DropboxRequestHandlerOptions options)
     : base(new DropboxRequestHandler(options))
 {
     this.options = options;
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxClient"/> class.
 /// </summary>
 /// <param name="options">The request handler options.</param>
 /// <param name="selectUser">The member id of the selected user. If provided together with
 /// a team access token, actions will be performed on this this user's Dropbox.</param>
 internal DropboxClient(DropboxRequestHandlerOptions options, string selectUser = null)
     : base(new DropboxRequestHandler(options, selectUser))
 {
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
 /// </summary>
 /// <param name="options">The request handler options.</param>
 /// <param name="requestHandler">The request handler.</param>
 private DropboxTeamClient(DropboxRequestHandlerOptions options, DropboxRequestHandler requestHandler) : base(requestHandler)
 {
     this.options        = options;
     this.requestHandler = requestHandler;
 }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Dropbox.Api.DropboxTeamClient"/> class.
 /// </summary>
 /// <param name="options">The request handler options.</param>
 private DropboxTeamClient(DropboxRequestHandlerOptions options) : this(options, new DropboxRequestHandler(options))
 {
 }