public static RestApiSpec GetRestSpec(bool useCache) { Console.WriteLine("Getting a listing of all the api endpoints from the elasticsearch-rest-api-spec repos"); string html = string.Empty; using (var client = new WebClient()) html = client.DownloadString(useCache ? LocalUri("root.html") : _listingUrl); var dom = CQ.Create(html); if (!useCache) { File.WriteAllText(_cacheFolder + "root.html", html); } var endpoints = dom[".js-directory-link"] .Select(s => s.InnerText) .Where(s => !string.IsNullOrEmpty(s) && s.EndsWith(".json")) .Select(s => CreateApiDocumentation(useCache, s)) .ToDictionary(d => d.Key, d => d.Value); var restSpec = new RestApiSpec { Endpoints = endpoints, Commit = dom[".sha:first"].Text() }; return(restSpec); }
public static void GenerateEnums(RestApiSpec model) { var targetFile = _nestFolder + @"Enums\Enums.Generated.cs"; var source = _razorMachine.Execute(File.ReadAllText(_viewFolder + @"Enums.Generated.cshtml"), model).ToString(); File.WriteAllText(targetFile, source); }
public static void GenerateClientInterface(RestApiSpec model) { var targetFile = _nestFolder + @"IRawElasticClient.Generated.cs"; var source = _razorMachine.Execute(File.ReadAllText(_viewFolder + @"IRawElasticClient.Generated.cshtml"), model).ToString(); File.WriteAllText(targetFile, source); }
public static void GenerateRawClient(RestApiSpec model) { var targetFile = _nestFolder + @"RawElasticClient.Generated.cs"; var source = _razorMachine.Execute(File.ReadAllText(_viewFolder + @"RawElasticClient.Generated.cshtml"), model).ToString(); File.WriteAllText(targetFile, source); }
public static void GenerateQueryStringParameters(RestApiSpec model) { var targetFile = _nestFolder + @"QueryStringParameters\QueryStringParameters.Generated.cs"; var source = _razorMachine.Execute(File.ReadAllText(_viewFolder + @"QueryStringParameters.Generated.cshtml"), model).ToString(); File.WriteAllText(targetFile, source); }
public static void GenerateDescriptors(RestApiSpec model) { var targetFile = _nestFolder + @"DSL\_Descriptors.Generated.cs"; var source = _razorMachine.Execute(File.ReadAllText(_viewFolder + @"_Descriptors.Generated.cshtml"), model).ToString(); File.WriteAllText(targetFile, source); }
public static RestApiSpec GetRestSpec(bool useCache) { Console.WriteLine("Getting a listing of all the api endpoints from the elasticsearch-rest-api-spec repos"); string html = string.Empty; using (var client = new WebClient()) html = client.DownloadString(useCache ? LocalUri("root.html") : _listingUrl); var dom = CQ.Create(html); if (!useCache) File.WriteAllText(_cacheFolder + "root.html", html); var endpoints = dom[".js-directory-link"] .Select(s => s.InnerText) .Where(s => !string.IsNullOrEmpty(s) && s.EndsWith(".json")) .Select(s => CreateApiDocumentation(useCache, s)) .ToDictionary(d => d.Key, d => d.Value); var restSpec = new RestApiSpec { Endpoints = endpoints, Commit = dom[".sha:first"].Text() }; return restSpec; }