From 9e21432cb90b3d1ae4867871a05841f4687ecc01 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sun, 27 Dec 2020 11:54:20 -0300 Subject: Update room documentation --- docs/basics.pod6 | 3 +- docs/room.pod6 | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 110 insertions(+), 6 deletions(-) diff --git a/docs/basics.pod6 b/docs/basics.pod6 index 694983f..5770f4f 100644 --- a/docs/basics.pod6 +++ b/docs/basics.pod6 @@ -50,8 +50,7 @@ repeated data. my $new-response = $client.sync(:$since); There's a C argument that you could use to filter the response. To -see available parameters to the filter you can go -L. +see available parameters to the filter you can go L. # limit the messages per room to 1 diff --git a/docs/room.pod6 b/docs/room.pod6 index 9724793..f186583 100644 --- a/docs/room.pod6 +++ b/docs/room.pod6 @@ -34,16 +34,37 @@ without the need for a L. Returns the name of the room. If no C was emmited (i.e.: no name was set for this room), then an empty string is returned. -=head2 send +=head2 fallback-name - method send(Str $body!, Str :$type? = "m.text") + method fallback-name(--> Str) -Sends a message to the room. It will return the C for this message. +Return a name for the room with the members of the room. Use this if +the room doesn't have a name set or in 1-1 chats. + +Example: + + my $room = Matrix::Client::Room $room .= new( + :$access-token, :$home-server, :id('#34df12:matrix.org') + ); + say 'Room name: ' ~ $room.name # OUTPUT: «Room name: » + say 'Room name: ' ~ $room.fallback-name # OUTPUT: «Room name: Alice and Bob» + +=head2 aliases + + method aliases(--> List) + +Get a list of aliases maintained by the local server for the given room. + +=head2 event + + method event(Str $event-id --> Matrix::Response::RoomEvent) + +Get a single event based on the C<$event-id>. Returns a L. =head2 state multi method state(--> Seq) - multi method state(Str $event-type) + multi method state(Str $event-type, Str $state-key = "") Get the state events for the current state of a room. it will return a C for every event on that room. @@ -51,6 +72,52 @@ for every event on that room. If an C<$event-type> is passed, the return value will be the value of that single event. +C<$state-key> is the key of the state to look up. + +=head2 joined-members + + method joined-members() + +Returns the data for the members of the room. + +Example: + + my $room = Matrix::Client::Room $room .= new( + :$access-token, :$home-server, :id('#34df12:matrix.org') + ); + my $member = $room.joined-members.head; + # the key is the matrix id + say $member.key # OUTPUT: «@meeple:matrix.deprecated.org» + say $member.values # OUTPUT: «mxc://matrix.deprecated.org/NdSvF..» + say $member.values # OUTPUT: «meeple» + +=head2 messages + + method messages( + Str:D :$from!, Str :$to, + Str :$dir where * eq 'f'|'b' = 'f', + Int :$limit = 10, :%filter + --> Matrix::Response::Messages + ) + +Return a L with the messages from +C<$from>. This token can be obtained from a C token +returned for each room by the sync API, or from a C or C +attributes from L. + +=head2 members + + method members(:$at, Str :$membership, Str :$not-membership --> Seq) + +Get the list of members for this room. This returns a C of +L. + +=head2 send + + method send(Str $body!, Str :$type? = "m.text") + +Sends a message to the room. It will return the C for this message. + =head2 send-state method send-state(Str:D $event-type, :$state-key = "", *%args --> Str) @@ -61,10 +128,48 @@ server. It will return the C for this state change. +=head2 invite + + method invite(Str $user-id) + +Invite a user to the room. + +=head2 join + + method join() + +Join the room. As the creation of the C expects +a room id (C<#032mf90f:matrix.org> for example), you need to use the +L method of C to join by an alias. + =head2 leave method leave() Leaves the room. +=head2 forget + + method forget() + +Stop a user of remembering this particular room. + +=head2 kick + + method kick(Str $user-id, Str $reason = "") + +Kick an user of this room. + +=head2 ban + + method ban(Str $user-id, $reason = "") + +Ban an user of this room. + +=head2 unban + + method unban(Str $user-id) + +Unban a user of this room. + =end pod -- cgit v1.2.3-70-g09d2