<commit_before>﻿using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Twilio.Converters
{
    /// <summary>
    /// Convert between strings and a PhoneNumber
    /// </summary>
    public class PhoneNumberConverter : JsonConverter
    {
        /// <summary>
        /// Write value to JsonWriter
        /// </summary>
        /// <param name="writer">Writer to write to</param>
        /// <param name="value">Value to write</param>
        /// <param name="serializer">unsued</param>
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var t = JToken.FromObject(value.ToString());
            t.WriteTo(writer);
        }

        /// <summary>
        /// Convert a string to a PhoneNumber
        /// </summary>
        /// <param name="reader">JsonReader to read from</param>
        /// <param name="objectType">unused</param>
        /// <param name="existingValue">unused</param>
        /// <param name="serializer">unsued</param>
        /// <returns>Converted PhoneNumber</returns>
        public override object ReadJson(
            JsonReader reader,<commit_msg>fix: Exception received if "from" not passed to MessageResource CreateAsync<commit_after>﻿using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Twilio.Converters
{
    /// <summary>
    /// Convert between strings and a PhoneNumber
    /// </summary>
    public class PhoneNumberConverter : JsonConverter
    {
        /// <summary>
        /// Write value to JsonWriter
        /// </summary>
        /// <param name="writer">Writer to write to</param>
        /// <param name="value">Value to write</param>
        /// <param name="serializer">unsued</param>
        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var t = value.ToString() != null
                                            ? JToken.FromObject(value.ToString())
                                            : JValue.CreateNull();
            t.WriteTo(writer);
        }

        /// <summary>
        /// Convert a string to a PhoneNumber
        /// </summary>
        /// <param name="reader">JsonReader to read from</param>
        /// <param name="objectType">unused</param>
        /// <param name="existingValue">unused</param>
        /// <param name="serializer">unsued</param>
        /// <returns>Converted PhoneNumber</returns>
        public override object ReadJson(
            JsonReader reader,
{'fraction_non_alphanumeric': 0.13214990138067062, 'fraction_numerical': 0.0, 'mean_word_length': 1.9976359338061467, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3945514', 'n_tokens_mistral': 631, 'n_tokens_neox': 634, 'n_words': 165}