1 |
1 |
import {Injectable} from '@angular/core';
|
2 |
2 |
import {HttpClient} from '@angular/common/http';
|
3 |
|
import {Observable, of} from "rxjs";
|
4 |
|
import {properties} from "../../../environments/environment";
|
5 |
|
import {CustomOptions} from "./servicesUtils/customOptions.class";
|
6 |
|
import {catchError, map} from "rxjs/operators";
|
|
3 |
import {Observable} from 'rxjs';
|
|
4 |
import {properties} from '../../../environments/environment';
|
|
5 |
import {CustomOptions} from './servicesUtils/customOptions.class';
|
|
6 |
import {map} from 'rxjs/operators';
|
7 |
7 |
|
8 |
8 |
@Injectable({
|
9 |
9 |
providedIn: 'root'
|
10 |
10 |
})
|
11 |
11 |
export class UserRegistryService {
|
12 |
|
|
|
12 |
|
13 |
13 |
constructor(private http: HttpClient) {
|
14 |
14 |
}
|
15 |
|
|
|
15 |
|
16 |
16 |
public getSubscribersCount(type: string, id: string): Observable<any> {
|
17 |
17 |
return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/count');
|
18 |
18 |
}
|
19 |
|
|
|
19 |
|
20 |
20 |
public subscribeTo(type: string, id: string): Observable<any> {
|
21 |
21 |
return this.http.post(properties.registryUrl + 'subscribe/' + encodeURIComponent(type) + '/' + encodeURIComponent(id),
|
22 |
|
null, CustomOptions.registryOptions())
|
|
22 |
null, CustomOptions.registryOptions());
|
23 |
23 |
}
|
24 |
|
|
|
24 |
|
25 |
25 |
public unsubscribeFrom(type: string, id: string): Observable<any> {
|
26 |
26 |
return this.http.post(properties.registryUrl + 'unsubscribe/' + encodeURIComponent(type) + '/' + encodeURIComponent(id),
|
27 |
|
null, CustomOptions.registryOptions())
|
|
27 |
null, CustomOptions.registryOptions());
|
28 |
28 |
}
|
29 |
29 |
|
30 |
30 |
public removeManagerRole(type: string, id: string, email: string): Observable<any> {
|
... | ... | |
32 |
32 |
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), CustomOptions.registryOptions());
|
33 |
33 |
}
|
34 |
34 |
|
35 |
|
public invite(type: string, id: string, email: string): Observable<any[]> {
|
|
35 |
public invite(type: string, id: string, email: string, details: any): Observable<any[]> {
|
36 |
36 |
return this.http.post<any>(properties.registryUrl + 'invite/' +
|
37 |
|
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), null,
|
|
37 |
encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), details,
|
38 |
38 |
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
39 |
39 |
}
|
40 |
40 |
|
... | ... | |
48 |
48 |
return this.http.get<any>(properties.registryUrl + 'invite/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/',
|
49 |
49 |
CustomOptions.registryOptions()).pipe(map((response: any) => response.response));
|
50 |
50 |
}
|
51 |
|
|
|
51 |
|
52 |
52 |
public getSubscribers(type: string, id: string): Observable<any[]> {
|
53 |
53 |
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/').pipe(map(response => response.response));
|
54 |
54 |
}
|
55 |
|
|
|
55 |
|
56 |
56 |
public getManagers(type: string, id: string): Observable<any[]> {
|
57 |
57 |
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/').pipe(map(response => response.response));
|
58 |
58 |
}
|
59 |
|
|
|
59 |
|
60 |
60 |
public getSubscribersEmail(type: string, id: string): Observable<any[]> {
|
61 |
61 |
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/email').pipe(map(response => response.response));
|
62 |
62 |
}
|
63 |
|
|
|
63 |
|
64 |
64 |
public getInvitation(id: string): Observable<any> {
|
65 |
|
return this.http.get<any>(properties.registryUrl + "verification/" + encodeURIComponent(id), CustomOptions.registryOptions())
|
|
65 |
return this.http.get<any>(properties.registryUrl + 'verification/' + encodeURIComponent(id), CustomOptions.registryOptions())
|
66 |
66 |
.pipe(map((response: any) => response.response));
|
67 |
67 |
}
|
68 |
|
|
|
68 |
|
69 |
69 |
public verify(id: string, code: string): Observable<any> {
|
70 |
|
return this.http.post<any>(properties.registryUrl + "verification/" + encodeURIComponent(id), code,CustomOptions.registryOptions());
|
|
70 |
return this.http.post<any>(properties.registryUrl + 'verification/' + encodeURIComponent(id), code, CustomOptions.registryOptions());
|
71 |
71 |
}
|
72 |
|
|
|
72 |
|
73 |
73 |
public deleteVerification(id: string): Observable<any> {
|
74 |
|
return this.http.delete<any>(properties.registryUrl + "verification/" + encodeURIComponent(id), CustomOptions.registryOptions());
|
|
74 |
return this.http.delete<any>(properties.registryUrl + 'verification/' + encodeURIComponent(id), CustomOptions.registryOptions());
|
75 |
75 |
}
|
76 |
|
|
|
76 |
|
77 |
77 |
public getManagersEmail(type: string, id: string): Observable<any[]> {
|
78 |
78 |
return this.http.get<any>(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/email').pipe(map(response => response.response));
|
79 |
79 |
}
|
[Library | Trunk]: Remove deprecated from getCommunity, add methods on user registry service