Show / Hide Table of Contents

Interface IUOLClient

Provides UOL related services, such as downloading CAD content or querying product information. See UOLClientControls for UOL related services that provide a user interface.

Namespace: UOL.SDK
Assembly: UOL.SDK.dll
Syntax
public interface IUOLClient

Methods

AddValidationRequestAsync(CADValidationRequest)

Adds a validation request.

Declaration
Task<string> AddValidationRequestAsync(CADValidationRequest cadValidationRequest)
Parameters
Type Name Description
UOL.Models.CADValidationRequest cadValidationRequest

The validation request data to add.

Returns
Type Description
System.Threading.Tasks.Task<System.String>

A task that represents the asynchronous data download operation.

Examples

Call this method to add a new validation request:

var ticketNumber = await uolClient.AddValidationRequestAsync(cadValidationRequest);

When validation request is processed, you can see the results of the validation by ticket number in the Addin.
Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

DeleteValidationRequestAsync(String, String)

Deletes the specified validation request from the UOL Content Service.

Declaration
Task<bool> DeleteValidationRequestAsync(string projectId, string ticketNumber)
Parameters
Type Name Description
System.String projectId

The id of the project to use to delete.

System.String ticketNumber

The ticket number to use to delete.

Returns
Type Description
System.Threading.Tasks.Task<System.Boolean>

A task that represents the asynchronous data download operation.

Examples

Call this method to delete a validation request from the UOL Content Service:

var result = await uolClient.DeleteValidationRequestsAsync("UOB-0001", "189289938");

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

DownloadCadContentAsync(CADApplication, ETIM, String, String, Int32, Int32)

Downloads CAD content from the UOL Content Service.

Declaration
Task<CADContent> DownloadCadContentAsync(CADApplication application, ETIM etim, string type, string languageCode = "nl", int majorVersion = -1, int minorVersion = 0)
Parameters
Type Name Description
UOL.Models.CADApplication application

The CAD application associated with the desired CAD content.

UOL.Models.ETIM etim

The ETIM information associated with the desired CAD content.

System.String type

The type of content to download.

System.String languageCode

The language (e.g. 'en' or 'nl') associated with the desired CAD content.

System.Int32 majorVersion

The major version of the desired CAD content.

System.Int32 minorVersion

The minor version of the desired CAD content.

Returns
Type Description
System.Threading.Tasks.Task<UOL.Models.CADContent>

A task that represents the asynchronous CAD content download operation.

Examples

Call this method to download Cad content:

var application = new CADApplication { Name = "revit", Version = "2019" };
var etim = new ETIM { ClassCode = "EC003024", ClassCodeVersion = "1", ModelCode = "MC000011", ModelCodeVersion = "1" };
var content = await uolClient.DownloadCadContentAsync(application, etim, "Template", "en");
var rfaPath = Path.Combine("c:\temp", cadContent.Filename);
using (var fileStream = new FileStream(rfaPath, FileMode.Create))
{
    cadContent.CadByteStream.CopyTo(fileStream);
}

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

DownloadFilterDetailsAsync(String, String, ICollection<String>)

Downloads data from the UOL Data Service.

Declaration
Task<CADFilterResult> DownloadFilterDetailsAsync(string filterId, string type, ICollection<string> disableFields)
Parameters
Type Name Description
System.String filterId

The id of the filter to use to download filter details.

System.String type

The type of selection that is made on the search site. Possible types are 'productselection' for multi selection or 'interface' for single selection.

System.Collections.Generic.ICollection<System.String> disableFields

The product fields properties that will have selected set to "false"

Returns
Type Description
System.Threading.Tasks.Task<UOL.Models.CADFilterResult>

A task that represents the asynchronous data download operation.

Examples

Call this method to download the UOL data that is chosen in the online UOL Search page:

var cadFilterResult = await uolClient.DownloadFilterDetailsAsync(filterId, "productselection");
var language = cadFilterResult.LanguageCode;
var searchCriteria = cadFilterResult.SearchCriteria;
var cadProducts = cadFilterResult.CADProducts;

Exceptions
Type Condition
UOLClientException

The response of the Data Service indicated failure or any unexpected error occurred.

GetCadContentVersionsAsync(CADApplication, ETIM, String, String)

Gets the list of versions for CAD content and specifies the current version.

Declaration
Task<CADContentVersions> GetCadContentVersionsAsync(CADApplication application, ETIM etim, string type, string languageCode = "nl")
Parameters
Type Name Description
UOL.Models.CADApplication application

The CAD application associated with the desired CAD content.

UOL.Models.ETIM etim

The ETIM information associated with the desired CAD content.

System.String type

The type of content to get the versions for.

System.String languageCode

The language (e.g. 'en' or 'nl') associated with the desired CAD content.

Returns
Type Description
System.Threading.Tasks.Task<UOL.Models.CADContentVersions>

A task that represents the asynchronous CAD content versions GET operation.

Examples

Call this method to get a list of versions of the specified CAD content:

var application = new CADApplication { Name = "revit", Version = "2019" };
var etim = new ETIM { ClassCode = "EC003024", ClassCodeVersion = "1", ModelCode = "MC000011", ModelCodeVersion = "1" };
var versions = await uolClient.GetCadContentVersionsAsync(application, etim, "Template", "nl");
var currentVersion = versions.Current;
var numberOfVersions = versions.Versions.Count();

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

GetEtimStructureAsync(String, String, String)

Gets the ETIM structure by ETIM class code and EITM model class code.

Declaration
Task<CADProduct> GetEtimStructureAsync(string etimClassCode, string etimModelClassCode, string languageCode = "nl")
Parameters
Type Name Description
System.String etimClassCode

The ETIM class code to get the ETIM structure for.

System.String etimModelClassCode

The ETIM model class code to get the ETIM structure for.

System.String languageCode

The language (e.g. 'en' or 'nl' for the ETIM structure.

Returns
Type Description
System.Threading.Tasks.Task<UOL.Models.CADProduct>

A task that represents the asynchronous data download operation.

Examples

Call this method to get the ETIM structure for a combination of ETIM Class Code and ETIM Model Class Code:

var etimStructure = await uolClient.GetEtimStructureAsync("EC000137", "MC000164");
var numberOfProperties = etimStructure.Properties.Count();

Exceptions
Type Condition
UOLClientException

The response of the Data Service indicated failure or any unexpected error occurred.

GetMetadataAsync(IEnumerable<CADMetadataCriteria>)

Gets the metadata for multiple metadata criteria. The criteria include application, EC and MC code and version and language.

Declaration
Task<IEnumerable<CADMetadata>> GetMetadataAsync(IEnumerable<CADMetadataCriteria> metadataCriteria)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<UOL.Models.CADMetadataCriteria> metadataCriteria

The criteria to use to find the metadata.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<UOL.Models.CADMetadata>>

A list of UOL.Models.CADMetadata with the metadata found by the criteria.

Examples

Call this method to get multiple CAD metadata objects:

var application = new CADApplication { Name = "revit", Version = "2019" };
var identifier = new CADMetadataIdentifier { Application = application, ETIM = etim };
var options = new CADMetadataIdentifierOptions { LanguageCode = "en" };
var criteria = new List<CADMetadataCriteria>
    {
        new CADMetadataCriteria { Identifier = new CADMetadataIdentifier { Application = application, ETIM = new ETIM { ClassCode = "EC003024", ClassCodeVersion = "1", ModelCode = "MC000011", ModelCodeVersion = "1" } }, Options = options },
        new CADMetadataCriteria { Identifier = new CADMetadataIdentifier { Application = application, ETIM = new ETIM { ClassCode = "EC000002", ClassCodeVersion = "1", ModelCode = "MC000003", ModelCodeVersion = "1" } }, Options = options }
    };

var metadataList = await uolClient.GetMetadataAsync(criteria); var baseFilename = metadataList.First().BaseFilename;

GetMetadataByDateAsync(CADApplication, Boolean, String, String)

Gets the most recent available metadata information for the supplied parameters. When The criteria include application, EC and MC code and version and language.

Declaration
Task<IEnumerable<CADMetadata>> GetMetadataByDateAsync(CADApplication application, bool includeMinorVersion = false, string afterChangeDate = null, string languageCode = "nl")
Parameters
Type Name Description
UOL.Models.CADApplication application

The CAD application associated with the desired CAD content.

System.Boolean includeMinorVersion

Specifies whether minor versions are to be included.

System.String afterChangeDate

Only return versions changed after this date (e.g. '2020-04-28'), if date is empty, null or incorrectly formatted return all versions.

System.String languageCode

The language (e.g. 'en' or 'nl') associated with the desired CAD content.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<UOL.Models.CADMetadata>>

A list of UOL.Models.CADMetadata with the metadata found by the criteria.

Examples

Call this method to get multiple CAD metadata objects:

var application = new CADApplication { Name = "revit", Version = "2019" };
var metadataList = await uolClient.GetMetadataByDateAsync(application, false, "2020-04-28", "nl");
var baseFilename = metadataList.First().BaseFilename;

GetProductValuesAsync(ProductIdFilter)

Gets the product values as defined by the manufacturer of the product.

Declaration
Task<IList<CADProduct>> GetProductValuesAsync(ProductIdFilter productIdFilter)
Parameters
Type Name Description
UOL.Models.ProductIdFilter productIdFilter

The product Ids and language to get the product values for.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IList<UOL.Models.CADProduct>>

A task that represents the asynchronous data download operation.

Examples

Call this method to get the product values as defined by the manufacturer of the product:

var productIdFilter = new ProductIdFilter
    {
        LanguageCode = "nl",
        ProductIds = new List<int> { 86448760 }
    };

var productValues = await uolClient.GetProductValuesAsync(productIdFilter); var numberOfProperties = productValues.First().Properties.Count();

Exceptions
Type Condition
UOLClientException

The response of the Data Service indicated failure or any unexpected error occurred.

GetStandardsAsync()

Gets the available CAD Standards.

Declaration
Task<Dictionary<Guid, string>> GetStandardsAsync()
Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.Guid, System.String>>

A task that represents the asynchronous data download operation.

Examples

Call this method to get the available CAD standards:

var standards = await uolClient.GetStandardsAsync();
var numberOfStandards = standards.Count();

Exceptions
Type Condition
UOLClientException

The response of the Data Service indicated failure or any unexpected error occurred.

GetUOLInfoAsync()

Gets the list of UOL information to use.

Declaration
Task<Dictionary<string, string>> GetUOLInfoAsync()
Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.Dictionary<System.String, System.String>>

A task that represents the asynchronous UOL Information GET operation.

Examples

Call this method to get the information needed to call the UOL APIs:

var info = await GetUOLInfoAsync();
var authorizationServerUrl = info["AuthorizationServerUrl"];
var redirectUrl = info["RedirectUrl"];
var searchUrl = info["SearchUrl"];
var clientId = info["ClientId"];
var clientSecret = info["ClientSecret"];

GetValidationBlobAsObjectAsync<T>(String)

Gets validation blob from the UOL Content Service and convert to object of type T.

Declaration
Task<T> GetValidationBlobAsObjectAsync<T>(string blobId)
Parameters
Type Name Description
System.String blobId

The id of the blob to download.

Returns
Type Description
System.Threading.Tasks.Task<T>

A task that represents the asynchronous data download operation.

Type Parameters
Name Description
T

The return blob object.

Examples

Call this method to get validation blob from the UOL Content Service as an object:

var cadProducts = await uolClient.GetValidationBlobAsObjectAsync<IEnumerable<CADProduct>>("123-444d-dd3r3-ddd32");
var numberOfCADProducts = cadProducts.Count();

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

GetValidationBlobAsStringAsync(String)

Gets validation blob from the UOL Content Service as string.

Declaration
Task<string> GetValidationBlobAsStringAsync(string blobId)
Parameters
Type Name Description
System.String blobId

The id of the blob to download.

Returns
Type Description
System.Threading.Tasks.Task<System.String>

A task that represents the asynchronous data download operation.

Examples

Call this method to get validation blob from the UOL Content Service as string:

var validationResultString = await uolClient.GetValidationBlobAsStringAsync("123-444d-dd3r3-ddd32");

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

GetValidationRequestsAsync(String, String)

Gets validation requests from the UOL Content Service.

Declaration
Task<IEnumerable<CADValidationRequest>> GetValidationRequestsAsync(string projectId, string ticketNumber = null)
Parameters
Type Name Description
System.String projectId

The id of the project to use to get validation requests.

System.String ticketNumber

The ticket number to use to get validation requests.

Returns
Type Description
System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<UOL.Models.CADValidationRequest>>

A task that represents the asynchronous data download operation.

Examples

Call this method to get validation requests from the UOL Content Service:

var cadValidationRequests = await uolClient.GetValidationRequestsAsync("UOB-0001", "189289938");
var numberOfValidationRequests = cadValidationRequests.Count();

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

Initialize()

Initializes the UOL client with the needed URIs.

Declaration
void Initialize()

PublishContentAsync(Stream, IEnumerable<CADMetadata>)

Publishes the CAD content file and the metadata for it.

Declaration
Task<Guid> PublishContentAsync(Stream stream, IEnumerable<CADMetadata> fileMetadata)
Parameters
Type Name Description
System.IO.Stream stream

The CAD file stream.

System.Collections.Generic.IEnumerable<UOL.Models.CADMetadata> fileMetadata

The metadata to publish with the file.

Returns
Type Description
System.Threading.Tasks.Task<System.Guid>

The blobId of the published Cad content file.

Examples

Call this method to publish new CAD content with metadata:

var metadata = new List<CADMetadata>();
metadata.Add(new CADMetadata
    {
        Application = new CADApplication { Name = "Revit", Version = "2018|2019|2020" },
        BaseFilename = "Testcontent",
        LanguageCode = "nl",
        Category = "None",
        ETIM = new ETIM { ClassCode = "EC000001", ClassCodeVersion = "1|2|3", ModelCode = "MC000001", ModelCodeVersion = "1|2" },
        FileExtension = "rfa",
        Tags = $"LOOKUPTABLE=MC000001",
        Type = "Template",
        ParameterInfo = "[{\"Name\":\"EC_EF000007_0_Kleur\",\"Type\":\"OTHER\",\"Unit\":\"\",\"Required\":false,\"NewType\":false,\"Value\":\"\"},{\"Name\":\"EC_EF000187_0_Spanningstype\",\"Type\":\"OTHER\",\"Unit\":\"\",\"Required\":false,\"NewType\":false,\"Value\":\"\"}]"
    });

var path = ApplicationGlobals.ExternalCommandData.Application.ActiveUIDocument.Document.PathName.Replace(".rfa", $"{Guid.NewGuid()}.rfa"); File.Copy(ApplicationGlobals.ExternalCommandData.Application.ActiveUIDocument.Document.PathName, path, true); var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read); using (var memoryStream = new MemoryStream()) { fileStream.CopyTo(memoryStream); var blobId = await uolClient.PublishContentAsync(memoryStream, metadata);
}

ReleaseContentAsync(CADApplication, ETIM, String, String, String)

Releases the latest minor version of CAD content as the new major version.

Declaration
Task ReleaseContentAsync(CADApplication application, ETIM etim, string comments, string type, string languageCode = "nl")
Parameters
Type Name Description
UOL.Models.CADApplication application

The CAD application associated with the CAD content.

UOL.Models.ETIM etim

The ETIM information associated with the CAD content.

System.String comments

The comments for the release.

System.String type

The type of the content to release.

System.String languageCode

The language (e.g. 'en' or 'nl') associated with the CAD content.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task that represents the asynchronous operation.

Examples

Call this method to release the latest minor version of the specified CAD content as the new major version.

var application = new CADApplication { Name = "revit", Version = "2019" };
var etim = new ETIM { ClassCode = "EC003024", ClassCodeVersion = "1", ModelCode = "MC000011", ModelCodeVersion = "1" };
await uolClient.ReleaseContentAsync(application, etim, "testcontent", "Template", "en");

SetBIMReadyInformationAsync(Dictionary<String, Boolean>)

Sets BIM ready information on the data platform.

Declaration
Task SetBIMReadyInformationAsync(Dictionary<string, bool> bimReadyInformation)
Parameters
Type Name Description
System.Collections.Generic.Dictionary<System.String, System.Boolean> bimReadyInformation

The BIM ready information to set.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task that represents the asynchronous operation.

Examples

Call this method to start validating:

var bimInfo = new Dictionary<string, bool>();
bimInfo.Add("123456", true);
bimInfo.Add("443322", false);
uolClient.SetBIMReadyInformation("UOB-0001", "189289938");

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

StartValidationAsync(String, String)

Starts validation of the validation request with the specified ticket number.

Declaration
Task StartValidationAsync(string projectId, string ticketNumber)
Parameters
Type Name Description
System.String projectId

The id of the project to use to start validating.

System.String ticketNumber

The ticket number to use to start validating.

Returns
Type Description
System.Threading.Tasks.Task

A System.Threading.Tasks.Task that represents the asynchronous operation.

Remarks

This method is automatically called when AddValidationRequestAsync is called.

Examples

Call this method to start validating:

uolClient.StartValidation("UOB-0001", "189289938");

Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.

UploadCADFilterResultAsync(CADFilterResult)

Uploads a filter to the UOL Data Service.

Declaration
Task<long> UploadCADFilterResultAsync(CADFilterResult cadFilterResult)
Parameters
Type Name Description
UOL.Models.CADFilterResult cadFilterResult

The filter to upload.

Returns
Type Description
System.Threading.Tasks.Task<System.Int64>

A task that represents the asynchronous data download operation.

Examples

Call this method to upload a CAD filter result for parameterized search:

var filterId = await uolClient.UploadCADFilterResultAsync(cadFilterResult);

Then you can go to the UOL Search site with the parameter interfaceObjectId={filterId} to use the uploaded filter result for new search.
Exceptions
Type Condition
UOLClientException

The response of the Data Service indicated failure or any unexpected error occurred.

UploadValidationFileAsync(String)

Uploads a validation file to the online file storage.

Declaration
Task<Guid> UploadValidationFileAsync(string jsonContent)
Parameters
Type Name Description
System.String jsonContent

The content of the file to upload.

Returns
Type Description
System.Threading.Tasks.Task<System.Guid>

A task that represents the asynchronous data upload operation.

Examples

Call this method to upload a validation file:

var blobId = await uolClient.UploadValidationFileAsync("JSON CONTENT GOES HERE!!!");

When the file is uploaded, the blob Id is returned.
Exceptions
Type Condition
UOLClientException

The response of the Content Service indicated failure or any unexpected error occurred.