Interface EventApi


  • @Path("/_matrix/client/r0/rooms")
    @Consumes("application/json")
    @Produces("application/json")
    public interface EventApi
    There are several APIs provided to GET events for a room.
    • Method Summary

      Modifier and Type Method Description
      void joinedMembers​(String roomId, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      This API returns a map of MXIDs to member info objects for members of the room.
      void members​(String roomId, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Get the list of members for this room.
      void messages​(String roomId, String from, String to, String dir, Integer limit, String filter, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      This API returns a list of message and state events for a room.
      void redact​(String roomId, String eventId, String txnId, RedactRequest event, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Strips all information out of an event which isn't critical to the integrity of the server-side representation of the room.
      void roomEvent​(String roomId, String eventId, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Get a single event based on roomId/eventId.
      void roomEventWithTypeAndState​(String roomId, String eventType, String stateKey, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Looks up the contents of a state event in a room.
      void roomState​(String roomId, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      Get the state events for the current state of a room.
      void sendEvent​(String roomId, String eventType, String txnId, EventContent event, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      This endpoint is used to send a message event to a room.
      void sendEventWithType​(String roomId, String eventType, EventContent event, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      State events can be sent using this endpoint.
      void sendEventWithTypeAndState​(String roomId, String eventType, String stateKey, EventContent event, javax.ws.rs.core.UriInfo uriInfo, javax.ws.rs.core.HttpHeaders httpHeaders, javax.ws.rs.container.AsyncResponse asyncResponse, javax.ws.rs.core.SecurityContext securityContext)
      State events can be sent using this endpoint.
    • Method Detail

      • roomEvent

        @GET
        @Path("/{roomId}/event/{eventId}")
        void roomEvent​(@PathParam("roomId")
                       String roomId,
                       @PathParam("eventId")
                       String eventId,
                       @Context
                       javax.ws.rs.core.UriInfo uriInfo,
                       @Context
                       javax.ws.rs.core.HttpHeaders httpHeaders,
                       @Suspended
                       javax.ws.rs.container.AsyncResponse asyncResponse,
                       @Context
                       javax.ws.rs.core.SecurityContext securityContext)
        Get a single event based on roomId/eventId. You must have permission to retrieve this event e.g. by being a member in the room for this event.
        Requires auth: Yes.
        Return: Event.

        Status code 200: The full event.

        Status code 404: The event was not found or you do not have permission to read this event.

        Parameters:
        roomId - Required. The ID of the room the event is in.
        eventId - Required. The event ID to get.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • roomEventWithTypeAndState

        @GET
        @Path("/{roomId}/state/{eventType}/{stateKey}")
        void roomEventWithTypeAndState​(@PathParam("roomId")
                                       String roomId,
                                       @PathParam("eventType")
                                       String eventType,
                                       @PathParam("stateKey")
                                       String stateKey,
                                       @Context
                                       javax.ws.rs.core.UriInfo uriInfo,
                                       @Context
                                       javax.ws.rs.core.HttpHeaders httpHeaders,
                                       @Suspended
                                       javax.ws.rs.container.AsyncResponse asyncResponse,
                                       @Context
                                       javax.ws.rs.core.SecurityContext securityContext)
        Looks up the contents of a state event in a room. If the user is joined to the room then the state is taken from the current state of the room. If the user has left the room then the state is taken from the state of the room when they left.
        Requires auth: Yes.
        Return: EventContent.

        Status code 200: The content of the state event.

        Status code 403: You aren't a member of the room and weren't previously a member of the room.

        Status code 404: The room has no state with the given type or key.

        Parameters:
        roomId - Required. The room to look up the state in.
        eventType - Required. The type of state to look up.
        stateKey - Required. The key of the state to look up.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • roomState

        @GET
        @Path("/{roomId}/state")
        void roomState​(@PathParam("roomId")
                       String roomId,
                       @Context
                       javax.ws.rs.core.UriInfo uriInfo,
                       @Context
                       javax.ws.rs.core.HttpHeaders httpHeaders,
                       @Suspended
                       javax.ws.rs.container.AsyncResponse asyncResponse,
                       @Context
                       javax.ws.rs.core.SecurityContext securityContext)
        Get the state events for the current state of a room.
        Requires auth: Yes.
        Return: List of the Events.

        Status code 200: The current state of the room.

        Status code 403: You aren't a member of the room and weren't previously a member of the room.

        Parameters:
        roomId - Required. The room to look up the state for.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • members

        @GET
        @Path("/{roomId}/members")
        void members​(@PathParam("roomId")
                     String roomId,
                     @Context
                     javax.ws.rs.core.UriInfo uriInfo,
                     @Context
                     javax.ws.rs.core.HttpHeaders httpHeaders,
                     @Suspended
                     javax.ws.rs.container.AsyncResponse asyncResponse,
                     @Context
                     javax.ws.rs.core.SecurityContext securityContext)
        Get the list of members for this room.
        Requires auth: Yes.
        Return: MembersResponse.

        Status code 200: A list of members of the room. If you are joined to the room then this will be the current members of the room. If you have left the room then this will be the members of the room when you left.

        Status code 403: You aren't a member of the room and weren't previously a member of the room.

        Parameters:
        roomId - Required. The room to get the member events for.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • joinedMembers

        @GET
        @Path("/{roomId}/joined_members")
        void joinedMembers​(@PathParam("roomId")
                           String roomId,
                           @Context
                           javax.ws.rs.core.UriInfo uriInfo,
                           @Context
                           javax.ws.rs.core.HttpHeaders httpHeaders,
                           @Suspended
                           javax.ws.rs.container.AsyncResponse asyncResponse,
                           @Context
                           javax.ws.rs.core.SecurityContext securityContext)
        This API returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than /members as it can be implemented more efficiently on the server.
        Requires auth: Yes.
        Return: JoinedMembersResponse.

        Status code 200: A map of MXID to room member objects.

        Status code 403: You aren't a member of the room.

        Parameters:
        roomId - Required. The room to get the members of.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • messages

        @GET
        @Path("/{roomId}/messages")
        void messages​(@PathParam("roomId")
                      String roomId,
                      @QueryParam("from")
                      String from,
                      @QueryParam("to")
                      String to,
                      @QueryParam("dir")
                      String dir,
                      @QueryParam("limit")
                      Integer limit,
                      @QueryParam("filter")
                      String filter,
                      @Context
                      javax.ws.rs.core.UriInfo uriInfo,
                      @Context
                      javax.ws.rs.core.HttpHeaders httpHeaders,
                      @Suspended
                      javax.ws.rs.container.AsyncResponse asyncResponse,
                      @Context
                      javax.ws.rs.core.SecurityContext securityContext)
        This API returns a list of message and state events for a room. It uses pagination query parameters to paginate history in the room.
        Requires auth: Yes.
        Return: Page of the Events.

        Status code 200: A list of messages with a new token to request more.

        Status code 403: You aren't a member of the room.

        Parameters:
        roomId - Required. The room to get events from.
        from - Required. The token to start returning events from. This token can be obtained from a prev_batch token returned for each room by the sync API, or from a start or end token returned by a previous request to this endpoint.
        to - The token to stop returning events at. This token can be obtained from a prev_batch token returned for each room by the sync endpoint, or from a start or end token returned by a previous request to this endpoint.
        dir - Required. The direction to return events from. One of: ["b", "f"]
        limit - The maximum number of events to return. Default: 10.
        filter - A JSON RoomEventFilter to filter returned events with.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • sendEventWithTypeAndState

        @PUT
        @Path("/{roomId}/state/{eventType}/{stateKey}")
        void sendEventWithTypeAndState​(@PathParam("roomId")
                                       String roomId,
                                       @PathParam("eventType")
                                       String eventType,
                                       @PathParam("stateKey")
                                       String stateKey,
                                       EventContent event,
                                       @Context
                                       javax.ws.rs.core.UriInfo uriInfo,
                                       @Context
                                       javax.ws.rs.core.HttpHeaders httpHeaders,
                                       @Suspended
                                       javax.ws.rs.container.AsyncResponse asyncResponse,
                                       @Context
                                       javax.ws.rs.core.SecurityContext securityContext)
        State events can be sent using this endpoint. These events will be overwritten if (room id), (event type) and (state key) all match.
        Requests to this endpoint cannot use transaction IDs like other PUT paths because they cannot be differentiated from the state_key. Furthermore, POST is unsupported on state paths.
        The body of the request should be the content object of the event; the fields in this object will vary depending on the type of event. See Room Events for the m. event specification.
        Requires auth: Yes.
        Return: SendEventResponse.

        Status code 200: An ID for the sent event.

        Status code 403: The sender doesn't have permission to send the event into the room.

        Parameters:
        roomId - Required. The room to set the state in.
        eventType - Required. The type of event to send.
        stateKey - Required. The state_key for the state to send. Defaults to the empty string.
        event - event.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • sendEventWithType

        @PUT
        @Path("/{roomId}/state/{eventType}")
        void sendEventWithType​(@PathParam("roomId")
                               String roomId,
                               @PathParam("eventType")
                               String eventType,
                               EventContent event,
                               @Context
                               javax.ws.rs.core.UriInfo uriInfo,
                               @Context
                               javax.ws.rs.core.HttpHeaders httpHeaders,
                               @Suspended
                               javax.ws.rs.container.AsyncResponse asyncResponse,
                               @Context
                               javax.ws.rs.core.SecurityContext securityContext)
        State events can be sent using this endpoint. This endpoint is equivalent to calling /rooms/{roomId}/state/{eventType}/{stateKey} with an empty stateKey. Previous state events with matching (roomId) and (eventType), and empty (stateKey), will be overwritten.
        Requests to this endpoint cannot use transaction IDs like other PUT paths because they cannot be differentiated from the state_key. Furthermore, POST is unsupported on state paths.
        The body of the request should be the content object of the event; the fields in this object will vary depending on the type of event. See Room Events for the m. event specification.
        Requires auth: Yes.
        Return: SendEventResponse.

        Status code 200: An ID for the sent event.

        Status code 403: The sender doesn't have permission to send the event into the room.

        Parameters:
        roomId - Required. The room to set the state in.
        eventType - Required. The type of event to send.
        event - event.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • sendEvent

        @PUT
        @Path("/{roomId}/send/{eventType}/{txnId}")
        void sendEvent​(@PathParam("roomId")
                       String roomId,
                       @PathParam("eventType")
                       String eventType,
                       @PathParam("txnId")
                       String txnId,
                       EventContent event,
                       @Context
                       javax.ws.rs.core.UriInfo uriInfo,
                       @Context
                       javax.ws.rs.core.HttpHeaders httpHeaders,
                       @Suspended
                       javax.ws.rs.container.AsyncResponse asyncResponse,
                       @Context
                       javax.ws.rs.core.SecurityContext securityContext)
        This endpoint is used to send a message event to a room. Message events allow access to historical events and pagination, making them suited for "once-off" activity in a room.
        The body of the request should be the content object of the event; the fields in this object will vary depending on the type of event. See Room Events for the m. event specification.
        Requires auth: Yes.
        Return: SendEventResponse.

        Status code 200: An ID for the sent event.

        Parameters:
        roomId - Required. The room to send the event to.
        eventType - Required. The type of event to send.
        txnId - Required. The transaction ID for this event. Clients should generate an ID unique across requests with the same access token; it will be used by the server to ensure idempotency of requests.
        event - event.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.
      • redact

        @PUT
        @Path("/{roomId}/redact/{eventId}/{txnId}")
        void redact​(@PathParam("roomId")
                    String roomId,
                    @PathParam("eventId")
                    String eventId,
                    @PathParam("txnId")
                    String txnId,
                    RedactRequest event,
                    @Context
                    javax.ws.rs.core.UriInfo uriInfo,
                    @Context
                    javax.ws.rs.core.HttpHeaders httpHeaders,
                    @Suspended
                    javax.ws.rs.container.AsyncResponse asyncResponse,
                    @Context
                    javax.ws.rs.core.SecurityContext securityContext)
        Strips all information out of an event which isn't critical to the integrity of the server-side representation of the room.
        This cannot be undone.
        Users may redact their own events, and any user with a power level greater than or equal to the redact power level of the room may redact events there.
        Requires auth: Yes.
        Return: SendEventResponse.

        Status code 200: An ID for the redaction event.

        Parameters:
        roomId - Required. The room from which to redact the event.
        eventId - Required. The ID of the event to redact.
        txnId - Required. The transaction ID for this event. Clients should generate a unique ID; it will be used by the server to ensure idempotency of requests.
        event - The reason for the event being redacted.
        uriInfo - Request Information.
        httpHeaders - Http headers.
        asyncResponse - Asynchronous response.
        securityContext - Security context.