public string ConstructTSItemTypeName() { var builder = new IndentedStringBuilder(" "); builder.AppendFormat("<{0}>", ClientModelExtensions.TSType(ItemType, true)); return(builder.ToString()); }
public override void GenerateModelDefinition(TSBuilder builder) { builder.DocumentationComment(comment => { comment.Summary(Summary); comment.Description(Documentation); }); IModelType arrayType; Property arrayProperty = Properties.FirstOrDefault(p => p.ModelType is SequenceTypeJs); if (arrayProperty == null) { throw new Exception($"The Pageable model {Name} does not contain a single property that is an Array."); } else { arrayType = ((SequenceTypeJs)arrayProperty.ModelType).ElementType; } builder.ExportInterface(Name, $"Array<{ClientModelExtensions.TSType(arrayType, true)}>", tsInterface => { Property nextLinkProperty = Properties.Where(p => p.Name.ToLowerInvariant().Contains("nextlink")).FirstOrDefault(); if (nextLinkProperty != null) { tsInterface.DocumentationComment(comment => { comment.Summary(nextLinkProperty.Summary); comment.Description(nextLinkProperty.Documentation); }); string propertyType = nextLinkProperty.ModelType.TSType(inModelsModule: true); tsInterface.Property(nextLinkProperty.Name, propertyType, isRequired: nextLinkProperty.IsRequired, isReadonly: nextLinkProperty.IsReadOnly); } }); }