-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIGraphFriendSystem.cs
101 lines (81 loc) · 3.37 KB
/
IGraphFriendSystem.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
91
92
93
94
95
96
97
98
99
100
101
using System;
using System.Collections.Generic;
using NFX.Glue;
using NFX.DataAccess.Distributed;
using Agni.Contracts;
namespace Agni.Social.Graph
{
/// <summary>
/// Handles the social graph functionality that deals with friend connection, friend list tagging and connection approval
/// </summary>
[Glued]
[LifeCycle(ServerInstanceMode.Singleton)]
public interface IGraphFriendSystem : IAgniService
{
/// <summary>
/// Returns an enumeration of friend list ids for the particular node
/// </summary>
IEnumerable<string> GetFriendLists(GDID gNode);
/// <summary>
/// Adds a new friend list id for the particular node. The list id may not contain commas
/// </summary>
GraphChangeStatus AddFriendList(GDID gNode, string list, string description);
/// <summary>
/// Removes friend list id for the particular node
/// </summary>
GraphChangeStatus DeleteFriendList(GDID gNode, string list);
/// <summary>
/// Returns an enumeration of FriendConnection{GraphNode, approve date, direction, groups}
/// </summary>
IEnumerable<FriendConnection> GetFriendConnections(FriendQuery query);
/// <summary>
/// Adds a bidirectional friend connection between gNode and gFriendNode
/// If friend connection already exists updates the approve/ban stamp by the receiving party (otherwise approve is ignored)
/// If approve==null then no stamps are set, if true connection is approved given that gNode is not the one who initiated the connection,
/// false then connection is banned given that gNode is not the one who initiated the connection
/// </summary>
GraphChangeStatus AddFriend(GDID gNode, GDID gFriendNode, bool? approve);
/// <summary>
/// Assigns lists to the gNode (the operation is unidirectional - it only assigns the lists on the gNode).
/// Lists is a comma-separated list of friend list ids
/// </summary>
GraphChangeStatus AssignFriendLists(GDID gNode, GDID gFriendNode, string lists);
/// <summary>
/// Deletes friend connections. The operation drops both connections from node and friend
/// </summary>
GraphChangeStatus DeleteFriend(GDID gNode, GDID gFriendNode);
}
/// <summary>
/// Represents query parameters sent to IGraphFriendSystem.GetFriendConnections(query)
/// </summary>
public struct FriendQuery
{
public FriendQuery(GDID gNode, FriendStatusFilter status, string orgQry, string lists, int fetchStart, int fetchCount)
{
G_Node = gNode;
Status = status;
OriginQuery = orgQry;
Lists = lists;
FetchStart = fetchStart;
FetchCount = fetchCount;
}
/// <summary>Node for which friends are returned</summary>
public readonly GDID G_Node;
public readonly FriendStatusFilter Status;
/// <summary>Pass expression with * to search by name</summary>
public readonly string OriginQuery;
/// <summary>A comma-delimited list of friend list ids, null = all</summary>
public readonly string Lists;
/// <summary>From what position to start fetching</summary>
public readonly int FetchStart;
/// <summary>How many records to fetch</summary>
public readonly int FetchCount;
}
/// <summary>
/// Contract for client of IGraphFriendSystem svc
/// </summary>
public interface IGraphFriendSystemClient : IAgniServiceClient, IGraphFriendSystem
{
//todo Add async versions
}
}