Example #1
0
 public static FB_Poll _from_graphql(JToken data)
 {
     return(new FB_Poll(
                uid: data.get("id")?.Value <string>(),
                title: data.get("title")?.Value <string>() ?? data.get("text")?.Value <string>(),
                options: data.get("options")?.Select((m) => FB_PollOption._from_graphql(m))?.ToList(),
                options_count: data.get("total_count")?.Value <int>() ?? 0));
 }
Example #2
0
        /// <summary>
        /// Fetches list of`PollOption` objects from the poll
        /// </summary>
        /// <returns></returns>
        public async Task <List <FB_PollOption> > fetchOptions()
        {
            /*
             * Fetches list of`PollOption` objects from the poll
             * :rtype: list
             * :raises: FBchatException if request failed
             * */

            var data = new Dictionary <string, object>()
            {
                { "question_id", this.uid }
            };
            var j = await this.session._payload_post("/ajax/mercury/get_poll_options", data);

            return(j.Select((m) => FB_PollOption._from_graphql(m)).ToList());
        }