added protocol ROOM all,
buddy, group models filename chaged
This commit is contained in:
parent
06f0219660
commit
31129c90ac
|
@ -17,19 +17,19 @@ import {
|
|||
encodeBuddyAdd,
|
||||
decodeBuddyAdd,
|
||||
BuddyAddResponse
|
||||
} from '../models/buddy-add';
|
||||
} from '../models/add';
|
||||
import {
|
||||
BuddyDelRequest,
|
||||
encodeBuddyDel,
|
||||
decodeBuddyDel,
|
||||
BuddyDelResponse
|
||||
} from '../models/buddy-del';
|
||||
} from '../models/del';
|
||||
import {
|
||||
BuddyUpdateRequest,
|
||||
decodeBuddyUpdate,
|
||||
encodeBuddyUpdate,
|
||||
BuddyUpdateResponse
|
||||
} from '../models/buddy-update';
|
||||
} from '../models/update';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* Public API Surface of ucap-webmessenger-protocol-buddy
|
||||
*/
|
||||
export * from './lib/models/buddy-add';
|
||||
export * from './lib/models/buddy-del';
|
||||
export * from './lib/models/buddy-update';
|
||||
export * from './lib/models/add';
|
||||
export * from './lib/models/del';
|
||||
export * from './lib/models/update';
|
||||
|
||||
export * from './lib/services/buddy-protocol.service';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
encodeGroupAdd,
|
||||
decodeGroupAdd,
|
||||
GroupAddResponse
|
||||
} from '../models/group-add';
|
||||
} from '../models/add';
|
||||
import {
|
||||
SVC_TYPE_GROUP,
|
||||
SSVC_TYPE_GROUP_ADD_REQ,
|
||||
|
@ -22,7 +22,7 @@ import {
|
|||
encodeGroupDel,
|
||||
decodeGroupDel,
|
||||
GroupDelResponse
|
||||
} from '../models/group-del';
|
||||
} from '../models/del';
|
||||
import {
|
||||
GroupUpdateRequest,
|
||||
encodeGroupUpdate,
|
||||
|
@ -30,7 +30,7 @@ import {
|
|||
encodeGroupUpdate2,
|
||||
decodeGroupUpdate2,
|
||||
GroupUpdateResponse
|
||||
} from '../models/group-update';
|
||||
} from '../models/update';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* Public API Surface of ucap-webmessenger-protocol-group
|
||||
*/
|
||||
export * from './lib/models/group-add';
|
||||
export * from './lib/models/group-del';
|
||||
export * from './lib/models/group-update';
|
||||
export * from './lib/models/add';
|
||||
export * from './lib/models/del';
|
||||
export * from './lib/models/update';
|
||||
|
||||
export * from './lib/services/group-protocol.service';
|
||||
|
||||
|
|
123
projects/ucap-webmessenger-protocol-room/src/lib/models/exit.ts
Normal file
123
projects/ucap-webmessenger-protocol-room/src/lib/models/exit.ts
Normal file
|
@ -0,0 +1,123 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { RoomExitType } from '../types/room.type';
|
||||
|
||||
export interface RoomExitRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export interface RoomExitResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export const encodeRoomExit: ProtocolEncoder<RoomExitRequest> = (
|
||||
req: RoomExitRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomExit: ProtocolDecoder<RoomExitResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomExitResponse;
|
||||
};
|
||||
export const decodeRoomExitNotification: ProtocolDecoder<RoomExitResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomExitResponse;
|
||||
};
|
||||
|
||||
export interface RoomExitAllRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string[];
|
||||
}
|
||||
|
||||
export const encodeRoomAllExit: ProtocolEncoder<RoomExitAllRequest> = (
|
||||
req: RoomExitAllRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq.join(',') });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export interface RoomExitForcingRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 강퇴요청타입(s)
|
||||
type: string;
|
||||
// sender사용자SEQ(n)
|
||||
senderSeq: number;
|
||||
// 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomExitForcingResponse extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 강퇴요청타입(s)
|
||||
type: RoomExitType;
|
||||
// sender사용자SEQ(n)
|
||||
senderSeq: number;
|
||||
// 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeRoomExitForcing: ProtocolEncoder<RoomExitForcingRequest> = (
|
||||
req: RoomExitForcingRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.type });
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.senderSeq });
|
||||
req.userSeqs.forEach(userSeq => {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
});
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomExitForcing: ProtocolDecoder<RoomExitForcingResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqs: number[] = [];
|
||||
if (message.bodyList.length > 3) {
|
||||
userSeqs = message.bodyList.slice(3);
|
||||
}
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
type: message.bodyList[1] as RoomExitType,
|
||||
senderSeq: message.bodyList[2],
|
||||
userSeqs
|
||||
} as RoomExitForcingResponse;
|
||||
};
|
||||
export const decodeRoomExitForcingNotification: ProtocolDecoder<
|
||||
RoomExitForcingResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
let userSeqs: number[] = [];
|
||||
if (message.bodyList.length > 3) {
|
||||
userSeqs = message.bodyList.slice(3);
|
||||
}
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
type: message.bodyList[1] as RoomExitType,
|
||||
senderSeq: message.bodyList[2],
|
||||
userSeqs
|
||||
} as RoomExitForcingResponse;
|
||||
};
|
|
@ -203,7 +203,7 @@ export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
|
|||
if (info.length > 11) {
|
||||
roomInfo = {
|
||||
roomSeq: info[0],
|
||||
roomType: info[1],
|
||||
roomType: info[1] as RoomType,
|
||||
roomName: info[2],
|
||||
finalEventType: info[3] as EventType,
|
||||
finalEventMessage: info[4],
|
||||
|
@ -300,3 +300,35 @@ export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
|
|||
userInfos
|
||||
} as RoomUserDataResponse;
|
||||
};
|
||||
|
||||
export interface RoomUserStatusOfflineRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export interface RoomUserStatusOfflineResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
export const encodeRoomUserStatusOffline: ProtocolEncoder<
|
||||
RoomUserStatusOfflineRequest
|
||||
> = (req: RoomUserStatusOfflineRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
return bodyList;
|
||||
};
|
||||
export const decodeRoomUserStatusOffline: ProtocolDecoder<
|
||||
RoomUserStatusOfflineResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
let userSeqs: number[] = [];
|
||||
if (message.bodyList.length > 1) {
|
||||
userSeqs = message.bodyList.slice(1);
|
||||
}
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userSeqs
|
||||
} as RoomUserStatusOfflineResponse;
|
||||
};
|
220
projects/ucap-webmessenger-protocol-room/src/lib/models/open.ts
Normal file
220
projects/ucap-webmessenger-protocol-room/src/lib/models/open.ts
Normal file
|
@ -0,0 +1,220 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpenRequest extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpenResponse extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 2. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
|
||||
req: RoomOpenRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen: ProtocolDecoder<RoomOpenResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomSeq: message.bodyList[1],
|
||||
newRoom: message.bodyList[2] === 'Y' ? true : false
|
||||
} as RoomOpenResponse;
|
||||
};
|
||||
|
||||
export interface RoomOpen2Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen2Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
|
||||
req: RoomOpen2Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false
|
||||
} as RoomOpen2Response;
|
||||
};
|
||||
|
||||
export interface RoomOpen3Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 3. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
// 4n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen3Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
// 4. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 5. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
|
||||
req: RoomOpen3Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isTimerRoom === true ? 'Y' : 'N'
|
||||
});
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.Integer,
|
||||
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
|
||||
});
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false,
|
||||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval: message.bodyList[5] || 0
|
||||
} as RoomOpen3Response;
|
||||
};
|
||||
|
||||
export interface RoomOpen4Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 3. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
// 4n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen4Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
// 4. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 5. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
|
||||
req: RoomOpen4Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isTimerRoom === true ? 'Y' : 'N'
|
||||
});
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.Integer,
|
||||
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
|
||||
});
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false,
|
||||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval:
|
||||
message.bodyList[4] !== 'Y' ? 0 : message.bodyList[5] || 0
|
||||
} as RoomOpen4Response;
|
||||
};
|
|
@ -1,48 +0,0 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpenRequest extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpenResponse extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 2. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
|
||||
req: RoomOpenRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen: ProtocolDecoder<RoomOpenResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomSeq: message.bodyList[1],
|
||||
newRoom: message.bodyList[2] === 'Y' ? true : false
|
||||
} as RoomOpenResponse;
|
||||
};
|
|
@ -1,54 +0,0 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpen2Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen2Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
|
||||
req: RoomOpen2Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false
|
||||
} as RoomOpen2Response;
|
||||
};
|
|
@ -1,72 +0,0 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpen3Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 3. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
// 4n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen3Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
// 4. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 5. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
|
||||
req: RoomOpen3Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isTimerRoom === true ? 'Y' : 'N'
|
||||
});
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.Integer,
|
||||
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
|
||||
});
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false,
|
||||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval: message.bodyList[5] || 0
|
||||
} as RoomOpen3Response;
|
||||
};
|
|
@ -1,73 +0,0 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpen4Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 3. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
// 4n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen4Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
roomName: string;
|
||||
// 2. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 3. 신규여부(y)
|
||||
newRoom: boolean;
|
||||
// 4. 타이머대화방여부YN(s)
|
||||
isTimerRoom: boolean;
|
||||
// 5. 타이머시간(n)
|
||||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
|
||||
req: RoomOpen4Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isTimerRoom === true ? 'Y' : 'N'
|
||||
});
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.Integer,
|
||||
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
|
||||
});
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false,
|
||||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval:
|
||||
message.bodyList[4] !== 'Y' ? 0 : message.bodyList[5] || 0
|
||||
} as RoomOpen4Response;
|
||||
};
|
|
@ -0,0 +1,142 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomUpdateRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 대화방제목(s)
|
||||
roomName: string;
|
||||
// 알람여부(y)
|
||||
isAlarm: boolean;
|
||||
// 동기화여부(s)
|
||||
isSyncAll: boolean;
|
||||
}
|
||||
|
||||
export interface RoomUpdateResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 대화방제목(s)
|
||||
roomName: string;
|
||||
// 알람여부(y)
|
||||
isAlarm: boolean;
|
||||
// 동기화여부(s)
|
||||
isSyncAll: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomUpdate: ProtocolEncoder<RoomUpdateRequest> = (
|
||||
req: RoomUpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomName });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isAlarm ? 'Y' : 'N'
|
||||
});
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isSyncAll ? 'Y' : 'N'
|
||||
});
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdate: ProtocolDecoder<RoomUpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
roomName: message.bodyList[1],
|
||||
isAlarm: message.bodyList[2] === 'Y' ? true : false,
|
||||
isSyncAll: message.bodyList[3] === 'Y' ? true : false
|
||||
} as RoomUpdateResponse;
|
||||
};
|
||||
|
||||
export interface RoomUpdateTimerSetRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 타이머시간(n)
|
||||
timerInterval: number;
|
||||
}
|
||||
|
||||
export interface RoomUpdateTimerSetResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 타이머시간(n)
|
||||
timerInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomUpdateTimerSet: ProtocolEncoder<
|
||||
RoomUpdateTimerSetRequest
|
||||
> = (req: RoomUpdateTimerSetRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.timerInterval });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdateTimerSet: ProtocolDecoder<
|
||||
RoomUpdateTimerSetResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
timerInterval: message.bodyList[1] || 0
|
||||
} as RoomUpdateTimerSetResponse;
|
||||
};
|
||||
|
||||
export interface RoomUpdateFontRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 폰트색(s) cf)0x000000 형태의 스트링
|
||||
fontColor: string;
|
||||
// sender사용자SEQ(n)
|
||||
senderSeq: number;
|
||||
}
|
||||
|
||||
export interface RoomUpdateFontResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 폰트색(s) cf)0x000000 형태의 스트링
|
||||
fontColor: string;
|
||||
// sender사용자SEQ(n)
|
||||
senderSeq: number;
|
||||
}
|
||||
|
||||
export const encodeRoomUpdateFont: ProtocolEncoder<RoomUpdateFontRequest> = (
|
||||
req: RoomUpdateFontRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.fontColor });
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.senderSeq });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdateFont: ProtocolDecoder<RoomUpdateFontResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
fontColor: message.bodyList[1],
|
||||
senderSeq: message.bodyList[2]
|
||||
} as RoomUpdateFontResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdateFontNotification: ProtocolDecoder<
|
||||
RoomUpdateFontResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
fontColor: message.bodyList[1],
|
||||
senderSeq: message.bodyList[2]
|
||||
} as RoomUpdateFontResponse;
|
||||
};
|
|
@ -15,38 +15,39 @@ import {
|
|||
SSVC_TYPE_ROOM_INFO_RES,
|
||||
SSVC_TYPE_ROOM_INFO_REQ,
|
||||
SSVC_TYPE_ROOM_INFO_USER,
|
||||
SSVC_TYPE_ROOM_INFO_USER2
|
||||
SSVC_TYPE_ROOM_INFO_USER2,
|
||||
SSVC_TYPE_ROOM_EXIT_REQ,
|
||||
SSVC_TYPE_ROOM_EXIT_ALL_REQ,
|
||||
SSVC_TYPE_ROOM_EXIT_FORCING_REQ,
|
||||
SSVC_TYPE_ROOM_USER_STATUS_REQ,
|
||||
SSVC_TYPE_ROOM_UPD_REQ,
|
||||
SSVC_TYPE_ROOM_INFO_UPD_REQ,
|
||||
SSVC_TYPE_ROOM_FONT_UPD_REQ
|
||||
} from '../types/service';
|
||||
import {
|
||||
RoomOpenRequest,
|
||||
encodeRoomOpen,
|
||||
decodeRoomOpen,
|
||||
RoomOpenResponse
|
||||
} from '../models/room-open';
|
||||
import {
|
||||
RoomOpenResponse,
|
||||
RoomOpen2Request,
|
||||
RoomOpen2Response,
|
||||
decodeRoomOpen2,
|
||||
encodeRoomOpen2
|
||||
} from '../models/room-open2';
|
||||
import {
|
||||
encodeRoomOpen2,
|
||||
RoomOpen3Request,
|
||||
RoomOpen3Response,
|
||||
encodeRoomOpen3,
|
||||
decodeRoomOpen3
|
||||
} from '../models/room-open3';
|
||||
import {
|
||||
decodeRoomOpen3,
|
||||
RoomOpen4Request,
|
||||
RoomOpen4Response,
|
||||
encodeRoomOpen4,
|
||||
decodeRoomOpen4
|
||||
} from '../models/room-open4';
|
||||
} from '../models/open';
|
||||
import {
|
||||
RoomInviteRequest,
|
||||
RoomInviteResponse,
|
||||
encodeRoomInvite,
|
||||
decodeRoomInvite
|
||||
} from '../models/room-invite';
|
||||
} from '../models/invite';
|
||||
import {
|
||||
RoomInfoRequest,
|
||||
RoomInfoResponse,
|
||||
|
@ -57,8 +58,38 @@ import {
|
|||
decodeRoomInfoData,
|
||||
decodeRoomInfo,
|
||||
decodeRoomUserShortData,
|
||||
decodeRoomUserData
|
||||
} from '../models/room-info';
|
||||
decodeRoomUserData,
|
||||
RoomUserStatusOfflineRequest,
|
||||
RoomUserStatusOfflineResponse,
|
||||
encodeRoomUserStatusOffline,
|
||||
decodeRoomUserStatusOffline
|
||||
} from '../models/info';
|
||||
import {
|
||||
RoomExitRequest,
|
||||
RoomExitResponse,
|
||||
encodeRoomExit,
|
||||
decodeRoomExit,
|
||||
RoomExitAllRequest,
|
||||
encodeRoomAllExit,
|
||||
RoomExitForcingRequest,
|
||||
RoomExitForcingResponse,
|
||||
encodeRoomExitForcing,
|
||||
decodeRoomExitForcing
|
||||
} from '../models/exit';
|
||||
import {
|
||||
RoomUpdateRequest,
|
||||
RoomUpdateResponse,
|
||||
encodeRoomUpdate,
|
||||
decodeRoomUpdate,
|
||||
RoomUpdateTimerSetRequest,
|
||||
RoomUpdateTimerSetResponse,
|
||||
encodeRoomUpdateTimerSet,
|
||||
decodeRoomUpdateTimerSet,
|
||||
RoomUpdateFontRequest,
|
||||
RoomUpdateFontResponse,
|
||||
encodeRoomUpdateFont,
|
||||
decodeRoomUpdateFont
|
||||
} from '../models/update';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -74,7 +105,6 @@ export class RoomProtocolService {
|
|||
map(res => decodeRoomOpen(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen2(req: RoomOpen2Request): Observable<RoomOpen2Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req))
|
||||
|
@ -83,7 +113,6 @@ export class RoomProtocolService {
|
|||
map(res => decodeRoomOpen2(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen3(req: RoomOpen3Request): Observable<RoomOpen3Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req))
|
||||
|
@ -92,7 +121,6 @@ export class RoomProtocolService {
|
|||
map(res => decodeRoomOpen3(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen4(req: RoomOpen4Request): Observable<RoomOpen4Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req))
|
||||
|
@ -136,4 +164,103 @@ export class RoomProtocolService {
|
|||
})
|
||||
);
|
||||
}
|
||||
public roomUserStatusOffline(
|
||||
req: RoomUserStatusOfflineRequest
|
||||
): Observable<RoomUserStatusOfflineResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_USER_STATUS_REQ,
|
||||
...encodeRoomUserStatusOffline(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUserStatusOffline(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public roomExit(req: RoomExitRequest): Observable<RoomExitResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeRoomExit(req))
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomExit(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomExitAll(req: RoomExitAllRequest): Observable<void> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_EXIT_ALL_REQ,
|
||||
...encodeRoomAllExit(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomExitForcing(
|
||||
req: RoomExitForcingRequest
|
||||
): Observable<RoomExitForcingResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_EXIT_FORCING_REQ,
|
||||
...encodeRoomExitForcing(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomExitForcing(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public roomUpdate(req: RoomUpdateRequest): Observable<RoomUpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeRoomUpdate(req))
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUpdate(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomUpdateTimerSet(
|
||||
req: RoomUpdateTimerSetRequest
|
||||
): Observable<RoomUpdateTimerSetResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_INFO_UPD_REQ,
|
||||
...encodeRoomUpdateTimerSet(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUpdateTimerSet(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomUpdateFont(
|
||||
req: RoomUpdateFontRequest
|
||||
): Observable<RoomUpdateFontResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_FONT_UPD_REQ,
|
||||
...encodeRoomUpdateFont(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUpdateFont(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,3 +18,8 @@ export enum RoomType {
|
|||
// K: MyTalk(나와의 대화)
|
||||
Mytalk = 'K'
|
||||
}
|
||||
|
||||
export enum RoomExitType {
|
||||
// A 만 사용하고 있고, 서버에서도 달리 처리하지는 않음, 하지만 추후 사용성을 위해 생성.
|
||||
All = 'A'
|
||||
}
|
||||
|
|
|
@ -2,12 +2,9 @@
|
|||
* Public API Surface of ucap-webmessenger-protocol-room
|
||||
*/
|
||||
|
||||
export * from './lib/models/room-info';
|
||||
export * from './lib/models/room-invite';
|
||||
export * from './lib/models/room-open';
|
||||
export * from './lib/models/room-open2';
|
||||
export * from './lib/models/room-open3';
|
||||
export * from './lib/models/room-open4';
|
||||
export * from './lib/models/info';
|
||||
export * from './lib/models/invite';
|
||||
export * from './lib/models/open';
|
||||
|
||||
export * from './lib/services/room-protocol.service';
|
||||
export * from './lib/types/employee.type';
|
||||
|
|
Loading…
Reference in New Issue
Block a user