本文整理汇总了C#中RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法的典型用法代码示例。如果您正苦于以下问题:C# RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法的具体用法?C# RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields怎么用?C# RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RestClient
的用法示例。
在下文中一共展示了RestClient.GetAllMetadataDescribeEntitiesAndGetAllFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
bool repeat = true;
while (repeat)
{
var mainNameSpace = string.Empty;
var folder = string.Empty;
var userName = string.Empty;
var passWord = string.Empty;
string howManyEntities = string.Empty;
int count = 0;
string countEntities = "N";
string[] yn = { "Y", "N", "y", "n" };
bool limitEntities = false;
ReadInputFromUser(ref userName, "Please enter your Clarizen Username");
ReadInputFromUserSecretly(ref passWord, "Please enter your Clarizen Password");
ReadInputFromUser(ref mainNameSpace, "Please enter a Main Namespace ");
ReadInputFromUser(ref countEntities, "Parse all Clarizen Entities? Y/N ", yn);
if (countEntities == "N" || countEntities == "n") limitEntities = true;
if (limitEntities == true)
{
ReadInputFromUser(ref howManyEntities, "How many Entities to parse?");
try
{
count = Convert.ToInt32(howManyEntities);
}
catch (FormatException e)
{
Console.WriteLine("Input string is not a sequence of digits.");
}
catch (OverflowException e)
{
Console.WriteLine("The number cannot fit in an Int32.");
}
}
//TODO add logic to test this is a correct drive/folder.
ReadInputFromUser(ref folder, "Please enter the folder location to save your code files ");
///need to change your password.
RestClient client = new RestClient(userName, passWord);
Console.WriteLine("Fetching data from Clarizen...");
if (client.ListEntities != null)
{
int counting = 0;
foreach (string s in client.ListEntities)
{
counting++;
client.GetAllMetadataDescribeEntitiesAndGetAllFields(s);
Console.Write(".");
if (counting > count && limitEntities == true) break;
}
Console.WriteLine();
}
if (client.ConvertedMetadata != null)
{
Console.WriteLine("Creating Classes...");
foreach (KeyValuePair<string, JToken> pair in client.ConvertedMetadataWithoutCustomFields)
{
Console.Write(".");
var gen = Prepare(pair.Value, pair.Key, folder, mainNameSpace);
if (gen == null) return;
try
{
gen.GenerateClasses();
}
catch (Exception ex)
{
Console.Write("Error writing class " + ex + pair.Key + " " + pair.Value);
}
}
}
Console.WriteLine();
Console.Write("Finished! - code should be ready in folder " + folder + " ");
Console.WriteLine();
string go = string.Empty;
ReadInputFromUser(ref go, "Continue? ");
if (go == "Y" || go == "y")
{
repeat = true;
}
else
{
repeat = false;
}
}
}