mirror of
https://github.com/Xevion/recommit.git
synced 2025-12-05 23:15:59 -06:00
Add sources.py
This commit is contained in:
27
sources.py
Normal file
27
sources.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import abc
|
||||
from typing import Callable, List
|
||||
|
||||
from decouple import config
|
||||
|
||||
from models import Commit
|
||||
|
||||
|
||||
class CommitSource(abc.ABC):
|
||||
"""A simple abstract class for representing different commit sources generally."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def fetch(self, check_function: Callable) -> List[Commit]:
|
||||
"""Fetch commits from the source."""
|
||||
pass
|
||||
|
||||
|
||||
class Gitlab(CommitSource):
|
||||
"""Serves as the commit source for GitLab."""
|
||||
|
||||
API_KEY_CONSTANT: str = 'GITLAB_API_KEY'
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.__api_key: str = config(self.API_KEY_CONSTANT)
|
||||
|
||||
def fetch(self, check_function: Callable) -> List[Commit]:
|
||||
pass
|
||||
Reference in New Issue
Block a user