/// <summary> /// Gets repository groups ids. /// </summary> /// <param name="repositoryId"></param> /// <param name="startsWithName"></param> /// <param name="includeUnlisted"></param> /// <param name="top"></param> /// <param name="paging"></param> /// <param name="skipToken"></param> /// <param name="returnInfo"></param> /// <param name="token"></param> /// <returns><see cref="NdRepositoryGroupList"> instance.</returns> public OperationResult <NdRepositoryGroupList> GetRepositoryGroups(string repositoryId, string startsWithName = null, bool?includeUnlisted = null, int?top = null, bool?paging = null, string skipToken = null, bool returnInfo = false, CancellationToken token = default) { var builder = requestBuilderFactory .Get() .SetInitialData(new ControllerMetadata { ApiVersion = ApiVersion.V1, BaseUrlPart = "repository" }) .SetMethod(HttpMethod.Get) .AddUriPart(repositoryId) .AddUriPart("groups"); var filterParameter = new FilterParameter(); if (!string.IsNullOrWhiteSpace(startsWithName)) { filterParameter.AppendAndExpression(FilterParameter.StartsWithExpression, "name", startsWithName); } if (includeUnlisted.HasValue) { filterParameter.AppendAndExpression(FilterParameter.IncludeUnlistedExpression, includeUnlisted.Value.ToString().ToLower()); } if (top.HasValue) { builder.AddQueryParameter(new TopParameter(Math.Min(10000, Math.Max(1, top.Value)))); } var isPaginationUsed = false; if (!string.IsNullOrEmpty(skipToken)) { isPaginationUsed = true; builder.AddQueryParameter(new SkipTokenParameter(skipToken)); } if (paging.HasValue) { isPaginationUsed = paging.Value; builder.AddQueryParameter(new RequestParameter <bool>("paging", paging.Value)); } if (returnInfo) { builder.AddQueryParameter(new RequestParameter <string>("returnInfo", "all")); } builder.AddQueryParameter(filterParameter); var request = builder.Build <NdRepositoryGroupList>(); return(isPaginationUsed ? request.Execute(clientProvider.GetDefaultClient(), token) : request.Execute <string[]>(clientProvider.GetDefaultClient(), (groups, cancellationToken) => new NdRepositoryGroupList { Items = groups }, token)); }