fediseer/overseer/apis/models/v1.py

40 lines
3.0 KiB
Python
Raw Normal View History

2023-06-20 17:47:56 +00:00
from flask_restx import fields
class Models:
def __init__(self,api):
2023-06-20 22:14:53 +00:00
self.response_model_error = api.model('RequestError', {
'message': fields.String(description="The error message for this status code."),
})
2023-06-22 00:37:25 +00:00
self.response_model_simple_response = api.model('SimpleResponse', {
"message": fields.String(default='OK',required=True, description="The result of this operation."),
})
2023-06-20 17:47:56 +00:00
self.response_model_suspicious_instances = api.model('SuspiciousInstances', {
'domain': fields.String(description="The instance domain"),
'uptime_alltime': fields.Float(description="The instance uptime pct. 100% and thousand of users is unlikely"),
'local_posts': fields.Integer(description="The amount of local posts in that instance"),
2023-06-20 23:57:30 +00:00
'comment_counts': fields.Integer(description="The amount of comments in that instance"),
2023-06-20 17:47:56 +00:00
'total_users': fields.Integer(description="The total amount of users registered in that instance"),
'active_users_monthly': fields.Integer(description="The amount of active users monthly."),
'signup': fields.Boolean(default=False,description="True when subscriptions are open, else False"),
2023-06-20 23:57:30 +00:00
'activity_suspicion': fields.Float(description="Local Comments+Posts per User. Higher is worse"),
2023-06-21 17:37:34 +00:00
'activity_suspicion': fields.Float(description="Local Comments+Posts per User. Higher is worse"),
2023-06-20 17:47:56 +00:00
})
2023-06-21 17:37:34 +00:00
self.response_model_model_Suspicions_get = api.model('SuspiciousInstances', {
2023-06-20 22:33:37 +00:00
'instances': fields.List(fields.Nested(self.response_model_suspicious_instances)),
'domains': fields.List(fields.String(description="The suspicious domains as a list.")),
'csv': fields.String(description="The suspicious domains as a csv."),
2023-06-20 22:14:53 +00:00
})
2023-06-21 17:37:34 +00:00
self.response_model_instances = api.model('InstanceDetails', {
2023-06-22 09:30:51 +00:00
'id': fields.Integer(description="The instance id"),
2023-06-21 17:37:34 +00:00
'domain': fields.String(description="The instance domain"),
'open_registrations': fields.Boolean(description="The instance uptime pct. 100% and thousand of users is unlikely"),
'email_verify': fields.Boolean(description="The amount of local posts in that instance"),
'approvals': fields.Integer(description="The amount of endorsements this instance has given out"),
'endorsements': fields.Integer(description="The amount of endorsements this instance has received"),
'guarantor': fields.String(description="The domain of the instance which guaranteed this instance."),
})
2023-06-22 09:30:51 +00:00
self.response_model_model_Whitelist_get = api.model('WhitelistedInstances', {
2023-06-21 17:37:34 +00:00
'instances': fields.List(fields.Nested(self.response_model_instances)),
'domains': fields.List(fields.String(description="The instance domains as a list.")),
'csv': fields.String(description="The instance domains as a csv."),
2023-06-22 09:30:51 +00:00
})