예제 #1
0
        public Task UserRemoveFromAllGroupsAsync(string userId, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(userId));
            }

            var message = new UserLeaveGroupMessage(userId, null);

            return(ServiceConnectionContainer.WriteAsync(message));
        }
예제 #2
0
        public Task UserAddToGroupAsync(string userId, string groupName, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(userId));
            }

            if (string.IsNullOrEmpty(groupName))
            {
                throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(groupName));
            }

            var message = new UserJoinGroupMessage(userId, groupName);

            return(ServiceConnectionContainer.WriteAsync(message));
        }
        public Task UserAddToGroupAsync(string userId, string groupName, TimeSpan ttl, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(userId));
            }

            if (string.IsNullOrEmpty(groupName))
            {
                throw new ArgumentException(NullOrEmptyStringErrorMessage, nameof(groupName));
            }

            if (ttl < TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException(nameof(ttl), TtlOutOfRangeErrorMessage);
            }
            var message = new UserJoinGroupMessage(userId, groupName)
            {
                Ttl = (int)ttl.TotalSeconds
            };

            return(ServiceConnectionContainer.WriteAsync(message));
        }
예제 #4
0
 public Task StartAsync()
 {
     return(ServiceConnectionContainer.StartAsync());
 }
 public Task DisposeAsync()
 {
     return(ServiceConnectionContainer.StopAsync());
 }