Beispiel #1
0
        /// <summary>
        /// Sends the status to the user with targetId in private.
        /// </summary>
        /// <param name="status"></param>
        /// <param name="targetId"></param>
        /// <returns></returns>
        public static async Task <LCStatus> SendPrivately(LCStatus status, string targetId)
        {
            if (status == null)
            {
                throw new ArgumentNullException(nameof(status));
            }
            if (string.IsNullOrEmpty(targetId))
            {
                throw new ArgumentNullException(nameof(targetId));
            }
            LCUser user = await LCUser.GetCurrent();

            if (user == null)
            {
                throw new ArgumentNullException("current user");
            }

            status.Data[SourceKey] = user;
            LCQuery <LCObject> query = new LCQuery <LCObject>("_User")
                                       .WhereEqualTo("objectId", targetId);

            status.query = query;

            status.InboxType = InboxTypePrivate;

            return(await status.Send());
        }
Beispiel #2
0
        /// <summary>
        /// Sends the status to the followers of this user.
        /// </summary>
        /// <param name="status"></param>
        /// <returns></returns>
        public static async Task <LCStatus> SendToFollowers(LCStatus status)
        {
            if (status == null)
            {
                throw new ArgumentNullException(nameof(status));
            }
            LCUser user = await LCUser.GetCurrent();

            if (user == null)
            {
                throw new ArgumentNullException("current user");
            }

            status.Data[SourceKey] = user;

            LCQuery <LCObject> query = new LCQuery <LCObject>("_Follower")
                                       .WhereEqualTo("user", user)
                                       .Select("follower");

            status.query = query;

            status.InboxType = InboxTypeDefault;

            return(await status.Send());
        }