Table of Contents

Class EndpointGenerator

Namespace
TypedRest.CodeGeneration.CSharp.Endpoints
Assembly
TypedRest.CodeGeneration.CSharp.dll
public class EndpointGenerator : IEndpointGenerator
Inheritance
object
EndpointGenerator
Implements

Constructors

EndpointGenerator(INamingStrategy, BuilderRegistry)

public EndpointGenerator(INamingStrategy namingStrategy, BuilderRegistry builders)

Parameters

namingStrategy INamingStrategy
builders BuilderRegistry

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

bool

Naming

public INamingStrategy Naming { get; }

Property Value

INamingStrategy

WithInterfaces

public bool WithInterfaces { get; set; }

Property Value

bool

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

key string
endpoint IEndpoint

Returns

CSharpIdentifier

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

key string
endpoint IEndpoint

Returns

(CSharpProperty property, IEnumerable<ICSharpType> types)

Generate(EntryEndpoint)

public IEnumerable<ICSharpType> Generate(EntryEndpoint endpoint)

Parameters

endpoint EntryEndpoint

Returns

IEnumerable<ICSharpType>

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

key string