Example #1
0
        public static async Task <List <AlertCategory> > GetAlertCategories()
        {
            try
            {
                var alertCategoriesString = await MaestroHttpClientRequest.GetAsync(apiAlertCatergories);

                var alertCategoriesObject = JsonConvert.DeserializeObject <List <AlertCategory> >(alertCategoriesString);
                return(alertCategoriesObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public static async Task <List <AlertNewsFeed> > GetAlerts(AlertNewsRequest obj)
        {
            try
            {
                var alertNewsFeedString = await MaestroHttpClientRequest.PostAsync(apiAlertNewsFeed, JsonConvert.SerializeObject(obj), true);

                var alertNewsFeedObject = JsonConvert.DeserializeObject <List <AlertNewsFeed> >(alertNewsFeedString);
                return(alertNewsFeedObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
        public static async Task <AlertNewsFeed> GetAlertById(int appliedEntityId, int alertId)
        {
            try
            {
                string _apiRelativeUrl     = string.Format(apiAlertNewsFeedDetails, appliedEntityId, alertId);
                var    alertNewsFeedString = await MaestroHttpClientRequest.GetAsync(_apiRelativeUrl);

                var alertNewsFeedObject = JsonConvert.DeserializeObject <AlertNewsFeed>(alertNewsFeedString);
                return(alertNewsFeedObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        /// <summary>
        /// Gets the logged in user info.
        /// </summary>
        /// <returns>The logged in user info.</returns>
        public static async Task <UserProfile> GetLoggedInUserInfo()
        {
            try
            {
                // Calling the Get Request to Get the User Logged in User Info
                var userInfoString = await MaestroHttpClientRequest.GetAsync(apiUserInfoRelativePath);

                // Converting the String response to Object
                var userInfoObject = JsonConvert.DeserializeObject <UserProfile>(userInfoString);

                // Returning the data
                return(userInfoObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        public static async Task <LoginToken> AuthenticateUser(LoginRequest objLoginRequest)
        {
            try
            {
                var objLoginRequestDictionary = new Dictionary <string, string>();
                objLoginRequestDictionary.Add("grant_type", objLoginRequest.grant_type);
                objLoginRequestDictionary.Add("username", objLoginRequest.username);
                objLoginRequestDictionary.Add("password", objLoginRequest.password);


                var loginTokenString = await MaestroHttpClientRequest.PostAsFormUrlAsync(apiAuthenticateRelativePath,
                                                                                         objLoginRequestDictionary);

                var loginTokenObject = JsonConvert.DeserializeObject <LoginToken>(loginTokenString);

                return(loginTokenObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }