<commit_before>﻿using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using System.Text;
using System.Xml.Linq;
using System.Xml.XPath;

namespace Sms.ApiClient.V2.SendMessages
{
	public class SendMessagesClient : ISendMessagesClient
	{
		public static readonly string CodeStamp = "Official SendMessages Client " + ClientUtils.VersionNumber;

		private readonly string _apiKey;
		private readonly string _postUrl;
		private readonly ISendMessagesRequestBuilder _requestBuilder;

		public SendMessagesClient(string apiKey, string postUrl, ISendMessagesRequestBuilder requestBuilder)
		{
			_apiKey = apiKey;
			_postUrl = postUrl;
			_requestBuilder = requestBuilder;
		}

		public SendMessagesResponse SendMessages(List<ISmsMessage> messages, string messageStatusCallbackUrl)
		{
			var xml = _requestBuilder.BuildPostXmlData(messages: messages, apiKey: _apiKey, messageStatusCallbackUrl: messageStatusCallbackUrl);
			using (var client = new WebClient())
			{
				var responseBytes = client.UploadValues(_postUrl, new NameValueCollection()
				{
					{"xml", xml}
				});
				string responseString = Encoding.UTF8.GetString(responseBytes);
				int errorCode;
				if (int.TryParse(responseString, out errorCode))
					throw new SendMessageException(errorCode);

				var replyDoc = XDocument.Parse(responseString);

				// Parse response
				var replyElements = replyDoc.Root.XPathSelectElements("./recipient").ToList();
				var messageIds = new List<MsisdnAndMessageId>(replyElements.Count);
				foreach (var replyElement in replyElements)
				{
					messageIds.Add(new MsisdnAndMessageId(msisdn: replyElement.Attribute(XName.Get("msisdn")).Value, messageId: replyElement.Attribute(XName.Get("id")).Value));
				}
				return new SendMessagesResponse(messageIds);
			}
		}<commit_msg>Removed unused variable<commit_after>﻿using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using System.Text;
using System.Xml.Linq;
using System.Xml.XPath;

namespace Sms.ApiClient.V2.SendMessages
{
	public class SendMessagesClient : ISendMessagesClient
	{
		public static readonly string CodeStamp = "Official SendMessages Client " + ClientUtils.VersionNumber;

		private readonly string _apiKey;
		private readonly string _postUrl;
		private readonly ISendMessagesRequestBuilder _requestBuilder;

		public SendMessagesClient(string apiKey, string postUrl, ISendMessagesRequestBuilder requestBuilder)
		{
			_apiKey = apiKey;
			_postUrl = postUrl;
			_requestBuilder = requestBuilder;
		}

		public SendMessagesResponse SendMessages(List<ISmsMessage> messages, string messageStatusCallbackUrl)
		{
			var xml = _requestBuilder.BuildPostXmlData(messages: messages, apiKey: _apiKey, messageStatusCallbackUrl: messageStatusCallbackUrl);
			using (var client = new WebClient())
			{
				var responseBytes = client.UploadValues(_postUrl, new NameValueCollection()
				{
					{"xml", xml}
				});
				string responseString = Encoding.UTF8.GetString(responseBytes);
				int errorCode;
				if (int.TryParse(responseString, out errorCode))
					throw new SendMessageException(errorCode);

				var replyDoc = XDocument.Parse(responseString);
				// Parse response
				var replyElements = replyDoc.Root.XPathSelectElements("./recipient").ToList();
				var messageIds = new List<MsisdnAndMessageId>(replyElements.Count);
				foreach (var replyElement in replyElements)
				{
					messageIds.Add(new MsisdnAndMessageId(msisdn: replyElement.Attribute(XName.Get("msisdn")).Value, messageId: replyElement.Attribute(XName.Get("id")).Value));
				}
				return new SendMessagesResponse(messageIds);
			}
		}
{'fraction_non_alphanumeric': 0.08955223880597014, 'fraction_numerical': 0.001085481682496608, 'mean_word_length': 5.1433333333333335, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7654108', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1026, 'n_words': 236}