rename
This commit is contained in:
parent
d4abaeea32
commit
d2ac61381a
|
@ -9,19 +9,17 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyAddRequest extends ProtocolRequest {
|
||||
export interface AddRequest extends ProtocolRequest {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface BuddyAddResponse extends ProtocolResponse {
|
||||
export interface AddResponse extends ProtocolResponse {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeBuddyAdd: ProtocolEncoder<BuddyAddRequest> = (
|
||||
req: BuddyAddRequest
|
||||
) => {
|
||||
export const encodeAdd: ProtocolEncoder<AddRequest> = (req: AddRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
for (const userSeq of req.userSeqs) {
|
||||
|
@ -31,11 +29,11 @@ export const encodeBuddyAdd: ProtocolEncoder<BuddyAddRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyAdd: ProtocolDecoder<BuddyAddResponse> = (
|
||||
export const decodeAdd: ProtocolDecoder<AddResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userSeqArray: number[] = [...message.bodyList];
|
||||
return {
|
||||
userSeqs: userSeqArray
|
||||
} as BuddyAddResponse;
|
||||
} as AddResponse;
|
||||
};
|
||||
|
|
|
@ -9,19 +9,17 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyDelRequest extends ProtocolRequest {
|
||||
export interface DelRequest extends ProtocolRequest {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface BuddyDelResponse extends ProtocolResponse {
|
||||
export interface DelResponse extends ProtocolResponse {
|
||||
// 0n. 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeBuddyDel: ProtocolEncoder<BuddyDelRequest> = (
|
||||
req: BuddyDelRequest
|
||||
) => {
|
||||
export const encodeDel: ProtocolEncoder<DelRequest> = (req: DelRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
for (const userSeq of req.userSeqs) {
|
||||
|
@ -31,11 +29,11 @@ export const encodeBuddyDel: ProtocolEncoder<BuddyDelRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyDel: ProtocolDecoder<BuddyDelResponse> = (
|
||||
export const decodeDel: ProtocolDecoder<DelResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userSeqArray: number[] = [...message.bodyList];
|
||||
return {
|
||||
userSeqs: userSeqArray
|
||||
} as BuddyDelResponse;
|
||||
} as DelResponse;
|
||||
};
|
||||
|
|
|
@ -9,22 +9,22 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface BuddyUpdateRequest extends ProtocolRequest {
|
||||
export interface UpdateRequest extends ProtocolRequest {
|
||||
// 0. 사용자SEQ(n)
|
||||
seq: number;
|
||||
// 1. 즐겨찾기여부(y)
|
||||
isFavorit: boolean;
|
||||
}
|
||||
|
||||
export interface BuddyUpdateResponse extends ProtocolResponse {
|
||||
export interface UpdateResponse extends ProtocolResponse {
|
||||
// 0. 사용자SEQ(n)
|
||||
seq: number;
|
||||
// 1. 즐겨찾기여부(y)
|
||||
isFavorit: boolean;
|
||||
}
|
||||
|
||||
export const encodeBuddyUpdate: ProtocolEncoder<BuddyUpdateRequest> = (
|
||||
req: BuddyUpdateRequest
|
||||
export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
|
||||
req: UpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -37,11 +37,11 @@ export const encodeBuddyUpdate: ProtocolEncoder<BuddyUpdateRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeBuddyUpdate: ProtocolDecoder<BuddyUpdateResponse> = (
|
||||
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
seq: message.bodyList[0],
|
||||
isFavorit: message.bodyList[1] === 'Y' ? true : false
|
||||
} as BuddyUpdateResponse;
|
||||
} as UpdateResponse;
|
||||
};
|
||||
|
|
|
@ -12,23 +12,13 @@ import {
|
|||
SSVC_TYPE_BUDDY_UPD_REQ
|
||||
} from '../types/service';
|
||||
|
||||
import { AddRequest, encodeAdd, decodeAdd, AddResponse } from '../models/add';
|
||||
import { DelRequest, encodeDel, decodeDel, DelResponse } from '../models/del';
|
||||
import {
|
||||
BuddyAddRequest,
|
||||
encodeBuddyAdd,
|
||||
decodeBuddyAdd,
|
||||
BuddyAddResponse
|
||||
} from '../models/add';
|
||||
import {
|
||||
BuddyDelRequest,
|
||||
encodeBuddyDel,
|
||||
decodeBuddyDel,
|
||||
BuddyDelResponse
|
||||
} from '../models/del';
|
||||
import {
|
||||
BuddyUpdateRequest,
|
||||
decodeBuddyUpdate,
|
||||
encodeBuddyUpdate,
|
||||
BuddyUpdateResponse
|
||||
UpdateRequest,
|
||||
decodeUpdate,
|
||||
encodeUpdate,
|
||||
UpdateResponse
|
||||
} from '../models/update';
|
||||
|
||||
@Injectable({
|
||||
|
@ -37,30 +27,30 @@ import {
|
|||
export class BuddyProtocolService {
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public buddyAdd(req: BuddyAddRequest): Observable<BuddyAddResponse> {
|
||||
public add(req: AddRequest): Observable<AddResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_ADD_REQ, ...encodeBuddyAdd(req))
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_ADD_REQ, ...encodeAdd(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyAdd(res))
|
||||
map(res => decodeAdd(res))
|
||||
);
|
||||
}
|
||||
|
||||
public buddyDel(req: BuddyDelRequest): Observable<BuddyDelResponse> {
|
||||
public del(req: DelRequest): Observable<DelResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_DEL_REQ, ...encodeBuddyDel(req))
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_DEL_REQ, ...encodeDel(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyDel(res))
|
||||
map(res => decodeDel(res))
|
||||
);
|
||||
}
|
||||
|
||||
public buddyUpdate(req: BuddyUpdateRequest): Observable<BuddyUpdateResponse> {
|
||||
public update(req: UpdateRequest): Observable<UpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_UPD_REQ, ...encodeBuddyUpdate(req))
|
||||
.call(SVC_TYPE_BUDDY, SSVC_TYPE_BUDDY_UPD_REQ, ...encodeUpdate(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeBuddyUpdate(res))
|
||||
map(res => decodeUpdate(res))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,21 +9,19 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupAddRequest extends ProtocolRequest {
|
||||
export interface AddRequest extends ProtocolRequest {
|
||||
// 0. 동료그룹이름
|
||||
groupName: string;
|
||||
}
|
||||
|
||||
export interface GroupAddResponse extends ProtocolResponse {
|
||||
export interface AddResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
groupName: string;
|
||||
}
|
||||
|
||||
export const encodeGroupAdd: ProtocolEncoder<GroupAddRequest> = (
|
||||
req: GroupAddRequest
|
||||
) => {
|
||||
export const encodeAdd: ProtocolEncoder<AddRequest> = (req: AddRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.groupName });
|
||||
|
@ -31,11 +29,11 @@ export const encodeGroupAdd: ProtocolEncoder<GroupAddRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupAdd: ProtocolDecoder<GroupAddResponse> = (
|
||||
export const decodeAdd: ProtocolDecoder<AddResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1]
|
||||
} as GroupAddResponse;
|
||||
} as AddResponse;
|
||||
};
|
||||
|
|
|
@ -9,19 +9,17 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupDelRequest extends ProtocolRequest {
|
||||
export interface DelRequest extends ProtocolRequest {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
}
|
||||
|
||||
export interface GroupDelResponse extends ProtocolResponse {
|
||||
export interface DelResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
}
|
||||
|
||||
export const encodeGroupDel: ProtocolEncoder<GroupDelRequest> = (
|
||||
req: GroupDelRequest
|
||||
) => {
|
||||
export const encodeDel: ProtocolEncoder<DelRequest> = (req: DelRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.Integer, value: req.groupSeq });
|
||||
|
@ -29,10 +27,10 @@ export const encodeGroupDel: ProtocolEncoder<GroupDelRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupDel: ProtocolDecoder<GroupDelResponse> = (
|
||||
export const decodeDel: ProtocolDecoder<DelResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
groupSeq: message.bodyList[0]
|
||||
} as GroupDelResponse;
|
||||
} as DelResponse;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface GroupUpdateRequest extends ProtocolRequest {
|
||||
export interface UpdateRequest extends ProtocolRequest {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
|
@ -18,7 +18,7 @@ export interface GroupUpdateRequest extends ProtocolRequest {
|
|||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface GroupUpdateResponse extends ProtocolResponse {
|
||||
export interface UpdateResponse extends ProtocolResponse {
|
||||
// 0: 동료그룹SEQ(n)
|
||||
groupSeq: number;
|
||||
// 1: 동료그룹이름(s)
|
||||
|
@ -27,8 +27,8 @@ export interface GroupUpdateResponse extends ProtocolResponse {
|
|||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeGroupUpdate: ProtocolEncoder<GroupUpdateRequest> = (
|
||||
req: GroupUpdateRequest
|
||||
export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
|
||||
req: UpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -41,7 +41,7 @@ export const encodeGroupUpdate: ProtocolEncoder<GroupUpdateRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupUpdate: ProtocolDecoder<GroupUpdateResponse> = (
|
||||
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqArray: number[] = [];
|
||||
|
@ -53,11 +53,11 @@ export const decodeGroupUpdate: ProtocolDecoder<GroupUpdateResponse> = (
|
|||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1],
|
||||
userSeqs: userSeqArray
|
||||
} as GroupUpdateResponse;
|
||||
} as UpdateResponse;
|
||||
};
|
||||
|
||||
export const encodeGroupUpdate2: ProtocolEncoder<GroupUpdateRequest> = (
|
||||
req: GroupUpdateRequest
|
||||
export const encodeUpdate2: ProtocolEncoder<UpdateRequest> = (
|
||||
req: UpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -75,7 +75,7 @@ export const encodeGroupUpdate2: ProtocolEncoder<GroupUpdateRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeGroupUpdate2: ProtocolDecoder<GroupUpdateResponse> = (
|
||||
export const decodeUpdate2: ProtocolDecoder<UpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqArray: number[] = [];
|
||||
|
@ -87,5 +87,5 @@ export const decodeGroupUpdate2: ProtocolDecoder<GroupUpdateResponse> = (
|
|||
groupSeq: message.bodyList[0],
|
||||
groupName: message.bodyList[1],
|
||||
userSeqs: userSeqArray
|
||||
} as GroupUpdateResponse;
|
||||
} as UpdateResponse;
|
||||
};
|
||||
|
|
|
@ -4,12 +4,6 @@ import { Observable } from 'rxjs';
|
|||
import { map, take } from 'rxjs/operators';
|
||||
|
||||
import { ProtocolService } from '@ucap-webmessenger/protocol';
|
||||
import {
|
||||
GroupAddRequest,
|
||||
encodeGroupAdd,
|
||||
decodeGroupAdd,
|
||||
GroupAddResponse
|
||||
} from '../models/add';
|
||||
import {
|
||||
SVC_TYPE_GROUP,
|
||||
SSVC_TYPE_GROUP_ADD_REQ,
|
||||
|
@ -17,19 +11,15 @@ import {
|
|||
SSVC_TYPE_GROUP_UPD_REQ,
|
||||
SSVC_TYPE_GROUP_UPD_REQ2
|
||||
} from '../types/service';
|
||||
import { AddRequest, encodeAdd, decodeAdd, AddResponse } from '../models/add';
|
||||
import { DelRequest, encodeDel, decodeDel, DelResponse } from '../models/del';
|
||||
import {
|
||||
GroupDelRequest,
|
||||
encodeGroupDel,
|
||||
decodeGroupDel,
|
||||
GroupDelResponse
|
||||
} from '../models/del';
|
||||
import {
|
||||
GroupUpdateRequest,
|
||||
encodeGroupUpdate,
|
||||
decodeGroupUpdate,
|
||||
encodeGroupUpdate2,
|
||||
decodeGroupUpdate2,
|
||||
GroupUpdateResponse
|
||||
UpdateRequest,
|
||||
encodeUpdate,
|
||||
decodeUpdate,
|
||||
encodeUpdate2,
|
||||
decodeUpdate2,
|
||||
UpdateResponse
|
||||
} from '../models/update';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -37,45 +27,39 @@ import {
|
|||
export class GroupProtocolService {
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public groupAdd(req: GroupAddRequest): Observable<GroupAddResponse> {
|
||||
public add(req: AddRequest): Observable<AddResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_ADD_REQ, ...encodeGroupAdd(req))
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_ADD_REQ, ...encodeAdd(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupAdd(res))
|
||||
map(res => decodeAdd(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupDel(req: GroupDelRequest): Observable<GroupDelResponse> {
|
||||
public del(req: DelRequest): Observable<DelResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_DEL_REQ, ...encodeGroupDel(req))
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_DEL_REQ, ...encodeDel(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupDel(res))
|
||||
map(res => decodeDel(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupUpdate(req: GroupUpdateRequest): Observable<GroupUpdateResponse> {
|
||||
public update(req: UpdateRequest): Observable<UpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ, ...encodeGroupUpdate(req))
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ, ...encodeUpdate(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupUpdate(res))
|
||||
map(res => decodeUpdate(res))
|
||||
);
|
||||
}
|
||||
|
||||
public groupUpdate2(
|
||||
req: GroupUpdateRequest
|
||||
): Observable<GroupUpdateResponse> {
|
||||
public update2(req: UpdateRequest): Observable<UpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_GROUP,
|
||||
SSVC_TYPE_GROUP_UPD_REQ2,
|
||||
...encodeGroupUpdate2(req)
|
||||
)
|
||||
.call(SVC_TYPE_GROUP, SSVC_TYPE_GROUP_UPD_REQ2, ...encodeUpdate2(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeGroupUpdate2(res))
|
||||
map(res => decodeUpdate2(res))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,47 +9,45 @@ import {
|
|||
} from '@ucap-webmessenger/protocol';
|
||||
import { RoomExitType } from '../types/room.type';
|
||||
|
||||
export interface RoomExitRequest extends ProtocolRequest {
|
||||
export interface ExitRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export interface RoomExitResponse extends ProtocolResponse {
|
||||
export interface ExitResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export const encodeRoomExit: ProtocolEncoder<RoomExitRequest> = (
|
||||
req: RoomExitRequest
|
||||
) => {
|
||||
export const encodeExit: ProtocolEncoder<ExitRequest> = (req: ExitRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomExit: ProtocolDecoder<RoomExitResponse> = (
|
||||
export const decodeExit: ProtocolDecoder<ExitResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomExitResponse;
|
||||
} as ExitResponse;
|
||||
};
|
||||
export const decodeRoomExitNotification: ProtocolDecoder<RoomExitResponse> = (
|
||||
export const decodeExitNotification: ProtocolDecoder<ExitResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomExitResponse;
|
||||
} as ExitResponse;
|
||||
};
|
||||
|
||||
export interface RoomExitAllRequest extends ProtocolRequest {
|
||||
export interface ExitAllRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string[];
|
||||
}
|
||||
|
||||
export const encodeRoomAllExit: ProtocolEncoder<RoomExitAllRequest> = (
|
||||
req: RoomExitAllRequest
|
||||
export const encodeAllExit: ProtocolEncoder<ExitAllRequest> = (
|
||||
req: ExitAllRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -57,7 +55,7 @@ export const encodeRoomAllExit: ProtocolEncoder<RoomExitAllRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export interface RoomExitForcingRequest extends ProtocolRequest {
|
||||
export interface ExitForcingRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 강퇴요청타입(s)
|
||||
|
@ -68,7 +66,7 @@ export interface RoomExitForcingRequest extends ProtocolRequest {
|
|||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomExitForcingResponse extends ProtocolRequest {
|
||||
export interface ExitForcingResponse extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 강퇴요청타입(s)
|
||||
|
@ -79,8 +77,8 @@ export interface RoomExitForcingResponse extends ProtocolRequest {
|
|||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export const encodeRoomExitForcing: ProtocolEncoder<RoomExitForcingRequest> = (
|
||||
req: RoomExitForcingRequest
|
||||
export const encodeExitForcing: ProtocolEncoder<ExitForcingRequest> = (
|
||||
req: ExitForcingRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -93,7 +91,7 @@ export const encodeRoomExitForcing: ProtocolEncoder<RoomExitForcingRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomExitForcing: ProtocolDecoder<RoomExitForcingResponse> = (
|
||||
export const decodeExitForcing: ProtocolDecoder<ExitForcingResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let userSeqs: number[] = [];
|
||||
|
@ -105,10 +103,10 @@ export const decodeRoomExitForcing: ProtocolDecoder<RoomExitForcingResponse> = (
|
|||
type: message.bodyList[1] as RoomExitType,
|
||||
senderSeq: message.bodyList[2],
|
||||
userSeqs
|
||||
} as RoomExitForcingResponse;
|
||||
} as ExitForcingResponse;
|
||||
};
|
||||
export const decodeRoomExitForcingNotification: ProtocolDecoder<
|
||||
RoomExitForcingResponse
|
||||
export const decodeExitForcingNotification: ProtocolDecoder<
|
||||
ExitForcingResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
let userSeqs: number[] = [];
|
||||
if (message.bodyList.length > 3) {
|
||||
|
@ -119,5 +117,5 @@ export const decodeRoomExitForcingNotification: ProtocolDecoder<
|
|||
type: message.bodyList[1] as RoomExitType,
|
||||
senderSeq: message.bodyList[2],
|
||||
userSeqs
|
||||
} as RoomExitForcingResponse;
|
||||
} as ExitForcingResponse;
|
||||
};
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
PacketBodyValue,
|
||||
ProtocolDecoder,
|
||||
ProtocolMessage,
|
||||
BodyStringDivider
|
||||
BodyStringDivider,
|
||||
ProtocolStream
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
import { LocaleCode } from '@ucap-webmessenger/core';
|
||||
import { RoomType } from '../types/room.type';
|
||||
|
@ -137,7 +138,7 @@ export interface UserInfo {
|
|||
id: string;
|
||||
}
|
||||
|
||||
export interface RoomInfoRequest extends ProtocolRequest {
|
||||
export interface InfoRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. 상세정보여부(y)
|
||||
|
@ -146,34 +147,32 @@ export interface RoomInfoRequest extends ProtocolRequest {
|
|||
localeCode: LocaleCode;
|
||||
}
|
||||
|
||||
export interface RoomInfoResponse extends ProtocolResponse {
|
||||
export interface InfoResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export interface RoomInfoDataResponse extends ProtocolResponse {
|
||||
export interface InfoData extends ProtocolStream {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1. {대화방정보}
|
||||
roomInfo: RoomInfo;
|
||||
}
|
||||
|
||||
export interface RoomUserShortDataResponse extends ProtocolResponse {
|
||||
export interface UserShortData extends ProtocolStream {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보}
|
||||
userInfos: UserInfoShort[];
|
||||
}
|
||||
export interface RoomUserDataResponse extends ProtocolResponse {
|
||||
export interface UserData extends ProtocolStream {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. {참여자정보-D}
|
||||
userInfos: UserInfo[];
|
||||
}
|
||||
|
||||
export const encodeRoomInfo: ProtocolEncoder<RoomInfoRequest> = (
|
||||
req: RoomInfoRequest
|
||||
) => {
|
||||
export const encodeInfo: ProtocolEncoder<InfoRequest> = (req: InfoRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
|
@ -186,15 +185,15 @@ export const encodeRoomInfo: ProtocolEncoder<RoomInfoRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomInfo: ProtocolDecoder<RoomInfoResponse> = (
|
||||
export const decodeInfo: ProtocolDecoder<InfoResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInfoResponse;
|
||||
} as InfoResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
|
||||
export const decodeInfoData: ProtocolDecoder<InfoData> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
let roomInfo: RoomInfo = null;
|
||||
|
@ -222,12 +221,12 @@ export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
|
|||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
roomInfo
|
||||
} as RoomInfoDataResponse;
|
||||
} as InfoData;
|
||||
};
|
||||
|
||||
export const decodeRoomUserShortData: ProtocolDecoder<
|
||||
RoomUserShortDataResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
export const decodeUserShortData: ProtocolDecoder<UserShortData> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userInfos: UserInfoShort[] = [];
|
||||
message.bodyList.slice(1).forEach(userInfo => {
|
||||
const info = userInfo.split(BodyStringDivider);
|
||||
|
@ -252,10 +251,10 @@ export const decodeRoomUserShortData: ProtocolDecoder<
|
|||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as RoomUserShortDataResponse;
|
||||
} as UserShortData;
|
||||
};
|
||||
|
||||
export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
|
||||
export const decodeUserData: ProtocolDecoder<UserData> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
const userInfos: UserInfo[] = [];
|
||||
|
@ -298,30 +297,30 @@ export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
|
|||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userInfos
|
||||
} as RoomUserDataResponse;
|
||||
} as UserData;
|
||||
};
|
||||
|
||||
export interface RoomUserStatusOfflineRequest extends ProtocolRequest {
|
||||
export interface UserStatusOfflineRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export interface RoomUserStatusOfflineResponse extends ProtocolResponse {
|
||||
export interface UserStatusOfflineResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 사용자SEQ(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
export const encodeRoomUserStatusOffline: ProtocolEncoder<
|
||||
RoomUserStatusOfflineRequest
|
||||
> = (req: RoomUserStatusOfflineRequest) => {
|
||||
export const encodeUserStatusOffline: ProtocolEncoder<
|
||||
UserStatusOfflineRequest
|
||||
> = (req: UserStatusOfflineRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
return bodyList;
|
||||
};
|
||||
export const decodeRoomUserStatusOffline: ProtocolDecoder<
|
||||
RoomUserStatusOfflineResponse
|
||||
export const decodeUserStatusOffline: ProtocolDecoder<
|
||||
UserStatusOfflineResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
let userSeqs: number[] = [];
|
||||
if (message.bodyList.length > 1) {
|
||||
|
@ -330,5 +329,5 @@ export const decodeRoomUserStatusOffline: ProtocolDecoder<
|
|||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
userSeqs
|
||||
} as RoomUserStatusOfflineResponse;
|
||||
} as UserStatusOfflineResponse;
|
||||
};
|
||||
|
|
|
@ -8,20 +8,20 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomInviteRequest extends ProtocolRequest {
|
||||
export interface InviteRequest extends ProtocolRequest {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 1n. 초대자 userSeq(n)...
|
||||
inviteUserSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomInviteResponse extends ProtocolResponse {
|
||||
export interface InviteResponse extends ProtocolResponse {
|
||||
// 0. 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
}
|
||||
|
||||
export const encodeRoomInvite: ProtocolEncoder<RoomInviteRequest> = (
|
||||
req: RoomInviteRequest
|
||||
export const encodeInvite: ProtocolEncoder<InviteRequest> = (
|
||||
req: InviteRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -33,18 +33,18 @@ export const encodeRoomInvite: ProtocolEncoder<RoomInviteRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomInvite: ProtocolDecoder<RoomInviteResponse> = (
|
||||
export const decodeInvite: ProtocolDecoder<InviteResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInviteResponse;
|
||||
} as InviteResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomInviteNotification: ProtocolDecoder<
|
||||
RoomInviteResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
export const decodeInviteNotification: ProtocolDecoder<InviteResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0]
|
||||
} as RoomInviteResponse;
|
||||
} as InviteResponse;
|
||||
};
|
||||
|
|
|
@ -8,14 +8,14 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomOpenRequest extends ProtocolRequest {
|
||||
export interface OpenRequest extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1n. 초대자 userSeq(n)...
|
||||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpenResponse extends ProtocolResponse {
|
||||
export interface OpenResponse extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방SEQ(s)
|
||||
|
@ -24,9 +24,7 @@ export interface RoomOpenResponse extends ProtocolResponse {
|
|||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
|
||||
req: RoomOpenRequest
|
||||
) => {
|
||||
export const encodeOpen: ProtocolEncoder<OpenRequest> = (req: OpenRequest) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
|
||||
|
@ -37,17 +35,17 @@ export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen: ProtocolDecoder<RoomOpenResponse> = (
|
||||
export const decodeOpen: ProtocolDecoder<OpenResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
divCd: message.bodyList[0],
|
||||
roomSeq: message.bodyList[1],
|
||||
newRoom: message.bodyList[2] === 'Y' ? true : false
|
||||
} as RoomOpenResponse;
|
||||
} as OpenResponse;
|
||||
};
|
||||
|
||||
export interface RoomOpen2Request extends ProtocolRequest {
|
||||
export interface Open2Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
|
@ -56,7 +54,7 @@ export interface RoomOpen2Request extends ProtocolRequest {
|
|||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen2Response extends ProtocolResponse {
|
||||
export interface Open2Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
|
@ -67,8 +65,8 @@ export interface RoomOpen2Response extends ProtocolResponse {
|
|||
newRoom: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
|
||||
req: RoomOpen2Request
|
||||
export const encodeOpen2: ProtocolEncoder<Open2Request> = (
|
||||
req: Open2Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -81,7 +79,7 @@ export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
|
||||
export const decodeOpen2: ProtocolDecoder<Open2Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
|
@ -89,10 +87,10 @@ export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
|
|||
roomName: message.bodyList[1],
|
||||
roomSeq: message.bodyList[2],
|
||||
newRoom: message.bodyList[3] === 'Y' ? true : false
|
||||
} as RoomOpen2Response;
|
||||
} as Open2Response;
|
||||
};
|
||||
|
||||
export interface RoomOpen3Request extends ProtocolRequest {
|
||||
export interface Open3Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
|
@ -105,7 +103,7 @@ export interface RoomOpen3Request extends ProtocolRequest {
|
|||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen3Response extends ProtocolResponse {
|
||||
export interface Open3Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
|
@ -120,8 +118,8 @@ export interface RoomOpen3Response extends ProtocolResponse {
|
|||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
|
||||
req: RoomOpen3Request
|
||||
export const encodeOpen3: ProtocolEncoder<Open3Request> = (
|
||||
req: Open3Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -142,7 +140,7 @@ export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
|
||||
export const decodeOpen3: ProtocolDecoder<Open3Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
|
@ -152,10 +150,10 @@ export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
|
|||
newRoom: message.bodyList[3] === 'Y' ? true : false,
|
||||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval: message.bodyList[5] || 0
|
||||
} as RoomOpen3Response;
|
||||
} as Open3Response;
|
||||
};
|
||||
|
||||
export interface RoomOpen4Request extends ProtocolRequest {
|
||||
export interface Open4Request extends ProtocolRequest {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
|
@ -168,7 +166,7 @@ export interface RoomOpen4Request extends ProtocolRequest {
|
|||
userSeqs: number[];
|
||||
}
|
||||
|
||||
export interface RoomOpen4Response extends ProtocolResponse {
|
||||
export interface Open4Response extends ProtocolResponse {
|
||||
// 0. 구분자
|
||||
divCd: string;
|
||||
// 1. 대화방제목(s)
|
||||
|
@ -183,8 +181,8 @@ export interface RoomOpen4Response extends ProtocolResponse {
|
|||
timerRoomInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
|
||||
req: RoomOpen4Request
|
||||
export const encodeOpen4: ProtocolEncoder<Open4Request> = (
|
||||
req: Open4Request
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -205,7 +203,7 @@ export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
|
||||
export const decodeOpen4: ProtocolDecoder<Open4Response> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
|
@ -216,5 +214,5 @@ export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
|
|||
isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
|
||||
timerRoomInterval:
|
||||
message.bodyList[4] !== 'Y' ? 0 : message.bodyList[5] || 0
|
||||
} as RoomOpen4Response;
|
||||
} as Open4Response;
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
ProtocolMessage
|
||||
} from '@ucap-webmessenger/protocol';
|
||||
|
||||
export interface RoomUpdateRequest extends ProtocolRequest {
|
||||
export interface UpdateRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 대화방제목(s)
|
||||
|
@ -19,7 +19,7 @@ export interface RoomUpdateRequest extends ProtocolRequest {
|
|||
isSyncAll: boolean;
|
||||
}
|
||||
|
||||
export interface RoomUpdateResponse extends ProtocolResponse {
|
||||
export interface UpdateResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 대화방제목(s)
|
||||
|
@ -30,8 +30,8 @@ export interface RoomUpdateResponse extends ProtocolResponse {
|
|||
isSyncAll: boolean;
|
||||
}
|
||||
|
||||
export const encodeRoomUpdate: ProtocolEncoder<RoomUpdateRequest> = (
|
||||
req: RoomUpdateRequest
|
||||
export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
|
||||
req: UpdateRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -48,7 +48,7 @@ export const encodeRoomUpdate: ProtocolEncoder<RoomUpdateRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdate: ProtocolDecoder<RoomUpdateResponse> = (
|
||||
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
|
@ -56,26 +56,26 @@ export const decodeRoomUpdate: ProtocolDecoder<RoomUpdateResponse> = (
|
|||
roomName: message.bodyList[1],
|
||||
isAlarm: message.bodyList[2] === 'Y' ? true : false,
|
||||
isSyncAll: message.bodyList[3] === 'Y' ? true : false
|
||||
} as RoomUpdateResponse;
|
||||
} as UpdateResponse;
|
||||
};
|
||||
|
||||
export interface RoomUpdateTimerSetRequest extends ProtocolRequest {
|
||||
export interface UpdateTimerSetRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 타이머시간(n)
|
||||
timerInterval: number;
|
||||
}
|
||||
|
||||
export interface RoomUpdateTimerSetResponse extends ProtocolResponse {
|
||||
export interface UpdateTimerSetResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 타이머시간(n)
|
||||
timerInterval: number;
|
||||
}
|
||||
|
||||
export const encodeRoomUpdateTimerSet: ProtocolEncoder<
|
||||
RoomUpdateTimerSetRequest
|
||||
> = (req: RoomUpdateTimerSetRequest) => {
|
||||
export const encodeUpdateTimerSet: ProtocolEncoder<UpdateTimerSetRequest> = (
|
||||
req: UpdateTimerSetRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
|
||||
|
@ -83,16 +83,16 @@ export const encodeRoomUpdateTimerSet: ProtocolEncoder<
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdateTimerSet: ProtocolDecoder<
|
||||
RoomUpdateTimerSetResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
export const decodeUpdateTimerSet: ProtocolDecoder<UpdateTimerSetResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
timerInterval: message.bodyList[1] || 0
|
||||
} as RoomUpdateTimerSetResponse;
|
||||
} as UpdateTimerSetResponse;
|
||||
};
|
||||
|
||||
export interface RoomUpdateFontRequest extends ProtocolRequest {
|
||||
export interface UpdateFontRequest extends ProtocolRequest {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 폰트색(s) cf)0x000000 형태의 스트링
|
||||
|
@ -101,7 +101,7 @@ export interface RoomUpdateFontRequest extends ProtocolRequest {
|
|||
senderSeq: number;
|
||||
}
|
||||
|
||||
export interface RoomUpdateFontResponse extends ProtocolResponse {
|
||||
export interface UpdateFontResponse extends ProtocolResponse {
|
||||
// 대화방SEQ(s)
|
||||
roomSeq: string;
|
||||
// 폰트색(s) cf)0x000000 형태의 스트링
|
||||
|
@ -110,8 +110,8 @@ export interface RoomUpdateFontResponse extends ProtocolResponse {
|
|||
senderSeq: number;
|
||||
}
|
||||
|
||||
export const encodeRoomUpdateFont: ProtocolEncoder<RoomUpdateFontRequest> = (
|
||||
req: RoomUpdateFontRequest
|
||||
export const encodeUpdateFont: ProtocolEncoder<UpdateFontRequest> = (
|
||||
req: UpdateFontRequest
|
||||
) => {
|
||||
const bodyList: PacketBody[] = [];
|
||||
|
||||
|
@ -121,22 +121,22 @@ export const encodeRoomUpdateFont: ProtocolEncoder<RoomUpdateFontRequest> = (
|
|||
return bodyList;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdateFont: ProtocolDecoder<RoomUpdateFontResponse> = (
|
||||
export const decodeUpdateFont: ProtocolDecoder<UpdateFontResponse> = (
|
||||
message: ProtocolMessage
|
||||
) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
fontColor: message.bodyList[1],
|
||||
senderSeq: message.bodyList[2]
|
||||
} as RoomUpdateFontResponse;
|
||||
} as UpdateFontResponse;
|
||||
};
|
||||
|
||||
export const decodeRoomUpdateFontNotification: ProtocolDecoder<
|
||||
RoomUpdateFontResponse
|
||||
export const decodeUpdateFontNotification: ProtocolDecoder<
|
||||
UpdateFontResponse
|
||||
> = (message: ProtocolMessage) => {
|
||||
return {
|
||||
roomSeq: message.bodyList[0],
|
||||
fontColor: message.bodyList[1],
|
||||
senderSeq: message.bodyList[2]
|
||||
} as RoomUpdateFontResponse;
|
||||
} as UpdateFontResponse;
|
||||
};
|
||||
|
|
|
@ -25,70 +25,70 @@ import {
|
|||
SSVC_TYPE_ROOM_FONT_UPD_REQ
|
||||
} from '../types/service';
|
||||
import {
|
||||
RoomOpenRequest,
|
||||
encodeRoomOpen,
|
||||
decodeRoomOpen,
|
||||
RoomOpenResponse,
|
||||
RoomOpen2Request,
|
||||
RoomOpen2Response,
|
||||
decodeRoomOpen2,
|
||||
encodeRoomOpen2,
|
||||
RoomOpen3Request,
|
||||
RoomOpen3Response,
|
||||
encodeRoomOpen3,
|
||||
decodeRoomOpen3,
|
||||
RoomOpen4Request,
|
||||
RoomOpen4Response,
|
||||
encodeRoomOpen4,
|
||||
decodeRoomOpen4
|
||||
OpenRequest,
|
||||
encodeOpen,
|
||||
decodeOpen,
|
||||
OpenResponse,
|
||||
Open2Request,
|
||||
Open2Response,
|
||||
decodeOpen2,
|
||||
encodeOpen2,
|
||||
Open3Request,
|
||||
Open3Response,
|
||||
encodeOpen3,
|
||||
decodeOpen3,
|
||||
Open4Request,
|
||||
Open4Response,
|
||||
encodeOpen4,
|
||||
decodeOpen4
|
||||
} from '../models/open';
|
||||
import {
|
||||
RoomInviteRequest,
|
||||
RoomInviteResponse,
|
||||
encodeRoomInvite,
|
||||
decodeRoomInvite
|
||||
InviteRequest,
|
||||
InviteResponse,
|
||||
encodeInvite,
|
||||
decodeInvite
|
||||
} from '../models/invite';
|
||||
import {
|
||||
RoomInfoRequest,
|
||||
RoomInfoResponse,
|
||||
RoomInfoDataResponse,
|
||||
RoomUserShortDataResponse,
|
||||
RoomUserDataResponse,
|
||||
encodeRoomInfo,
|
||||
decodeRoomInfoData,
|
||||
decodeRoomInfo,
|
||||
decodeRoomUserShortData,
|
||||
decodeRoomUserData,
|
||||
RoomUserStatusOfflineRequest,
|
||||
RoomUserStatusOfflineResponse,
|
||||
encodeRoomUserStatusOffline,
|
||||
decodeRoomUserStatusOffline
|
||||
InfoRequest,
|
||||
InfoResponse,
|
||||
InfoData,
|
||||
UserShortData,
|
||||
UserData,
|
||||
encodeInfo,
|
||||
decodeInfoData,
|
||||
decodeInfo,
|
||||
decodeUserShortData,
|
||||
decodeUserData,
|
||||
UserStatusOfflineRequest,
|
||||
UserStatusOfflineResponse,
|
||||
encodeUserStatusOffline,
|
||||
decodeUserStatusOffline
|
||||
} from '../models/info';
|
||||
import {
|
||||
RoomExitRequest,
|
||||
RoomExitResponse,
|
||||
encodeRoomExit,
|
||||
decodeRoomExit,
|
||||
RoomExitAllRequest,
|
||||
encodeRoomAllExit,
|
||||
RoomExitForcingRequest,
|
||||
RoomExitForcingResponse,
|
||||
encodeRoomExitForcing,
|
||||
decodeRoomExitForcing
|
||||
ExitRequest,
|
||||
ExitResponse,
|
||||
encodeExit,
|
||||
decodeExit,
|
||||
ExitAllRequest,
|
||||
encodeAllExit,
|
||||
ExitForcingRequest,
|
||||
ExitForcingResponse,
|
||||
encodeExitForcing,
|
||||
decodeExitForcing
|
||||
} from '../models/exit';
|
||||
import {
|
||||
RoomUpdateRequest,
|
||||
RoomUpdateResponse,
|
||||
encodeRoomUpdate,
|
||||
decodeRoomUpdate,
|
||||
RoomUpdateTimerSetRequest,
|
||||
RoomUpdateTimerSetResponse,
|
||||
encodeRoomUpdateTimerSet,
|
||||
decodeRoomUpdateTimerSet,
|
||||
RoomUpdateFontRequest,
|
||||
RoomUpdateFontResponse,
|
||||
encodeRoomUpdateFont,
|
||||
decodeRoomUpdateFont
|
||||
UpdateRequest,
|
||||
UpdateResponse,
|
||||
encodeUpdate,
|
||||
decodeUpdate,
|
||||
UpdateTimerSetRequest,
|
||||
UpdateTimerSetResponse,
|
||||
encodeUpdateTimerSet,
|
||||
decodeUpdateTimerSet,
|
||||
UpdateFontRequest,
|
||||
UpdateFontResponse,
|
||||
encodeUpdateFont,
|
||||
decodeUpdateFont
|
||||
} from '../models/update';
|
||||
|
||||
@Injectable({
|
||||
|
@ -97,169 +97,159 @@ import {
|
|||
export class RoomProtocolService {
|
||||
constructor(private protocolService: ProtocolService) {}
|
||||
|
||||
public roomOpen(req: RoomOpenRequest): Observable<RoomOpenResponse> {
|
||||
public open(req: OpenRequest): Observable<OpenResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN_REQ, ...encodeRoomOpen(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN_REQ, ...encodeOpen(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen(res))
|
||||
map(res => decodeOpen(res))
|
||||
);
|
||||
}
|
||||
public roomOpen2(req: RoomOpen2Request): Observable<RoomOpen2Response> {
|
||||
public open2(req: Open2Request): Observable<Open2Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeOpen2(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen2(res))
|
||||
map(res => decodeOpen2(res))
|
||||
);
|
||||
}
|
||||
public roomOpen3(req: RoomOpen3Request): Observable<RoomOpen3Response> {
|
||||
public open3(req: Open3Request): Observable<Open3Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeOpen3(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen3(res))
|
||||
map(res => decodeOpen3(res))
|
||||
);
|
||||
}
|
||||
public roomOpen4(req: RoomOpen4Request): Observable<RoomOpen4Response> {
|
||||
public open4(req: Open4Request): Observable<Open4Response> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeOpen4(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomOpen4(res))
|
||||
map(res => decodeOpen4(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomInvite(req: RoomInviteRequest): Observable<RoomInviteResponse> {
|
||||
public invite(req: InviteRequest): Observable<InviteResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INVITE_REQ, ...encodeRoomInvite(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INVITE_REQ, ...encodeInvite(req))
|
||||
.pipe(
|
||||
take(1),
|
||||
map(res => decodeRoomInvite(res))
|
||||
map(res => decodeInvite(res))
|
||||
);
|
||||
}
|
||||
|
||||
public roomInfo(
|
||||
req: RoomInfoRequest
|
||||
): Observable<
|
||||
| RoomInfoResponse
|
||||
| RoomInfoDataResponse
|
||||
| RoomUserShortDataResponse
|
||||
| RoomUserDataResponse
|
||||
> {
|
||||
public info(
|
||||
req: InfoRequest
|
||||
): Observable<InfoResponse | InfoData | UserShortData | UserData> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeRoomInfo(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_INFO_REQ, ...encodeInfo(req))
|
||||
.pipe(
|
||||
takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType, true),
|
||||
map(res => {
|
||||
if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) {
|
||||
return decodeRoomInfoData(res);
|
||||
return { ...decodeInfoData(res), Type: SSVC_TYPE_ROOM_INFO_ROOM };
|
||||
} else if (SSVC_TYPE_ROOM_INFO_USER === res.subServiceType) {
|
||||
return decodeRoomUserShortData(res);
|
||||
return {
|
||||
...decodeUserShortData(res),
|
||||
Type: SSVC_TYPE_ROOM_INFO_USER
|
||||
};
|
||||
} else if (SSVC_TYPE_ROOM_INFO_USER2 === res.subServiceType) {
|
||||
return decodeRoomUserData(res);
|
||||
return { ...decodeUserData(res), Type: SSVC_TYPE_ROOM_INFO_USER2 };
|
||||
}
|
||||
|
||||
return decodeRoomInfo(res);
|
||||
return { ...decodeInfo(res), Type: SSVC_TYPE_ROOM_INFO_RES };
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomUserStatusOffline(
|
||||
req: RoomUserStatusOfflineRequest
|
||||
): Observable<RoomUserStatusOfflineResponse> {
|
||||
public userStatusOffline(
|
||||
req: UserStatusOfflineRequest
|
||||
): Observable<UserStatusOfflineResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_USER_STATUS_REQ,
|
||||
...encodeRoomUserStatusOffline(req)
|
||||
...encodeUserStatusOffline(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUserStatusOffline(res);
|
||||
return decodeUserStatusOffline(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public roomExit(req: RoomExitRequest): Observable<RoomExitResponse> {
|
||||
public exit(req: ExitRequest): Observable<ExitResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeRoomExit(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeExit(req))
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomExit(res);
|
||||
return decodeExit(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomExitAll(req: RoomExitAllRequest): Observable<void> {
|
||||
public exitAll(req: ExitAllRequest): Observable<void> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_EXIT_ALL_REQ,
|
||||
...encodeRoomAllExit(req)
|
||||
)
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_ALL_REQ, ...encodeAllExit(req))
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomExitForcing(
|
||||
req: RoomExitForcingRequest
|
||||
): Observable<RoomExitForcingResponse> {
|
||||
public exitForcing(req: ExitForcingRequest): Observable<ExitForcingResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_EXIT_FORCING_REQ,
|
||||
...encodeRoomExitForcing(req)
|
||||
...encodeExitForcing(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomExitForcing(res);
|
||||
return decodeExitForcing(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public roomUpdate(req: RoomUpdateRequest): Observable<RoomUpdateResponse> {
|
||||
public update(req: UpdateRequest): Observable<UpdateResponse> {
|
||||
return this.protocolService
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeRoomUpdate(req))
|
||||
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeUpdate(req))
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUpdate(res);
|
||||
return decodeUpdate(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomUpdateTimerSet(
|
||||
req: RoomUpdateTimerSetRequest
|
||||
): Observable<RoomUpdateTimerSetResponse> {
|
||||
public updateTimerSet(
|
||||
req: UpdateTimerSetRequest
|
||||
): Observable<UpdateTimerSetResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_INFO_UPD_REQ,
|
||||
...encodeRoomUpdateTimerSet(req)
|
||||
...encodeUpdateTimerSet(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUpdateTimerSet(res);
|
||||
return decodeUpdateTimerSet(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
public roomUpdateFont(
|
||||
req: RoomUpdateFontRequest
|
||||
): Observable<RoomUpdateFontResponse> {
|
||||
public updateFont(req: UpdateFontRequest): Observable<UpdateFontResponse> {
|
||||
return this.protocolService
|
||||
.call(
|
||||
SVC_TYPE_ROOM,
|
||||
SSVC_TYPE_ROOM_FONT_UPD_REQ,
|
||||
...encodeRoomUpdateFont(req)
|
||||
...encodeUpdateFont(req)
|
||||
)
|
||||
.pipe(
|
||||
map(res => {
|
||||
take(1);
|
||||
return decodeRoomUpdateFont(res);
|
||||
return decodeUpdateFont(res);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, take, takeWhile } from 'rxjs/operators';
|
||||
import { map, take } from 'rxjs/operators';
|
||||
import {
|
||||
UserPasswordSetRequest,
|
||||
UserPasswordSetResponse,
|
||||
|
|
Loading…
Reference in New Issue
Block a user