forked from tompaana/bot-message-routing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMessageRouterResult.cs
90 lines (81 loc) · 2.51 KB
/
MessageRouterResult.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using Microsoft.Bot.Connector;
using Underscore.Bot.Models;
namespace Underscore.Bot.MessageRouting
{
public enum MessageRouterResultType
{
NoActionTaken, // No action taken - The result handler should ignore results with this type
OK, // Action taken, but the result handler should ignore results with this type
ConnectionRequested,
ConnectionAlreadyRequested,
ConnectionRejected,
Connected,
Disconnected,
NoAgentsAvailable,
NoAggregationChannel,
FailedToForwardMessage,
Error // Generic error including e.g. null arguments
}
/// <summary>
/// Represents a result of more complex operations executed by MessageRouterManager (when
/// boolean just isn't enough).
///
/// Note that - as this class serves different kind of operations with different kind of
/// outcomes - some of the properties can be null. The type of the result defines which
/// properties are meaningful.
/// </summary>
public class MessageRouterResult
{
public MessageRouterResultType Type
{
get;
set;
}
/// <summary>
/// Activity instance associated with the result.
/// </summary>
public Activity Activity
{
get;
set;
}
/// <summary>
/// A valid ConversationResourceResponse of the newly created direct conversation
/// (between the bot [who will relay messages] and the conversation owner),
/// if the connection was added and a conversation created successfully
/// (MessageRouterResultType is Connected).
/// </summary>
public ConversationResourceResponse ConversationResourceResponse
{
get;
set;
}
public Party ConversationOwnerParty
{
get;
set;
}
public Party ConversationClientParty
{
get;
set;
}
public string ErrorMessage
{
get;
set;
}
/// <summary>
/// Constructor.
/// </summary>
public MessageRouterResult()
{
Type = MessageRouterResultType.NoActionTaken;
ErrorMessage = string.Empty;
}
public override string ToString()
{
return $"[{Type}; {ConversationResourceResponse}; {ConversationOwnerParty}; {ConversationClientParty}; {ErrorMessage}]";
}
}
}