37 lines
1.5 KiB
TypeScript
37 lines
1.5 KiB
TypeScript
import { Invitation } from '../../models/invitation/Invitation';
|
|
import { UserInvitationCriteria } from '../../models/criteria/invitation/UserInvitationCriteria';
|
|
import { User } from '../../models/invitation/User';
|
|
import { HostConfiguration } from '../../app.constants';
|
|
import { BaseHttpService } from '../../utilities/cite-http-service-module/base-http.service';
|
|
import { Injectable } from "@angular/core";
|
|
import { HttpHeaders } from '@angular/common/http';
|
|
import { Observable } from 'rxjs/Observable';
|
|
import { RequestItem } from '../../models/criteria/RequestItem';
|
|
|
|
@Injectable()
|
|
export class InvitationService {
|
|
|
|
private actionUrl: string;
|
|
private headers: HttpHeaders;
|
|
|
|
constructor(private http: BaseHttpService) {
|
|
|
|
this.actionUrl = HostConfiguration.Server + 'invite/';
|
|
|
|
this.headers = new HttpHeaders();
|
|
this.headers = this.headers.set('Content-Type', 'application/json');
|
|
this.headers = this.headers.set('Accept', 'application/json');
|
|
}
|
|
|
|
public inviteUsers(invitation: Invitation): Observable<User[]> {
|
|
return this.http.post<User[]>(this.actionUrl + "users", invitation, { headers: this.headers });
|
|
}
|
|
|
|
public getUsers(usersInvitationRequestItem: RequestItem<UserInvitationCriteria>): Observable<User[]> {
|
|
return this.http.post<User[]>(this.actionUrl + "getUsers", usersInvitationRequestItem, { headers: this.headers });
|
|
}
|
|
|
|
public exchange(id:String): Observable<String> {
|
|
return this.http.get<String>(this.actionUrl + "exchange/"+id, { headers: this.headers });
|
|
}
|
|
} |