Example #1
0
 /// <summary>
 /// Get list of users(with minified data) who match with specified query.
 /// </summary>
 /// <exception cref="Exceptions.InstagramAPICallException">Instagram api exception.</exception>
 public static List <Models.IMinifiedUser> GetUsers(ISearchUserParameters _params)
 {
     try
     {
         return(searchQueryExecutor.SearchUsers(_params));
     }
     catch (Exceptions.InstagramAPICallException e)
     {
         throw e;
     }
 }
        /// <summary>
        /// Return a list of users who match with the specified query. (MinifiedUser)
        /// </summary>
        /// <exception cref="Exceptions.InstagramAPICallException">Authorization error related to application.</exception>
        public List <IMinifiedUser> SearchUsers(ISearchUserParameters _params)
        {
            try
            {
                // If no parameters or not query -> Invalid request
                if (_params == null)
                {
                    return(null);
                }
                if (_params.Query == null)
                {
                    return(null);
                }

                // No count
                if (_params.Count == null)
                {
                    return(userJsonController.MapJsonToMinifiedUsers(UserEndPoint.
                                                                     ApiCallSearch(_params.Query)));
                }
                // With count
                else
                {
                    return(userJsonController.MapJsonToMinifiedUsers(UserEndPoint.
                                                                     ApiCallSearch(_params.Query, _params.Count.Value)));
                }
            }
            catch (Exceptions.InstagramAPICallException e)
            {
                throw e;
            }
            catch (Exception)
            {
                return(null);
            }
        }