Add docs to data interface for repo notifications

This commit is contained in:
Evan Cordell 2017-07-18 14:21:22 -04:00
parent 3db8d54a31
commit dd58008470

View file

@ -29,12 +29,12 @@ class RepositoryNotification(
def to_dict(self): def to_dict(self):
try: try:
config = json.loads(self.config_json) config = json.loads(self.config_json)
except: except ValueError:
config = {} config = {}
try: try:
event_config = json.loads(self.event_config_json) event_config = json.loads(self.event_config_json)
except: except ValueError:
event_config = {} event_config = {}
return { return {
@ -56,24 +56,89 @@ class RepoNotificationInterface(object):
@abstractmethod @abstractmethod
def create_repo_notification(self, namespace_name, repository_name, event_name, method_name, method_config, event_config, title=None): def create_repo_notification(self, namespace_name, repository_name, event_name, method_name, method_config, event_config, title=None):
"""
Args:
namespace_name: namespace of repository
repository_name: name of repository
event_name: name of event
method_name: name of method
method_config: method config, json string
event_config: event config, json string
title: title of the notification
Returns:
RepositoryNotification object
"""
pass pass
@abstractmethod @abstractmethod
def list_repo_notifications(self, namespace_name, repository_name, event_name=None): def list_repo_notifications(self, namespace_name, repository_name, event_name=None):
"""
Args:
namespace_name: namespace of repository
repository_name: name of repository
event_name: name of event
Returns:
list(RepositoryNotification)
"""
pass pass
@abstractmethod @abstractmethod
def get_repo_notification(self, uuid): def get_repo_notification(self, uuid):
"""
Args:
uuid: uuid of notification
Returns:
RepositoryNotification or None
"""
pass pass
@abstractmethod @abstractmethod
def delete_repo_notification(self, namespace_name, repository_name, uuid): def delete_repo_notification(self, namespace_name, repository_name, uuid):
"""
Args:
namespace_name: namespace of repository
repository_name: name of repository
uuid: uuid of notification
Returns:
RepositoryNotification or None
"""
pass pass
@abstractmethod @abstractmethod
def reset_notification_number_of_failures(self, namespace_name, repository_name, uuid): def reset_notification_number_of_failures(self, namespace_name, repository_name, uuid):
"""
Args:
namespace_name: namespace of repository
repository_name: name of repository
uuid: uuid of notification
Returns:
RepositoryNotification
"""
pass pass
@abstractmethod @abstractmethod
def queue_test_notification(self, uuid): def queue_test_notification(self, uuid):
"""
Args:
uuid: uuid of notification
Returns:
RepositoryNotification or None
"""
pass pass