Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GGCE
GRIN-Global API dotnet
Commits
07f3d6d2
Commit
07f3d6d2
authored
Feb 25, 2020
by
Matija Obreza
Browse files
Fix console app
parent
1cb28711
Changes
1
Hide whitespace changes
Inline
Side-by-side
ConsoleApplication1/Program.cs
View file @
07f3d6d2
...
...
@@ -18,7 +18,6 @@ namespace Example
client
.
RestClient
.
Authenticator
=
new
JWTAuthenticator
(
client
);
// implements IAuthenticator
Configuration
.
Default
.
AccessToken
=
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODI2NTUyMzEsInVzZXJfbmFtZSI6ImFkbWluaXN0cmF0b3IiLCJhdXRob3JpdGllcyI6WyJBRE1JTlMiLCJDVFVTRVJTIiwiQUxMVVNFUlMiLCJ3ZWJ0b29scyJdLCJqdGkiOiI4NmNhZDNhYi1jYjZiLTQ5MDMtOGFmNy1jYjNjYTBhZTNkMTUiLCJjbGllbnRfaWQiOiJkZWZhdWx0Y2xpZW50QGxvY2FsaG9zdCIsInNjb3BlIjpbInJlYWQiXX0.sskzAd7FFAfpWftwIJU2ZQRGDiR9Wrjm_Ym3PX1yyd0"
;
// 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"
);
...
...
@@ -35,7 +34,7 @@ namespace Example
var
response
=
client
.
RestClient
.
Post
(
request
);
Debug
.
Write
(
response
.
Content
);
var
tokens
=
JsonConvert
.
DeserializeObject
(
response
.
Content
);
Debug
.
Write
(
tokens
);
Console
.
Out
.
Write
Line
(
tokens
);
}
// Configuration.Default.AddDefaultHeader("Origin", "https://sandbox.genesys-pgr.org");
...
...
@@ -51,24 +50,24 @@ namespace Example
{
var
speciesFilter
=
new
InlineObject2
();
var
taxonomyFamily
=
apiTaxonomy
.
GetFamily
(
43255
);
//.FilterSpecies(null, speciesFilter);
Debug
.
WriteLine
(
taxonomyFamily
);
Console
.
Out
.
WriteLine
(
taxonomyFamily
);
var
speciesList
=
apiTaxonomy
.
FilterSpecies
(
null
,
speciesFilter
);
Debug
.
WriteLine
(
speciesList
);
Console
.
Out
.
WriteLine
(
speciesList
);
foreach
(
var
i
in
speciesList
.
Content
)
{
Debug
.
WriteLine
(
i
);
Console
.
Out
.
WriteLine
(
i
);
}
}
catch
(
ApiException
e
)
{
Debug
.
Print
(
"Exception when calling
: "
+
e
.
Message
);
Debug
.
Print
(
"Status Code: "
+
e
.
ErrorCode
);
Console
.
Error
.
WriteLine
(
"Exception
: "
+
e
.
Message
);
Console
.
Error
.
WriteLine
(
"Status Code: "
+
e
.
ErrorCode
);
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
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment