Ejemplo n.º 1
0
 /// <summary>
 /// Returns authenticated user's liked media.
 /// </summary>
 /// <exception cref="Exceptions.InstagramAPICallException">Application authorization error.</exception>
 public List <IMedia> GetUserLikedMedia(int count = 0)
 {
     try
     {
         if (count != 0)
         {
             return(mediaJsonController
                    .MapJsonToMedias(UserEndPoint.APICall("self/media/liked",
                                                          new Dictionary <string, string>()
             {
                 { "count", count.ToString() }
             })));
         }
         else
         {
             return(mediaJsonController
                    .MapJsonToMedias(UserEndPoint.APICall("self/media/liked")));
         }
     }
     catch (Exceptions.InstagramAPICallException e)
     {
         throw new Exceptions.InstagramAPICallException(e.ToString());
     }
     catch (Exception)
     {
         return(null);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns the profile of the user with id "id".
 /// </summary>
 /// <exception cref="Exceptions.InstagramAPICallException">Application authorization error.</exception>
 public Models.IUser GetUserProfile(long id)
 {
     try
     {
         return(userJsonController
                .MapJsonToUser(UserEndPoint.APICall(id.ToString())));
     }
     catch (Exceptions.InstagramAPICallException e)
     {
         throw new Exceptions.InstagramAPICallException(e.ToString());
     }
     catch (Exception)
     {
         return(null);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Make the api call to get authenticated user.
 /// If api call is incorrect returns null.
 /// </summary>
 /// <returns>Authenticated User</returns>
 /// <exception cref="Exceptions.InstagramAPICallException">Application authorization error.</exception>
 public Models.IUser GetAuthenticatedUser()
 {
     try
     {
         return(userJsonController
                .MapJsonToUser(UserEndPoint.APICall("self")));
     }
     catch (Exceptions.InstagramAPICallException e)
     {
         throw new Exceptions.InstagramAPICallException(e.ToString());
     }
     catch (Exception)
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns a list with recent media of specified user.
 /// </summary>
 /// <exception cref="Exceptions.InstagramAPICallException">Application authorization error.</exception>
 public List <Models.IMedia> GetUserRecentMedia(IUsersQueryParameters parameter = null)
 {
     try
     {
         // Some parameters specified
         if (parameter != null)
         {
             // With only count
             if (parameter.Count != null)
             {
                 return(mediaJsonController
                        .MapJsonToMedias(UserEndPoint.APICall(parameter.Id.ToString() + "/media/recent",
                                                              new Dictionary <string, string>()
                 {
                     { "count", parameter.Count.Value.ToString() }
                 })));
             }
             // With count and id
             else
             {
                 return(mediaJsonController
                        .MapJsonToMedias(UserEndPoint.APICall(parameter.Id.ToString() + "/media/recent",
                                                              new Dictionary <string, string>()
                 {
                     { "count", parameter.Count.Value.ToString() }
                 })));
             }
         }
         // No parameters
         return(mediaJsonController
                .MapJsonToMedias(UserEndPoint.APICall("self/media/recent")));
     }
     catch (Exceptions.InstagramAPICallException e)
     {
         throw new Exceptions.InstagramAPICallException(e.ToString());
     }
     catch (Exception)
     {
         return(null);
     }
 }