public void Process(ApiModel api, CodegenSettings settings, Stream stream) { var snippets = new List<string>(); // Api Client snippets.Add(new ClientTemplate { Api = api, Settings = settings }.TransformText()); // Endpoint Clients foreach (var endpoint in api.Endpoints) { snippets.Add(new EndpointTemplate { Endpoint = endpoint, Settings = settings }.TransformText()); }; // Indent snippets when a namespace is set if (!String.IsNullOrEmpty(settings.Namespace)) { snippets = snippets.Select(s => " " + s.Replace(Environment.NewLine, Environment.NewLine + " ")).ToList(); } var contents = new WrapperTemplate { Api = api, Snippet = string.Join(Environment.NewLine + Environment.NewLine, snippets), Settings = settings }.TransformText(); using (var sr = new StreamWriter(stream, Encoding.UTF8)) { sr.Write(contents); } }
public void Process(ApiModel api, CodegenSettings settings, Stream stream) { var snippets = new List <string>(); // Api Client snippets.Add(new ClientTemplate { Api = api, Settings = settings }.TransformText()); // Endpoint Clients foreach (var endpoint in api.Endpoints) { snippets.Add(new EndpointTemplate { Endpoint = endpoint, Settings = settings }.TransformText()); } ; // Indent snippets when a namespace is set if (!String.IsNullOrEmpty(settings.Namespace)) { snippets = snippets.Select(s => " " + s.Replace(Environment.NewLine, Environment.NewLine + " ")).ToList(); } var contents = new WrapperTemplate { Api = api, Snippet = string.Join(Environment.NewLine + Environment.NewLine, snippets), Settings = settings }.TransformText(); using (var sr = new StreamWriter(stream, Encoding.UTF8)) { sr.Write(contents); } }