IRestRequest IRequestBuilder.GetUploadShares(long?offset, long?limit, GetUploadSharesFilter filter = null, SharesSort sort = null)
        {
            RestRequest request = new RestRequest(ApiConfig.ApiGetUploadShares, Method.GET);

            SetGeneralRestValues(request, true);
            AddFilters(filter, request);
            AddSort(sort, request);
            if (offset.HasValue)
            {
                request.AddQueryParameter("offset", offset.ToString());
            }
            if (limit.HasValue)
            {
                request.AddQueryParameter("limit", limit.ToString());
            }
            return(request);
        }
        public void Shares_GetUploadShares()
        {
            // ARRANGE
            string          fString = "name:cn:name_part_up", sString = "name:desc";
            long            offset = 4, limit = 5;
            IRequestBuilder builder  = new DracoonRequestBuilder(FactoryClients.OAuthMock);
            RestRequest     expected = FactoryRestSharp.RestRequestWithAuth(ApiConfig.ApiGetUploadShares, Method.GET);

            expected.AddQueryParameter("filter", fString);
            expected.AddQueryParameter("sort", sString);
            expected.AddQueryParameter("offset", offset.ToString());
            expected.AddQueryParameter("limit", limit.ToString());

            // ACT
            GetUploadSharesFilter f = new GetUploadSharesFilter();

            f.AddNameFilter(GetUploadSharesFilter.Name.Contains("name_part_up").Build());
            IRestRequest actual = builder.GetUploadShares(offset, limit, f, SharesSort.Name.Descending());

            // ASSERT
            Assert.Equal(expected, actual, new RestRequestComparer());
        }
示例#3
0
        public UploadShareList GetUploadShares(long?offset = null, long?limit = null, GetUploadSharesFilter filter = null, SharesSort sort = null)
        {
            _client.Executor.CheckApiServerVersion();

            #region Parameter Validation

            offset.NullableMustNotNegative(nameof(offset));
            limit.NullableMustPositive(nameof(limit));

            #endregion

            IRestRequest       restRequest = _client.Builder.GetUploadShares(offset, limit, filter, sort);
            ApiUploadShareList result      =
                _client.Executor.DoSyncApiCall <ApiUploadShareList>(restRequest, DracoonRequestExecutor.RequestType.GetUploadShares);
            return(ShareMapper.FromApiUploadShareList(result));
        }
示例#4
0
        internal static IRestRequest GetUploadSharesMock(long?offset = null, long?limit = null, GetUploadSharesFilter f = null, SharesSort s = null)
        {
            RestRequest rr = RestRequestWithAuth(ApiConfig.ApiGetUploadShares, Method.GET);

            ApplyFilter(f, rr);
            ApplySort(s, rr);
            if (offset.HasValue)
            {
                rr.AddQueryParameter("offset", offset.ToString());
            }
            if (limit.HasValue)
            {
                rr.AddQueryParameter("limit", limit.ToString());
            }
            return(rr);
        }