Esempio n. 1
0
        public async ValueTask <IEnumerable <UserMessage> > GetAllAsync(long roomId, bool isForceMode = false)
        {
            // TODO QueryAsync + data is error
            // single arg is invalid ?
            var uri = $"{EndPoints.RoomMessages(roomId)}?force={URLArgEncoder.BoolToInt(isForceMode).ToString()}";

            return(await this.chatworkClient.QueryAsync <List <UserMessage> >(new Uri(uri), HttpMethod.Get, new Dictionary <string, string>()));
        }
Esempio n. 2
0
        public async ValueTask <ElementId> SendAsync(long roomId, string message, bool isSelfUnread)
        {
            var data = new Dictionary <string, string>()
            {
                { "body", message },
                { "self_unread", URLArgEncoder.BoolToInt(isSelfUnread).ToString() }
            };

            return(await this.chatworkClient.QueryAsync <MessageId>(EndPoints.RoomMessages(roomId), HttpMethod.Post, data));
        }
Esempio n. 3
0
        public async ValueTask <InviteLink> UpdateAsync(long roomId, string uniqueName, string description, bool requireAcceptance)
        {
            var data = new Dictionary <string, string>()
            {
                { "code", uniqueName },
                { "description", description },
                { "need_acceptance", URLArgEncoder.BoolToInt(requireAcceptance).ToString() },
            };

            return(await this.chatworkClient.QueryAsync <InviteLink>(EndPoints.RoomTasks(roomId), HttpMethod.Put, data));
        }
Esempio n. 4
0
        public async ValueTask <UserFile> GetAsync(long roomId, long fileId, bool createDownloadLink)
        {
            var uri = $"{EndPoints.RoomFiles(roomId)}?create_download_url={URLArgEncoder.BoolToInt(createDownloadLink)}";

            return(await this.chatworkClient.QueryAsync <UserFile>(new Uri(uri), HttpMethod.Get, new Dictionary <string, string>()));
        }