Created
December 16, 2018 13:20
-
-
Save icebeam7/b6c05ea5f31afa002bcb677a248cd71a to your computer and use it in GitHub Desktop.
VideoGameMusicApp: get-songs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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