Skip to content

Instantly share code, notes, and snippets.

@icebeam7
Created December 16, 2018 13:20
Show Gist options
  • Save icebeam7/b6c05ea5f31afa002bcb677a248cd71a to your computer and use it in GitHub Desktop.
Save icebeam7/b6c05ea5f31afa002bcb677a248cd71a to your computer and use it in GitHub Desktop.
VideoGameMusicApp: get-songs.cs
#r "Microsoft.Azure.ApiHub.Sdk"
using System.Net;
using System.Net.Http.Headers;
using Microsoft.Azure.ApiHub;
public class Song
{
public string Title { get; set; }
public string Game { get; set; }
}
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, ITable<Song> inputTable, TraceWriter log)
{
List<Song> songsList = new List<Song>();
ContinuationToken token = null;
do
{
var segment = await inputTable.ListEntitiesAsync(continuationToken: token);
foreach (var item in segment.Items)
{
if (!String.IsNullOrWhiteSpace(item.Title))
songsList.Add(item);
}
token = segment.ContinuationToken;
}while (token != null);
return req.CreateResponse(HttpStatusCode.OK, songsList);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment