aboutsummaryrefslogtreecommitdiff
path: root/scripts/load-docs.p6
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2019-06-05 00:30:10 -0300
committerMatias Linares <matiaslina@gmail.com>2019-06-05 00:30:10 -0300
commit5d8aafcccbc582bf2d3be828b66e1495433ae5e5 (patch)
tree4f0f5c5b8b83930dcec1d7c26bde2ff75358fa68 /scripts/load-docs.p6
parent0b1e90f84b94e22fc8d5a1eb6158498a1a5b2f17 (diff)
downloadperl6-matrix-client-5d8aafcccbc582bf2d3be828b66e1495433ae5e5.tar.gz
Auto check the endpoint if it's found on pod declarator
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 "";
}