示例#1
0
 /// <summary>取得大量使用者檔案</summary>
 /// <param name="userids"></param>
 /// <returns></returns>
 public IEnumerable <UserProfile> GetUserProfiles(List <string> userids)
 {
     foreach (var userid in userids)
     {
         yield return(MessageApi.GetUserProfile(this.channelAccessToken, userid));
     }
 }
示例#2
0
 /// <summary>
 /// .Net 4.5 非同步方法
 /// 離開群組或對話
 /// </summary>
 /// <param name="sourceId"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public Task <bool> LeaveAsync(string sourceId, SourceType type)
 {
     if (type == SourceType.user)
     {
         throw new NotSupportedException("無法使用 SourceType = User");
     }
     return(MessageApi.LeaveRoomorGroupAsync(this.channelAccessToken, sourceId, type));
 }
示例#3
0
        /// <summary>
        /// 取得群組或多人對談中指定使用者檔案
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="GroupIdOrRoomId"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public UserProfile GetGroupOrRoomUserProfile(string userid, string GroupIdOrRoomId, SourceType type)
        {
            if (type == SourceType.user)
            {
                throw new NotSupportedException("無法使用 SourceType = User");
            }

            return(MessageApi.GetUserProfile(channelAccessToken, userid, GroupIdOrRoomId, type));
        }
示例#4
0
        /// <summary>
        ///  .Net 4.5 非同步方法
        /// 取得大量使用者檔案</summary>
        /// <param name="userids"></param>
        /// <returns></returns>
        public async Task <IEnumerable <UserProfile> > GetUserProfilesAsync(List <string> userids)
        {
            List <UserProfile> list = new List <UserProfile>();

            foreach (var userid in userids)
            {
                list.Add(await MessageApi.GetUserProfileAsync(this.channelAccessToken, userid));
            }
            return(list.AsEnumerable());
        }
示例#5
0
 /// <summary>
 /// 初始化物件
 /// 當TOKEN未傳入時
 /// 自動向line api取得short-lived token
 /// </summary>
 /// <param name="_id"></param>
 /// <param name="_secret"></param>
 /// <param name="token"></param>
 public LineChannel(string _id, string _secret, string token = "")
 {
     clientId     = _id;
     clientSecret = _secret;
     if (!string.IsNullOrWhiteSpace(token))
     {
         this.channelAccessToken = token;
     }
     else
     {
         this.channelAccessToken = MessageApi.GetTokenString(clientId, clientSecret);
     }
 }
示例#6
0
 /// <summary>
 ///  .Net 4.5 非同步方法
 /// 被動回復訊息
 /// </summary>
 /// <param name="ReplyToken"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public Task <bool> SendReplyMessageAsync(string ReplyToken, params MessageObjectBase[] message)
 {
     return(MessageApi.SendMessageActionAsync(this.channelAccessToken, PostMessageType.Reply, new ReplyMessage(ReplyToken, message)));
 }
示例#7
0
 /// <summary>
 ///   .Net 4.5 非同步方法
 /// 主動傳送訊息
 /// </summary>
 /// <param name="ToId"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public Task <bool> SendPushMessageAsync(string ToId, params MessageObjectBase[] message)
 {
     return(MessageApi.SendMessageActionAsync(channelAccessToken, PostMessageType.Push, new PushMessage(ToId, message)));
 }
示例#8
0
 /// <summary>
 ///   .Net 4.5 非同步方法
 /// 傳送訊息給多位使用者
 /// </summary>
 /// <param name="ToId"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public Task <bool> SendMuticastMessageAsync(IList <string> ToId, params MessageObjectBase[] message)
 {
     return(MessageApi.SendMessageActionAsync(this.channelAccessToken, PostMessageType.Multicast, new MulticastMessage(ToId, message)));
 }
示例#9
0
 /// <summary>
 ///  .Net 4.5 非同步方法
 /// 取得使用者上傳的資料(圖片、影片、聲音)
 /// </summary>
 /// <param name="message_id"></param>
 /// <returns></returns>
 public Task <byte[]> GetUserUploadAsync(string message_id)
 {
     return(MessageApi.GetContntAsync(this.channelAccessToken, message_id));
 }
示例#10
0
 /// <summary>
 ///  .Net 4.5 非同步方法
 /// 離開對話或群組
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public Task <UserProfile> GetUserProfileAsync(string userid)
 {
     return(MessageApi.GetUserProfileAsync(this.channelAccessToken, userid));
 }
示例#11
0
 /// <summary>
 /// 取得使用者上傳的資料(圖片、影片、聲音)
 /// </summary>
 /// <param name="message_id"></param>
 /// <returns></returns>
 public byte[] GetUserUpload(string message_id)
 {
     return(MessageApi.GetContnt(this.channelAccessToken, message_id));
 }
示例#12
0
 /// <summary>
 /// 取得使用者資料
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public UserProfile GetUserProfile(string userid)
 {
     return(MessageApi.GetUserProfile(this.channelAccessToken, userid));
 }