public async Task <GitHubEventPayload> LoadAsync(GitHubEventPayloadName name) { var containerClient = GetClient(); var blobName = name.ToString(); var blobClient = new BlobClient(_connectionString, containerClient.Name, blobName); var data = await blobClient.DownloadAsync(); using (var reader = new StreamReader(data.Value.Content)) { var json = await reader.ReadToEndAsync(); return(GitHubEventPayload.ParseJson(json)); } }
public async Task SaveAsync(GitHubEventPayloadName name, GitHubEventPayload payload) { var blobName = name.ToString(); var blobContent = payload.ToJson(); var client = GetClient(); await client.CreateIfNotExistsAsync(); using (var memoryStream = new MemoryStream()) { using (var writer = new StreamWriter(memoryStream, leaveOpen: true)) writer.Write(blobContent); memoryStream.Position = 0; await client.UploadBlobAsync(blobName, memoryStream); } }
public async Task DeleteAsync(GitHubEventPayloadName name) { var blobName = name.ToString(); var client = GetClient(); await client.DeleteBlobAsync(blobName); }