UNPKG

ngo-login-client

Version:

Auth and User services for Angular v2 and up. Requires backend REST service.

45 lines (44 loc) 1.48 kB
import { Http } from '@angular/http'; import { Observable, ConnectableObservable } from 'rxjs'; import { Broadcaster, Logger } from 'ngo-base'; import { User } from './user'; /** * Provides user and user list methods to retrieve current or user list details * * The UserService should be injected at the root of the application to ensure it is a singleton * getUser and getAllUsers return observables that can be subscribed to for information */ export declare class UserService { private http; private logger; /** * The currently logged in user */ loggedInUser: ConnectableObservable<User>; private headers; private userUrl; private usersUrl; private searchUrl; constructor(http: Http, logger: Logger, broadcaster: Broadcaster, apiUrl: string); /** * Get the User object for a given user id, or null if no user is found * @param userId the userId to search for */ getUserByUserId(userId: string): Observable<User>; /** * Get the User object for a given username, or null if no user is found * @param username the username to search for */ getUserByUsername(username: string): Observable<User>; /** * Get users by a search string */ getUsersBySearchString(search: string): Observable<User[]>; /** * * Filter users by username * * @returns Observable<User[]> */ filterUsersByUsername(username: string): Observable<User[]>; }