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)); }
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)); }