/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="richMenuId"></param>
 /// <param name="source"></param>
 public ResponseRichMenu(string richMenuId, RichMenu source)
 {
     RichMenuId  = richMenuId;
     Size        = source.Size;
     Selected    = source.Selected;
     Name        = source.Name;
     ChatBarText = source.ChatBarText;
     Areas       = source.Areas;
 }
        // https://developers.line.biz/ja/reference/messaging-api/#rich-menu

        /// <summary>
        /// リッチメニューを作成する
        /// Create a rich menu
        /// https://developers.line.biz/ja/reference/messaging-api/#create-rich-menu
        /// </summary>
        /// <param name="richMenu">RichMenu</param>
        public virtual async Task <string> CreateRichMenuAsync(RichMenu richMenu)
        {
            var request = new HttpRequestMessage(HttpMethod.Post, $"{_uri}/bot/richmenu");
            var content = JsonConvert.SerializeObject(richMenu, _jsonSerializerSettings);

            request.Content = new StringContent(content, Encoding.UTF8, "application/json");

            var response = await _client.SendAsync(request).ConfigureAwait(false);

            await response.EnsureSuccessStatusCodeAsync().ConfigureAwait(false);

            var json = await response.Content.ReadAsStringAsync() ?? throw new Exception();

            var richMenuId = JsonConvert.DeserializeAnonymousType(json, new { richMenuId = "" }) ?? throw new Exception();

            return(richMenuId.richMenuId);
        }
        internal static ResponseRichMenu CreateFrom(dynamic dynamicObject)
        {
            var areas = new List <ActionArea>();

            foreach (var area in dynamicObject?.areas ?? Enumerable.Empty <dynamic>())
            {
                areas.Add(ActionArea.CreateFrom(area));
            }

            var menu = new RichMenu()
            {
                Name        = (string)dynamicObject?.name,
                Size        = new ActionSize((int)(dynamicObject?.size?.width ?? 0), (int)(dynamicObject?.size?.height ?? 0)),
                Selected    = (bool)(dynamicObject?.selected ?? false),
                ChatBarText = (string)dynamicObject?.chatBarText,
                Areas       = areas
            };

            return(new ResponseRichMenu((string)dynamicObject?.richMenuId, menu));
        }