From 6d593aaa270f4e70f8384dce01f3bd0e9ed287dd Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 8 Sep 2020 14:33:06 +0000 Subject: [PATCH] [Library | Trunk]: Remove deprecated from getCommunity, add methods on user registry service git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@59348 d315682c-612b-4755-9ff5-7f18f6832af3 --- connect/community/community.service.ts | 3 -- services/user-registry.service.ts | 44 +++++++++++++------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/connect/community/community.service.ts b/connect/community/community.service.ts index d60091f7..27c14538 100644 --- a/connect/community/community.service.ts +++ b/connect/community/community.service.ts @@ -41,9 +41,6 @@ export class CommunityService { return from(this.getCommunityByStateAsync(properties, url)); } - /** - * @deprecated - */ getCommunity(properties: EnvProperties, url: string) { return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) .pipe(map(res => this.parseCommunity(res))); diff --git a/services/user-registry.service.ts b/services/user-registry.service.ts index 2218b07d..304424dc 100644 --- a/services/user-registry.service.ts +++ b/services/user-registry.service.ts @@ -1,30 +1,30 @@ import {Injectable} from '@angular/core'; import {HttpClient} from '@angular/common/http'; -import {Observable, of} from "rxjs"; -import {properties} from "../../../environments/environment"; -import {CustomOptions} from "./servicesUtils/customOptions.class"; -import {catchError, map} from "rxjs/operators"; +import {Observable} from 'rxjs'; +import {properties} from '../../../environments/environment'; +import {CustomOptions} from './servicesUtils/customOptions.class'; +import {map} from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class UserRegistryService { - + constructor(private http: HttpClient) { } - + public getSubscribersCount(type: string, id: string): Observable { return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/count'); } - + public subscribeTo(type: string, id: string): Observable { return this.http.post(properties.registryUrl + 'subscribe/' + encodeURIComponent(type) + '/' + encodeURIComponent(id), - null, CustomOptions.registryOptions()) + null, CustomOptions.registryOptions()); } - + public unsubscribeFrom(type: string, id: string): Observable { return this.http.post(properties.registryUrl + 'unsubscribe/' + encodeURIComponent(type) + '/' + encodeURIComponent(id), - null, CustomOptions.registryOptions()) + null, CustomOptions.registryOptions()); } public removeManagerRole(type: string, id: string, email: string): Observable { @@ -32,9 +32,9 @@ export class UserRegistryService { encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), CustomOptions.registryOptions()); } - public invite(type: string, id: string, email: string): Observable { + public invite(type: string, id: string, email: string, details: any): Observable { return this.http.post(properties.registryUrl + 'invite/' + - encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), null, + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/manager/' + encodeURIComponent(email), details, CustomOptions.registryOptions()).pipe(map((response: any) => response.response)); } @@ -48,32 +48,32 @@ export class UserRegistryService { return this.http.get(properties.registryUrl + 'invite/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/', CustomOptions.registryOptions()).pipe(map((response: any) => response.response)); } - + public getSubscribers(type: string, id: string): Observable { return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/').pipe(map(response => response.response)); } - + public getManagers(type: string, id: string): Observable { return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/').pipe(map(response => response.response)); } - + public getSubscribersEmail(type: string, id: string): Observable { return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/subscribers/email').pipe(map(response => response.response)); } - + public getInvitation(id: string): Observable { - return this.http.get(properties.registryUrl + "verification/" + encodeURIComponent(id), CustomOptions.registryOptions()) + return this.http.get(properties.registryUrl + 'verification/' + encodeURIComponent(id), CustomOptions.registryOptions()) .pipe(map((response: any) => response.response)); } - + public verify(id: string, code: string): Observable { - return this.http.post(properties.registryUrl + "verification/" + encodeURIComponent(id), code,CustomOptions.registryOptions()); + return this.http.post(properties.registryUrl + 'verification/' + encodeURIComponent(id), code, CustomOptions.registryOptions()); } - + public deleteVerification(id: string): Observable { - return this.http.delete(properties.registryUrl + "verification/" + encodeURIComponent(id), CustomOptions.registryOptions()); + return this.http.delete(properties.registryUrl + 'verification/' + encodeURIComponent(id), CustomOptions.registryOptions()); } - + public getManagersEmail(type: string, id: string): Observable { return this.http.get(properties.registryUrl + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/managers/email').pipe(map(response => response.response)); }