Exemplo n.º 1
0
        public static async Task <bool> GetInbox(string cursorId = null)
        {
            var type      = "inbox";
            var inboxData = new Dictionary <string, string>
            {
                { "persistentBadging", "true" },
                { "use_unified_inbox", "true" }
            };

            if (cursorId != null)
            {
                type = "inbox2";
                inboxData.Add("cursor", cursorId);
            }

            var data = JsonConvert.SerializeObject(inboxData).ToString();

            if (await Request.SendRequestAsync("direct_v2/inbox/", GenerateData.Signature(data), false))
            {
                var arg = JsonConvert.DeserializeObject <Objects.InstagramData.InboxData>(InstaInfo.LastResponse);
                inboxcount += arg.inbox.threads.Count;
                if (arg != null)
                {
                    CallBackInbox.CallbackEventHandler(arg, type);

                    //if (inboxcount < 100 && arg.inbox.oldest_cursor != null)
                    //    await GetInbox(arg.inbox.oldest_cursor);
                }


                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        public static async Task <bool> GetInboxThread(string threadId)
        {
            var inboxData = new Dictionary <string, string>
            {
                { "use_unified_inbox", "true" }
            };

            var data = JsonConvert.SerializeObject(inboxData).ToString();

            if (await Request.SendRequestAsync($"direct_v2/threads/{threadId}/", GenerateData.Signature(data), false))
            {
                var arg = JsonConvert.DeserializeObject <Objects.InstagramData.ThreadData>(InstaInfo.LastResponse);
                if (arg != null)
                {
                    CallBackInbox.CallbackEventHandler(arg, "thread");
                }
                return(true);
            }
            return(false);
        }