Class EndpointGenerator
- Namespace
- TypedRest.CodeGeneration.TypeScript.Endpoints
- Assembly
- TypedRest.CodeGeneration.TypeScript.dll
Generates TypeScript types for a tree of IEndpoints.
public class EndpointGenerator : IEndpointGenerator
- Inheritance
-
objectEndpointGenerator
- Implements
Constructors
EndpointGenerator(INamingStrategy, BuilderRegistry, TypeNameRegistry?)
Generates TypeScript types for a tree of IEndpoints.
public EndpointGenerator(INamingStrategy namingStrategy, BuilderRegistry builders, TypeNameRegistry? typeNames = null)
Parameters
namingStrategyINamingStrategyDecides what the generated types and members are called.
buildersBuilderRegistryDecides what code is emitted for each kind of endpoint.
typeNamesTypeNameRegistryKeeps the generated names from colliding. Share this with a DTO generator writing to the same output directory.
Properties
Log
Collects messages about aspects of the document that TypeScript cannot express.
public IGenerationLog Log { get; set; }
Property Value
Modules
The modules of the TypedRest runtime library to import from.
public Modules Modules { get; set; }
Property Value
Naming
Decides what the generated types and members are called.
public INamingStrategy Naming { get; }
Property Value
Methods
EndpointType(string, IEndpoint)
Reserves a unique name for a generated endpoint class.
public TsIdentifier EndpointType(string key, IEndpoint endpoint)
Parameters
Returns
Generate(string, IEndpoint)
Generates the getter exposing an endpoint on its parent, plus any types needed for it.
public (TsGetter getter, IEnumerable<ITsType> types) Generate(string key, IEndpoint endpoint)
Parameters
Returns
Generate(EntryEndpoint)
Generates the types for an entire client.
public IEnumerable<ITsType> Generate(EntryEndpoint endpoint)
Parameters
endpointEntryEndpoint
Returns
PopParent()
Records that generation has left the children of the most recently pushed endpoint.
public void PopParent()
PushParent(string)
Records that generation has descended into the children of the endpoint with this key.
public void PushParent(string key)
Parameters
keystring