IRestRequest IRequestBuilder.PostFolder(ApiCreateFolderRequest folderParams) { RestRequest request = new RestRequest(ApiConfig.ApiPostFolder, Method.POST); SetGeneralRestValues(request, true, folderParams); return(request); }
internal static ApiCreateFolderRequest ToApiCreateFolderRequest(CreateFolderRequest createFolderRequest) { ApiCreateFolderRequest apiCreateFolderRequest = new ApiCreateFolderRequest { ParentId = createFolderRequest.ParentId, Name = createFolderRequest.Name, Notes = createFolderRequest.Notes }; return(apiCreateFolderRequest); }
public void ToApiCreateFolderRequest() { // ARRANGE ApiCreateFolderRequest expected = FactoryFolder.ApiCreateFolderRequest; CreateFolderRequest param = new CreateFolderRequest(expected.ParentId, expected.Name) { Notes = expected.Notes }; // ACT ApiCreateFolderRequest actual = FolderMapper.ToApiCreateFolderRequest(param); // ASSERT Assert.Equal(expected, actual, new ApiCreateFolderRequestComparer()); }
public Node CreateFolder(CreateFolderRequest request) { _client.Executor.CheckApiServerVersion(); #region Parameter Validation request.MustNotNull(nameof(request)); request.ParentId.MustPositive(nameof(request.ParentId)); request.Name.MustNotNullOrEmptyOrWhitespace(nameof(request.Name)); #endregion ApiCreateFolderRequest apiCreateFolderRequest = FolderMapper.ToApiCreateFolderRequest(request); IRestRequest restRequest = _client.Builder.PostFolder(apiCreateFolderRequest); ApiNode result = _client.Executor.DoSyncApiCall <ApiNode>(restRequest, RequestType.PostFolder); return(NodeMapper.FromApiNode(result)); }