From 58e2f0e3dff4cf9f8dcde1dbba96fe025775b4e8 Mon Sep 17 00:00:00 2001 From: kthouky Date: Tue, 8 Aug 2023 12:49:10 +0200 Subject: [PATCH] endpoints --- fediseer/apis/v1/__init__.py | 3 +++ fediseer/apis/v1/censures.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fediseer/apis/v1/__init__.py b/fediseer/apis/v1/__init__.py index 8546465..650becc 100644 --- a/fediseer/apis/v1/__init__.py +++ b/fediseer/apis/v1/__init__.py @@ -1,6 +1,7 @@ import fediseer.apis.v1.base as base import fediseer.apis.v1.whitelist as whitelist import fediseer.apis.v1.endorsements as endorsements +import fediseer.apis.v1.censures as censures import fediseer.apis.v1.guarantees as guarantees import fediseer.apis.v1.activitypub as activitypub import fediseer.apis.v1.badges as badges @@ -15,6 +16,8 @@ api.add_resource(whitelist.Whitelist, "/whitelist") api.add_resource(whitelist.WhitelistDomain, "/whitelist/") api.add_resource(endorsements.Endorsements, "/endorsements/") api.add_resource(endorsements.Approvals, "/approvals/") +api.add_resource(censures.Censures, "/censures/") +api.add_resource(censures.CensuresGiven, "/censures_given/") api.add_resource(guarantees.Guarantors, "/guarantors/") api.add_resource(guarantees.Guarantees, "/guarantees/") api.add_resource(badges.GuaranteeBadge, "/badges/guarantees/.svg") diff --git a/fediseer/apis/v1/censures.py b/fediseer/apis/v1/censures.py index 0947c51..0ac7000 100644 --- a/fediseer/apis/v1/censures.py +++ b/fediseer/apis/v1/censures.py @@ -1,7 +1,7 @@ from fediseer.apis.v1.base import * from fediseer.classes.instance import Censure -class Censures(Resource): +class CensuresGiven(Resource): get_parser = reqparse.RequestParser() get_parser.add_argument("Client-Agent", default="unknown:0:unknown", type=str, required=False, help="The client name and version.", location="headers") get_parser.add_argument("csv", required=False, type=bool, help="Set to true to return just the domains as a csv. Mutually exclusive with domains", location="args") @@ -30,7 +30,7 @@ class Censures(Resource): return {"domains": [instance["domain"] for instance in instance_details]},200 return {"instances": instance_details},200 -class CensuredReceived(Resource): +class Censures(Resource): get_parser = reqparse.RequestParser() get_parser.add_argument("Client-Agent", default="unknown:0:unknown", type=str, required=False, help="The client name and version.", location="headers") get_parser.add_argument("csv", required=False, type=bool, help="Set to true to return just the domains as a csv. Mutually exclusive with domains", location="args")