/// <summary>
        /// Gets group's contacts list
        /// </summary>
        /// <param name="ShortName">group short name</param>
        /// <returns></returns>
        public ResponseObjects.ApiResponse <List <ContactJson> > GetContactList(string ShortName)
        {
            Dictionary <string, string> UrlParameters = new Dictionary <string, string>();

            UrlParameters.Add("short_name", ShortName);

            ResponseObjects.ApiResponse <List <ContactJson> > serverResponse = this.RequestToApi <List <ContactJson> >("groups/" + ShortName + "/contacts", request.get, UrlParameters, null);
            return(serverResponse);
            //object serverResponse = this.RequestToApi("groups/" + ShortName + "/contacts", request.get, UrlParameters, null);
            //if (serverResponse.GetType() == typeof(List<string>))
            //    return serverResponse;
            //else
            //    return JsonConvert.DeserializeObject<List<ContactResponse>>((string)serverResponse);
        }
        /// <summary>
        /// Deletes a group
        /// </summary>
        /// <param name="ShortName">Group short name</param>
        /// <returns></returns>
        public ResponseObjects.ApiResponse <ActionMessageResponse> Delete(string ShortName)
        {
            Dictionary <string, string> UrlParameters = new Dictionary <string, string>();

            UrlParameters.Add("short_name", ShortName);

            ResponseObjects.ApiResponse <ActionMessageResponse> serverResponse = this.RequestToApi <ActionMessageResponse>("groups/" + ShortName, request.delete, UrlParameters, null);
            return(serverResponse);
            //object serverResponse = this.RequestToApi("groups/" + ShortName, request.delete, UrlParameters, null);
            //if (serverResponse.GetType() == typeof(List<string>))
            //    return serverResponse;
            //else
            //    return JsonConvert.DeserializeObject<ActionMessageResponse>((string)serverResponse);
        }
        /// <summary>
        /// Gets the messages log
        /// </summary>
        /// <param name="StartDate">FROM this date</param>
        /// <param name="EndDate">TO this date</param>
        /// <param name="Start">From this message on the list</param>
        /// <param name="Limit">Maximun number of records</param>
        /// <param name="Msisdn">Country code and phone number</param>
        /// <param name="ShortName">Filter all messages sent to specified group's short_name</param>
        /// <param name="Include_Recipients">If true it will include the list of recipients for each message</param>
        /// <returns>Object with the message list</returns>
        public ResponseObjects.ApiResponse <List <MessageResponse> > GetList(DateTime?StartDate = null, DateTime?EndDate = null, Int32 Start = -1, Int32 Limit = -1, String Msisdn = null, String ShortName = null, Boolean IncludeRecipients = false, MessageDirection Direction = MessageDirection.MT, String Username = null)
        {
            Dictionary <string, string> UrlParameters = new Dictionary <string, string>();

            if (StartDate.HasValue)
            {
                UrlParameters.Add("start_date", StartDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (EndDate.HasValue)
            {
                UrlParameters.Add("end_date", EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            if (Start != -1)
            {
                UrlParameters.Add("start", Start.ToString());
            }
            if (Limit != -1)
            {
                UrlParameters.Add("limit", Limit.ToString());
            }
            if (Msisdn != null)
            {
                UrlParameters.Add("msisdn", Msisdn);
            }
            if (ShortName != null)
            {
                UrlParameters.Add("short_name", ShortName);
            }
            if (Username != null)
            {
                UrlParameters.Add("user", Username);
            }
            UrlParameters.Add("direction", Direction.ToString().ToUpper());
            UrlParameters.Add("include_recipients", IncludeRecipients.ToString().ToLower());

            ResponseObjects.ApiResponse <List <MessageResponse> > serverResponse = this.RequestToApi <List <MessageResponse> >("messages", request.get, UrlParameters, null, true);
            return(serverResponse);

            //object serverResponse = this.RequestToApi("messages", request.get, UrlParameters, null, true);
            //if (serverResponse.GetType() == typeof(List<string>))
            //    return serverResponse;
            //else
            //    return JsonConvert.DeserializeObject<List<MessageResponse>>((string)serverResponse);
        }
        /// <summary>
        /// Creates a new group
        /// </summary>
        /// <param name="ShortName">Group short name</param>
        /// <param name="Name">Group name</param>
        /// <param name="Description">Group description</param>
        /// <returns></returns>
        public ResponseObjects.ApiResponse <ActionMessageResponse> Add(string ShortName, string Name, string Description)
        {
            Dictionary <string, string>  UrlParameters = new Dictionary <string, string>();
            Dictionary <string, dynamic> Parameters    = new Dictionary <string, dynamic>();

            UrlParameters.Add("short_name", ShortName);

            Parameters.Add("name", Name);
            Parameters.Add("description", Description);
            Parameters.Add("short_name", ShortName);

            ResponseObjects.ApiResponse <ActionMessageResponse> serverResponse = this.RequestToApi <ActionMessageResponse>("groups/" + ShortName, request.post, UrlParameters, Parameters);
            return(serverResponse);
            //object serverResponse = this.RequestToApi("groups/" + ShortName, request.post, UrlParameters, Parameters);
            //if (serverResponse.GetType() == typeof(List<string>))
            //    return serverResponse;
            //else
            //    return JsonConvert.DeserializeObject<ActionMessageResponse>((string)serverResponse);
        }
        /// <summary>
        /// Adds a new schedule messsage
        /// </summary>
        /// <param name="StartDate">Start sending messages FROM this date</param>
        /// <param name="EndDate">Send messages UNTIL this date</param>
        /// <param name="Name">Schedule message's name</param>
        /// <param name="Message">Message content</param>
        /// <param name="Time">Hour to send the message Ex. 09.00</param>
        /// <param name="Frequency">How often send the message Ex. ONCE</param>
        /// <param name="Groups">String array with the groups' short names where to send to the message</param>
        /// <returns>Object with schedule message info</returns>
        public ResponseObjects.ApiResponse <ActionMessageResponse> AddSchedule(DateTime StartDate, DateTime EndDate, String Name, String Message, String Time, String Frequency, String[] Groups)
        {
            Dictionary <string, dynamic> Parameters = new Dictionary <string, dynamic>();

            Parameters.Add("start_date", StartDate.ToString("yyyy-MM-dd"));
            Parameters.Add("end_date", EndDate.ToString("yyyy-MM-dd"));
            Parameters.Add("name", Name);
            Parameters.Add("message", Message);
            Parameters.Add("time", Time);
            Parameters.Add("frequency", Frequency.ToUpper());
            Parameters.Add("groups", Groups);

            ResponseObjects.ApiResponse <ActionMessageResponse> serverResponse = this.RequestToApi <ActionMessageResponse>("messages/scheduled", request.post, null, Parameters);
            return(serverResponse);
            //object serverResponse = this.RequestToApi("messages/scheduled", request.post, null, Parameters);
            //if (serverResponse.GetType() == typeof(List<string>))
            //    return serverResponse;
            //else
            //    return JsonConvert.DeserializeObject<ActionMessageResponse>((string)serverResponse);
        }
        /// <summary>
        /// Sends a message to a specific contact
        /// </summary>
        /// <param name="Msisdn">country code and phone number</param>
        /// <param name="Message">Messages content</param>
        /// <param name="Id">Id content</param>
        /// <returns>Object with message info</returns>
        public ResponseObjects.ApiResponse <MessageResponse> SendToContact(String Msisdn, String Message, String Id = null)
        {
            Dictionary <string, dynamic> Parameters = new Dictionary <string, dynamic>();

            Parameters.Add("msisdn", Msisdn);
            Parameters.Add("message", Message);
            if (Id != null)
            {
                Parameters.Add("id", Id);
            }

            ResponseObjects.ApiResponse <MessageResponse> serverResponse = this.RequestToApi <MessageResponse>("messages/send_to_contact", request.post, null, Parameters);
            return(serverResponse);

            //object serverResponse = this.RequestToApi("messages/send_to_contact", request.post, null, Parameters);
            //if (serverResponse.GetType() == typeof(List<string>))
            //    return serverResponse;
            //else
            //    return JsonConvert.DeserializeObject<MessageToGroupResponse>((string)serverResponse);
        }