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') 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 From 6f12086338bcb4fefbef374710449f364a2faf0f Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Wed, 5 Jun 2019 00:33:51 -0300 Subject: Remove debug information --- endpoints.md | 1 - scripts/load-docs.p6 | 1 - 2 files changed, 2 deletions(-) (limited to 'scripts') diff --git a/endpoints.md b/endpoints.md index 1d5be92..9abcf1a 100644 --- a/endpoints.md +++ b/endpoints.md @@ -1,4 +1,3 @@ -SetHash(DELETE - /_matrix/client/r0/directory/room/{roomAlias} DELETE - /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag} GET - /_matrix/client/r0/account/whoami GET - /_matrix/client/r0/directory/room/{roomAlias} GET - /_matrix/client/r0/joined_rooms GET - /_matrix/client/r0/presence/{userId}/status GET - /_matrix/client/r0/profile/{userId} GET - /_matrix/client/r0/profile/{userId}/avatar_url GET - /_matrix/client/r0/profile/{userId}/displayname GET - /_matrix/client/r0/publicRooms GET - /_matrix/client/r0/rooms/{roomId}/joined_members GET - /_matrix/client/r0/rooms/{roomId}/messages POST - /_matrix/client/r0/createRoom POST - /_matrix/client/r0/join/{roomIdOrAlias} POST - /_matrix/client/r0/logout POST - /_matrix/client/r0/register POST - /_matrix/client/r0/rooms/{roomId}/leave POST - /_matrix/media/r0/upload PUT - /_matrix/client/r0/directory/room/{roomAlias} PUT - /_matrix/client/r0/presence/{userId}/status PUT - /_matrix/client/r0/profile/{userId}/displayname PUT - /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId} PUT - /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}) # List of implemented endpoints This list was generated by the `load-docs.p6` script that gets the data diff --git a/scripts/load-docs.p6 b/scripts/load-docs.p6 index c6736d7..b20dd86 100755 --- a/scripts/load-docs.p6 +++ b/scripts/load-docs.p6 @@ -39,7 +39,6 @@ sub MAIN(:$spec?) { { quietly try { .WHY.Str } or "" }).grep(/_matrix/).SetHash; - .say for $implemented-methods; say q:to/EOF/; # List of implemented endpoints -- cgit v1.2.3-70-g09d2