ICatalogService
Namespace: Meshmakers.Octo.ConstructionKit.Contracts.Services
Public service to access construction kit model catalogs
public interface ICatalogService
Methods
SearchAsync(String, Int32, Int32, Object, Nullable<CancellationToken>)
Searches for models in all known catalogs
Task<ModelSearchResult> SearchAsync(string searchTerm, int skip, int take, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
searchTerm String
Search term
skip Int32
Amount of models to skip
take Int32
Amount of models to take
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Task<ModelSearchResult>
If existing the deserialized and validated construction kit model
SearchAsync(String, String, Int32, Int32, Object, Nullable<CancellationToken>)
Searches for models in a specific catalog
Task<ModelSearchResult> SearchAsync(string catalogName, string searchTerm, int skip, int take, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
catalogName String
catalog name to search models from
searchTerm String
Search term
skip Int32
Amount of models to skip
take Int32
Amount of models to take
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Task<ModelSearchResult>
If existing the deserialized and validated construction kit model
ListAsync(Int32, Int32, Object, Nullable<CancellationToken>)
Lists models in all known catalogs. A unique list of models is returned, so if a model exists in multiple catalogs
Task<ModelListResult> ListAsync(int skip, int take, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
skip Int32
Amount of models to skip
take Int32
Amount of models to take
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Task<ModelListResult>
If existing the deserialized and validated construction kit model
ListAsync(String, Int32, Int32, Object, Nullable<CancellationToken>)
Lists models in a specific catalog
Task<ModelListResult> ListAsync(string catalogName, int skip, int take, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
catalogName String
catalog name to list models from
skip Int32
Amount of models to skip
take Int32
Amount of models to take
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Task<ModelListResult>
If existing the deserialized and validated construction kit model
ListVersionsAsync(String, Object, Nullable<CancellationToken>)
Returns all versions of a construction kit model across all known catalogs, unpaged and ordered by
ascending semantic version. The model name is matched case-insensitively. A model id present in
several catalogs is taken from the catalog with the lowest Order (same dedupe rule as
ICatalogService.ListAsync(Int32, Int32, Object, Nullable<CancellationToken>)).
Task<IReadOnlyList<CatalogResultItem>> ListVersionsAsync(string ckModelName, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
ckModelName String
Name of the construction kit model (without version)
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Task<IReadOnlyList<CatalogResultItem>>
All catalog entries of the model, ordered by version
GetAsync(CkModelId, OperationResult, Object, Nullable<CancellationToken>)
Looks up a model by its id
Task<CkCompiledModelRoot> GetAsync(CkModelId ckModelId, OperationResult operationResult, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
ckModelId CkModelId
The construction kit model id
operationResult OperationResult
Operation results
that contain validation messages occured during deserialization.
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Task<CkCompiledModelRoot>
If existing the deserialized and validated construction kit model
GetAsync(String, CkModelId, OperationResult, Nullable<CancellationToken>)
Looks up a model by its id
Task<CkCompiledModelRoot> GetAsync(string catalogName, CkModelId ckModelId, OperationResult operationResult, Nullable<CancellationToken> cancellationToken)
Parameters
catalogName String
Name of catalog.
ckModelId CkModelId
The construction kit model id
operationResult OperationResult
Operation results
that contain validation messages occured during deserialization.
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Task<CkCompiledModelRoot>
If existing the deserialized and validated construction kit model
GetCatalogList(Object)
Returns a list of known construction kit model catalogs
IEnumerable<Tuple<string, string>> GetCatalogList(object sourceIdentifier)
Parameters
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
Returns
IEnumerable<Tuple<String, String>>
Returns a tuple with name and description of catalog
PublishAsync(String, CkCompiledModelRoot, OriginFileResolver, Boolean, Object, Nullable<CancellationToken>)
Publishes a model to a catalog. The model is hard-resolved first; when the resolve reports errors the model is NOT written to the catalog and a CompilerException is thrown (AB#5453 — this used to return quietly, so callers logged success for a model that never reached the catalog).
Task PublishAsync(string catalogName, CkCompiledModelRoot ckCompiledModel, OriginFileResolver originFileResolver, bool isForced, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
catalogName String
Name of catalog.
ckCompiledModel CkCompiledModelRoot
Deserialized construction kit model.
originFileResolver OriginFileResolver
Origin file resolver
isForced Boolean
When true, existing construction kit models are replaced.
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Exceptions
CompilerException
The model could not be resolved and was not published.
PublishAsync(String, CkCompiledModelRoot, OriginFileResolver, Boolean, OperationResult, Object, Nullable<CancellationToken>)
Publishes a model to a catalog and collects the resolve messages in the caller's
operationResult. Use this overload from hosts that render an
OperationResult themselves (the MSBuild tasks do: their
providers are cleared, so messages that
only reach the logger are lost). Behaves exactly like the other overload otherwise.
Task PublishAsync(string catalogName, CkCompiledModelRoot ckCompiledModel, OriginFileResolver originFileResolver, bool isForced, OperationResult operationResult, object sourceIdentifier, Nullable<CancellationToken> cancellationToken)
Parameters
catalogName String
Name of catalog.
ckCompiledModel CkCompiledModelRoot
Deserialized construction kit model.
originFileResolver OriginFileResolver
Origin file resolver
isForced Boolean
When true, existing construction kit models are replaced.
operationResult OperationResult
Receives the messages produced while resolving the model.
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
cancellationToken Nullable<CancellationToken>
A cancellation token that can be used to cancel the operation
Returns
Exceptions
CompilerException
The model could not be resolved and was not published.
IsExistingAsync(String, CkModelIdVersionRange, Object)
Returns true if the model exists in a given catalog
Task<ModelExistingResult> IsExistingAsync(string catalogName, CkModelIdVersionRange ckModelIdVersionRange, object sourceIdentifier)
Parameters
catalogName String
Name of catalog.
ckModelIdVersionRange CkModelIdVersionRange
The construction kit model id with optional version range
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
Returns
Task<ModelExistingResult>
The task that returns true if the model exists in a given catalog
IsExistingAsync(CkModelId, Object)
Returns true if the model with the given id and version exists in any of the known catalogs.
Task<bool> IsExistingAsync(CkModelId ckModelId, object sourceIdentifier)
Parameters
ckModelId CkModelId
The construction kit model id
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
Returns
Task<Boolean>
The task that returns true if the model exists in a given catalog
IsExistingAsync(CkModelIdVersionRange, Object)
Returns whether a model within the version range exists in any of the known catalogs. When the model exists in multiple catalogs, the highest satisfying version is returned.
Task<ModelExistingResult> IsExistingAsync(CkModelIdVersionRange ckModelIdVersionRange, object sourceIdentifier)
Parameters
ckModelIdVersionRange CkModelIdVersionRange
The construction kit model id with version range
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
Returns
Task<ModelExistingResult>
The task that returns the existence result including the highest satisfying version
RestoreConstructionKitModelsAsync(String, String, String, Object)
Restores construction kit models based on a construction kit model configuration file.
Task<IEnumerable<CompileResult>> RestoreConstructionKitModelsAsync(string modelConfigurationFilePath, string outputPath, string createCacheFilePath, object sourceIdentifier)
Parameters
modelConfigurationFilePath String
Local file path where the model configuration file exists.
outputPath String
Output path of compiled construction kit
createCacheFilePath String
When defined, a cache file is created at the defined path containing all
dependencies
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
Returns
Task<IEnumerable<CompileResult>>
RestoreConstructionKitModelsAsync(String, String, String, OperationResult, Object)
Returns information about the construction kit model folder.
Task<IEnumerable<CompileResult>> RestoreConstructionKitModelsAsync(string modelConfigurationFilePath, string outputPath, string createCacheFilePath, OperationResult operationResult, object sourceIdentifier)
Parameters
modelConfigurationFilePath String
Local file path where the model configuration file exists.
outputPath String
Output path of compiled construction kit
createCacheFilePath String
When defined, a cache file is created at the defined path containing all
dependencies
operationResult OperationResult
Operation result
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
Returns
Task<IEnumerable<CompileResult>>
RefreshCatalogCacheAsync(String, Object, Boolean)
Refreshes the cache of a specific catalog, e.g., by reloading from disk or fetching from a remote source.
Task RefreshCatalogCacheAsync(string catalogName, object sourceIdentifier, bool forceRefresh)
Parameters
catalogName String
Name of the catalog
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
forceRefresh Boolean
When true, the refresh bypasses the cache freshness window and always
contacts the source
Returns
RefreshAllCatalogCachesAsync(Object, Boolean)
Refreshes the catalog cache for all catalogs
Task RefreshAllCatalogCachesAsync(object sourceIdentifier, bool forceRefresh)
Parameters
sourceIdentifier Object
An object
that describes the source
which the catalog should search set it to null to use default
forceRefresh Boolean
When true, the refresh bypasses the cache freshness window and always
contacts the source