@amityco/ts-sdk-react-native
Version:
Amity Social Cloud Typescript SDK
129 lines • 4.89 kB
TypeScript
import { AxiosInstance } from 'axios';
import { Emitter } from 'mitt';
export declare const enum MembershipAcceptanceTypeEnum {
AUTOMATIC = "automatic",
INVITATION = "invitation"
}
declare global {
namespace Amity {
type Logger = (topic: string, ...args: any[]) => void;
type MembershipAcceptanceType = MembershipAcceptanceTypeEnum;
const enum TokenTerminationReason {
GLOBAL_BAN = "globalBan",
USER_DELETED = "userDeleted",
UNAUTHORIZED = "unauthorized"
}
const enum SessionStates {
NOT_LOGGED_IN = "notLoggedIn",
ESTABLISHING = "establishing",
ESTABLISHED = "established",
TOKEN_EXPIRED = "tokenExpired",
TERMINATED = "terminated"
}
const enum RTEConnectionStateEnum {
CONNECTING = "connecting",
CONNECTED = "connected",
RECONNECTING = "reconnecting",
DISCONNECTED = "disconnected",
DISCONNECTING = "disconnecting"
}
type RTEConnectionState = `${Amity.RTEConnectionStateEnum}`;
type Client = {
version: string;
log: Logger;
http: AxiosInstance;
upload: AxiosInstance;
mqtt?: Amity.MqttClient;
emitter: Emitter<Amity.Events>;
hasPermission: (permission: string) => Amity.PermissionChecker;
validateUrls: (urls: string[]) => Promise<boolean>;
validateTexts: (texts: string[]) => Promise<boolean>;
sessionState: Amity.SessionStates;
sessionHandler?: Amity.SessionHandler;
cache?: Amity.Cache;
apiKey?: string;
userId?: string;
token?: Amity.Tokens;
isUnreadCountEnabled: boolean;
useLegacyUnreadCount: boolean;
use: () => void;
accessTokenExpiryWatcher: (sessionHandler: Amity.SessionHandler) => Amity.Unsubscriber;
onRTEConnectionStateChange: (callback: (state: Amity.RTEConnectionState) => void) => (() => void) | undefined;
getFeedSettings: () => Promise<Amity.FeedSettings>;
getSocialSettings: () => Promise<Amity.SocialSettings>;
getMessagePreviewSetting: (refresh?: boolean) => Promise<Amity.MessagePreviewSetting>;
getMarkerSyncConsistentMode: () => boolean;
prefixDeviceIdKey?: string;
};
type Device = {
deviceId: string;
deviceInfo: {
kind: 'node' | 'web';
model?: string;
sdkVersion: string;
};
};
type Tokens = {
accessToken: string;
issuedAt: string;
expiresAt: string;
};
type AccessTokenRenewal = {
renew: () => void;
renewWithAuthToken: (authToken: string) => void;
unableToRetrieveAuthToken: () => void;
};
interface SessionHandler {
sessionWillRenewAccessToken(renewal: AccessTokenRenewal): void;
}
type ChatSettings = {
enabled: boolean;
mention: {
isAllowMentionedChannelEnabled: boolean;
};
messagePreview: {
enabled: boolean;
isIncludeDeleted: boolean;
};
};
type ShareableLinkConfiguration = {
domain: string;
patterns: Record<string, string>;
};
type FeedSettings = {
[name in Amity.ContentFeedType]?: Amity.ContentSetting[];
};
type SocialSettings = {
enabled: boolean;
isAllowEditPostWhenReviewingEnabled: boolean;
isFollowWithRequestEnabled: boolean;
globalFeed: {
showCommunityPost: boolean;
showEveryonePost: boolean;
showFollowingPost: boolean;
showMyPost: boolean;
showOnlyMyFeed: boolean;
};
story: {
allowAllUserToCreateStory: boolean;
expiryTimeMinutes: number;
};
userPrivacySetting: 'public' | 'private';
membershipAcceptance: Amity.MembershipAcceptanceType;
};
type ConnectClientParams = {
userId: Amity.InternalUser['userId'];
displayName?: Amity.InternalUser['displayName'];
authToken?: string;
deviceId?: Amity.Device['deviceId'];
};
type ConnectClientConfig = {
disableRTE: boolean;
};
type ActiveUser = Pick<Amity.InternalUser, '_id' | 'userId' | 'path' | 'displayName'>;
type UserUnread = Pick<Amity.UserMarker, 'unreadCount'> & {
isMentioned: boolean;
};
}
}
//# sourceMappingURL=client.d.ts.map