コード例 #1
0
ファイル: Program.cs プロジェクト: microcompiler/backblaze
        static async Task Main()
        {
            try
            {
                var options = new ClientOptions();

                var loggerFactory = LoggerFactory.Create(builder =>
                {
                    builder
                    .AddFilter("Microsoft", LogLevel.Warning)
                    .AddFilter("System", LogLevel.Warning)
                    .AddFilter("Bytewizer.Backblaze", LogLevel.Trace)
                    .AddDebug();
                });

                var cache = new MemoryCache(new MemoryCacheOptions());

                Client = new BackblazeClient(options, loggerFactory, cache);

                await Client.ConnectAsync("[key_id]", "[application_key]");

                var buckets = await Client.Buckets.GetAsync();

                foreach (var bucket in buckets)
                {
                    Console.WriteLine($"Bucket Name: {bucket.BucketName} - Type: {bucket.BucketType}");
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
            }
        }
コード例 #2
0
 public async Task Client_Authentication()
 {
     await Assert.ThrowsAsync <AuthenticationException>(async() =>
     {
         using (var client = new BackblazeClient())
         {
             await client.ConnectAsync("Bad_Key_Id", "Bad_Appkication_Key");
         };
     });
 }