public void GithubActivityShouldRefresh() { var secrets = DevSecretsDictionary.Load("SessionTableStorage.sln"); var data = _storage.GetAsync("activity", async() => { string user = secrets.Contents["name"]; var client = new GitHubClient(new ProductHeaderValue(user)); client.Credentials = new Credentials(secrets.Contents["github-token"]); var events = await client.Activity.Events.GetAllUserPerformedPublic(user, new ApiOptions() { StartPage = 1, PageCount = 1, PageSize = 30 }); var array = events.ToArray(); var flattened = array.Select(e => new GithubActivityFlattened(e)).ToArray(); return(new GithubActivityView() { Activities = flattened }); }).Result; }
public static async Task <CloudTable> GetTableAsync() { var secrets = DevSecretsDictionary.Load("SessionTableStorage.sln"); var creds = new StorageCredentials(secrets.Contents["name"], secrets.Contents["key"]); var account = new CloudStorageAccount(creds, true); var client = account.CreateCloudTableClient(); var table = client.GetTableReference("SessionStorage"); await table.CreateIfNotExistsAsync(); return(table); }
protected override CloudBlobContainer GetContainer() { var config = DevSecretsDictionary.Load("JsonStorage.sln"); var creds = new StorageCredentials(config.Contents["accountname"], config.Contents["accountkey"]); var account = new CloudStorageAccount(creds, true); var client = account.CreateCloudBlobClient(); var container = client.GetContainerReference("jsonstorage"); container.CreateIfNotExists(); return(container); }
private static void Main(string[] args) { var secrets = DevSecretsDictionary.Load("WebContentBackup.sln"); var account = new CloudStorageAccount(new StorageCredentials(secrets.Contents["accountName"], secrets.Contents["accountKey"]), true); var client = account.CreateCloudBlobClient(); /* * var containers = client.ListContainersAsync().Result; * foreach (string container in containers) * { * Console.WriteLine(container); * } */ Progress <string> progress = new Progress <string>(WriteFolder); var folders = client.ListContainerFoldersAsync("aerie-hpmachine", progress: progress).Result; foreach (var folder in folders) { Console.WriteLine($"{folder.Path}: {folder.BlobCount}"); } Console.WriteLine("done"); Console.ReadLine(); }