Class EndpointGenerator
- Namespace
- TypedRest.CodeGeneration.CSharp.Endpoints
- Assembly
- TypedRest.CodeGeneration.CSharp.dll
public class EndpointGenerator : IEndpointGenerator
- Inheritance
-
objectEndpointGenerator
- Implements
Constructors
EndpointGenerator(INamingStrategy, BuilderRegistry)
public EndpointGenerator(INamingStrategy namingStrategy, BuilderRegistry builders)
Parameters
namingStrategyINamingStrategybuildersBuilderRegistry
Properties
GenerateEntryConstructor
Controls whether the entry endpoint gets a generated constructor taking the base URI. Turn this off to supply the constructors yourself in a partial class, e.g. to pass an error handler or custom headers.
public bool GenerateEntryConstructor { get; set; }
Property Value
Naming
public INamingStrategy Naming { get; }
Property Value
WithInterfaces
public bool WithInterfaces { get; set; }
Property Value
Methods
EndpointType(string, IEndpoint)
Returns the name to use for the class generated for an endpoint with the given key.
Endpoints that share a key are disambiguated with a prefix derived from their parents, or failing that a number.
public CSharpIdentifier EndpointType(string key, IEndpoint endpoint)
Parameters
Returns
Remarks
Every call hands out a new name, so this must be called exactly once per generated class.
Generate(string, IEndpoint)
public (CSharpProperty property, IEnumerable<ICSharpType> types) Generate(string key, IEndpoint endpoint)
Parameters
Returns
Generate(EntryEndpoint)
public IEnumerable<ICSharpType> Generate(EntryEndpoint endpoint)
Parameters
endpointEntryEndpoint
Returns
PopParent()
Pops a key from the parent stack.
public void PopParent()
PushParent(string)
Pushes a key onto the parent stack. Builders call this around recursion into child endpoints so that EndpointType(string, IEndpoint) can derive prefixes from the current parents.
public void PushParent(string key)
Parameters
keystring