BotStateExtensions.cs
1 // Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
2 // Changes may cause incorrect behavior and will be lost if the code is
3 // regenerated.
4 
5 namespace Microsoft.Bot.Connector
6 {
7  using System;
8  using System.Collections;
9  using System.Collections.Generic;
10  using System.Threading;
11  using System.Threading.Tasks;
12  using Microsoft.Rest;
13 
14 
18  public static partial class BotStateExtensions
19  {
33  public static BotData GetUserData(this IBotState operations, string channelId, string userId)
34  {
35  return Task.Factory.StartNew(s => ((IBotState)s).GetUserDataAsync(channelId, userId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
36  }
37 
54  public static async Task<BotData> GetUserDataAsync(this IBotState operations, string channelId, string userId, CancellationToken cancellationToken = default(CancellationToken))
55  {
56  using (var _result = await operations.GetUserDataWithHttpMessagesAsync(channelId, userId, null, cancellationToken).ConfigureAwait(false))
57  {
58  return await _result.HandleErrorAsync<BotData>().ConfigureAwait(false);
59  }
60  }
61 
78  public static BotData SetUserData(this IBotState operations, string channelId, string userId, BotData botData)
79  {
80  return Task.Factory.StartNew(s => ((IBotState)s).SetUserDataAsync(channelId, userId, botData), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
81  }
82 
102  public static async Task<BotData> SetUserDataAsync(this IBotState operations, string channelId, string userId, BotData botData, CancellationToken cancellationToken = default(CancellationToken))
103  {
104  using (var _result = await operations.SetUserDataWithHttpMessagesAsync(channelId, userId, botData, null, cancellationToken).ConfigureAwait(false))
105  {
106  return await _result.HandleErrorAsync<BotData>().ConfigureAwait(false);
107  }
108  }
109 
124  public static string[] DeleteStateForUser(this IBotState operations, string channelId, string userId)
125  {
126  return Task.Factory.StartNew(s => ((IBotState)s).DeleteStateForUserAsync(channelId, userId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
127  }
128 
146  public static async Task<string[]> DeleteStateForUserAsync(this IBotState operations, string channelId, string userId, CancellationToken cancellationToken = default(CancellationToken))
147  {
148  using (var _result = await operations.DeleteStateForUserWithHttpMessagesAsync(channelId, userId, null, cancellationToken).ConfigureAwait(false))
149  {
150  return await _result.HandleErrorAsync<string[]>().ConfigureAwait(false);
151  }
152  }
153 
167  public static BotData GetConversationData(this IBotState operations, string channelId, string conversationId)
168  {
169  return Task.Factory.StartNew(s => ((IBotState)s).GetConversationDataAsync(channelId, conversationId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
170  }
171 
188  public static async Task<BotData> GetConversationDataAsync(this IBotState operations, string channelId, string conversationId, CancellationToken cancellationToken = default(CancellationToken))
189  {
190  using (var _result = await operations.GetConversationDataWithHttpMessagesAsync(channelId, conversationId, null, cancellationToken).ConfigureAwait(false))
191  {
192  return await _result.HandleErrorAsync<BotData>().ConfigureAwait(false);
193  }
194  }
195 
212  public static BotData SetConversationData(this IBotState operations, string channelId, string conversationId, BotData botData)
213  {
214  return Task.Factory.StartNew(s => ((IBotState)s).SetConversationDataAsync(channelId, conversationId, botData), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
215  }
216 
236  public static async Task<BotData> SetConversationDataAsync(this IBotState operations, string channelId, string conversationId, BotData botData, CancellationToken cancellationToken = default(CancellationToken))
237  {
238  using (var _result = await operations.SetConversationDataWithHttpMessagesAsync(channelId, conversationId, botData, null, cancellationToken).ConfigureAwait(false))
239  {
240  return await _result.HandleErrorAsync<BotData>().ConfigureAwait(false);
241  }
242  }
243 
260  public static BotData GetPrivateConversationData(this IBotState operations, string channelId, string conversationId, string userId)
261  {
262  return Task.Factory.StartNew(s => ((IBotState)s).GetPrivateConversationDataAsync(channelId, conversationId, userId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
263  }
264 
284  public static async Task<BotData> GetPrivateConversationDataAsync(this IBotState operations, string channelId, string conversationId, string userId, CancellationToken cancellationToken = default(CancellationToken))
285  {
286  using (var _result = await operations.GetPrivateConversationDataWithHttpMessagesAsync(channelId, conversationId, userId, null, cancellationToken).ConfigureAwait(false))
287  {
288  return await _result.HandleErrorAsync<BotData>().ConfigureAwait(false);
289  }
290  }
291 
311  public static BotData SetPrivateConversationData(this IBotState operations, string channelId, string conversationId, string userId, BotData botData)
312  {
313  return Task.Factory.StartNew(s => ((IBotState)s).SetPrivateConversationDataAsync(channelId, conversationId, userId, botData), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
314  }
315 
338  public static async Task<BotData> SetPrivateConversationDataAsync(this IBotState operations, string channelId, string conversationId, string userId, BotData botData, CancellationToken cancellationToken = default(CancellationToken))
339  {
340  using (var _result = await operations.SetPrivateConversationDataWithHttpMessagesAsync(channelId, conversationId, userId, botData, null, cancellationToken).ConfigureAwait(false))
341  {
342  return await _result.HandleErrorAsync<BotData>().ConfigureAwait(false);
343  }
344  }
345 
346  }
347 }
static BotData GetConversationData(this IBotState operations, string channelId, string conversationId)
GetConversationData
Task< HttpOperationResponse< object > > DeleteStateForUserWithHttpMessagesAsync(string channelId, string userId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
DeleteStateForUser
static async Task< BotData > GetPrivateConversationDataAsync(this IBotState operations, string channelId, string conversationId, string userId, CancellationToken cancellationToken=default(CancellationToken))
GetPrivateConversationData
Task< HttpOperationResponse< object > > SetPrivateConversationDataWithHttpMessagesAsync(string channelId, string conversationId, string userId, BotData botData, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
SetPrivateConversationData
static BotData GetUserData(this IBotState operations, string channelId, string userId)
GetUserData
static async Task< BotData > SetPrivateConversationDataAsync(this IBotState operations, string channelId, string conversationId, string userId, BotData botData, CancellationToken cancellationToken=default(CancellationToken))
SetPrivateConversationData
Task< HttpOperationResponse< object > > GetUserDataWithHttpMessagesAsync(string channelId, string userId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
GetUserData
static BotData SetConversationData(this IBotState operations, string channelId, string conversationId, BotData botData)
SetConversationData
Task< HttpOperationResponse< object > > GetPrivateConversationDataWithHttpMessagesAsync(string channelId, string conversationId, string userId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
GetPrivateConversationData
static async Task< string[]> DeleteStateForUserAsync(this IBotState operations, string channelId, string userId, CancellationToken cancellationToken=default(CancellationToken))
DeleteStateForUser
static BotData SetUserData(this IBotState operations, string channelId, string userId, BotData botData)
SetUserData
static async Task< BotData > GetConversationDataAsync(this IBotState operations, string channelId, string conversationId, CancellationToken cancellationToken=default(CancellationToken))
GetConversationData
static BotData SetPrivateConversationData(this IBotState operations, string channelId, string conversationId, string userId, BotData botData)
SetPrivateConversationData
static async Task< BotData > SetConversationDataAsync(this IBotState operations, string channelId, string conversationId, BotData botData, CancellationToken cancellationToken=default(CancellationToken))
SetConversationData
Task< HttpOperationResponse< object > > GetConversationDataWithHttpMessagesAsync(string channelId, string conversationId, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
GetConversationData
BotState operations.
Definition: IBotState.cs:18
Extension methods for BotState.
Task< HttpOperationResponse< object > > SetUserDataWithHttpMessagesAsync(string channelId, string userId, BotData botData, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
SetUserData
static async Task< BotData > GetUserDataAsync(this IBotState operations, string channelId, string userId, CancellationToken cancellationToken=default(CancellationToken))
GetUserData
Task< HttpOperationResponse< object > > SetConversationDataWithHttpMessagesAsync(string channelId, string conversationId, BotData botData, Dictionary< string, List< string >> customHeaders=null, CancellationToken cancellationToken=default(CancellationToken))
SetConversationData
static string[] DeleteStateForUser(this IBotState operations, string channelId, string userId)
DeleteStateForUser
static BotData GetPrivateConversationData(this IBotState operations, string channelId, string conversationId, string userId)
GetPrivateConversationData
static async Task< BotData > SetUserDataAsync(this IBotState operations, string channelId, string userId, BotData botData, CancellationToken cancellationToken=default(CancellationToken))
SetUserData