当前位置: 首页>>代码示例>>C#>>正文


C# ApiOptions类代码示例

本文整理汇总了C#中ApiOptions的典型用法代码示例。如果您正苦于以下问题:C# ApiOptions类的具体用法?C# ApiOptions怎么用?C# ApiOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ApiOptions类属于命名空间,在下文中一共展示了ApiOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReturnsDistinctEventsBasedOnStartPage

            public async Task ReturnsDistinctEventsBasedOnStartPage()
            {
                var startOptions = new ApiOptions
                {
                    PageSize = 5,
                    PageCount = 1
                };

                var firstEventsPage = await _eventsClient.GetAll(startOptions).ToList();

                var skipStartOptions = new ApiOptions
                {
                    PageSize = 5,
                    PageCount = 1,
                    StartPage = 2
                };

                var secondEventsPage = await _eventsClient.GetAll(skipStartOptions).ToList();

                Assert.NotEqual(firstEventsPage[0].Id, secondEventsPage[0].Id);
                Assert.NotEqual(firstEventsPage[1].Id, secondEventsPage[1].Id);
                Assert.NotEqual(firstEventsPage[2].Id, secondEventsPage[2].Id);
                Assert.NotEqual(firstEventsPage[3].Id, secondEventsPage[3].Id);
                Assert.NotEqual(firstEventsPage[4].Id, secondEventsPage[4].Id);
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:25,代码来源:ObservableEventsClientTests.cs

示例2: GetAll

        /// <summary>
        /// Gets all verified public keys for a user.
        /// </summary>
        /// <remarks>
        /// https://developer.github.com/v3/users/keys/#list-public-keys-for-a-user
        /// </remarks>
        /// <param name="userName">The @ handle of the user.</param>
        /// <param name="options">Options to change API's behavior.</param>
        /// <returns>Lists the verified public keys for a user.</returns>
        public IObservable<PublicKey> GetAll(string userName, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(userName, "userName");
            Ensure.ArgumentNotNull(options, "options");

            return _client.GetAll(userName, options).ToObservable().SelectMany(k => k);
        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:16,代码来源:ObservableUserKeysClient.cs

示例3: GetAll

        /// <summary>
        /// List a user’s followers
        /// </summary>
        /// <param name="login">The login name for the user</param>
        /// <param name="options">Options for changing the API response</param>
        /// <remarks>
        /// See the <a href="http://developer.github.com/v3/users/followers/#list-followers-of-a-user">API documentation</a> for more information.
        /// </remarks>
        /// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that follow the passed user.</returns>
        public IObservable<User> GetAll(string login, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(login, "login");
            Ensure.ArgumentNotNull(options, "options");

            return _connection.GetAndFlattenAllPages<User>(ApiUrls.Followers(login), options);
        }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:16,代码来源:ObservableFollowersClient.cs

示例4: FileUpload

 /// <summary>
 /// Creates a new instance of FileUpload for uploading a file to appacitive.
 /// </summary>
 /// <param name="mimeType">The mime type for the file to be uploaded.</param>
 /// <param name="filename">Name of the file to be downloaded. This name should match the name of the file on Appacitive.</param>
 /// <param name="expiryInMinutes">The duration in minutes for which the upload session would be valid. After this duration, this object cannot be used to upload a file.</param>
 /// <param name="options">Request specific api options. These will override the global settings for the app for this request.</param>
 public FileUpload(string mimeType, string filename = null, int expiryInMinutes = 5, ApiOptions options = null)
 {
     this.MimeType = mimeType;
     this.FileName = filename;
     this.FileHandler = ObjectFactory.Build<IHttpFileHandler>();
     this.CacheControlMaxAge = TimeSpan.MinValue;
 }
开发者ID:ytokas,项目名称:appacitive-dotnet-sdk,代码行数:14,代码来源:FileUpload.cs

示例5: GetAll

        /// <summary>
        /// <para>
        /// List all users who are members of an organization. A member is a user that
        /// belongs to at least 1 team in the organization.
        /// </para>
        /// <para>
        /// If the authenticated user is also an owner of this organization then both
        /// concealed and public member will be returned.
        /// </para>
        /// <para>
        /// If the requester is not an owner of the organization the query will be redirected
        /// to the public members list.
        /// </para>
        /// </summary>
        /// <remarks>
        /// See the <a href="http://developer.github.com/v3/orgs/members/#members-list">API documentation</a>
        /// for more information.
        /// </remarks>
        /// <param name="org">The login for the organization</param>
        /// <param name="options">Options for changing the API response</param>
        /// <returns></returns>
        public IObservable<User> GetAll(string org, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(org, "org");
            Ensure.ArgumentNotNull(options, "options");

            return _connection.GetAndFlattenAllPages<User>(ApiUrls.Members(org), options);
        }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:28,代码来源:ObservableOrganizationMembersClient.cs

示例6: GetAll

        /// <summary>
        /// Returns all <see cref="Team" />s for the current org.
        /// </summary>
        /// <param name="org">Organization to list all teams of.</param>
        /// <param name="options">Options to change API behaviour.</param>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>A list of the orgs's teams <see cref="Team"/>s.</returns>
        public IObservable<Team> GetAll(string org, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(org, "org");
            Ensure.ArgumentNotNull(options, "options");

            return _connection.GetAndFlattenAllPages<Team>(ApiUrls.OrganizationTeams(org), options);
        }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:14,代码来源:ObservableTeamsClient.cs

示例7: GetAllForGist

        /// <summary>
        /// Gets all comments for the gist with the specified id.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist</remarks>
        /// <param name="gistId">The id of the gist</param>
        /// <param name="options">Options for changing the API response</param>
        /// <returns>IObservable{GistComment}.</returns>
        public IObservable<GistComment> GetAllForGist(string gistId, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(gistId, "gistId");
            Ensure.ArgumentNotNull(options, "options");

            return _connection.GetAndFlattenAllPages<GistComment>(ApiUrls.GistComments(gistId), options);
        }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:14,代码来源:ObservableGistCommentsClient.cs

示例8: ReturnsDistinctResultsBasedOnStartPage

            public async Task ReturnsDistinctResultsBasedOnStartPage()
            {
                var startOptions = new ApiOptions
                {
                    PageSize = 5,
                    PageCount = 1
                };

                var firstPage = await _releaseClient.GetAll(owner, name, startOptions).ToList();

                var skipStartOptions = new ApiOptions
                {
                    PageSize = 5,
                    PageCount = 1,
                    StartPage = 2
                };

                var secondPage = await _releaseClient.GetAll(owner, name, skipStartOptions).ToList();

                Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
                Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
                Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
                Assert.NotEqual(firstPage[3].Id, secondPage[3].Id);
                Assert.NotEqual(firstPage[4].Id, secondPage[4].Id);
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:25,代码来源:ObservableReleaseClientTests.cs

示例9: ReturnsDistinctResultsBasedOnStartPage

            public async Task ReturnsDistinctResultsBasedOnStartPage()
            {
                var github = Helper.GetAuthenticatedClient();

                var client = new ObservableRepositoryHooksClient(github);

                var startOptions = new ApiOptions
                {
                    PageSize = 2,
                    PageCount = 1
                };

                var firstPage = await client.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, startOptions).ToList();

                var skipStartOptions = new ApiOptions
                {
                    PageSize = 2,
                    PageCount = 1,
                    StartPage = 2
                };

                var secondPage = await client.GetAll(_fixture.RepositoryOwner, _fixture.RepositoryName, skipStartOptions).ToList();

                Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
                Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:26,代码来源:ObservableRepositoryHooksClientTests.cs

示例10: ReturnsDistinctForksBasedOnStartPage

            public async Task ReturnsDistinctForksBasedOnStartPage()
            {
                var github = Helper.GetAuthenticatedClient();

                var startOptions = new ApiOptions
                {
                    PageCount = 1,
                    PageSize = 3,
                    StartPage = 1
                };

                var firstPage = await github.Repository.Forks.GetAll("octokit", "octokit.net", startOptions);

                var skipStartOptions = new ApiOptions
                {
                    PageCount = 1,
                    PageSize = 3,
                    StartPage = 2
                };

                var secondPage = await github.Repository.Forks.GetAll("octokit", "octokit.net", skipStartOptions);

                Assert.Equal(3, firstPage.Count);
                Assert.Equal(3, secondPage.Count);
                Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
                Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
                Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:28,代码来源:RepositoryForksClientTests.cs

示例11: GetAll

        /// <summary>
        /// Retrieves commit statuses for the specified reference. A reference can be a commit SHA, a branch name, or
        /// a tag name.
        /// </summary>
        /// <remarks>Only users with pull access can see this.</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="reference">The reference (SHA, branch name, or tag name) to list commits for</param>
        /// <param name="options">Options for changing the API response</param>
        public IObservable<CommitStatus> GetAll(int repositoryId, string reference, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
            Ensure.ArgumentNotNull(options, "options");

            return _connection.GetAndFlattenAllPages<CommitStatus>(ApiUrls.CommitStatuses(repositoryId, reference), options);
        }
开发者ID:rlugojr,项目名称:octokit.net,代码行数:15,代码来源:ObservableCommitStatusClient.cs

示例12: RequestsCorrectUrlWithApiOptions

            public async Task RequestsCorrectUrlWithApiOptions()
            {
                var result = new List<EventInfo> { new EventInfo() };

                var connection = Substitute.For<IConnection>();
                var gitHubClient = new GitHubClient(connection);
                var client = new ObservableIssuesEventsClient(gitHubClient);
                
                var options = new ApiOptions
                {
                    StartPage = 1,
                    PageCount = 1,
                    PageSize = 1
                };

                IApiResponse<List<EventInfo>> response = new ApiResponse<List<EventInfo>>(
                    new Response
                    {
                        ApiInfo = new ApiInfo(new Dictionary<string, Uri>(), new List<string>(), new List<string>(), "etag", new RateLimit()),
                    }, result);
                gitHubClient.Connection.Get<List<EventInfo>>(Args.Uri, Arg.Is<Dictionary<string, string>>(d => d.Count == 2), null)
                    .Returns(Task.FromResult(response));

                var eventInfos = await client.GetAllForIssue("fake", "repo", 42, options).ToList();

                connection.Received().Get<List<EventInfo>>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/issues/42/events"), Arg.Is<Dictionary<string, string>>(d => d.Count == 2), null);
                Assert.Equal(1, eventInfos.Count);
            }
开发者ID:daveaglick,项目名称:octokit.net,代码行数:28,代码来源:ObservableIssuesEventsClientTests.cs

示例13: ReturnsDistinctResultsBasedOnStartPage

            public async Task ReturnsDistinctResultsBasedOnStartPage()
            {
                var startOptions = new ApiOptions
                {
                    PageSize = 5,
                    PageCount = 1
                };

                var firstPageIssueComments = await _issueCommentsClient.GetAllForRepository(owner, name, startOptions).ToList();

                var skipStartOptions = new ApiOptions
                {
                    PageSize = 5,
                    PageCount = 1,
                    StartPage = 2
                };

                var secondPageIssueComments = await _issueCommentsClient.GetAllForRepository(owner, name, skipStartOptions).ToList();

                Assert.NotEqual(firstPageIssueComments[0].Id, secondPageIssueComments[0].Id);
                Assert.NotEqual(firstPageIssueComments[1].Id, secondPageIssueComments[1].Id);
                Assert.NotEqual(firstPageIssueComments[2].Id, secondPageIssueComments[2].Id);
                Assert.NotEqual(firstPageIssueComments[3].Id, secondPageIssueComments[3].Id);
                Assert.NotEqual(firstPageIssueComments[4].Id, secondPageIssueComments[4].Id);
            }
开发者ID:RadicalLove,项目名称:octokit.net,代码行数:25,代码来源:ObservableIssueCommentsClientTests.cs

示例14: FindAllAsync

        /// <summary>
        /// Gets a paginated list of APObjects matching the given search criteria.
        /// </summary>
        /// <param name="type">The object type.</param>
        /// <param name="query">The search query for objects to be found.</param>
        /// <param name="fields">The object fields to be returned for the matching list of objects.</param>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="pageSize">The page size.</param>
        /// <param name="orderBy">The object field on which the results should be sorted.</param>
        /// <param name="sortOrder">The sort order.</param>
        /// <param name="options">Request specific api options. These will override the global settings for the app for this request.</param>
        /// <returns>Paginated list of APObject objects matching the given search criteria.</returns>
        public async static Task<PagedList<APObject>> FindAllAsync(string type, IQuery query = null, IEnumerable<string> fields = null, int pageNumber = 1, int pageSize = 20, string orderBy = null, SortOrder sortOrder = SortOrder.Descending, ApiOptions options = null)
        {
            query = query ?? Query.None;
            var request = new FindAllObjectsRequest()
            {
                Type = type,
                Query = query.AsString().Escape(),
                PageNumber = pageNumber,
                PageSize = pageSize,
                OrderBy = orderBy,
                SortOrder = sortOrder
            };
            if( fields != null )
                request.Fields.AddRange(fields);
            ApiOptions.Apply(request, options);
            var response = await request.ExecuteAsync();
            if (response.Status.IsSuccessful == false)
                throw response.Status.ToFault();
            var objects = new PagedList<APObject>()
            {
                PageNumber = response.PagingInfo.PageNumber,
                PageSize = response.PagingInfo.PageSize,
                TotalRecords = response.PagingInfo.TotalRecords,
                GetNextPage = async skip => await FindAllAsync(type, query, fields, pageNumber + skip + 1, pageSize, orderBy, sortOrder, options)
            };
            objects.AddRange(response.Objects);
            return objects;

        }
开发者ID:ytokas,项目名称:appacitive-dotnet-sdk,代码行数:41,代码来源:APObjects.cs

示例15: GetAllStargazersWithTimestamps

        /// <summary>
        /// Retrieves all of the stargazers for the passed repository with star creation timestamps.
        /// </summary>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</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="IObservable{UserStar}"/> of <see cref="User"/>s starring the passed repository with star creation timestamps.</returns>
        public IObservable<UserStar> GetAllStargazersWithTimestamps(string owner, string name, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.ArgumentNotNull(options, "options");

            return _connection.GetAndFlattenAllPages<UserStar>(ApiUrls.Stargazers(owner, name), null, AcceptHeaders.StarCreationTimestamps, options);
        }
开发者ID:jrusbatch,项目名称:octokit.net,代码行数:16,代码来源:ObservableStarredClient.cs


注:本文中的ApiOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。