Esempio n. 1
0
 private BoxManager(IRequestAuthenticator requestAuthenticator, IWebProxy proxy, BoxManagerOptions options, string onBehalfOf = null)
     : this()
 {
     requestAuthenticator.SetOnBehalfOf(onBehalfOf);
     _restClient = new BoxRestClient(requestAuthenticator, proxy, options);
     _uploadClient = new BoxUploadClient(requestAuthenticator, proxy, options);
 }
Esempio n. 2
0
 public TokenProvider(string clientId, string clientSecret, IWebProxy webProxy = null, BoxManagerOptions options = BoxManagerOptions.None)
 {
     _clientId = clientId;
     _clientSecret = clientSecret;
     _requestHelper = new RequestHelper();
     _restClient = new BoxRestClient(null, webProxy, options);
 }
 /// <summary>
 ///     Instantiates a BoxAuthenticator
 /// </summary>
 /// <param name="apiKey">The API key for your application</param>
 /// <param name="ticket">The ticket associated with the current authorization token request, if you already have one.</param>
 /// <param name="proxy">An optional web proxy that should be used in conjunction with any calls to Box</param>
 public BoxAuthenticator(string apiKey, string ticket = null, WebProxy proxy = null, BoxManagerOptions options = BoxManagerOptions.None)
 {
     ApiKey = apiKey;
     Ticket = ticket;
     Proxy = proxy;
     _requestHelper = new RequestHelper();
     _restClient = new BoxRestClient(new LegacyRequestAuthenticator(ApiKey, null), proxy, options);
 }
Esempio n. 4
0
        public BoxRestClientBase(string serviceUrlBase, IRequestAuthenticator authenticator, IWebProxy proxy, BoxManagerOptions options) :
            base(serviceUrlBase)
        {
            Options       = options;
            Authenticator = authenticator;
            Proxy         = proxy;
            ClearHandlers();
            var xmlDeserializer  = new XmlDeserializer();
            var jsonDeserializer = new JsonDeserializer();

            AddHandler(XmlMimeType, xmlDeserializer);
            AddHandler(XmlAltMimeType, xmlDeserializer);
            AddHandler(JsonMimeType, jsonDeserializer);
        }
Esempio n. 5
0
 public TokenProvider(string clientId, string clientSecret, IWebProxy webProxy = null, BoxManagerOptions options = BoxManagerOptions.None)
 {
     _clientId      = clientId;
     _clientSecret  = clientSecret;
     _requestHelper = new RequestHelper();
     _restClient    = new BoxRestClient(null, webProxy, options);
 }
Esempio n. 6
0
 public BoxManager(string v1ApiKey, string v1AuthToken, IWebProxy proxy = null, BoxManagerOptions options = BoxManagerOptions.None)
     : this(new LegacyRequestAuthenticator(v1ApiKey, v1AuthToken), proxy, options)
 {
 }
Esempio n. 7
0
 /// <summary>
 ///     Creates a BoxManager client using the v2 authentication scheme
 /// </summary>
 /// <param name="oauth2AccessToken">The OAuth 2.0 access token for this user</param>
 /// <param name="proxy">HTTP proxy configuration information</param>
 /// <param name="options">Options to customize the behavior of the BoxManager</param>
 /// <param name="onBehalfOf">All operations will be performed on behalf of the user with this login.</param>
 public BoxManager(string oauth2AccessToken, IWebProxy proxy = null, BoxManagerOptions options = BoxManagerOptions.None, string onBehalfOf = null)
     : this(new OAuth2RequestAuthenticator(oauth2AccessToken), proxy, options, onBehalfOf)
 {
 }
Esempio n. 8
0
 private BoxManager(IRequestAuthenticator requestAuthenticator, IWebProxy proxy, BoxManagerOptions options, string onBehalfOf = null)
     : this()
 {
     requestAuthenticator.SetOnBehalfOf(onBehalfOf);
     _restClient     = new BoxRestClient(requestAuthenticator, proxy, options);
     _uploadClient   = new BoxUploadClient(requestAuthenticator, proxy, options);
     _downloadClient = new RestClient()
     {
         Authenticator = requestAuthenticator
     };
 }
Esempio n. 9
0
 public BoxManager(string v1ApiKey, string v1AuthToken, IWebProxy proxy = null, BoxManagerOptions options = BoxManagerOptions.None)
     : this(new LegacyRequestAuthenticator(v1ApiKey, v1AuthToken), proxy, options)
 {
 }
Esempio n. 10
0
 /// <summary>
 ///     Creates a BoxManager client using the v2 authentication scheme
 /// </summary>
 /// <param name="oauth2AccessToken">The OAuth 2.0 access token for this user</param>
 /// <param name="proxy">HTTP proxy configuration information</param>
 /// <param name="options">Options to customize the behavior of the BoxManager</param>
 /// <param name="onBehalfOf">All operations will be performed on behalf of the user with this login.</param>
 public BoxManager(string oauth2AccessToken, IWebProxy proxy = null, BoxManagerOptions options = BoxManagerOptions.None, string onBehalfOf = null)
     : this(new OAuth2RequestAuthenticator(oauth2AccessToken), proxy, options, onBehalfOf)
 {
 }
Esempio n. 11
0
 /// <summary>
 ///     Instantiates a BoxAuthenticator
 /// </summary>
 /// <param name="apiKey">The API key for your application</param>
 /// <param name="ticket">The ticket associated with the current authorization token request, if you already have one.</param>
 /// <param name="proxy">An optional web proxy that should be used in conjunction with any calls to Box</param>
 public BoxAuthenticator(string apiKey, string ticket = null, WebProxy proxy = null, BoxManagerOptions options = BoxManagerOptions.None)
 {
     ApiKey         = apiKey;
     Ticket         = ticket;
     Proxy          = proxy;
     _requestHelper = new RequestHelper();
     _restClient    = new BoxRestClient(new LegacyRequestAuthenticator(ApiKey, null), proxy, options);
 }
Esempio n. 12
0
 public BoxUploadClient(IRequestAuthenticator authenticator, IWebProxy proxy, BoxManagerOptions options)
     : base(ServiceUrl, authenticator, proxy, options)
 {
 }
Esempio n. 13
0
 private void SetClient(IRequestAuthenticator requestAuthenticator, IWebProxy proxy, BoxManagerOptions options)
 {
     _restClient = new BoxRestClient(requestAuthenticator, proxy, options);
 }
Esempio n. 14
0
 /// <summary>
 ///     Creates a BoxManager client using the v2 authentication scheme
 /// </summary>
 /// <param name="oauth2AccessToken">The OAuth 2.0 access token for this user</param>
 /// <param name="proxy">HTTP proxy configuration information</param>
 /// <param name="options">Options to customize the behavior of the BoxManager</param>
 public BoxManager(string oauth2AccessToken, IWebProxy proxy = null, BoxManagerOptions options = BoxManagerOptions.None)
     : this()
 {
     SetClient(new OAuth2RequestAuthenticator(oauth2AccessToken), proxy, options);
 }
Esempio n. 15
0
 private BoxManager(IRequestAuthenticator requestAuthenticator, IWebProxy proxy, BoxManagerOptions options)
     : this()
 {
     _restClient = new BoxRestClient(requestAuthenticator, proxy, options);
     _uploadClient = new BoxUploadClient(requestAuthenticator, proxy, options);
 }