private static async Task <IEntity> GetContentEntity(long entityId, ILogger logger) { var propertyLoad = new PropertyLoadOption(new string[] { DescFieldId }); var relationLoad = new RelationLoadOption(new string[] { ContentAssetRelation }); var loadConfig = new EntityLoadConfiguration(CultureLoadOption.Default, propertyLoad, relationLoad); IEntity entity = await MConnector.Client.Entities.GetAsync(entityId, loadConfig); return(entity); }
private async Task <IEntity> GetAssetFromRelation(IEntity entity, string relationName, int index) { var relationWithAssets = entity.GetRelation <IParentToManyChildrenRelation>(relationName); Assert.IsNotNull(relationWithAssets, $"Failed to get relation: {relationName}."); var assetIds = relationWithAssets.GetIds(); Assert.IsNotNull(assetIds[index - 1], $"Asset with index {index - 1} not found."); var propertiesLoad = new PropertyLoadOption(new string[] { Constants.Asset.Properties.FileName, Constants.Asset.Properties.Title, Constants.Asset.Properties.Renditions }); return(await WebMClient.Entities.GetAsync(assetIds[index - 1], new EntityLoadConfiguration(CultureLoadOption.Default, propertiesLoad, RelationLoadOption.None)).ConfigureAwait(false)); }
private static IEntityLoadConfiguration PublicLinkLoadConfiguration() { var propertyOptions = new PropertyLoadOption(new string[] { Constants.PublicLink.Properties.RelativeUrl, Constants.PublicLink.Properties.VersionHash, Constants.PublicLink.Properties.ConversionConfiguration }); return(new EntityLoadConfiguration(CultureLoadOption.All, propertyOptions, RelationLoadOption.None)); }