From 5d8aafcccbc582bf2d3be828b66e1495433ae5e5 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Wed, 5 Jun 2019 00:30:10 -0300 Subject: Auto check the endpoint if it's found on pod declarator --- scripts/load-docs.p6 | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'scripts/load-docs.p6') 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 ; 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 ""; } -- cgit v1.2.3-70-g09d2