Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 6cc4c80

Browse files
committed
feat: add abuse and contact endpoints
1 parent dab7b51 commit 6cc4c80

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

polyproto/core/routes/main.tsp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace polyproto.core;
2727
enum Version {
2828
`v1.0-beta.3`,
2929
`v1.0-beta.4`,
30+
`v1.0-beta.5`,
3031
}
3132

3233
/**
@@ -40,3 +41,57 @@ op gatewayUrl(): {
4041
@body _: url;
4142
@statusCode statusCode: 200;
4243
};
44+
45+
@doc("""
46+
This actor either does not exist on this home server (anymore), or the actor is not from this home server.
47+
""")
48+
model BadReport {
49+
...BadRequestResponse;
50+
}
51+
52+
/**
53+
* File an abuse report for an actor that is misbehaving either on this home server or on other
54+
* home servers/service servers.
55+
*/
56+
@route("/abuse")
57+
@added(Version.`v1.0-beta.5`)
58+
@summary("File an abuse report - Report an Actor")
59+
@post
60+
op reportAbuseFid(
61+
@body _b: {
62+
@doc("Federation ID of the reported actor")
63+
fid: string;
64+
65+
@doc("Information about why this actor was reported.")
66+
reportText: string;
67+
68+
@doc("This endpoint requires you to identify by completing a key trial.")
69+
keyTrial: polyproto.core.models.KeyTrialCompleted;
70+
},
71+
): {
72+
@statusCode _: 200;
73+
74+
@example(#{
75+
message: "Thank you for filing a report. Instance moderators will be in touch shortly.",
76+
})
77+
@body
78+
_b: {
79+
@doc("An optional message from the home server")
80+
message?: string;
81+
};
82+
} | BadReport;
83+
84+
/**
85+
* Retrieve contact information for this home server. May include an `adminAccount` federation ID,
86+
* if this instance supports some form of text message exchange and such an account exists.
87+
*/
88+
@get
89+
@summary("Retrieve contact information")
90+
@route("/contact")
91+
op getContactInfo(): {
92+
@statusCode _s: 200;
93+
@body _b: {
94+
adminAccount?: string;
95+
mail: string;
96+
};
97+
};

0 commit comments

Comments
 (0)