@allthings/sdk
Version:
Allthings Node/Javascript SDK
41 lines (40 loc) • 1.64 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { EnumCommunicationMethodType, EnumInputChannel, IAllthingsRestClient } from '../types';
export interface IConversation {
readonly createdAt: string;
readonly id: string;
}
export interface IMessage {
readonly _embedded?: any;
readonly _links?: any;
readonly content: {
readonly content?: string;
readonly description?: string;
readonly files?: readonly string[];
};
readonly createdAt: string;
readonly id: string;
readonly inputChannel?: EnumInputChannel;
readonly internal: boolean;
readonly read: boolean;
readonly type: string;
}
export interface IMessagePayload {
readonly attachments?: readonly {
readonly content: Buffer;
readonly filename: string;
}[];
readonly body: string;
readonly createdBy: {
readonly type: EnumCommunicationMethodType;
readonly value: string;
};
readonly inputChannel?: string;
}
export type ConversationResult = Promise<IConversation>;
export type ConversationCreateMessageResult = Promise<IMessage>;
export type MethodConversationGetById = (conversationId: string) => ConversationResult;
export declare function conversationGetById(client: IAllthingsRestClient, conversationId: string): ConversationResult;
export type MethodConversationCreateMessage = (conversationId: string, messageData: IMessagePayload) => ConversationCreateMessageResult;
export declare function conversationCreateMessage(client: IAllthingsRestClient, conversationId: string, messageData: IMessagePayload): ConversationCreateMessageResult;