/// <summary>
 /// Returns the IML metadata suggestions for the given temporary files and object version.
 /// </summary>
 /// <param name="requestInfo">The request for automatic metadata suggestions.</param>
 /// <param name="token">A cancellation token for the request.</param>
 /// <returns>Any metadata suggestions.</returns>
 public List <PropertyValueSuggestion> GetAutomaticMetadata(AutomaticMetadataRequestInfo requestInfo,
                                                            CancellationToken token = default(CancellationToken))
 {
     // Execute the async method.
     return(this.GetAutomaticMetadataAsync(requestInfo, token)
            .ConfigureAwait(false)
            .GetAwaiter()
            .GetResult());
 }
Exemple #2
0
        public async Task GetAutomaticMetadataForTemporaryFilesAsync()
        {
            // Create our test runner.
            var runner = new RestApiTestRunner <List <PropertyValueSuggestion> >(Method.POST, "/REST/objects/automaticmetadata.aspx");

            // Set up the expected body.
            var body = new AutomaticMetadataRequestInfo()
            {
                UploadIds = new List <int>()
                {
                    123, 456
                }
            };

            runner.SetExpectedRequestBody(body);

            // Execute.
            await runner.MFWSClient.AutomaticMetadataOperations.GetAutomaticMetadataForTemporaryFilesAsync(temporaryFileIds : body.UploadIds.ToArray());

            // Verify.
            runner.Verify();
        }
        /// <summary>
        /// Returns the IML metadata suggestions for the given temporary files and object version.
        /// </summary>
        /// <param name="temporaryFileIds">The ids of any temporary files (<see cref="MFWSVaultObjectFileOperations.UploadFiles(System.IO.FileInfo[])"/>) to include when producing metadata suggestions.</param>
        /// <param name="objectTypeId">The type of the object type the metadata suggestions are for.</param>
        /// <param name="objVer">The version of the object to retrieve suggestions for (may be null).</param>
        /// <param name="propertyValues">The property values to include when producing metadata suggestions.</param>
        /// <param name="metadataSuggestionProviders">The ids of the intelligence services to include (leave empty for all).</param>
        /// <param name="customData">Custom data to provide to the metadata suggestion providers.</param>
        /// <param name="token">A cancellation token for the request.</param>
        /// <returns>An awaitable task for any metadata suggestions.</returns>
        public Task <List <PropertyValueSuggestion> > GetAutomaticMetadataAsync(
            int objectTypeId                     = (int)MFBuiltInObjectType.MFBuiltInObjectTypeDocument,
            ObjVer objVer                        = null,
            int[] temporaryFileIds               = null,
            PropertyValue[] propertyValues       = null,
            string[] metadataSuggestionProviders = null,
            string customData                    = null,
            CancellationToken token              = default(CancellationToken))
        {
            // Build up the request.
            var request = new AutomaticMetadataRequestInfo()
            {
                ObjVer              = objVer,
                CustomData          = customData,
                MetadataProviderIds = new List <string>(metadataSuggestionProviders ?? new string[0]),
                ObjectType          = objectTypeId,
                PropertyValues      = new List <PropertyValue>(propertyValues ?? new PropertyValue[0]),
                UploadIds           = new List <int>(temporaryFileIds ?? new int[0])
            };

            // Use the other overload.
            return(this.GetAutomaticMetadataAsync(request, token));
        }
Exemple #4
0
        public void GetAutomaticMetadataForObject()
        {
            // Create our test runner.
            var runner = new RestApiTestRunner <List <PropertyValueSuggestion> >(Method.POST, "/REST/objects/automaticmetadata.aspx");

            // Set up the expected body.
            var body = new AutomaticMetadataRequestInfo()
            {
                ObjVer = new ObjVer()
                {
                    Type    = 0,
                    ID      = 43,
                    Version = 0
                }
            };

            runner.SetExpectedRequestBody(body);

            // Execute.
            runner.MFWSClient.AutomaticMetadataOperations.GetAutomaticMetadataForObject(body.ObjVer);

            // Verify.
            runner.Verify();
        }
        /// <summary>
        /// Returns the IML metadata suggestions for the given temporary files and object version.
        /// </summary>
        /// <param name="requestInfo">The request for automatic metadata suggestions.</param>
        /// <param name="token">A cancellation token for the request.</param>
        /// <returns>An awaitable task for any metadata suggestions.</returns>
        public async Task <List <PropertyValueSuggestion> > GetAutomaticMetadataAsync(AutomaticMetadataRequestInfo requestInfo,
                                                                                      CancellationToken token = default(CancellationToken))
        {
            // Create the request.
            var request = new RestRequest($"/REST/objects/automaticmetadata.aspx");

            // Add the body to the request.
            request.AddJsonBody(requestInfo);

            // Make the request and get the response.
            var response = await this.MFWSClient.Post <List <PropertyValueSuggestion> >(request, token)
                           .ConfigureAwait(false);

            // Return the data.
            return(response.Data);
        }