public void oauth_authentication_with_storage() { var storage = new Storage.JsonFileStorage( @"ExamplesTests\client_secrets.json", @"ExamplesTests\stored_credentials.json"); var connector = new VersionOneAPIConnector(_prefix) .WithOAuth2(storage); using (connector.GetData(Path)); }
public void oauth_authentication_with_storage() { var storage = new Storage.JsonFileStorage( @"ExamplesTests\client_secrets.json", @"ExamplesTests\stored_credentials.json"); var connector = new VersionOneAPIConnector(_prefix) .WithOAuth2(storage); using (connector.GetData(Path)) ; }
private static void Main() { IStorage credentials = new Storage.JsonFileStorage( "../../client_secrets.json", "../../stored_credentials.json"); const string scopes = "query-api-1.0 apiv1"; const string url = "https://www14.v1host.com/v1sdktesting/query.v1"; var client = new JsonClient(credentials, url, scopes); const string queryBody = @" from: Scope select: - Name - Workitems.@Count - Workitems:PrimaryWorkitem.@Count - Workitems:PrimaryWorkitem[Estimate>'0'].@Count - Workitems:PrimaryWorkitem[Estimate='0'].@Count - Workitems:PrimaryWorkitem[Estimate>'0'].Estimate.@Sum - from: Workitems:PrimaryWorkitem[Estimate>'0'] select: - Name - Estimate "; var resultSets = client.GetResultSets(queryBody).ToArray(); foreach (var result in resultSets[0]) // Rember that query.v1 returns a resultSet of resultSets! { Console.WriteLine(result["Name"]); Console.WriteLine("Total # of workitems: " + result["Workitems.@Count"]); Console.WriteLine("Total # of Primary workitems: " + result["Workitems:PrimaryWorkitem.@Count"]); Console.WriteLine("Total # of Estimated Primary workitems: " + result["Workitems:PrimaryWorkitem[Estimate>'0'].@Count"]); Console.WriteLine("Total # of Unestimated Primary workitems: " + result["Workitems:PrimaryWorkitem[Estimate='0'].@Count"]); Console.WriteLine("Sum of all Estimated Primary workitems: " + result["Workitems:PrimaryWorkitem[Estimate>'0'].Estimate.@Sum"]); foreach (var estimatedWorkitem in result["Workitems:PrimaryWorkitem[Estimate>'0']"]) { Console.WriteLine(estimatedWorkitem["Name"] + " : " + estimatedWorkitem["Estimate"]); } Console.WriteLine("\n"); } Console.Write("Press any key to exit..."); Console.ReadLine(); }