class BotFramework::BotState
Public Class Methods
# File lib/bot_framework/bot_state.rb, line 3 def initialize(_service_url) @service_url = 'https://state.botframework.com' end
Public Instance Methods
DeleteStateForUser Delete all data for a user in a channel (UserData and PrivateConversationData) @param channel_id channelId @param user_id id for the user on the channel @param [Hash] opts the optional parameters @return [Array<String>]
# File lib/bot_framework/bot_state.rb, line 13 def delete_state_for_user(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}" api_delete(uri) end
GetConversationData get the bots data for all users in a conversation @param channel_id the channelId @param conversation_id The id for the conversation on the channel @param [Hash] opts the optional parameters @return [BotData]
# File lib/bot_framework/bot_state.rb, line 25 def get_conversation_data(opts = {}) # opts['channel_id'] & opts['conversation_id'] uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}" BotFramework::BotData.new api_get(uri) end
GetPrivateConversationData get bot's data for a single user in a conversation @param channel_id channelId @param conversation_id The id for the conversation on the channel @param user_id id for the user on the channel
# File lib/bot_framework/bot_state.rb, line 36 def get_private_conversation_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}/users/#{opts['user_id']}" BotFramework::BotData.new api_get(uri) end
GetUserData Get a bots data for the user across all conversations @param channel_id channelId @param user_id id for the user on the channel @return [BotData]
# File lib/bot_framework/bot_state.rb, line 47 def get_user_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}" BotFramework::BotData.new api_get(uri) end
SetConversationData Update the bot's data for all users in a conversation @param channel_id channelId @param conversation_id The id for the conversation on the channel @param bot_data the new botdata @return [BotData]
# File lib/bot_framework/bot_state.rb, line 58 def set_conversation_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}" api_post(uri, opts['bot_data']) end
SetPrivateConversationData Update the bot's data for a single user in a conversation @param channel_id channelId @param conversation_id The id for the conversation on the channel @param user_id id for the user on the channel @param bot_data the new botdata @param [Hash] opts the optional parameters @return [BotData]
# File lib/bot_framework/bot_state.rb, line 72 def set_private_conversation_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/conversations/#{opts['conversation_id']}/users/#{opts['user_id']}" api_post(uri, opts['bot_data']) end
SetUserData Update the bot's data for a user @param channel_id channelId @param user_id id for the user on the channel @param bot_data the new botdata @param [Hash] opts the optional parameters @return [BotData]
# File lib/bot_framework/bot_state.rb, line 84 def set_user_data(opts = {}) uri = "/v3/botstate/#{opts['channel_id']}/users/#{opts['user_id']}" api_post(uri, opts['bot_data']) end