IRestRequest IRequestBuilder.PutFolder(long folderId, ApiUpdateFolderRequest folderParams)
        {
            RestRequest request = new RestRequest(ApiConfig.ApiPutFolder, Method.PUT);

            SetGeneralRestValues(request, true, folderParams);
            request.AddUrlSegment("folderId", folderId);
            return(request);
        }
Exemplo n.º 2
0
        internal static ApiUpdateFolderRequest ToApiUpdateFolderRequest(UpdateFolderRequest updateFolderRequest)
        {
            ApiUpdateFolderRequest apiUpdateFolderRequest = new ApiUpdateFolderRequest {
                Name  = updateFolderRequest.Name,
                Notes = updateFolderRequest.Notes
            };

            return(apiUpdateFolderRequest);
        }
Exemplo n.º 3
0
        public Node UpdateFolder(UpdateFolderRequest request)
        {
            _client.Executor.CheckApiServerVersion();

            #region Parameter Validation

            request.MustNotNull(nameof(request));
            request.Id.MustPositive(nameof(request.Id));
            request.Name.MustNotNullOrEmptyOrWhitespace(nameof(request.Name), true);

            #endregion

            ApiUpdateFolderRequest apiUpdateFolderRequest = FolderMapper.ToApiUpdateFolderRequest(request);
            IRestRequest           restRequest            = _client.Builder.PutFolder(request.Id, apiUpdateFolderRequest);
            ApiNode result = _client.Executor.DoSyncApiCall <ApiNode>(restRequest, RequestType.PutFolder);
            return(NodeMapper.FromApiNode(result));
        }
Exemplo n.º 4
0
        public void ToApiUpdateFolderRequest()
        {
            // ARRANGE
            ApiUpdateFolderRequest expected = FactoryFolder.ApiUpdateFolderRequest;

            UpdateFolderRequest param = new UpdateFolderRequest(346)
            {
                Name  = expected.Name,
                Notes = expected.Notes
            };

            // ACT
            ApiUpdateFolderRequest actual = FolderMapper.ToApiUpdateFolderRequest(param);

            // ASSERT
            Assert.Equal(expected, actual, new ApiUpdateFolderRequestComparer());
        }