@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
81 lines (80 loc) • 2.69 kB
TypeScript
import { UUID as MessageUUID } from '../public/uuidObject';
/**
* @internal
* Limited to Microsoft-internal use
*
* MessageIDs represent the legacy number id used for processing MessageRequests and MessageResponses
*/
export type MessageID = number;
/**
* @internal
* Limited to Microsoft-internal use
*/
export interface MessageRequest {
id?: MessageID;
uuid?: MessageUUID;
func: string;
timestamp?: number;
monotonicTimestamp?: number;
args?: any[];
apiVersionTag?: string;
isPartialResponse?: boolean;
isProxiedFromChild?: boolean;
teamsJsInstanceId?: string;
}
/**
* @internal
* Limited to Microsoft-internal use
*/
export interface SerializedMessageRequest {
id?: MessageID;
uuidAsString?: string;
func: string;
timestamp?: number;
monotonicTimestamp?: number;
args?: any[];
apiVersionTag?: string;
}
/**
* @internal
* Limited to Microsoft-internal use
*/
export interface SerializedMessageResponse {
id: MessageID;
uuidAsString?: string;
args?: any[];
monotonicTimestamp?: number;
isPartialResponse?: boolean;
}
/**
* @internal
* Limited to Microsoft-internal use
*/
export interface MessageResponse {
id: MessageID;
uuid?: MessageUUID;
args?: any[];
monotonicTimestamp?: number;
isPartialResponse?: boolean;
}
/**
* @internal
* Limited to Microsoft-internal use
*
* For reasons that are unclear at this time, some MessageRequest objects can exist without an id or timestamp, even though
* many parts of code assume that they are defined.
* To enable type-safety in some scenarios, this new interface can be used where these properties are required. Because it
* derives from the original interface, objects of this type can be user interchangeably with the original interface.
* As the required messaging scenarios are better understood, the interfaces will eventually be updated and
* merged. However, it's a journey.
*/
export interface MessageRequestWithRequiredProperties extends MessageRequest {
id: MessageID;
uuid: MessageUUID;
/** Deprecated field, is still here for backwards compatibility */
timestamp: number;
}
export declare const serializeMessageRequest: (message: MessageRequest) => SerializedMessageRequest;
export declare const deserializeMessageRequest: (message: SerializedMessageRequest) => MessageRequest;
export declare const deserializeMessageResponse: (serializedResponse: SerializedMessageResponse) => MessageResponse;
export declare const serializeMessageResponse: (response: MessageResponse) => SerializedMessageResponse;