Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given an integer num, repeatedly add all its digits until the result has only one digit, and return it.
 
Please complete the following python code precisely:
```python
class Solution:
    def addDigits(self, num: int) -> int:
```