コード例 #1
0
        public async Task <IEnumerable <RefRestriction> > GetRepositoryRefRestrictionsAsync(string projectKey, string repositorySlug,
                                                                                            RefRestrictionTypes?type    = null,
                                                                                            RefMatcherTypes?matcherType = null,
                                                                                            string matcherId            = null,
                                                                                            int?maxPages   = null,
                                                                                            int?limit      = null,
                                                                                            int?start      = null,
                                                                                            int?avatarSize = null)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                ["type"]        = BitbucketHelpers.RefRestrictionTypeToString(type),
                ["matcherType"] = BitbucketHelpers.RefMatcherTypeToString(matcherType),
                ["matcherId"]   = matcherId,
                ["limit"]       = limit,
                ["start"]       = start,
                ["avatarSize"]  = avatarSize
            };

            return(await GetPagedResultsAsync(maxPages, queryParamValues, async qpv =>
                                              await GetRefRestrictionsUrl($"/projects/{projectKey}/repos/{repositorySlug}/restrictions")
                                              .SetQueryParams(qpv)
                                              .GetJsonAsync <PagedResults <RefRestriction> >()
                                              .ConfigureAwait(false))
                   .ConfigureAwait(false));
        }