示例#1
0
        public bool DeleteDirectories(FoldersRequest directories)
        {
            Logger.LogInformation($"Deleting {directories.Paths.Count} Director{(directories.Paths.Count == 1 ? "y" : "ies")}");

            if (directories == null || directories.Paths == null || directories.Paths.Count == 0)
            {
                Logger.LogInformation($"No Directories specified.");
                return(false);
            }

            List <Task> tasks = new List <Task>();

            var remainingDirectories = directories.Paths.Count;

            directories.Paths.ForEach(dir => {
                var task = new Task(new Action(() => {
                    DiretoryInfoHub.Clients.All.SendAsync("ReportProgress", $"Remaining Directories: {remainingDirectories--}");
                    deleteDirectory(dir);
                }));
                task.Start();
                tasks.Add(task);
            });

            Task.WaitAll(tasks.ToArray());

            return(false);
        }
        public void JwtMoveEnvelopesTest()
        {
            JwtRequestSignatureOnDocumentTest("sent");

            FoldersApi foldersApi = new FoldersApi(testConfig.ApiClient.Configuration);

            FoldersRequest foldersRequest = new FoldersRequest(EnvelopeIds: new List <string> {
                testConfig.EnvelopeId
            }, FromFolderId: "sentitems");

            string          ToFolderId = "draft";
            FoldersResponse foldersResponse;

            try
            {
                foldersResponse = foldersApi.MoveEnvelopes(testConfig.AccountId, ToFolderId, foldersRequest);
            }
            catch (Exception ex)
            {
                Assert.Fail("Expected no exception, Actual error message: " + ex.Message);
            }

            // Test if we moved the envelope to the correct folder
            FoldersApi.ListItemsOptions searchOptions = new FoldersApi.ListItemsOptions();
            searchOptions.includeItems = "true";

            var listfromDraftsFolder = foldersApi.ListItems(testConfig.AccountId, ToFolderId, searchOptions);

            Assert.IsNotNull(listfromDraftsFolder);

            bool doesExists = false;

            foreach (var folders in listfromDraftsFolder.Folders)
            {
                foreach (var item in folders.FolderItems)
                {
                    if (item.EnvelopeId == testConfig.EnvelopeId)
                    {
                        doesExists = true;
                        break;
                    }
                }
            }

            Assert.IsTrue(doesExists);
        }
示例#3
0
        public IActionResult DeleteMultiple([FromBody] FoldersRequest request)
        {
            try {
                var res = request.CheckForValidRequest(this, HttpContext.Request.Method, typeof(FolderRequest).Name);
                if (res?.StatusCode == 400)
                {
                    return(res);
                }

                var directoryResult = this.DirectoryService.DeleteDirectories(request);
                return(Ok(directoryResult));
            } catch (Exception ex) {
                var _ex = new Exception("Failed to Delete the Directories", ex);
                Logger.LogError(ex.Message, ex);
                return(StatusCode(500, _ex));
            }
        }
示例#4
0
        public static IPolicyLocationItem CreateFolder(IAssetService2 assetServiceClient, ItemId parentId, string name, string desc)
        {
            Folder testFolder = new Folder();
            testFolder.Name = name;
            testFolder.Description = desc;
            testFolder.ItemId = new ItemId();
            testFolder.AssetType = Workshare.Server.Proxies.Asset2Proxy.Type.Policy;
            testFolder.ParentFolderId = parentId;

            FoldersRequest request = new FoldersRequest();
            request.Folders = new Folders();
            request.Folders.Add(testFolder);

            FoldersResponse response = assetServiceClient.CreateFolders(request);
            if (0 == response.Folders.Count)
                throw new Exception("Failed to create test folder");

			return FindFolder(assetServiceClient, response.Folders[0].Path);
        }
        public void MoveEnvelopes_CorrectInputParameters_ReturnFolderResponse()
        {
            CreateEnvelopeMethod.CreateEnvelope_CorrectAccountIdAndEnvelopeDefinition_ReturnEnvelopeSummary(ref _testConfig);

            var envelopesApi = new EnvelopesApi(_testConfig.ApiClient);

            Envelope envelope = envelopesApi.GetEnvelope(_testConfig.AccountId, _testConfig.EnvelopeId);

            Assert.IsNull(envelope?.VoidedDateTime);
            var foldersRequest = new FoldersRequest(new List <string> {
                _testConfig.EnvelopeId
            });

            var ToFolderId = "recyclebin";

            _foldersApi.MoveEnvelopes(_testConfig.AccountId, ToFolderId, foldersRequest);

            envelope = envelopesApi.GetEnvelope(_testConfig.AccountId, _testConfig.EnvelopeId);
            Assert.IsNotNull(envelope?.VoidedDateTime);
        }
        /// <summary>
        /// Moves an envelope from its current folder to the specified folder. Moves an envelope from its current folder to the specified folder.\n\n### Note: You can use this endpoint to delete envelopes by specifying `recyclebin&#39; in the `folderId` parameter of the endpoint. Placing an in process envelope (envelope status of `sent` or `delivered`) in the recycle bin voids the envelope. You can also use this endpoint to delete templates by specifying a template ID instead of an envelope ID in the &#39;envelopeIds&#39; property and specifying `recyclebin` in the `folderId` parameter.
        /// </summary>
	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="folderId">The ID of the folder being accessed.</param> <param name="foldersRequest">TBD Description</param>
		/// <returns>8Task of ApiResponse (FoldersResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<FoldersResponse>> MoveEnvelopesAsyncWithHttpInfo (string accountId, string folderId, FoldersRequest foldersRequest)
        {
            // verify the required parameter 'accountId' is set
            if (accountId == null) throw new ApiException(400, "Missing required parameter 'accountId' when calling MoveEnvelopes");
            // verify the required parameter 'folderId' is set
            if (folderId == null) throw new ApiException(400, "Missing required parameter 'folderId' when calling MoveEnvelopes");
            
    
            var path_ = "/v2/accounts/{accountId}/folders/{folderId}";
    
            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>();
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            String postBody = null;

            // to determine the Accept header
            String[] http_header_accepts = new String[] {
                "application/json"
            };
            String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
            if (http_header_accept != null)
                headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            pathParams.Add("format", "json");
            if (accountId != null) pathParams.Add("accountId", Configuration.ApiClient.ParameterToString(accountId)); // path parameter
            if (folderId != null) pathParams.Add("folderId", Configuration.ApiClient.ParameterToString(folderId)); // path parameter
            

						
			
			

            
            
            postBody = Configuration.ApiClient.Serialize(foldersRequest); // http body (model) parameter
            

            

            // make the HTTP request
            IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, pathParams);

            int statusCode = (int) response.StatusCode;
 
            if (statusCode >= 400)
                throw new ApiException (statusCode, "Error calling MoveEnvelopes: " + response.Content, response.Content);
            else if (statusCode == 0)
                throw new ApiException (statusCode, "Error calling MoveEnvelopes: " + response.ErrorMessage, response.ErrorMessage);

            return new ApiResponse<FoldersResponse>(statusCode,
                response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (FoldersResponse) Configuration.ApiClient.Deserialize(response, typeof(FoldersResponse)));
            
        }
        /// <summary>
        /// Moves an envelope from its current folder to the specified folder. Moves an envelope from its current folder to the specified folder.\n\n### Note: You can use this endpoint to delete envelopes by specifying `recyclebin&#39; in the `folderId` parameter of the endpoint. Placing an in process envelope (envelope status of `sent` or `delivered`) in the recycle bin voids the envelope. You can also use this endpoint to delete templates by specifying a template ID instead of an envelope ID in the &#39;envelopeIds&#39; property and specifying `recyclebin` in the `folderId` parameter.
        /// </summary>
 	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="folderId">The ID of the folder being accessed.</param> <param name="foldersRequest">TBD Description</param>
		/// <returns>7Task of FoldersResponse</returns>
        public async System.Threading.Tasks.Task<FoldersResponse> MoveEnvelopesAsync (string accountId, string folderId, FoldersRequest foldersRequest)
        {
             ApiResponse<FoldersResponse> response = await MoveEnvelopesAsyncWithHttpInfo(accountId, folderId, foldersRequest);
             return response.Data;

        }
        /// <summary>
        /// Moves an envelope from its current folder to the specified folder. Moves an envelope from its current folder to the specified folder.\n\n### Note: You can use this endpoint to delete envelopes by specifying `recyclebin&#39; in the `folderId` parameter of the endpoint. Placing an in process envelope (envelope status of `sent` or `delivered`) in the recycle bin voids the envelope. You can also use this endpoint to delete templates by specifying a template ID instead of an envelope ID in the &#39;envelopeIds&#39; property and specifying `recyclebin` in the `folderId` parameter.
        /// </summary>
 	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="folderId">The ID of the folder being accessed.</param> <param name="foldersRequest">TBD Description</param>
		/// <returns>5FoldersResponse</returns>
        public FoldersResponse MoveEnvelopes (string accountId, string folderId, FoldersRequest foldersRequest)
        {
             ApiResponse<FoldersResponse> response = MoveEnvelopesWithHttpInfo(accountId, folderId, foldersRequest);
             return response.Data;
        }