Compare commits
1 commit
master
...
client-ref
Author | SHA1 | Date | |
---|---|---|---|
|
b1b3f62d37 |
1 changed files with 41 additions and 2 deletions
|
@ -1,6 +1,45 @@
|
|||
from abc import abstractmethod
|
||||
from typing import Iterable, override
|
||||
|
||||
import misskey
|
||||
import config
|
||||
|
||||
class FediverseNote:
|
||||
"""Abstraction for notes Use this to talk to per-software implementations"""
|
||||
def __init__(self, note):
|
||||
pass
|
||||
|
||||
def client_connection() -> misskey.Misskey:
|
||||
return misskey.Misskey(address=config.INSTANCE, i=config.KEY)
|
||||
class FediverseClient:
|
||||
def __init__(self, instance, software):
|
||||
self.instance = instance
|
||||
self.software = software
|
||||
|
||||
@abstractmethod
|
||||
def get_notifications(self) -> Iterable[FediverseNote]:
|
||||
"""Page through notifications from the instance"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def create_note(self, text, visibility, addressee, attachment):
|
||||
"""Create a new note"""
|
||||
pass
|
||||
|
||||
class MisskeyClient(FediverseClient):
|
||||
def __init__(self, instance, software):
|
||||
super().__init__(instance, software)
|
||||
|
||||
|
||||
def get_notifications(self) -> Iterable[FediverseNote]:
|
||||
pass
|
||||
|
||||
def create_note(self, text, visibility, addressee, attachment):
|
||||
pass
|
||||
|
||||
class PleromaClient(FediverseClient):
|
||||
def __init__(self, instance, software):
|
||||
super().__init__(instance, software)
|
||||
|
||||
def get_notifications(self) -> Iterable[FediverseNote]:
|
||||
pass
|
||||
def create_note(self, text, visibility, addressee, attachment):
|
||||
pass
|
||||
|
|
Loading…
Add table
Reference in a new issue