Example #1
0
        public object Any(Search request)
        {
            ///

            var results = new List <Comment>();

            Skybrud.Social.Instagram.InstagramService service = Skybrud.Social.Instagram.InstagramService.CreateFromOAuthClient(new InstagramOAuthClient
            {
                AccessToken = "281166601.ae390ad.f16a68e5d161400a88f124dd07690b36"
            });

            // Temporary list for storing the retrieved media
            List <InstagramMedia> temp = new List <InstagramMedia>();

            // Declare the initial options
            InstagramTagRecentMediaOptions options = new InstagramTagRecentMediaOptions
            {
                Count = 10
            };

            // Make the call to the API for the first page
            InstagramRecentMediaResponse response  = service.Tags.GetRecentMedia(request.Keyword, 200);
            InstagramSearchTagsResponse  response2 = service.Tags.Search(request.Keyword);

            // Add the media to the list
            temp.AddRange(response.Body.Data);

            // No reason to make another request if the first request didn't return any media
            if (temp.Count != 0)
            {
                // Update the options
                options.MaxTagId = response.Body.Pagination.NextMaxId;

                // Make another call to the Instagram API
                response = service.Tags.GetRecentMedia("allblacks", 200, options.MaxTagId);

                // Add the media to the list
                temp.AddRange(response.Body.Data);
            }


            foreach (InstagramMedia media in temp)
            {
                results.Add(new Comment {
                    Description = media.CaptionText, Provider = "Instagram"
                });
            }

            foreach (InstagramTag tag in response2.Body.Data)
            {
                results.Add(new Comment {
                    Description = tag.Name, Provider = "Instagram"
                });
            }


            return(results);
        }
Example #2
0
 /// <summary>
 /// Search for media in a given area. The default time span is set to 5 days. The time span must not
 /// exceed 7 days. Defaults time stamps cover the last 5 days. Can return mix of image and video types.
 /// </summary>
 /// <param name="options">The search options.</param>
 public InstagramRecentMediaResponse Search(InstagramRecentMediaSearchOptions options)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.Search(options)));
 }
Example #3
0
 /// <summary>
 /// Search for media in a given area. The default time span is set to 5 days. Can return mix of image
 /// and video types.
 /// </summary>
 /// <param name="latitude">The latitude of the point.</param>
 /// <param name="longitude">The longitude of the point.</param>
 /// <param name="distance">The distance/radius in meters. The API allows a maximum radius of 5000 meters.</param>
 public InstagramRecentMediaResponse Search(double latitude, double longitude, int distance)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.Search(latitude, longitude, distance)));
 }
 /// <summary>
 /// Gets a list of media from the specified <code>tag</code>.
 /// </summary>
 /// <param name="tag">The name of the tag.</param>
 /// <param name="minTagId"></param>
 /// <param name="maxTagId"></param>
 public InstagramRecentMediaResponse GetRecentMedia(string tag, string minTagId = null, string maxTagId = null)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia(tag, minTagId, maxTagId)));
 }
 /// <summary>
 /// Gets the the most recent media of the authenticated user.
 /// </summary>
 /// <param name="options">The search options with any optional parameters.</param>
 public InstagramRecentMediaResponse GetRecentMedia(InstagramUserRecentMediaOptions options)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia("self", options).Body));
 }
 /// <summary>
 /// Gets the most recent media of the user with the specified ID.
 /// </summary>
 /// <param name="userId">The ID of the user.</param>
 /// <param name="options">The search options with any optional parameters.</param>
 public InstagramRecentMediaResponse GetRecentMedia(long userId, InstagramUserRecentMediaOptions options)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia(userId + "", options).Body));
 }
Example #7
0
 /// <summary>
 /// Gets the most recent media of the user with the specified ID.
 /// </summary>
 /// <param name="userId">The ID of the user.</param>
 /// <param name="options">The search options with any optional parameters.</param>
 public InstagramRecentMediaResponse GetRecentMedia(long userId, InstagramMediaSearchOptions options)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia(userId, options)));
 }
Example #8
0
 /// <summary>
 /// Gets the most recent media of the user with the specified ID.
 /// </summary>
 /// <param name="userId">The ID of the user.</param>
 /// <param name="count">Count of media to return.</param>
 public InstagramRecentMediaResponse GetRecentMedia(long userId, int count)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia(userId, count)));
 }
Example #9
0
 /// <summary>
 /// The the most recent media of the authenticated user.
 /// </summary>
 public InstagramRecentMediaResponse GetRecentMedia()
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia()));
 }
Example #10
0
 /// <summary>
 /// Get a list of recent media objects from a given location.
 /// </summary>
 /// <param name="locationId">The ID of the location.</param>
 public InstagramRecentMediaResponse GetRecentMedia(int locationId)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia(locationId)));
 }
 /// <summary>
 /// Get a list of recent media objects from a given location.
 /// </summary>
 /// <param name="locationId">The ID of the location.</param>
 /// <param name="options">The options for the search.</param>
 public InstagramRecentMediaResponse GetRecentMedia(int locationId, InstagramLocationSearchOptions options)
 {
     return(InstagramRecentMediaResponse.ParseJson(Raw.GetRecentMedia(locationId, options)));
 }