The Tag API
Inheritance: InstaSharp.Endpoints.InstagramApi
        public override async Task ExecuteAsync(string receiver, WebHookHandlerContext context)
        {
            var client = Dependencies.Client;
            var notifications = context.GetDataOrDefault<IEnumerable<InstagramNotification>>();

            var repo = new UserRepository();
            var user = await repo.GetUser("steve");
            var config = Dependencies.GetConfig(context.Request.RequestUri);

            var media = new Tags(config, new InstaSharp.Models.Responses.OAuthResponse
            {
                AccessToken = user.InstagramAccessToken,
                User = new InstaSharp.Models.UserInfo
                {
                    Username = "******"
                }
            });

            var result = await media.Recent(notifications.First().ObjectId);

            foreach (var image in result.Data)
            {
                hubContext.Value.Clients.All.showImage(image.Images.LowResolution.Url, image.User.Username, image.Caption.Text);
            }
            
            return;
        }
Esempio n. 2
0
 public RecentMediaController(ILogger log, InstagramConfig config, ISubscriptionRepository subscriptions)
 {
     _geoEndpoint = new Geographies(config);
     _tagEndpoint = new Tags(config);
     _config = config;
     _log = log;
     _subscriptions = subscriptions;
 }