Beispiel #1
0
        /// <summary>
        /// Deletes communication history.
        /// </summary>
        /// <param name="peer">User or chat, communication history of which will be deleted</param>
        /// <param name="maxId">If a positive value was transferred, the method will return only messages with IDs less than the set one</param>
        /// <param name="justClear">Delete as non-recoverable or just clear the history</param>
        /// <returns>Returns a <see cref="IAffectedHistory"/> object containing a affected history</returns>
        public async Task <IAffectedHistory> DeleteHistoryAsync(IInputPeer peer, int maxId, bool justClear)
        {
            EnsureUserAuthorized();

            var deleteHistory = new RequestDeleteHistory
            {
                Peer      = peer,
                JustClear = justClear,
                MaxId     = maxId
            };

            return(await SenderService.SendRequestAsync(deleteHistory).ConfigureAwait(false));
        }
        /// <inheritdoc />
        public async Task <IAffectedHistory> DeleteHistoryAsync(IInputPeer peer, int maxId, bool justClear, CancellationToken cancellationToken = default(CancellationToken))
        {
            ClientSettings.EnsureUserAuthorized();

            var deleteHistory = new RequestDeleteHistory
            {
                Peer      = peer,
                JustClear = justClear,
                MaxId     = maxId
            };

            return(await RequestSender.SendRequestAsync(deleteHistory, cancellationToken).ConfigureAwait(false));
        }