[GH-26715] Added Pagination Support for IncomingWebHooks (#27502)

* Added Pagination Support for IncomingWebHooks

* Incorporated feedback from reviews

* Removed trailing spaces

* Restored deleted server en.json entries, fixed order in webapp en.json

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
alexcekay
2024-08-09 22:44:22 +02:00
коммит произвёл GitHub
родитель 1cf6cf4f5c
Коммит 7232b5f002
35 изменённых файлов: 515 добавлений и 97 удалений

Просмотреть файл

@@ -87,6 +87,7 @@ import type {
CommandResponse,
DialogSubmission,
IncomingWebhook,
IncomingWebhooksWithCount,
OAuthApp,
OutgoingOAuthConnection,
OutgoingWebhook,
@@ -2625,17 +2626,18 @@ export default class Client4 {
);
};
getIncomingWebhooks = (teamId = '', page = 0, perPage = PER_PAGE_DEFAULT) => {
getIncomingWebhooks = (teamId = '', page = 0, perPage = PER_PAGE_DEFAULT, includeTotalCount = false) => {
const queryParams: any = {
page,
per_page: perPage,
include_total_count: includeTotalCount,
};
if (teamId) {
queryParams.team_id = teamId;
}
return this.doFetch<IncomingWebhook[]>(
return this.doFetch<IncomingWebhook[] | IncomingWebhooksWithCount>(
`${this.getIncomingHooksRoute()}${buildQueryString(queryParams)}`,
{method: 'get'},
);

Просмотреть файл

@@ -19,6 +19,11 @@ export type IncomingWebhook = {
channel_locked: boolean;
};
export type IncomingWebhooksWithCount = {
incoming_webhooks: IncomingWebhook[];
total_count: number;
};
export type OutgoingWebhook = {
id: string;
token: string;
@@ -121,6 +126,7 @@ export type OutgoingOAuthConnection = {
export type IntegrationsState = {
incomingHooks: IDMappedObjects<IncomingWebhook>;
incomingHooksTotalCount: number;
outgoingHooks: IDMappedObjects<OutgoingWebhook>;
oauthApps: IDMappedObjects<OAuthApp>;
outgoingOAuthConnections: IDMappedObjects<OutgoingOAuthConnection>;