* Mobile fix for MM-65084
* Changing test/setup.ts to use a deterministic fill
This avoids the ci issue about parenthesis and is more clear that this is just a fixed sequence for testing, similar to randomUUID above.
* Add setBearerToken and setCSRFToken to Client definition
* Use setClientCredentials and memoize createPkceBundle
* Restoring the preauthSecret back to the Client constructors
This came out of a response to MM-65085: Support Pre Shared Password on server connect where preauthSecret was added in the buildConfig. Claude (correctly imo) identified this as now redundant and so removed it but it is valid to keep it as well. In any case, putting it back to be consistent with ClientTracking and ClientBase.
* Rename PKCE to SAML based terminology, similar to server
* Fix lint issue with too many blank lines at eof
* Removing plain on mobile side
---------
(cherry picked from commit 2d6a5d5097)
Co-authored-by: JG Heithcock <jgheithcock@gmail.com>
89 lines
3.2 KiB
TypeScript
89 lines
3.2 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import ClientCalls, {type ClientCallsMix} from '@calls/client/rest';
|
|
import ClientPlugins, {type ClientPluginsMix} from '@client/rest/plugins';
|
|
import ClientPlaybooks, {type ClientPlaybooksMix} from '@playbooks/client/rest';
|
|
import mix from '@utils/mix';
|
|
|
|
import ClientApps, {type ClientAppsMix} from './apps';
|
|
import ClientBase from './base';
|
|
import ClientCategories, {type ClientCategoriesMix} from './categories';
|
|
import ClientChannelBookmarks, {type ClientChannelBookmarksMix} from './channel_bookmark';
|
|
import ClientChannels, {type ClientChannelsMix} from './channels';
|
|
import {DEFAULT_LIMIT_AFTER, DEFAULT_LIMIT_BEFORE, HEADER_X_VERSION_ID} from './constants';
|
|
import ClientCustomAttributes, {type ClientCustomAttributesMix} from './custom_profile_attributes';
|
|
import ClientEmojis, {type ClientEmojisMix} from './emojis';
|
|
import ClientFiles, {type ClientFilesMix} from './files';
|
|
import ClientGeneral, {type ClientGeneralMix} from './general';
|
|
import ClientGroups, {type ClientGroupsMix} from './groups';
|
|
import ClientIntegrations, {type ClientIntegrationsMix} from './integrations';
|
|
import ClientNPS, {type ClientNPSMix} from './nps';
|
|
import ClientPosts, {type ClientPostsMix} from './posts';
|
|
import ClientPreferences, {type ClientPreferencesMix} from './preferences';
|
|
import ClientScheduledPost, {type ClientScheduledPostMix} from './scheduled_post';
|
|
import ClientTeams, {type ClientTeamsMix} from './teams';
|
|
import ClientThreads, {type ClientThreadsMix} from './threads';
|
|
import ClientTos, {type ClientTosMix} from './tos';
|
|
import ClientUsers, {type ClientUsersMix} from './users';
|
|
|
|
import type {APIClientInterface} from '@mattermost/react-native-network-client';
|
|
|
|
interface Client extends ClientBase,
|
|
ClientAppsMix,
|
|
ClientCategoriesMix,
|
|
ClientChannelsMix,
|
|
ClientChannelBookmarksMix,
|
|
ClientEmojisMix,
|
|
ClientFilesMix,
|
|
ClientGeneralMix,
|
|
ClientGroupsMix,
|
|
ClientIntegrationsMix,
|
|
ClientPostsMix,
|
|
ClientPreferencesMix,
|
|
ClientScheduledPostMix,
|
|
ClientTeamsMix,
|
|
ClientThreadsMix,
|
|
ClientTosMix,
|
|
ClientUsersMix,
|
|
ClientCallsMix,
|
|
ClientPluginsMix,
|
|
ClientNPSMix,
|
|
ClientCustomAttributesMix,
|
|
ClientPlaybooksMix
|
|
{
|
|
setClientCredentials: (token: string, preauthSecret?: string) => void;
|
|
setCSRFToken: (csrfToken: string) => void;
|
|
}
|
|
|
|
class Client extends mix(ClientBase).with(
|
|
ClientApps,
|
|
ClientCategories,
|
|
ClientChannels,
|
|
ClientChannelBookmarks,
|
|
ClientEmojis,
|
|
ClientFiles,
|
|
ClientGeneral,
|
|
ClientGroups,
|
|
ClientIntegrations,
|
|
ClientPosts,
|
|
ClientPreferences,
|
|
ClientScheduledPost,
|
|
ClientTeams,
|
|
ClientThreads,
|
|
ClientTos,
|
|
ClientUsers,
|
|
ClientCalls,
|
|
ClientPlugins,
|
|
ClientNPS,
|
|
ClientCustomAttributes,
|
|
ClientScheduledPost,
|
|
ClientPlaybooks,
|
|
) {
|
|
// eslint-disable-next-line no-useless-constructor
|
|
constructor(apiClient: APIClientInterface, serverUrl: string, bearerToken?: string, csrfToken?: string, preauthSecret?: string) {
|
|
super(apiClient, serverUrl, bearerToken, csrfToken, preauthSecret);
|
|
}
|
|
}
|
|
|
|
export {Client, DEFAULT_LIMIT_AFTER, DEFAULT_LIMIT_BEFORE, HEADER_X_VERSION_ID};
|