Beispiel #1
0
        public Task <TeamAppointmentStatusDTO> CheckAppointmentStatusAsync(long targetTeamId, CancellationTokenSource cancellationTokenSource) =>
        Task <TeamAppointmentStatusDTO> .Run(async() => {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new InvalidOperationException(AppConsts.ERROR_INTERNET_CONNECTION);
            }

            TeamAppointmentStatusDTO statusResult = null;

            CheckTeamAppointmentStatusRequest checkTeamAppointmentStatusRequest = new CheckTeamAppointmentStatusRequest()
            {
                AccessToken = GlobalSettings.Instance.UserProfile.AccesToken,
                Url         = string.Format(GlobalSettings.Instance.Endpoints.TeamEndPoints.CheckTeamAppointmentStatusApiKey, targetTeamId)
            };

            CheckTeamAppointmentStatusResponse checkTeamAppointmentStatusResponse = null;

            try {
                checkTeamAppointmentStatusResponse = await _requestProvider.GetAsync <CheckTeamAppointmentStatusRequest, CheckTeamAppointmentStatusResponse>(checkTeamAppointmentStatusRequest);

                statusResult = BuildTeamAppointmentStatusDTO(checkTeamAppointmentStatusResponse);
            }
            catch (ServiceAuthenticationException exc) {
                _identityUtilService.RefreshToken();

                throw exc;
            }
            catch (Exception exc) {
                Crashes.TrackError(exc);
                Debugger.Break();
                throw;
            }

            return(statusResult);
        });
Beispiel #2
0
        private TeamAppointmentStatusDTO BuildTeamAppointmentStatusDTO(CheckTeamAppointmentStatusResponse data)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new InvalidOperationException(AppConsts.ERROR_INTERNET_CONNECTION);
            }

            TeamAppointmentStatusDTO result = null;

            if (data != null)
            {
                result = new TeamAppointmentStatusDTO()
                {
                    Id      = data.Id,
                    Profile = data.Profile,
                    Team    = data.Team
                };
            }

            return(result);
        }