public static PagedFiles <T> As <T>(this PagedFiles <string> pagedFiles) => new PagedFiles <T> { Total = pagedFiles.Total, Start = pagedFiles.Start, End = pagedFiles.End, Files = pagedFiles.Files.Select(JsonConvert.DeserializeObject <T>).ToArray() };
public static async Task GetFiles <T>(this IGitDb gitDb, string branch, string key, int pageSize, Func <IReadOnlyCollection <T>, Task> processPage) { PagedFiles <T> currentResult = null; do { currentResult = await gitDb.GetFilesPaged <T>(branch, key, currentResult?.End ?? 0, pageSize); await processPage(currentResult.Files); } while (currentResult.Total > currentResult.End); }