Beispiel #1
0
        private static async Task <bool> UpdateMembershipAsync(IAuthedService authedService, string session)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var membershipInformation = new MembershipInformation
            {
                Email        = "*****@*****.**",
                MembershipId = "membership id",
                Session      = session
            };

            var membershipResponse = await clientEndpoint.UpdateMembershipAsync(membershipInformation);

            return(membershipResponse.Success && membershipResponse.Response.Code == 200);
        }
Beispiel #2
0
        private static async Task <bool> RenewAsync(IAuthedService authedService, string session)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var renewalInformation = new RenewalInformation
            {
                Email       = "*****@*****.**",
                LicenseCode = "licenseCode",
                Session     = session
            };

            var renewalResponse = await clientEndpoint.RenewAsync(renewalInformation);

            return(renewalResponse.Success && renewalResponse.Response.Code == 200);
        }
Beispiel #3
0
        private static async Task <bool> UpdateAppAsync(IAuthedService authedService, string applicationSecret, string session)
        {
            var appEndpoint = authedService.AppEndpoint;

            var updateAppInformation = new UpdateAppInformation
            {
                AppField          = AppField.IsFree,
                ApplicationSecret = applicationSecret,
                Session           = session,
                Value             = true
            };

            var updateAppResponse = await appEndpoint.UpdatAppAsync(updateAppInformation);

            return(updateAppResponse.Success && updateAppResponse.Response.Code == 200);
        }
Beispiel #4
0
        private static async Task <bool> UpdateClientAsync(IAuthedService authedService, string session, string userSession)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var updateClientInformation = new UpdateClientInformation
            {
                ClientField = ClientField.Email,
                Value       = "*****@*****.**",
                UserSession = userSession,
                Session     = session
            };

            var updateClientResponse = await clientEndpoint.UpdateClientAsync(updateClientInformation);

            return(updateClientResponse.Success && updateClientResponse.Response.Code == 200);
        }
Beispiel #5
0
        private static async Task <bool> RegisterAsync(IAuthedService authedService, string session)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var registerInformation = new RegisterInformation
            {
                Email       = "*****@*****.**",
                Password    = "******",
                LicenseCode = "license code",
                Session     = session
            };

            var registerResponse = await clientEndpoint.RegisterAsync(registerInformation);

            return(registerResponse.Success && registerResponse.Response.Code == 200);
        }
Beispiel #6
0
        private static async Task <string> VerifyAsync(IAuthedService authedService, string accessToken, string applicationId)
        {
            var appEndpoint = authedService.AppEndpoint;

            var applicationInformation = new ApplicationInformation
            {
                AccessToken   = accessToken,
                ApplicationId = applicationId
            };

            var verificationResponse = await appEndpoint.VerifyAsync(applicationInformation);

            if (verificationResponse.Success)
            {
                return(verificationResponse.Response.Session);
            }

            return(string.Empty);
        }
Beispiel #7
0
        private static async Task <string> VerifySessionAsync(IAuthedService authedService, string userSession, string session)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var sessionInformation = new SessionInformation
            {
                UserSession = userSession,
                Session     = session
            };

            var verifySessionResponse = await clientEndpoint.VerifySessionAsync(sessionInformation);

            if (verifySessionResponse.Success && verifySessionResponse.Response.Code == 200)
            {
                return(verifySessionResponse.Response.UserSession);
            }

            return(string.Empty);
        }
Beispiel #8
0
        private static async Task <User> GetUserDetailsAsync(IAuthedService authedService, string userSession, string session)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var sessionInformation = new SessionInformation
            {
                UserSession = userSession,
                Session     = session
            };

            var userResponse = await clientEndpoint.GetUserDetailsAsync(sessionInformation);

            if (userResponse.Success && userResponse.Response.Code == 200)
            {
                return(userResponse.Response.User);
            }

            return(null);
        }
Beispiel #9
0
        private static async Task <string> LoginAsync(IAuthedService authedService, string session)
        {
            var clientEndpoint = authedService.ClientEndpoint;

            var loginInformation = new LoginInformation
            {
                Email    = "*****@*****.**",
                Password = "******",
                Session  = session
            };

            var loginResponse = await clientEndpoint.LoginAsync(loginInformation);

            if (loginResponse.Success && !string.IsNullOrEmpty(loginResponse.Response.UserSession))
            {
                return(loginResponse.Response.UserSession);
            }

            return(string.Empty);
        }
Beispiel #10
0
        private static async Task <string> GenerateLicenseAsync(IAuthedService authedService, string applicationSecret, string session)
        {
            var appEndpoint = authedService.AppEndpoint;

            var licenseInformation = new LicenseInformation
            {
                Amount            = 1,
                ApplicationSecret = applicationSecret,
                Level             = 1,
                LicensePrefix     = "prefix",
                Session           = session,
                Time = 0
            };

            var licenseResponse = await appEndpoint.GenerateLicenseAsync(licenseInformation);

            var firstLicense = licenseResponse.Response?.Licenses[0];

            return(firstLicense?.Code ?? string.Empty);
        }
Beispiel #11
0
 private static void Finished(IAuthedService authedService)
 {
     authedService.Dispose();
 }