-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
53 lines (46 loc) · 1.47 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using AccelByte.Sdk.Core;
using AccelByte.Sdk.Api;
using AccelByte.Sdk.Api.Legal.Model;
namespace AccelByte.Sdk.Sample.GettingStarted
{
internal class Program
{
static int Main(string[] args)
{
using AccelByteSDK sdk = AccelByteSDK.Builder
.UseDefaultHttpClient()
.UseDefaultConfigRepository()
.UseDefaultTokenRepository()
.UseDefaultCredentialRepository()
.Build();
bool login = sdk.LoginUser();
if (!login)
{
Console.WriteLine("Login failed");
return 1;
}
try
{
List<RetrieveAcceptedAgreementResponse>? response = sdk.Legal.Agreement.RetrieveAgreementsPublicOp.Execute();
if (response == null)
throw new Exception("Response is null");
foreach (var aggreement in response)
Console.WriteLine(aggreement.PolicyName);
}
catch (HttpResponseException e)
{
Console.WriteLine(e.Message);
return 2;
}
bool logout = sdk.Logout();
if (!logout)
{
Console.WriteLine("Logout failed");
return 1;
}
return 0;
}
}
}