public void ContainsSetValues() { var request = new RepositoryRequest { Type = RepositoryType.All, Sort = RepositorySort.FullName, Direction = SortDirection.Ascending }; var parameters = request.ToParametersDictionary(); Assert.Equal(3, parameters.Count); Assert.Equal("all", parameters["type"]); Assert.Equal("full_name", parameters["sort"]); Assert.Equal("asc", parameters["direction"]); request = new RepositoryRequest { Affiliation = RepositoryAffiliation.All, Visibility = RepositoryRequestVisibility.Public }; parameters = request.ToParametersDictionary(); Assert.Equal(2, parameters.Count); Assert.Equal("owner, collaborator, organization_member", parameters["affiliation"]); Assert.Equal("public", parameters["visibility"]); }
public void ContainsSetValues() { var request = new RepositoryRequest { Type = RepositoryType.All, Sort = RepositorySort.FullName, Direction = SortDirection.Ascending }; var parameters = request.ToParametersDictionary(); Assert.Equal(3, parameters.Count); Assert.Equal("all", parameters["type"]); Assert.Equal("full_name", parameters["sort"]); Assert.Equal("asc", parameters["direction"]); request = new RepositoryRequest { Affiliation = RepositoryAffiliation.All, Visibility = RepositoryVisibility.Public }; parameters = request.ToParametersDictionary(); Assert.Equal(2, parameters.Count); Assert.Equal("owner, collaborator, organization_member", parameters["affiliation"]); Assert.Equal("public", parameters["visibility"]); }
public void DoesNotReturnValuesForDefaultRequest() { var request = new RepositoryRequest(); var parameters = request.ToParametersDictionary(); Assert.Empty(parameters); }
/// <summary> /// Retrieves every <see cref="Repository"/> that belongs to the current user. /// </summary> /// <param name="request">Search parameters to filter results on</param> /// <param name="options">Options for changing the API response</param> /// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception> /// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns> public IObservable <Repository> GetAllForCurrent(RepositoryRequest request, ApiOptions options) { Ensure.ArgumentNotNull(request, nameof(request)); Ensure.ArgumentNotNull(options, nameof(options)); return(_connection.GetAndFlattenAllPages <Repository>(ApiUrls.Repositories(), request.ToParametersDictionary(), AcceptHeaders.LicensesApiPreview)); }
/// <summary> /// Retrieves every <see cref="Repository"/> that belongs to the current user. /// </summary> /// <remarks> /// The default page size on GitHub.com is 30. /// </remarks> /// <param name="request">Search parameters to filter results on</param> /// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception> /// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns> public IObservable<Repository> GetAllForCurrent(RepositoryRequest request) { Ensure.ArgumentNotNull(request, "request"); return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.Repositories(), request.ToParametersDictionary()); }
/// <summary> /// Retrieves every <see cref="Repository"/> that belongs to the current user. /// </summary> /// <remarks> /// The default page size on GitHub.com is 30. /// </remarks> /// <param name="request">Search parameters to filter results on</param> /// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception> /// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns> public IObservable <Repository> GetAllForCurrent(RepositoryRequest request) { Ensure.ArgumentNotNull(request, "request"); return(_connection.GetAndFlattenAllPages <Repository>(ApiUrls.Repositories(), request.ToParametersDictionary())); }