Skip to content

Commit

Permalink
#128 Send invitations to affiliated users and groups
Browse files Browse the repository at this point in the history
#129 New endpoint to send invitations to selected users and groups
  • Loading branch information
evdherberg authored and Fishbowler committed Jul 31, 2022
1 parent 4373cd1 commit 9bd4d7d
Show file tree
Hide file tree
Showing 10 changed files with 459 additions and 112 deletions.
2 changes: 2 additions & 0 deletions changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ <h1>
<p><b>1.9.0</b> (tbd)</p>
<ul>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/130'>#130</a>] - Add endpoint to create a new MUC service</li>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/129'>#129</a>] - Add endpoint(s) to invite users to a chatroom</li>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/128'>#128</a>] - Modify endpoints to add 'send invitations to affiliated users' as optional functionality</li>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/127'>#127</a>] - Add endpoint that allows for more than one MUC room to be created with one request</li>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/33'>#33</a>] - Add 'allowPM' to representation of MUC room.</li>
<li>[<a href='https://github.com/igniterealtime/openfire-restAPI-plugin/issues/15'>#15</a>] - Fix group-based affiliations with MUC rooms.</li>
Expand Down
108 changes: 72 additions & 36 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -804,9 +804,10 @@ Endpoint to create a new chat room.

### Possible parameters

| Parameter | Parameter Type | Description | Default value |
|-------------|-----------------|-------------------------------------|---------------|
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| Parameter | Parameter Type | Description | Default value |
|-----------------|-----------------|-------------------------------------------------|---------------|
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| sendInvitations | @QueryParam | Whether to send invitations to affiliated users | false |

### XML Examples

Expand Down Expand Up @@ -1125,10 +1126,11 @@ Endpoint to update a chat room.

### Possible parameters

| Parameter | Parameter Type | Description | Default value |
|-------------|-----------------|------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| Parameter | Parameter Type | Description | Default value |
|-----------------|-----------------|-------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| sendInvitations | @QueryParam | Whether to send invitations to newly affiliated users | false |

### Examples
>**Header:** Authorization: Basic YWRtaW46MTIzNDU=
Expand Down Expand Up @@ -1178,9 +1180,9 @@ Endpoint to update a chat room.
</chatRoom>
```

## Invite user to a chat Room
## Invite user or user group to a chat Room

Endpoint to invite a user to a room.
Endpoint to invite a user or a user group to a room.
> **Header:** Authorization: Basic YWRtaW46MTIzNDU=
>
> **Header:** Content-Type: application/xml
Expand All @@ -1198,10 +1200,40 @@ Endpoint to invite a user to a room.
**Return value:** HTTP status 200 (OK)

### Possible parameters
| Parameter | Parameter Type | Description | Default value |
|-----------|-----------------|------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| name | @Path | The local username or the user JID | |
| Parameter | Parameter Type | Description | Default value |
|-----------|-----------------|---------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| name | @Path | The local username or group name or the user JID or group JID | |

## Invite multiple users and/or user groups to a chat Room

Endpoint to invite multiple users and/or user groups to a room. Works both with JIDs and (user/group) names.
> **Header:** Authorization: Basic YWRtaW46MTIzNDU=
>
> **Header:** Content-Type: application/xml
>
> **POST** http://localhost:9090/plugins/restapi/v1/chatrooms/{roomName}/invite
**Payload Example:**

```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<mucInvitation>
<reason>Hello, come to this room, it is nice</reason>
<jidsToInvite>
<jid>[email protected]</jid>
<jid>[email protected]/695c6ae413c00446733d926ccadefd8b</jid>
<jid>john</jid>
<jid>SomeGroupName</jid>
</jidsToInvite>
</mucInvitation>
```
**Return value:** HTTP status 200 (OK)

### Possible parameters
| Parameter | Parameter Type | Description | Default value |
|-----------|-----------------|---------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |

## Get all users with a particular affiliation in a chat room
Retrieves a list of JIDs for all users with the specified affiliation in a multi-user chat room.
Expand Down Expand Up @@ -1246,12 +1278,13 @@ Endpoint to add a new user with affiliation to a room.

### Possible parameters

| Parameter | Parameter Type | Description | Default value |
|-------------|-----------------|--------------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| name | @Path | The local username or the user JID | |
| affiliation | @Path | Available affiliations: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| Parameter | Parameter Type | Description | Default value |
|-----------------|-----------------|--------------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| name | @Path | The local username or the user JID | |
| affiliation | @Path | Available affiliations: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| sendInvitations | @QueryParam | Whether to send invitation to the newly affiliated user | false |

### Examples
>**Header:** Authorization: Basic YWRtaW46MTIzNDU=
Expand All @@ -1264,7 +1297,7 @@ Endpoint to add a new user with affiliation to a room.
>
>**POST** http://example.org:9090/plugins/restapi/v1/chatrooms/global/admins/testUser
>
>**POST** http://example.org:9090/plugins/restapi/v1/chatrooms/global/members/testUser
>**POST** http://example.org:9090/plugins/restapi/v1/chatrooms/global/members/testUser?sendInvitations=true
>
>**POST** http://example.org:9090/plugins/restapi/v1/chatrooms/global/outcasts/testUser
>
Expand All @@ -1280,11 +1313,12 @@ Endpoint to replace all users with a particular affiliation in a multi-user chat

### Possible parameters

| Parameter | Parameter Type | Description | Default value |
|-------------|-----------------|--------------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| affiliation | @Path | Available affiliations: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| Parameter | Parameter Type | Description | Default value |
|-----------------|-----------------|--------------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| affiliation | @Path | Available affiliations: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| sendInvitations | @QueryParam | Whether to send invitation to newly affiliated users | false |

### Examples
>**Header:** Authorization: Basic YWRtaW46MTIzNDU=
Expand Down Expand Up @@ -1312,11 +1346,12 @@ Endpoint to add multiple users with an affiliation to a multi-user chat room. No

### Possible parameters

| Parameter | Parameter Type | Description | Default value |
|--------------|-----------------|-------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| affiliation | @Path | Available affiliation: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| Parameter | Parameter Type | Description | Default value |
|-----------------|-----------------|-------------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| affiliation | @Path | Available affiliation: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| sendInvitations | @QueryParam | Whether to send invitations to newly affiliated users | false |

### Examples
>**Header:** Authorization: Basic YWRtaW46MTIzNDU=
Expand Down Expand Up @@ -1344,12 +1379,13 @@ Endpoint to add a new group with affiliation to a room.

### Possible parameters

| Parameter | Parameter Type | Description | Default value |
|-------------|----------------|--------------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| name | @Path | The group name | |
| affiliation | @Path | Available affiliations: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| Parameter | Parameter Type | Description | Default value |
|-----------------|----------------|--------------------------------------------------------------------------------------------|---------------|
| roomname | @Path | Exact room name | |
| name | @Path | The group name | |
| affiliation | @Path | Available affiliations: <br>**owners** <br> **admins** <br> **members** <br> **outcasts** | |
| servicename | @QueryParam | The name of the Group Chat Service | conference |
| sendInvitations | @QueryParam | Whether to send invitations to the users in the newly affiliated groups | false |

### Examples
>**Header:** Authorization: Basic YWRtaW46MTIzNDU=
Expand Down
Loading

0 comments on commit 9bd4d7d

Please sign in to comment.