Merge branch 'protocol'
This commit is contained in:
commit
58e4f249a2
|
@ -0,0 +1,41 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyAddRequest extends ProtocolRequest {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface BuddyAddResponse extends ProtocolResponse {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeBuddyAdd: ProtocolEncoder<BuddyAddRequest> = (
|
||||
req: BuddyAddRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyAdd: ProtocolDecoder<BuddyAddResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userSeqArray: number[] = [...message.bodyList];
|
||||
return {
|
||||
userSeqs: userSeqArray
|
||||
} as BuddyAddResponse;
|
||||
};
|
|
@ -0,0 +1,41 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyDelRequest extends ProtocolRequest {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface BuddyDelResponse extends ProtocolResponse {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeBuddyDel: ProtocolEncoder<BuddyDelRequest> = (
|
||||
req: BuddyDelRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
for (const userSeq of req.userSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyDel: ProtocolDecoder<BuddyDelResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userSeqArray: number[] = [...message.bodyList];
|
||||
return {
|
||||
userSeqs: userSeqArray
|
||||
} as BuddyDelResponse;
|
||||
};
|
|
@ -0,0 +1,47 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyUpdateRequest extends ProtocolRequest {
|
||||
// 0. 사용자SEQ(n)
|
||||
userSeq: number;
|
||||
// 1. 즐겨찾기여부(y)
|
||||
isFavorit: boolean;
|
||||
}
|
||||
|
||||
export interface BuddyUpdateResponse extends ProtocolResponse {
|
||||
// 0. 사용자SEQ(n)
|
||||
userSeq: number;
|
||||
// 1. 즐겨찾기여부(y)
|
||||
isFavorit: boolean;
|
||||
}
|
||||
|
||||
export const encodeBuddyUpdate: ProtocolEncoder<BuddyUpdateRequest> = (
|
||||
req: BuddyUpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.userSeq });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isFavorit ? 'Y' : 'N'
|
||||
});
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyUpdate: ProtocolDecoder<BuddyUpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
userSeq: message.bodyList[0],
|
||||
isFavorit: message.bodyList[1] === 'Y' ? true : false
|
||||
} as BuddyUpdateResponse;
|
||||
};
|
|
@ -1,8 +1,66 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
|
||||
import {
|
||||
SVC_TYPE_BUDDY,
|
||||
SSVC_TYPE_BUDDY_ADD_REQ,
|
||||
SSVC_TYPE_BUDDY_DEL_REQ,
|
||||
SSVC_TYPE_BUDDY_UPD_REQ
|
||||
} from '../types/service';
|
||||
|
||||
import {
|
||||
BuddyAddRequest,
|
||||
encodeBuddyAdd,
|
||||
decodeBuddyAdd,
|
||||
BuddyAddResponse
|
||||
} from '../models/buddy-add';
|
||||
import {
|
||||
BuddyDelRequest,
|
||||
encodeBuddyDel,
|
||||
decodeBuddyDel,
|
||||
BuddyDelResponse
|
||||
} from '../models/buddy-del';
|
||||
import {
|
||||
BuddyUpdateRequest,
|
||||
decodeBuddyUpdate,
|
||||
encodeBuddyUpdate,
|
||||
BuddyUpdateResponse
|
||||
} from '../models/buddy-update';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class BuddyProtocolService {
|
||||
constructor() {}
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public buddyAdd(req: BuddyAddRequest): Observable<BuddyAddResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_ADD_REQ, ...encodeBuddyAdd(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyAdd(res))
|
||||
);
|
||||
}
|
||||
|
||||
public buddyDel(req: BuddyDelRequest): Observable<BuddyDelResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_DEL_REQ, ...encodeBuddyDel(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyDel(res))
|
||||
);
|
||||
}
|
||||
|
||||
public buddyUpdate(req: BuddyUpdateRequest): Observable<BuddyUpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_UPD_REQ, ...encodeBuddyUpdate(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyUpdate(res))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export const SVC_TYPE_BUDDY = 4; // 동료 관리
|
||||
export const SSVC_TYPE_BUDDY_ADD_REQ = 1; // 동료추가
|
||||
export const SSVC_TYPE_BUDDY_ADD_RES = 2;
|
||||
export const SSVC_TYPE_BUDDY_DEL_REQ = 11; // 동료삭제
|
||||
export const SSVC_TYPE_BUDDY_DEL_RES = 12;
|
||||
export const SSVC_TYPE_BUDDY_UPD_REQ = 21; // 동료변경
|
||||
export const SSVC_TYPE_BUDDY_UPD_RES = 22;
|
|
@ -1,6 +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/services/buddy-protocol.service';
|
||||
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
ProtocolStream,
|
||||
PacketBodyValue
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { EventType } from '../types/event.type';
|
||||
import { PushStatus } from '../types/pushStatus.type';
|
||||
|
||||
export interface EventSendRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. 이벤트타입(s)
|
||||
type: EventType;
|
||||
// 2. 이벤트내용(s)
|
||||
sentMessage: string;
|
||||
}
|
||||
|
||||
export interface EventSendResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 이벤트SEQ(n)
|
||||
seq: number;
|
||||
// 이벤트타입(s)
|
||||
type: EventType;
|
||||
// 발생일시(s)
|
||||
sendDate: string;
|
||||
// 이벤트내용(s)
|
||||
message: string;
|
||||
// 수신자수
|
||||
receiverCount: number;
|
||||
// 알림상태(s) PC 경우에만 관여됨 N: 푸시를 보내지 않은 이벤트 S: 푸시를 보낸 이벤트
|
||||
pushStatus: PushStatus;
|
||||
// 강퇴 타입(s)
|
||||
ForcedExitType: string;
|
||||
// 요청자 이름(s)
|
||||
senderName: string;
|
||||
}
|
||||
|
||||
export interface EventSendNotification extends EventSendResponse {
|
||||
// 대화방SEQ(s)
|
||||
// 이벤트SEQ(n)
|
||||
// 이벤트타입(s)
|
||||
// 발생일시(s)
|
||||
// 이벤트내용(s)
|
||||
// 수신자수
|
||||
// 알림상태(s) PC 경우에만 관여됨 N: 푸시를 보내지 않은 이벤트 S: 푸시를 보낸 이벤트
|
||||
// 강퇴 타입(s)
|
||||
// 요청자 이름(s)
|
||||
|
||||
// 사용자아이디(s)
|
||||
id?: string;
|
||||
// 회사코드(s)
|
||||
companyCode?: string;
|
||||
}
|
||||
|
||||
export const encodeEventSend: ProtocolEncoder<EventSendRequest> = (
|
||||
req: EventSendRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push(
|
||||
{ type: PacketBodyValue.String, value: req.roomSeq },
|
||||
{ type: PacketBodyValue.String, value: req.type },
|
||||
{ type: PacketBodyValue.String, value: req.sentMessage }
|
||||
);
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeEventSend: ProtocolDecoder<EventSendResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
seq: message.bodyList[1],
|
||||
type: message.bodyList[2] as EventType,
|
||||
sendDate: message.bodyList[3],
|
||||
message: message.bodyList[4],
|
||||
receiverCount: message.bodyList[5] || 0,
|
||||
pushStatus: message.bodyList[6] as PushStatus,
|
||||
ForcedExitType: message.bodyList[7],
|
||||
senderName: message.bodyList[8]
|
||||
} as EventSendResponse;
|
||||
};
|
||||
|
||||
export const decodeEventSendNotification: ProtocolDecoder<
|
||||
EventSendNotification
|
||||
> = (message: ProtocolMessage) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
seq: message.bodyList[1],
|
||||
type: message.bodyList[2] as EventType,
|
||||
sendDate: message.bodyList[3],
|
||||
message: message.bodyList[4],
|
||||
receiverCount: message.bodyList[5] || 0,
|
||||
pushStatus: message.bodyList[6] as PushStatus,
|
||||
ForcedExitType: message.bodyList[7],
|
||||
senderName: message.bodyList[8],
|
||||
id: message.bodyList[9],
|
||||
companyCode: message.bodyList[10]
|
||||
} as EventSendNotification;
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, takeWhile, timeout } from 'rxjs/operators';
|
||||
import { map, takeWhile, timeout, take } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
|
||||
|
@ -17,8 +17,15 @@ import {
|
|||
SVC_TYPE_EVENT,
|
||||
SSVC_TYPE_EVENT_INFO_REQ,
|
||||
SSVC_TYPE_EVENT_INFO_RES,
|
||||
SSVC_TYPE_EVENT_INFO_DATA
|
||||
SSVC_TYPE_EVENT_INFO_DATA,
|
||||
SSVC_TYPE_EVENT_SEND_REQ
|
||||
} from '../types/service';
|
||||
import {
|
||||
EventSendRequest,
|
||||
EventSendResponse,
|
||||
decodeEventSend,
|
||||
encodeEventSend
|
||||
} from '../models/event-send';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -39,4 +46,15 @@ export class EventProtocolService {
|
|||
})
|
||||
);
|
||||
}
|
||||
|
||||
public eventSend(req: EventSendRequest): Observable<EventSendResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_EVENT, SSVC_TYPE_EVENT_SEND_REQ, ...encodeEventSend(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => {
|
||||
return decodeEventSend(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
export enum PushStatus {
|
||||
// PC 경우에만 관여됨
|
||||
// N: 푸시를 보내지 않은 이벤트
|
||||
NotSent = 'N',
|
||||
// S: 푸시를 보낸 이벤트
|
||||
Sent = 'S'
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupAddRequest extends ProtocolRequest {
|
||||
// 0. 동료그룹이름
|
||||
groupName: string;
|
||||
}
|
||||
|
||||
export interface GroupAddResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
groupName: string;
|
||||
}
|
||||
|
||||
export const encodeGroupAdd: ProtocolEncoder<GroupAddRequest> = (
|
||||
req: GroupAddRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.groupName });
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupAdd: ProtocolDecoder<GroupAddResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1]
|
||||
} as GroupAddResponse;
|
||||
};
|
|
@ -0,0 +1,38 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupDelRequest extends ProtocolRequest {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
}
|
||||
|
||||
export interface GroupDelResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
}
|
||||
|
||||
export const encodeGroupDel: ProtocolEncoder<GroupDelRequest> = (
|
||||
req: GroupDelRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.groupSeq });
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupDel: ProtocolDecoder<GroupDelResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
groupSeq: message.bodyList[0]
|
||||
} as GroupDelResponse;
|
||||
};
|
|
@ -0,0 +1,91 @@
|
|||
import { DeviceType, LocaleCode } from '@ucap-webmessenger/core';
|
||||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupUpdateRequest extends ProtocolRequest {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
groupName: string;
|
||||
// 2n: 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface GroupUpdateResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
groupName: string;
|
||||
// 2n: 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeGroupUpdate: ProtocolEncoder<GroupUpdateRequest> = (
|
||||
req: GroupUpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push(
|
||||
{ type: PacketBodyValue.Integer, value: req.groupSeq },
|
||||
{ type: PacketBodyValue.String, value: req.groupName },
|
||||
{ type: PacketBodyValue.String, value: req.userSeqs.join(',') }
|
||||
);
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupUpdate: ProtocolDecoder<GroupUpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqArray: number[] = [];
|
||||
if (message.bodyList.length > 2 && !message.bodyList[2].empty()) {
|
||||
userSeqArray = message.bodyList[2].split(',').map((v: any) => Number(v));
|
||||
}
|
||||
|
||||
return {
|
||||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1],
|
||||
userSeqs: userSeqArray
|
||||
} as GroupUpdateResponse;
|
||||
};
|
||||
|
||||
export const encodeGroupUpdate2: ProtocolEncoder<GroupUpdateRequest> = (
|
||||
req: GroupUpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push(
|
||||
{ type: PacketBodyValue.Integer, value: req.groupSeq },
|
||||
{ type: PacketBodyValue.String, value: req.groupName }
|
||||
);
|
||||
|
||||
if (req.userSeqs.length > 0) {
|
||||
req.userSeqs.forEach(userSeq => {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
});
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupUpdate2: ProtocolDecoder<GroupUpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqArray: number[] = [];
|
||||
if (message.bodyList.length > 2) {
|
||||
userSeqArray = message.bodyList.slice(2);
|
||||
}
|
||||
|
||||
return {
|
||||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1],
|
||||
userSeqs: userSeqArray
|
||||
} as GroupUpdateResponse;
|
||||
};
|
|
@ -1,8 +1,81 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
GroupAddRequest,
|
||||
encodeGroupAdd,
|
||||
decodeGroupAdd,
|
||||
GroupAddResponse
|
||||
} from '../models/group-add';
|
||||
import {
|
||||
SVC_TYPE_GROUP,
|
||||
SSVC_TYPE_GROUP_ADD_REQ,
|
||||
SSVC_TYPE_GROUP_DEL_REQ,
|
||||
SSVC_TYPE_GROUP_UPD_REQ,
|
||||
SSVC_TYPE_GROUP_UPD_REQ2
|
||||
} from '../types/service';
|
||||
import {
|
||||
GroupDelRequest,
|
||||
encodeGroupDel,
|
||||
decodeGroupDel,
|
||||
GroupDelResponse
|
||||
} from '../models/group-del';
|
||||
import {
|
||||
GroupUpdateRequest,
|
||||
encodeGroupUpdate,
|
||||
decodeGroupUpdate,
|
||||
encodeGroupUpdate2,
|
||||
decodeGroupUpdate2,
|
||||
GroupUpdateResponse
|
||||
} from '../models/group-update';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class GroupProtocolService {
|
||||
constructor() {}
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public groupAdd(req: GroupAddRequest): Observable<GroupAddResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_ADD_REQ, ...encodeGroupAdd(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupAdd(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupDel(req: GroupDelRequest): Observable<GroupDelResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_DEL_REQ, ...encodeGroupDel(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupDel(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupUpdate(req: GroupUpdateRequest): Observable<GroupUpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ, ...encodeGroupUpdate(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupUpdate(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupUpdate2(
|
||||
req: GroupUpdateRequest
|
||||
): Observable<GroupUpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_GROUP,
|
||||
SSVC_TYPE_GROUP_UPD_REQ2,
|
||||
...encodeGroupUpdate2(req)
|
||||
)
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupUpdate2(res))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
export const SVC_TYPE_GROUP = 5; // 동료 그룹 관리
|
||||
export const SSVC_TYPE_GROUP_ADD_REQ = 1; // 동료 그룹 추가
|
||||
export const SSVC_TYPE_GROUP_ADD_RES = 2;
|
||||
export const SSVC_TYPE_GROUP_DEL_REQ = 11; // 동료 그룹 삭제
|
||||
export const SSVC_TYPE_GROUP_DEL_RES = 12;
|
||||
export const SSVC_TYPE_GROUP_UPD_REQ = 21; // 동료 그룹 변경
|
||||
export const SSVC_TYPE_GROUP_UPD_RES = 22;
|
||||
export const SSVC_TYPE_GROUP_UPD_REQ2 = 23;
|
||||
export const SSVC_TYPE_GROUP_UPD_RES2 = 24;
|
|
@ -1,6 +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/services/group-protocol.service';
|
||||
|
||||
|
|
|
@ -0,0 +1,302 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
BodyStringDivider
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { LocaleCode } from '@ucap-webmessenger/core';
|
||||
import { RoomType } from '../types/room.type';
|
||||
import { EventType } from 'projects/ucap-webmessenger-protocol-event/src/lib/types/event.type';
|
||||
import { EmployeeType } from '../types/employee.type';
|
||||
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
|
||||
|
||||
export interface RoomInfo {
|
||||
// 0. 대화방SEQ
|
||||
roomSeq: string;
|
||||
// 1. 대화방종류
|
||||
roomType: RoomType;
|
||||
// 2. 대화방명
|
||||
roomName: string;
|
||||
// 3. 최종타입
|
||||
finalEventType: EventType;
|
||||
// 4. 최종대화
|
||||
finalEventMessage: string;
|
||||
// 5. 최종시간
|
||||
finalEventDate: string;
|
||||
// 6. 참여인원수
|
||||
joinUserCount: number;
|
||||
// 7. 안읽은수
|
||||
noReadCnt: number;
|
||||
// 8. 알람여부
|
||||
isAlarm: boolean;
|
||||
// 9. 참여여부
|
||||
isJoinRoom: boolean;
|
||||
// 10. 유효한파일 이벤트 기준 SEQ
|
||||
expiredFileStdSeq: number;
|
||||
// 11. 타이머대화방여부YN
|
||||
isTimeRoom: boolean;
|
||||
// 12. 타이머시간(n)
|
||||
timeRoomInterval: number;
|
||||
}
|
||||
|
||||
export interface UserInfoShort {
|
||||
// 0. 사용자SEQ
|
||||
userSeq: number;
|
||||
// 1. 사용자명
|
||||
name: string;
|
||||
// 2. 사진파일
|
||||
profileImageFile: string;
|
||||
// 3. 참여여부
|
||||
isJoinRoom: boolean;
|
||||
// 4. 최종확인SEQ
|
||||
lastReadEventSeq: number;
|
||||
// 5. MADN
|
||||
madn: string;
|
||||
// 6. HARDPHONE_SADN
|
||||
hardSadn: string;
|
||||
// 7. FMC_SADN
|
||||
fmcSadn: string;
|
||||
// 8. 사용자명(영어)
|
||||
nameEn: string;
|
||||
// 9. 사용자명(중국어)
|
||||
nameCn: string;
|
||||
// 10. 이용약관동의여부YN
|
||||
isPrivacyAgree: boolean;
|
||||
// 11. 유효접속여부YN
|
||||
isValidLogin: boolean;
|
||||
// 12. 임직원유형(s)
|
||||
employeeType: EmployeeType;
|
||||
// 13. 폰트색(s)
|
||||
fontColor: string;
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
// 0. 사용자SEQ
|
||||
userSeq: number;
|
||||
// 1. 사용자명
|
||||
name: string;
|
||||
// 2. 사진파일
|
||||
profileImageFile: string;
|
||||
// 3. 직급
|
||||
grade: string;
|
||||
// 4. 업무소개
|
||||
intro: string;
|
||||
// 5. 기관코드
|
||||
companyCode: string;
|
||||
// 6. 핸드폰번호
|
||||
hpNumber: string;
|
||||
// 7. 내선번호
|
||||
lineNumber: string;
|
||||
// 8. 이메일
|
||||
email: string;
|
||||
// 9. 모바일YN
|
||||
isMobile: boolean;
|
||||
// 10. 부서명
|
||||
deptName: string;
|
||||
// 11. 참여 여부
|
||||
isJoinRoom: boolean;
|
||||
// 12. 최종확인SEQ
|
||||
lastReadEventSeq: number;
|
||||
// 13. ActiveYN
|
||||
isActive: boolean;
|
||||
// 14. 역할코드
|
||||
roleCd: RoleCode;
|
||||
// 15. 사번
|
||||
employeeNum: string;
|
||||
// 16. MADN
|
||||
madn: string;
|
||||
// 17. HARDPHONE_SADN
|
||||
hardSadn: string;
|
||||
// 18. FMC_SADN
|
||||
fmcSadn: string;
|
||||
// 19. 사용자명(영어)
|
||||
nameEn: string;
|
||||
// 20. 사용자명(중국어)
|
||||
nameCn: string;
|
||||
// 21. 직급(영어)
|
||||
gradeEn: string;
|
||||
// 22. 직급(중국어)
|
||||
gradeCn: string;
|
||||
// 23. 부서명(영어)
|
||||
deptNameEn: string;
|
||||
// 24. 부서명(중국어)
|
||||
deptNameCn: string;
|
||||
// 25. CALL_MODE
|
||||
callMode: string;
|
||||
// 26. 이용약관동의여부YN
|
||||
isPrivacyAgree: boolean;
|
||||
// 27. 유효접속여부YN
|
||||
isValidLogin: boolean;
|
||||
// 28. 임직원유형(s)
|
||||
employeeType: EmployeeType;
|
||||
// 29. 사용자아이디(s)
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface RoomInfoRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. 상세정보여부(y)
|
||||
isDetail: boolean;
|
||||
// 2. 언어코드(s)
|
||||
localeCode: LocaleCode;
|
||||
}
|
||||
|
||||
export interface RoomInfoResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export interface RoomInfoDataResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. {대화방정보}
|
||||
roomInfo: RoomInfo;
|
||||
}
|
||||
|
||||
export interface RoomUserShortDataResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보}
|
||||
userInfos: UserInfoShort[];
|
||||
}
|
||||
export interface RoomUserDataResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보}
|
||||
userInfos: UserInfo[];
|
||||
}
|
||||
|
||||
export const encodeRoomInfo: ProtocolEncoder<RoomInfoRequest> = (
|
||||
req: RoomInfoRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
bodyList.push({
|
||||
type: PacketBodyValue.String,
|
||||
value: req.isDetail !== true ? 'N' : 'Y'
|
||||
}); // 요청응답을 상세로 받는것을 default
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.localeCode });
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomInfo: ProtocolDecoder<RoomInfoResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInfoResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let roomInfo: RoomInfo = null;
|
||||
if (message.bodyList.length > 1) {
|
||||
const info = message.bodyList[1].split(BodyStringDivider);
|
||||
if (info.length > 11) {
|
||||
roomInfo = {
|
||||
roomSeq: info[0],
|
||||
roomType: info[1],
|
||||
roomName: info[2],
|
||||
finalEventType: info[3] as EventType,
|
||||
finalEventMessage: info[4],
|
||||
finalEventDate: info[5],
|
||||
joinUserCount: info[6],
|
||||
noReadCnt: info[7],
|
||||
isAlarm: info[8] !== 'N' ? true : false,
|
||||
isJoinRoom: info[9] === 'Y' ? true : false,
|
||||
expiredFileStdSeq: info[10],
|
||||
isTimeRoom: info[11] === 'Y' ? true : false,
|
||||
timeRoomInterval: info[11] !== 'Y' ? 0 : info[12] || 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
roomInfo
|
||||
} as RoomInfoDataResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomUserShortData: ProtocolDecoder<
|
||||
RoomUserShortDataResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
const userInfos: UserInfoShort[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
userInfos.push({
|
||||
userSeq: info[0],
|
||||
name: info[1],
|
||||
profileImageFile: info[2],
|
||||
isJoinRoom: info[3],
|
||||
lastReadEventSeq: info[4],
|
||||
madn: info[5],
|
||||
hardSadn: info[6],
|
||||
fmcSadn: info[7],
|
||||
nameEn: info[8],
|
||||
nameCn: info[9],
|
||||
isPrivacyAgree: info[10] === 'Y' ? true : false,
|
||||
isValidLogin: info[11] === 'Y' ? true : false,
|
||||
employeeType: info[12] as EmployeeType,
|
||||
fontColor: info[13]
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as RoomUserShortDataResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userInfos: UserInfo[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
userInfos.push({
|
||||
userSeq: info[0],
|
||||
name: info[1],
|
||||
profileImageFile: info[2],
|
||||
grade: info[3],
|
||||
intro: info[4],
|
||||
companyCode: info[5],
|
||||
hpNumber: info[6],
|
||||
lineNumber: info[7],
|
||||
email: info[8],
|
||||
isMobile: info[9] === 'Y' ? true : false,
|
||||
deptName: info[10],
|
||||
isJoinRoom: info[11] === 'Y' ? true : false,
|
||||
lastReadEventSeq: info[12],
|
||||
isActive: info[13] === 'Y' ? true : false,
|
||||
roleCd: info[14] as RoleCode,
|
||||
employeeNum: info[15],
|
||||
madn: info[16],
|
||||
hardSadn: info[17],
|
||||
fmcSadn: info[18],
|
||||
nameEn: info[19],
|
||||
nameCn: info[20],
|
||||
gradeEn: info[21],
|
||||
gradeCn: info[22],
|
||||
deptNameEn: info[23],
|
||||
deptNameCn: info[24],
|
||||
callMode: info[25],
|
||||
isPrivacyAgree: info[26] === 'Y' ? true : false,
|
||||
isValidLogin: info[27] === 'Y' ? true : false,
|
||||
employeeType: info[28] as EmployeeType,
|
||||
id: info[29]
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as RoomUserDataResponse;
|
||||
};
|
|
@ -0,0 +1,50 @@
|
|||
import {
|
||||
ProtocolRequest,
|
||||
ProtocolResponse,
|
||||
ProtocolEncoder,
|
||||
PacketBody,
|
||||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomInviteRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. 초대자 userSeq(n)...
|
||||
inviteUserSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomInviteResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export const encodeRoomInvite: ProtocolEncoder<RoomInviteRequest> = (
|
||||
req: RoomInviteRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
for (const userSeq of req.inviteUserSeqs) {
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
|
||||
}
|
||||
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomInvite: ProtocolDecoder<RoomInviteResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInviteResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomInviteNotification: ProtocolDecoder<
|
||||
RoomInviteResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInviteResponse;
|
||||
};
|
|
@ -0,0 +1,48 @@
|
|||
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;
|
||||
};
|
|
@ -0,0 +1,54 @@
|
|||
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;
|
||||
};
|
|
@ -0,0 +1,72 @@
|
|||
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;
|
||||
};
|
|
@ -0,0 +1,73 @@
|
|||
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;
|
||||
};
|
|
@ -1,8 +1,139 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take, takeWhile } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_OPEN_REQ,
|
||||
SSVC_TYPE_ROOM_OPEN2_REQ,
|
||||
SSVC_TYPE_ROOM_OPEN3_REQ,
|
||||
SSVC_TYPE_ROOM_OPEN4_REQ,
|
||||
SSVC_TYPE_ROOM_INVITE_REQ,
|
||||
SSVC_TYPE_ROOM_INFO_ROOM,
|
||||
SSVC_TYPE_ROOM_INFO_RES,
|
||||
SSVC_TYPE_ROOM_INFO_REQ,
|
||||
SSVC_TYPE_ROOM_INFO_USER,
|
||||
SSVC_TYPE_ROOM_INFO_USER2
|
||||
} from '../types/service';
|
||||
import {
|
||||
RoomOpenRequest,
|
||||
encodeRoomOpen,
|
||||
decodeRoomOpen,
|
||||
RoomOpenResponse
|
||||
} from '../models/room-open';
|
||||
import {
|
||||
RoomOpen2Request,
|
||||
RoomOpen2Response,
|
||||
decodeRoomOpen2,
|
||||
encodeRoomOpen2
|
||||
} from '../models/room-open2';
|
||||
import {
|
||||
RoomOpen3Request,
|
||||
RoomOpen3Response,
|
||||
encodeRoomOpen3,
|
||||
decodeRoomOpen3
|
||||
} from '../models/room-open3';
|
||||
import {
|
||||
RoomOpen4Request,
|
||||
RoomOpen4Response,
|
||||
encodeRoomOpen4,
|
||||
decodeRoomOpen4
|
||||
} from '../models/room-open4';
|
||||
import {
|
||||
RoomInviteRequest,
|
||||
RoomInviteResponse,
|
||||
encodeRoomInvite,
|
||||
decodeRoomInvite
|
||||
} from '../models/room-invite';
|
||||
import {
|
||||
RoomInfoRequest,
|
||||
RoomInfoResponse,
|
||||
RoomInfoDataResponse,
|
||||
RoomUserShortDataResponse,
|
||||
RoomUserDataResponse,
|
||||
encodeRoomInfo,
|
||||
decodeRoomInfoData,
|
||||
decodeRoomInfo,
|
||||
decodeRoomUserShortData,
|
||||
decodeRoomUserData
|
||||
} from '../models/room-info';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class RoomProtocolService {
|
||||
constructor() {}
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public roomOpen(req: RoomOpenRequest): Observable<RoomOpenResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN_REQ, ...encodeRoomOpen(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen2(req: RoomOpen2Request): Observable<RoomOpen2Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen2(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen3(req: RoomOpen3Request): Observable<RoomOpen3Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen3(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomOpen4(req: RoomOpen4Request): Observable<RoomOpen4Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen4(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomInvite(req: RoomInviteRequest): Observable<RoomInviteResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INVITE_REQ, ...encodeRoomInvite(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomInvite(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomInfo(
|
||||
req: RoomInfoRequest
|
||||
): Observable<
|
||||
| RoomInfoResponse
|
||||
| RoomInfoDataResponse
|
||||
| RoomUserShortDataResponse
|
||||
| RoomUserDataResponse
|
||||
> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeRoomInfo(req))
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) {
|
||||
return decodeRoomInfoData(res);
|
||||
} else if (SSVC_TYPE_ROOM_INFO_USER === res.subServiceType) {
|
||||
return decodeRoomUserShortData(res);
|
||||
} else if (SSVC_TYPE_ROOM_INFO_USER2 === res.subServiceType) {
|
||||
return decodeRoomUserData(res);
|
||||
}
|
||||
|
||||
return decodeRoomInfo(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
export enum EmployeeType {
|
||||
// R(정규직)
|
||||
Regular = 'R',
|
||||
// P(파트너)
|
||||
Partner = 'P',
|
||||
// M(현장대리인)
|
||||
Manager = 'M'
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
export enum RoomType {
|
||||
// S: 1: 1 대화
|
||||
Single = 'S',
|
||||
// M: 멀티대화
|
||||
Multi = 'M',
|
||||
// B: Bot대화
|
||||
Bot = 'B',
|
||||
// A: 알림방
|
||||
Allim = 'A',
|
||||
|
||||
// // X: 확장대화 deprecated
|
||||
// Extend = 'E',
|
||||
// // N: 공지대화 deprecated
|
||||
// Notice = 'N',
|
||||
|
||||
// L: 링크(Legacy)
|
||||
Link = 'L',
|
||||
// K: MyTalk(나와의 대화)
|
||||
Mytalk = 'K'
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
export const SVC_TYPE_ROOM = 10; // 대화방
|
||||
export const SSVC_TYPE_ROOM_OPEN_REQ = 1; // 대화방 개설 요청
|
||||
export const SSVC_TYPE_ROOM_OPEN_RES = 2;
|
||||
export const SSVC_TYPE_ROOM_OPEN2_REQ = 3; // 대화방 개설 요청2
|
||||
export const SSVC_TYPE_ROOM_OPEN2_RES = 4;
|
||||
export const SSVC_TYPE_ROOM_OPEN3_REQ = 5; // 대화방 개설 요청3
|
||||
export const SSVC_TYPE_ROOM_OPEN3_RES = 6;
|
||||
export const SSVC_TYPE_ROOM_OPEN4_REQ = 7; // 대화방 개설 요청4
|
||||
export const SSVC_TYPE_ROOM_OPEN4_RES = 8;
|
||||
export const SSVC_TYPE_ROOM_INVITE_REQ = 11; // 초대 요청
|
||||
export const SSVC_TYPE_ROOM_INVITE_RES = 12;
|
||||
export const SSVC_TYPE_ROOM_INVITE_NOTI = 13;
|
||||
|
||||
export const SSVC_TYPE_ROOM_INFO_REQ = 21; // 대화방 정보 요청
|
||||
export const SSVC_TYPE_ROOM_INFO_ROOM = 22; // 대화방 정보
|
||||
export const SSVC_TYPE_ROOM_INFO_USER = 23; // 참가자 정보
|
||||
export const SSVC_TYPE_ROOM_INFO_USER2 = 25; // 참가자 정보(상세)
|
||||
export const SSVC_TYPE_ROOM_INFO_RES = 24; // 대화방 정보 완료
|
||||
export const SSVC_TYPE_ROOM_INFO_SIMPLE_REQ = 26; // 대화방 정보 요청
|
||||
// export const SSVC_TYPE_ROOM_INFO_ROOM = 22; // 대화방 정보
|
||||
// export const SSVC_TYPE_ROOM_INFO_USER = 25; // 참가자 정보(상세)
|
||||
export const SSVC_TYPE_ROOM_INFO_SIMPLE_RES = 27; // 대화방 정보 완료
|
||||
export const SSVC_TYPE_ROOM_UPD_REQ = 31; // 대화방 변경 요청
|
||||
export const SSVC_TYPE_ROOM_UPD_RES = 32;
|
||||
export const SSVC_TYPE_ROOM_INFO_UPD_REQ = 33; // 대화방 정보 변경 요청
|
||||
export const SSVC_TYPE_ROOM_INFO_UPD_RES = 34; // 대화방 정보 변경 응답
|
||||
export const SSVC_TYPE_ROOM_FONT_UPD_REQ = 35; // 대화방 옵션 변경 요청
|
||||
export const SSVC_TYPE_ROOM_FONT_UPD_NOTI = 36; // 대화방 옵션 변경 알림
|
||||
export const SSVC_TYPE_ROOM_FONT_UPD_RES = 37; // 대화방 옵션 변경 응답
|
||||
export const SSVC_TYPE_ROOM_DEL_REQ = 41; // 대화방 삭제 요청
|
||||
export const SSVC_TYPE_ROOM_DEL_RES = 42;
|
||||
export const SSVC_TYPE_ROOM_EXIT_REQ = 51; // 퇴장 요청
|
||||
export const SSVC_TYPE_ROOM_EXIT_RES = 52;
|
||||
export const SSVC_TYPE_ROOM_EXIT_NOTI = 53;
|
||||
|
||||
export const SSVC_TYPE_ROOM_EXIT_ALL_REQ = 61; // 전체 대화방 퇴장 요청
|
||||
export const SSVC_TYPE_ROOM_EXIT_ALL_RES = 62; // 전체 대화방 퇴장 응답
|
||||
|
||||
export const SSVC_TYPE_ROOM_EXIT_FORCING_REQ = 54; // 대화상대 강퇴 요청
|
||||
export const SSVC_TYPE_ROOM_EXIT_FORCING_NOTI = 55; // 대화상대 강퇴 알림
|
||||
export const SSVC_TYPE_ROOM_EXIT_FORCING_RES = 56; // 대화상대 강퇴 응답
|
||||
export const SSVC_TYPE_ROOM_USER_STATUS_REQ = 71; // 대화상대 오프라인 체크 요청
|
||||
export const SSVC_TYPE_ROOM_USER_STATUS_RES = 72; // 대화상대 오프라인 체크 응답
|
|
@ -2,6 +2,15 @@
|
|||
* 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/services/room-protocol.service';
|
||||
export * from './lib/types/employee.type';
|
||||
export * from './lib/types/room.type';
|
||||
|
||||
export * from './lib/ucap-room-protocol.module';
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
export const PacketBodyDivider = '\f';
|
||||
export const PacketBodyValueDivider = '\t';
|
||||
|
||||
export const BodyStringDivider = '\b';
|
||||
|
|
Loading…
Reference in New Issue
Block a user