Adds Shared Channel related API endpoints (#27436)
* Adds Shared Channel management API endpoints
New endpoints for the following routes are added:
- Get Shared Channel Remotes by Remote Cluster at `GET
/api/v4/remotecluster/{remote_id}/sharedchannelremotes`
- Invite Remote Cluster to Channel at `POST
/api/v4/remotecluster/{remote_id}/channels/invite`
- Uninvite Remote Cluster to Channel at `POST
/api/v4/remotecluster/{remote_id}/channels/uninvite`
These endpoints are planned to be used from the system console, and
gated through the `manage_secure_connections` permission.
* Adds i18n messages for API errors
* Fix pagination flaky test
* Fix linter
* Adds the posibility of filtering shared channel remotes by home
---------
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
60ffd00d30
Коммит
3dc0e63c03
@@ -3535,6 +3535,44 @@ components:
|
||||
description: The time in milliseconds a remote cluster was last pinged successfully
|
||||
type: integer
|
||||
format: int64
|
||||
SharedChannelRemote:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
description: The id of the shared channel remote
|
||||
type: string
|
||||
channel_id:
|
||||
description: The id of the channel
|
||||
type: string
|
||||
creator_id:
|
||||
description: Id of the user that invited the remote to share the channel
|
||||
type: string
|
||||
create_at:
|
||||
description: Time in milliseconds that the remote was invited to the channel
|
||||
type: integer
|
||||
update_at:
|
||||
description: Time in milliseconds that the shared channel remote record was last updated
|
||||
type: integer
|
||||
is_invite_accepted:
|
||||
description: Indicates if the invite has been accepted by the remote
|
||||
type: boolean
|
||||
is_invite_confirmed:
|
||||
description: Indicates if the invite has been confirmed by the remote
|
||||
type: boolean
|
||||
remote_id:
|
||||
description: Id of the remote cluster that the channel is shared with
|
||||
type: string
|
||||
last_post_update_at:
|
||||
description: Time in milliseconds of the last post in the channel that was synchronized with the remote update_at
|
||||
type: integer
|
||||
last_post_id:
|
||||
description: Id of the last post in the channel that was synchronized with the remote
|
||||
type: string
|
||||
last_post_create_at:
|
||||
description: Time in milliseconds of the last post in the channel that was synchronized with the remote create_at
|
||||
type: string
|
||||
last_post_create_id:
|
||||
type: string
|
||||
SystemStatusResponse:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -45,6 +45,61 @@
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
|
||||
"/api/v4/remotecluster/{remote_id}/sharedchannelremotes":
|
||||
get:
|
||||
tags:
|
||||
- shared channels
|
||||
summary: Get shared channel remotes by remote cluster.
|
||||
description: |
|
||||
Get a list of the channels shared with a given remote cluster
|
||||
and their status.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: GetSharedChannelRemotesByRemoteCluster
|
||||
parameters:
|
||||
- name: remote_id
|
||||
in: path
|
||||
description: The remote cluster GUID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: exclude_home
|
||||
in: query
|
||||
description: Show only those Shared channel remotes that were shared with this server
|
||||
schema:
|
||||
type: boolean
|
||||
- name: exclude_remote
|
||||
in: query
|
||||
description: Show only those Shared channel remotes that were shared from this server
|
||||
schema:
|
||||
type: boolean
|
||||
- name: page
|
||||
in: query
|
||||
description: The page to select
|
||||
schema:
|
||||
type: integer
|
||||
- name: per_page
|
||||
in: query
|
||||
description: The number of shared channels per page
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
"200":
|
||||
description: Shared channel remotes fetch successful. Result might be empty.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/SharedChannelRemote"
|
||||
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
|
||||
"/api/v4/sharedchannels/remote_info/{remote_id}":
|
||||
get:
|
||||
tags:
|
||||
@@ -80,3 +135,71 @@
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
|
||||
"/api/v4/remotecluster/{remote_id}/channels/{channel_id}/invite":
|
||||
post:
|
||||
tags:
|
||||
- shared channels
|
||||
summary: Invites a remote cluster to a channel.
|
||||
description: |
|
||||
Invites a remote cluster to a channel, sharing the channel if
|
||||
needed. If the remote cluster was already invited to the
|
||||
channel, calling this endpoint will have no effect.
|
||||
|
||||
##### Permissions
|
||||
`manage_shared_channels`
|
||||
operationId: InviteRemoteClusterToChannel
|
||||
parameters:
|
||||
- name: remote_id
|
||||
in: path
|
||||
description: The remote cluster GUID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: channel_id
|
||||
in: path
|
||||
description: The channel GUID to invite the remote cluster to
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"204":
|
||||
description: Remote cluster invited successfully
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
|
||||
"/api/v4/remotecluster/{remote_id}/channels/{channel_id}/uninvite":
|
||||
post:
|
||||
tags:
|
||||
- shared channels
|
||||
summary: Uninvites a remote cluster to a channel.
|
||||
description: |
|
||||
Stops sharing a channel with a remote cluster. If the channel
|
||||
was not shared with the remote, calling this endpoint will
|
||||
have no effect.
|
||||
|
||||
##### Permissions
|
||||
`manage_shared_channels`
|
||||
operationId: UninviteRemoteClusterToChannel
|
||||
parameters:
|
||||
- name: remote_id
|
||||
in: path
|
||||
description: The remote cluster GUID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: channel_id
|
||||
in: path
|
||||
description: The channel GUID to uninvite the remote cluster to
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"204":
|
||||
description: Remote cluster uninvited successfully
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
|
||||
Ссылка в новой задаче
Block a user