Beispiel #1
0
 public B2Client(B2Options options)
 {
     _options   = options;
     Buckets    = new Buckets(options);
     Files      = new Files(options);
     LargeFiles = new LargeFiles(options);
 }
Beispiel #2
0
 /// <summary>
 /// Only call this method if you created a B2Client with authorizeOnInitalize = false. This method of using B2.NET is considered in Beta, as it has not been extensively tested.
 /// </summary>
 /// <returns></returns>
 public async Task Initialize()
 {
     _options      = Authorize(_options);
     Buckets       = new Buckets(_options);
     Files         = new Files(_options);
     LargeFiles    = new LargeFiles(_options);
     _capabilities = _options.Capabilities;
 }
Beispiel #3
0
 public B2Client(B2Options options)
 {
     _options      = Authorize(options);
     Buckets       = new Buckets(options);
     Files         = new Files(options);
     LargeFiles    = new LargeFiles(options);
     _capabilities = options.Capabilities;
 }
Beispiel #4
0
        /// <summary>
        /// Simple method for instantiating the B2Client. Does auth for you.
        /// </summary>
        /// <param name="accountId"></param>
        /// <param name="applicationkey"></param>
        /// <param name="requestTimeout"></param>
        public B2Client(string accountId, string applicationkey, int requestTimeout = 100)
        {
            _options = new B2Options()
            {
                AccountId      = accountId,
                ApplicationKey = applicationkey,
                RequestTimeout = requestTimeout
            };
            _options = Authorize(_options);

            Buckets    = new Buckets(_options);
            Files      = new Files(_options);
            LargeFiles = new LargeFiles(_options);
        }
Beispiel #5
0
        /// <summary>
        /// Simple method for instantiating the B2Client. Does auth for you. See https://www.backblaze.com/b2/docs/application_keys.html for details on application keys.
        /// This method defaults to not persisting a bucket. Manually build the options object if you wish to do that.
        /// </summary>
        /// <param name="accountId"></param>
        /// <param name="applicationkey"></param>
        /// <param name="requestTimeout"></param>
        public B2Client(string keyId, string applicationkey, int requestTimeout = 100)
        {
            _options = new B2Options()
            {
                KeyId          = keyId,
                ApplicationKey = applicationkey,
                RequestTimeout = requestTimeout
            };
            _options = Authorize(_options);

            Buckets       = new Buckets(_options);
            Files         = new Files(_options);
            LargeFiles    = new LargeFiles(_options);
            _capabilities = _options.Capabilities;
        }
Beispiel #6
0
 /// <summary>
 /// If you specify authorizeOnInitialize = false, you MUST call Initialize() once before you use the client.
 /// </summary>
 /// <param name="options"></param>
 /// <param name="authorizeOnInitialize"></param>
 public B2Client(B2Options options, bool authorizeOnInitialize = true)
 {
     // Should we authorize on the class initialization?
     if (authorizeOnInitialize)
     {
         _options      = Authorize(options);
         Buckets       = new Buckets(options);
         Files         = new Files(options);
         LargeFiles    = new LargeFiles(options);
         _capabilities = options.Capabilities;
     }
     else
     {
         // If not, then the user will have to Initialize() before making any calls.
         _options = options;
     }
 }