Esempio n. 1
0
        /// <summary>
        /// Creates a new <see cref="SkillConversationReference"/>.
        /// </summary>
        /// <param name="options">Creation options to use when creating the <see cref="SkillConversationReference"/>.</param>
        /// <param name="cancellationToken">Cancellation token.</param>
        /// <returns>ID of the created <see cref="SkillConversationReference"/>.</returns>
        public override async Task <string> CreateSkillConversationIdAsync(
            SkillConversationIdFactoryOptions options,
            CancellationToken cancellationToken)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            // Create the storage key based on the SkillConversationIdFactoryOptions.
            var conversationReference = options.Activity.GetConversationReference();

            var skillConversationId = Guid.NewGuid().ToString();

            // Create the SkillConversationReference instance.
            var skillConversationReference = new SkillConversationReference
            {
                ConversationReference = conversationReference,
                OAuthScope            = options.FromBotOAuthScope
            };

            // Store the SkillConversationReference using the skillConversationId as a key.
            var skillConversationInfo = new Dictionary <string, object>
            {
                {
                    skillConversationId, JObject.FromObject(skillConversationReference)
                }
            };

            await _storage.WriteAsync(skillConversationInfo, cancellationToken).ConfigureAwait(false);

            // Return the generated skillConversationId (that will be also used as the conversation ID to call the skill).
            return(skillConversationId);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a conversation id for a skill conversation.
 /// </summary>
 /// <param name="options">A <see cref="SkillConversationIdFactoryOptions"/> instance containing parameters for creating the conversation ID.</param>
 /// <param name="cancellationToken">A cancellation token.</param>
 /// <returns>A unique conversation ID used to communicate with the skill.</returns>
 /// <remarks>
 /// It should be possible to use the returned string on a request URL and it should not contain special characters.
 /// </remarks>
 public virtual Task <string> CreateSkillConversationIdAsync(SkillConversationIdFactoryOptions options, CancellationToken cancellationToken)
 {
     throw new NotImplementedException();
 }