public static bool IsMessageSended(Message message, string token)
        {
            string url =
                new RequestUrlFactory(token, message.ChannelId, message.MessageText, message.UserId).SendMessage;

            string json = WebRequestUtility.GetContent(url);

            return(IsMessagesSendedFromJson(json));
        }
Exemple #2
0
        public static ICollection <User> GetUsers(string token)
        {
            var url = new RequestUrlFactory(token);

            string json = WebRequestUtility.GetContent(url.UsersList);

            var users = GetUsersFromJson(json);

            return(users);
        }
Exemple #3
0
        public static ICollection <Channel> GetChannels(string token)
        {
            var url = new RequestUrlFactory(token);

            string json = WebRequestUtility.GetContent(url.ChannelsList);

            var auth = GetChannelsFromJson(json);

            return(auth);
        }
        public static ICollection <Message> GetMessages(string token, string channelId, bool isChannelsMessages = false)
        {
            var factory = new RequestUrlFactory(token, channelId);

            string url = isChannelsMessages ? factory.ChannelHistory : factory.ImHistory;

            string json = WebRequestUtility.GetContent(url);

            var messages = GetMessagesInternal(json);

            return(messages);
        }
Exemple #5
0
        public static AuthResponse GetAuthResponse(string token)
        {
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }

            if (string.IsNullOrWhiteSpace(token))
            {
                throw new ArgumentException(nameof(token));
            }

            var url = new RequestUrlFactory(token);

            string json = WebRequestUtility.GetContent(url.Auth);

            var auth = GetAuthResponseFromJson(json);

            return(auth);
        }
Exemple #6
0
        public static ICollection <Im> GetIms(string token)
        {
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }

            if (string.IsNullOrWhiteSpace(token))
            {
                throw new ArgumentException(nameof(token));
            }

            var url = new RequestUrlFactory(token);

            string json = WebRequestUtility.GetContent(url.ImsList);

            var ims = GetImsFromJson(json);

            return(ims);
        }