Пример #1
0
        /// <summary>
        /// Creates a rich menu.
        /// </summary>
        /// <param name="richMenu">The rich menu represented as a rich menu object.</param>
        /// <returns>.</returns>
        public async Task <string?> CreateRichMenu(RichMenu richMenu)
        {
            Guard.NotNull(nameof(richMenu), richMenu);

            richMenu.Validate();

            var content = CreateStringContent(richMenu);

            var response = await _client.PostAsync($"richmenu", content).ConfigureAwait(false);

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

            var richMenuIdResponse = await response.Content.DeserializeObject <RichMenuIdResponse>().ConfigureAwait(false);

            return(richMenuIdResponse?.RichMenuId);
        }
Пример #2
0
        /// <summary>
        /// Creates a rich menu.
        /// </summary>
        /// <param name="richMenu">The rich menu represented as a rich menu object.</param>
        /// <returns>.</returns>
        public async Task <string> CreateRichMenu(RichMenu richMenu)
        {
            Guard.NotNull(nameof(richMenu), richMenu);

            richMenu.Validate();

            var content = CreateStringContent(richMenu);

            var response = await _client.PostAsync($"richmenu", content);

            await response.CheckResult();

            var stringResponseResult = await response.Content.ReadAsStringAsync();

            var objectResult = JsonConvert.DeserializeObject <RichMenuIdResponse>(stringResponseResult);

            return(objectResult.RichMenuId);
        }