private static Task <IReadOnlyList <Repository> > GetAllInstallationRepositories(string token) { var product = new ProductHeaderValue( "Maestro", Assembly.GetEntryAssembly() .GetCustomAttribute <AssemblyInformationalVersionAttribute>() .InformationalVersion); var client = new GitHubClient(product) { Credentials = new Credentials(token, AuthenticationType.Bearer) }; var pagination = new ApiPagination(); var uri = new Uri("installation/repositories", UriKind.Relative); async Task <IApiResponse <List <Repository> > > GetInstallationRepositories(Uri u) { IApiResponse <InstallationRepositoriesResponse> response = await client.Connection.Get <InstallationRepositoriesResponse>( u, null, AcceptHeaders.GitHubAppsPreview); return(new ApiResponse <List <Repository> >(response.HttpResponse, response.Body.Repositories)); } return(pagination.GetAllPages <Repository>( async() => new ReadOnlyPagedCollection <Repository>( await GetInstallationRepositories(uri), GetInstallationRepositories), uri)); }
public static ApiMessage <T> From <T>(ApiPagination pagination, params T[] data) { return(new ApiMessage <T> { Data = data, Pagination = pagination }); }