Commit 07f3d6d2 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix console app

parent 1cb28711
...@@ -18,7 +18,6 @@ namespace Example ...@@ -18,7 +18,6 @@ namespace Example
client.RestClient.Authenticator = new JWTAuthenticator(client); // implements IAuthenticator client.RestClient.Authenticator = new JWTAuthenticator(client); // implements IAuthenticator
Configuration.Default.AccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODI2NTUyMzEsInVzZXJfbmFtZSI6ImFkbWluaXN0cmF0b3IiLCJhdXRob3JpdGllcyI6WyJBRE1JTlMiLCJDVFVTRVJTIiwiQUxMVVNFUlMiLCJ3ZWJ0b29scyJdLCJqdGkiOiI4NmNhZDNhYi1jYjZiLTQ5MDMtOGFmNy1jYjNjYTBhZTNkMTUiLCJjbGllbnRfaWQiOiJkZWZhdWx0Y2xpZW50QGxvY2FsaG9zdCIsInNjb3BlIjpbInJlYWQiXX0.sskzAd7FFAfpWftwIJU2ZQRGDiR9Wrjm_Ym3PX1yyd0"; Configuration.Default.AccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODI2NTUyMzEsInVzZXJfbmFtZSI6ImFkbWluaXN0cmF0b3IiLCJhdXRob3JpdGllcyI6WyJBRE1JTlMiLCJDVFVTRVJTIiwiQUxMVVNFUlMiLCJ3ZWJ0b29scyJdLCJqdGkiOiI4NmNhZDNhYi1jYjZiLTQ5MDMtOGFmNy1jYjNjYTBhZTNkMTUiLCJjbGllbnRfaWQiOiJkZWZhdWx0Y2xpZW50QGxvY2FsaG9zdCIsInNjb3BlIjpbInJlYWQiXX0.sskzAd7FFAfpWftwIJU2ZQRGDiR9Wrjm_Ym3PX1yyd0";
// Configuration.Default.AccessToken = "";
if (Configuration.Default.AccessToken == null || Configuration.Default.AccessToken == "") if (Configuration.Default.AccessToken == null || Configuration.Default.AccessToken == "")
{ {
Console.Out.WriteLine(Configuration.Default.BasePath + "/oauth/authorize?client_id=defaultclient@localhost&scope=read&redirect_url=oob&response_type=code"); Console.Out.WriteLine(Configuration.Default.BasePath + "/oauth/authorize?client_id=defaultclient@localhost&scope=read&redirect_url=oob&response_type=code");
...@@ -35,7 +34,7 @@ namespace Example ...@@ -35,7 +34,7 @@ namespace Example
var response = client.RestClient.Post(request); var response = client.RestClient.Post(request);
Debug.Write(response.Content); Debug.Write(response.Content);
var tokens = JsonConvert.DeserializeObject(response.Content); var tokens = JsonConvert.DeserializeObject(response.Content);
Debug.Write(tokens); Console.Out.WriteLine(tokens);
} }
// Configuration.Default.AddDefaultHeader("Origin", "https://sandbox.genesys-pgr.org"); // Configuration.Default.AddDefaultHeader("Origin", "https://sandbox.genesys-pgr.org");
...@@ -51,24 +50,24 @@ namespace Example ...@@ -51,24 +50,24 @@ namespace Example
{ {
var speciesFilter = new InlineObject2(); var speciesFilter = new InlineObject2();
var taxonomyFamily = apiTaxonomy.GetFamily(43255);//.FilterSpecies(null, speciesFilter); var taxonomyFamily = apiTaxonomy.GetFamily(43255);//.FilterSpecies(null, speciesFilter);
Debug.WriteLine(taxonomyFamily); Console.Out.WriteLine(taxonomyFamily);
var speciesList = apiTaxonomy.FilterSpecies(null, speciesFilter); var speciesList = apiTaxonomy.FilterSpecies(null, speciesFilter);
Debug.WriteLine(speciesList); Console.Out.WriteLine(speciesList);
foreach (var i in speciesList.Content) foreach (var i in speciesList.Content)
{ {
Debug.WriteLine(i); Console.Out.WriteLine(i);
} }
} }
catch (ApiException e) catch (ApiException e)
{ {
Debug.Print("Exception when calling: " + e.Message); Console.Error.WriteLine("Exception: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode); Console.Error.WriteLine("Status Code: " + e.ErrorCode);
if (e.ErrorContent != null) if (e.ErrorContent != null)
{ {
Debug.Print("Content: " + ((object)e.ErrorContent).ToString()); Console.Error.WriteLine("Content: " + ((object)e.ErrorContent).ToString());
} }
Debug.Print("Status Content: " + e.Data); Console.Error.WriteLine("Status Content: " + e.Data);
Debug.Print(e.StackTrace); Debug.Print(e.StackTrace);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment