private CSharpInterface GenerateEndpointInterface(IEndpoint endpoint, TypeList typeList, CSharpClass endpointImplementation) { var builder = _builders[endpoint.GetType()]; var endpointInterface = new CSharpInterface(endpointImplementation.Identifier.ToInterface()) { Interfaces = { builder.GetInterface(endpoint, typeList) }, Description = endpoint.Description }; endpointInterface.Properties.AddRange(endpointImplementation.Properties); endpointImplementation.Interfaces.Add(endpointInterface.Identifier); typeList.Add(endpoint, endpointInterface); return(endpointInterface); }
private IEnumerable <CSharpProperty> GenerateEndpoints(EndpointList endpoints, TypeList typeList) => endpoints.Select(x => GenerateEndpoint(x.Key, x.Value, typeList));
private static CSharpClass GenerateSchema(CSharpIdentifier identifier, TypeList typeList) { // TODO: Proper implementation return(new CSharpClass(identifier)); }
private CSharpClass GenerateEndpointImplementation(string key, IEndpoint endpoint, TypeList typeList, IList <CSharpProperty> children) { var builder = _builders[endpoint.GetType()]; var endpointImplementation = new CSharpClass(_naming.EndpointType(key, endpoint)) { BaseClass = builder.GetConstruction(endpoint, typeList), Description = endpoint.Description }; endpointImplementation.Properties.AddRange(children); typeList.Add(endpoint, endpointImplementation); return(endpointImplementation); }
private CSharpProperty GenerateEndpointWithChildren(string key, IEndpoint endpoint, TypeList typeList, IList <CSharpProperty> children) { var endpointImplementation = GenerateEndpointImplementation(key, endpoint, typeList, children); var identifier = GenerateInterfaces ? GenerateEndpointInterface(endpoint, typeList, endpointImplementation).Identifier : endpointImplementation.Identifier; return(new CSharpProperty(identifier, key) { GetterExpression = endpointImplementation.GetConstruction(), Description = endpoint.Description }); }
private CSharpProperty GenerateEndpointWithoutChildren(string key, IEndpoint endpoint, TypeList typeList) { var builder = _builders[endpoint.GetType()]; return(new CSharpProperty(builder.GetInterface(endpoint, typeList), _naming.Property(key)) { GetterExpression = builder.GetConstruction(endpoint, typeList), Description = endpoint.Description }); }