| import { ModifyContacts } from '../../shared/models/modifyContacts.model'; |
| import { Action } from '@ngrx/store'; |
| import { Injectable } from '@angular/core'; |
| import { HttpService, Query, GET, Path, Adapter, PUT, Body, DefaultHeaders } from '@shared/asyncServices/http'; |
| import { Observable } from 'rxjs'; |
| import { ContactsService } from '@pages/contacts/contacts.service'; |
| import { Contact } from '@shared/models'; |
| import { PageRequestInterface } from '@shared/models/page/page-request.interface'; |
| import { PageModel } from '@app/shared/models/page/page.model'; |
| |
| @Injectable() |
| @DefaultHeaders({ |
| // prettier-ignore |
| 'Accept': 'application/json', |
| 'Content-Type': 'application/json', |
| }) |
| export class ContactsApiClient extends HttpService { |
| public getContacts(request: PageRequestInterface = null): Observable<PageModel<Contact>> { |
| const modifyContacts: ModifyContacts = request.queryParameter || {}; |
| return this._getContactsPage(modifyContacts.searchText, modifyContacts.personTypeId, modifyContacts.sort, request.pageNumber ? (request.pageNumber - 1) : 0, request.pageSize); |
| } |
| |
| /** |
| * Retrieves all paged contacts |
| */ |
| @GET('/contacts') |
| @Adapter(ContactsService.gridPageAdapter) |
| private _getContactsPage(@Query('searchText') searchtext: string, @Query('personTypeId') personTypeId: string, @Query('sort') sort: string, @Query('page') pageNumber: number, @Query('size') pageSize: number): Observable<any> { |
| return null; |
| } |
| |
| /** |
| * Retrieves product details by a given id |
| * |
| * @param id |
| */ |
| @GET('/contacts/{id}') |
| @Adapter(ContactsService.contactDetailsAdapter) |
| public getContactDetails(@Path('id') id: number): Observable<any> { |
| return null; |
| } |
| |
| @PUT('/contacts/{id}') |
| @Adapter(ContactsService.contactDetailsAdapter) |
| public putContactDetails(@Path('id') id: number, @Body() editedContact: Contact): Observable<Contact> { |
| return null; |
| } |
| } |