import { Observable } from 'rxjs/Observable' ; import { SDKFetch } from '../../SDKFetch' ; import { ActivitySchema , RoomSchema } from '../../schemas' ; import { RoomId } from 'teambition-types' ; export interface CreateChatMessageOptions { attachments : any ; boundToObjectType : string ; content : string ; created : string ; mentions : object ; objectType : string ; updated : string ; _boundToObjectId : string ; _creatorId : string ; } export function createChatMessageFetch ( this , roomId , options ) { return this . post < ActivitySchema > ( `rooms/${ roomId }/activities` , options ) ; } export function getRoomInfoFetch ( this , type , modelId , query ? ) { return this . get < RoomSchema > ( `rooms/${ type }/${ modelId }` , query ) ; } export function getRoomActivitiesFetch ( this , roomId , query ? ) { return this . get < ActivitySchema > ( `rooms/${ roomId }/activities` , query ) ; } export function getMoreRoomActivitiesFetch ( this , roomId , query ? ) { return this . get < ActivitySchema > ( `rooms/${ roomId }/activities` , query ) ; } export namespace MarkMute { export interface IsMute { isMute : boolean ; } } export function markRoomMute ( this , roomId , options ) { return this . put < MarkMute . IsMute > ( `rooms/${ roomId }/mute` , options ) ; } export namespace MarkRead { export interface Response { isAted : boolean ; isRead : boolean ; msgType : string ; unreadActivitiesCount : number ; updated : string ; } } export function markRoomRead ( this , roomId ) { return this . put < MarkRead . Response > ( `rooms/${ roomId }/message` ) ; } SDKFetch . prototype . createChatMessage = createChatMessageFetch ; SDKFetch . prototype . getRoomInfo = getRoomInfoFetch ; SDKFetch . prototype . getRoomActivities = getRoomActivitiesFetch ; SDKFetch . prototype . getMoreRoomActivities = getMoreRoomActivitiesFetch ; SDKFetch . prototype . markRoomMute = markRoomMute ; SDKFetch . prototype . markRoomRead = markRoomRead ; declare module '../../SDKFetch' { interface SDKFetch { createChatMessage : typeof createChatMessageFetch ; getRoomInfo : typeof getRoomInfoFetch ; getRoomActivities : typeof getRoomActivitiesFetch ; getMoreRoomActivities : typeof getMoreRoomActivitiesFetch ; markRoomMute : typeof markRoomMute ; markRoomRead : typeof markRoomRead ; } }