示例#1
0
            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"]);
            }
示例#3
0
            public void DoesNotReturnValuesForDefaultRequest()
            {
                var request = new RepositoryRequest();

                var parameters = request.ToParametersDictionary();

                Assert.Empty(parameters);
            }
            public void DoesNotReturnValuesForDefaultRequest()
            {
                var request = new RepositoryRequest();

                var parameters = request.ToParametersDictionary();

                Assert.Empty(parameters);
            }
示例#5
0
        /// <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()));
        }