Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.