endpoints

pull/17/head
kthouky 2023-08-08 12:49:10 +02:00
parent 0c6bf684f8
commit 58e2f0e3df
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
import fediseer.apis.v1.base as base import fediseer.apis.v1.base as base
import fediseer.apis.v1.whitelist as whitelist import fediseer.apis.v1.whitelist as whitelist
import fediseer.apis.v1.endorsements as endorsements 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.guarantees as guarantees
import fediseer.apis.v1.activitypub as activitypub import fediseer.apis.v1.activitypub as activitypub
import fediseer.apis.v1.badges as badges import fediseer.apis.v1.badges as badges
@ -15,6 +16,8 @@ api.add_resource(whitelist.Whitelist, "/whitelist")
api.add_resource(whitelist.WhitelistDomain, "/whitelist/<string:domain>") api.add_resource(whitelist.WhitelistDomain, "/whitelist/<string:domain>")
api.add_resource(endorsements.Endorsements, "/endorsements/<string:domain>") api.add_resource(endorsements.Endorsements, "/endorsements/<string:domain>")
api.add_resource(endorsements.Approvals, "/approvals/<string:domains_csv>") api.add_resource(endorsements.Approvals, "/approvals/<string:domains_csv>")
api.add_resource(censures.Censures, "/censures/<string:domain>")
api.add_resource(censures.CensuresGiven, "/censures_given/<string:domains_csv>")
api.add_resource(guarantees.Guarantors, "/guarantors/<string:domain>") api.add_resource(guarantees.Guarantors, "/guarantors/<string:domain>")
api.add_resource(guarantees.Guarantees, "/guarantees/<string:domain>") api.add_resource(guarantees.Guarantees, "/guarantees/<string:domain>")
api.add_resource(badges.GuaranteeBadge, "/badges/guarantees/<string:domain>.svg") api.add_resource(badges.GuaranteeBadge, "/badges/guarantees/<string:domain>.svg")

View File

@ -1,7 +1,7 @@
from fediseer.apis.v1.base import * from fediseer.apis.v1.base import *
from fediseer.classes.instance import Censure from fediseer.classes.instance import Censure
class Censures(Resource): class CensuresGiven(Resource):
get_parser = reqparse.RequestParser() 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("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") 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 {"domains": [instance["domain"] for instance in instance_details]},200
return {"instances": instance_details},200 return {"instances": instance_details},200
class CensuredReceived(Resource): class Censures(Resource):
get_parser = reqparse.RequestParser() 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("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") 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")