aboutsummaryrefslogtreecommitdiff
path: root/scripts/load-docs.p6
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/load-docs.p6')
-rwxr-xr-xscripts/load-docs.p625
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/load-docs.p6 b/scripts/load-docs.p6
index d3a1f81..c6736d7 100755
--- a/scripts/load-docs.p6
+++ b/scripts/load-docs.p6
@@ -1,7 +1,9 @@
#!/usr/bin/env perl6
use v6;
+use lib <lib>;
use HTTP::UserAgent;
use JSON::Fast;
+use Matrix::Client;
sub get-api-docs {
my $url = "https://matrix.org/docs/api/client-server/json/api-docs.json";
@@ -32,19 +34,34 @@ sub get-api-docs {
sub MAIN(:$spec?) {
my %tags = get-api-docs;
+ my $implemented-methods = (Matrix::Client, Matrix::Client::Room).map(*.^methods)
+ .flat.map(
+ {
+ quietly try { .WHY.Str } or ""
+ }).grep(/_matrix/).SetHash;
+ .say for $implemented-methods;
+ say q:to/EOF/;
+ # List of implemented endpoints
+
+ This list was generated by the `load-docs.p6` script that gets the data
+ from the [api-docs.json](https://matrix.org/docs/api/client-server/json/api-docs.json)
+ from matrix.org. This will give you an overview about what's implemented in the library.
+ EOF
+
for %tags.sort -> $pair {
my $tag = $pair.key;
my $methods = $pair.value;
say qq:to/EOF/;
- # $tag
+ ## $tag
EOF
- for $methods.Seq -> $m {
- my Str $method = $m;
+ for $methods.Seq.sort -> $m {
+ my Str $method = $m.trim;
+ my $checked = $implemented-methods{$m} ?? "X" !! " ";
if $spec {
$method = $m.subst(/unstable/, $spec)
}
- say "- [ ] " ~ $method;
+ say "- [$checked] " ~ $method;
}
say "";
}