NuxeoClient.Client.Batch C# (CSharp) Method

Batch() public method

Requests a new Batch from the server.
public Batch ( ) : Task
return Task
        public async Task<Batch> Batch()
        {
            return (Batch)await Post(RestPath + "upload/");
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Uploads all files in the upload queue.
        /// </summary>
        /// <returns>A <see cref="Task"/> that will will return an instance of <see cref="EntityList{T}"/> containing
        /// one instance of <see cref="BatchFile"/> per file uploaded.</returns>
        public async Task <Entity> UploadFiles()
        {
            processedFilesCounter = 0;
            try
            {
                // perform handshake if needed
                Batch = Batch ?? await client.Batch();
            }
            catch (ServerErrorException exception)
            {
                throw new FailedHandshakeException("Failed to initialize batch with the server.", exception);
            }

            foreach (string path in filesToUpload)
            {
                await ProcessFile(path);
            }
            return(await Batch.Info());
        }