-
Notifications
You must be signed in to change notification settings - Fork 85
/
GroupsApiService.ts
63 lines (54 loc) · 2.23 KB
/
GroupsApiService.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import { ApiService } from './ApiService';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/';
import { AiurValue } from '../Models/AiurValue';
import { AiurProtocal } from '../Models/AiurProtocal';
@Injectable()
export class GroupsApiService {
private static serverPath = '/groups';
constructor(
private apiService: ApiService
) {}
public CreateGroup(groupName: string, password: string): Observable<AiurValue<number>> {
return this.apiService.Post(GroupsApiService.serverPath + '/CreateGroupConversation',
{
GroupName: groupName,
JoinPassword: password
});
}
public JoinGroup(groupName: string, password: string): Observable<AiurProtocal> {
return this.apiService.Post(GroupsApiService.serverPath + '/JoinGroup',
{
GroupName: groupName,
JoinPassword: password
});
}
public LeaveGroup(groupName: string): Observable<AiurProtocal> {
return this.apiService.Post(GroupsApiService.serverPath + '/LeaveGroup', {GroupName: groupName});
}
public MuteGroup(groupName: string, setMuted: boolean): Observable<AiurProtocal> {
return this.apiService.Post(GroupsApiService.serverPath + '/SetGroupMuted', {
groupName: groupName,
setMuted: setMuted
});
}
public TransferOwner(groupName: string, targetUserId: string): Observable<AiurProtocal> {
return this.apiService.Post(GroupsApiService.serverPath + '/TransferGroupOwner', {
groupName: groupName,
targetUserId: targetUserId
});
}
public UpdateGroupInfo(groupName: string, avatarKey?: number, newName?: string): Observable<AiurProtocal> {
return this.apiService.Post(GroupsApiService.serverPath + '/UpdateGroupInfo', {
GroupName: groupName,
AvatarKey: avatarKey,
NewName: newName
});
}
public UpdateGroupPassword(groupName: string, newJoinPassword?: string): Observable<AiurProtocal> {
return this.apiService.Post(GroupsApiService.serverPath + '/UpdateGroupPassword', {
GroupName: groupName,
NewJoinPassword: newJoinPassword
});
}
}