Interface IEntitiesClient

Contains functionality to get and manipulate entities.

Namespace: StylelabsStylelabs.MSdkClients
Assembly: Stylelabs.M.Sdk.dll
Syntax
RequestResponse
public interface IEntitiesClient
Remarks

When possible, always include the specific properties and relations that are required when fetching entities. IEntityLoadConfiguration

Methods

CopyAsync(long, IEntityCopyOptions)

Copies an entity by id to a new or existing entity.

Declaration
RequestResponse
Task<long> CopyAsync(long entityId, IEntityCopyOptions copyOptions)
Parameters
TypeNameDescription
longentityId

The source entity id.

IEntityCopyOptionscopyOptions

The copy options.

Returns
TypeDescription
Task<>long

The id of the copied entity.

DeleteAsync(long)

Deletes the IEntity with the specified id in Content-Hub. If the entity doesn't exist, nothing will happen.

Declaration
RequestResponse
Task DeleteAsync(long entityId)
Parameters
TypeNameDescription
longentityId

The id of the entity to delete.

Returns
TypeDescription
Task

A representing the asynchronous operation.

Exceptions
TypeCondition
ForbiddenException

Thrown when the entity exists but could not be deleted.

GetAsync(long, IEntityLoadConfiguration)

Gets the IEntity instance with the specified id.

Declaration
RequestResponse
Task<IEntity> GetAsync(long id, IEntityLoadConfiguration loadConfiguration = null)
Parameters
TypeNameDescription
longid

The id of the entity to get.

IEntityLoadConfigurationloadConfiguration

The loading configuration for the entity.

Returns
TypeDescription
Task<>IEntity

The entity or null when it was not found.

GetAsync(string, IEntityLoadConfiguration)

Gets the IEntity instance with the specified identifier.

Declaration
RequestResponse
Task<IEntity> GetAsync(string identifier, IEntityLoadConfiguration loadConfiguration = null)
Parameters
TypeNameDescription
stringidentifier

The identifier of the entity to get.

IEntityLoadConfigurationloadConfiguration

The loading configuration for the entity.

Returns
TypeDescription
Task<>IEntity

The entity or null when it was not found.

GetByDefinitionAsync(string, IEntityLoadConfiguration, int, int)

Queries for entities of the specified definition.

Declaration
RequestResponse
Task<IEntityQueryResult> GetByDefinitionAsync(string definition, IEntityLoadConfiguration loadConfiguration = null, int skip = null, int take = null)
Parameters
TypeNameDescription
stringdefinition

The name of the definition to get the entities for (case insensitive).

IEntityLoadConfigurationloadConfiguration

The loading configuration for entity.

intskip

Skip specified number of entities. If no value is specified, no items will be skipped.

inttake

Take only specified number of entities. If no value is specified, the default Take will be used.

Returns
TypeDescription
Task<>IEntityQueryResult

The iterator.

GetEntityIdIterator(string)

Creates an IIdIterator instance for the specified definition that returns entity ids Results are sorted ascending on creation date.

Declaration
RequestResponse
IIdIterator GetEntityIdIterator(string definition)
Parameters
TypeNameDescription
stringdefinition

The name of the definition to get the entities for (case insensitive).

Returns
TypeDescription
IIdIterator

The iterator.

GetEntityIterator(string, IEntityLoadConfiguration)

Creates an IEntityIterator instance for the specified definition that returns IEntity instances. Results are sorted ascending on creation date.

Declaration
RequestResponse
IEntityIterator GetEntityIterator(string definition, IEntityLoadConfiguration loadConfiguration = null)
Parameters
TypeNameDescription
stringdefinition

The name of the definition to get the entities for (case insensitive).

IEntityLoadConfigurationloadConfiguration

The loading configuration for entity.

Returns
TypeDescription
IEntityIterator

The iterator.

GetIdsByDefinitionAsync(string, int, int)

Queries for entity ids of the specified definition.

Declaration
RequestResponse
Task<IIdQueryResult> GetIdsByDefinitionAsync(string definition, int skip = null, int take = null)
Parameters
TypeNameDescription
stringdefinition

The name of the definition to get the entities for (case insensitive).

intskip

Skip specified number of entities. If no value is specified, no items will be skipped.

inttake

Take only specified number of entities. If no value is specified, the default Take will be used.

Returns
TypeDescription
Task<>IIdQueryResult

The iterator.

GetManyAsync(IEnumerable<long>, IEntityLoadConfiguration)

Gets multiple IEntity instances with the specified ids. The result can have a different ordering and size (when entities don't exist) than the input.

Declaration
RequestResponse
Task<IList<IEntity>> GetManyAsync(IEnumerable<long> ids, IEntityLoadConfiguration loadConfiguration = null)
Parameters
TypeNameDescription
IEnumerable<>longids

The ids of the entities to get.

IEntityLoadConfigurationloadConfiguration

The loading configuration for the entity.

Returns
TypeDescription
Task<>IList<>IEntity

A (non-null) list of entities.

GetManyAsync(IEnumerable<string>, IEntityLoadConfiguration)

Gets multiple IEntity instances with the specified s. The result can have a different ordering and size (when entities don't exist) than the input.

Declaration
RequestResponse
Task<IList<IEntity>> GetManyAsync(IEnumerable<string> identifiers, IEntityLoadConfiguration loadConfiguration = null)
Parameters
TypeNameDescription
IEnumerable<>stringidentifiers

The identifiers of the entities to get.

IEntityLoadConfigurationloadConfiguration

The loading configuration for the entity.

Returns
TypeDescription
Task<>IList<>IEntity

A (non-null) list of entities.

SaveAsync(IEntity)

Saves the entity in Content-Hub.

Declaration
RequestResponse
Task<long> SaveAsync(IEntity entity)
Parameters
TypeNameDescription
IEntityentity

The entity to save.

Returns
TypeDescription
Task<>long

The id of the entity in Content-Hub.

Remarks

The existing entity will not be updated in any way. If any information is needed that was generated on the server after persisting, they entity will need to be fetched again.

Exceptions
TypeCondition
ValidationException

Thrown when the entity could not be saved because a validation error occurred.

Do you have some feedback for us?

If you have suggestions for improving this article,