src/app/contacts/contacts.service.ts
Methods |
constructor(http: AuthHttp)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:10
|
||||||||
Parameters :
|
addContactsToGroup | ||||||||
addContactsToGroup(data: AddContactsToGroupData)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:59
|
||||||||
Parameters :
Returns :
any
|
createContact | ||||||||
createContact(contact: Contact)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:27
|
||||||||
Parameters :
Returns :
any
|
createGroup | ||||||||
createGroup(group: CreateGroupData)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:51
|
||||||||
Parameters :
Returns :
any
|
deleteContact | ||||||||
deleteContact(id: number)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:35
|
||||||||
Parameters :
Returns :
any
|
deleteContactFromGroup | ||||||||
deleteContactFromGroup(data: RemoveContactsFromGroupData)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:63
|
||||||||
Parameters :
Returns :
any
|
deleteContacts | ||||||||
deleteContacts(data: RemoveContactsData)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:39
|
||||||||
Parameters :
Returns :
any
|
deleteGroup | ||||||||
deleteGroup(id: number)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:47
|
||||||||
Parameters :
Returns :
any
|
getContacts |
getContacts()
|
Defined in src/app/contacts/contacts.service.ts:23
|
Returns :
any
|
getContactsBook |
getContactsBook()
|
Defined in src/app/contacts/contacts.service.ts:15
|
Returns :
any
|
getContactsBookByUserId | ||||||||
getContactsBookByUserId(userId: number)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:19
|
||||||||
Parameters :
Returns :
any
|
getGroup | ||||||||
getGroup(id: number)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:43
|
||||||||
Parameters :
Returns :
any
|
updateContact | ||||||||
updateContact(contact: Contact)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:31
|
||||||||
Parameters :
Returns :
any
|
updateGroup | ||||||||
updateGroup(data: UpdateGroupData)
|
||||||||
Defined in src/app/contacts/contacts.service.ts:55
|
||||||||
Parameters :
Returns :
any
|
import {Injectable} from "@angular/core";
import {AuthHttp} from "../core/auth/auth-http.service";
import {
CreateGroupData, AddContactsToGroupData, UpdateGroupData, RemoveContactsData,
RemoveContactsFromGroupData
} from "./contacts.data";
import {Contact} from "./shared/contact.model";
@Injectable()
export class ContactsService {
constructor(private http: AuthHttp) {
}
getContactsBook() {
return this.http.get('/api/v1/contacts/contactsbook/owner').map(res => res.json())
}
getContactsBookByUserId(userId: number) {
return this.http.get('/api/v1/contacts/contactsbook/owner/' + userId).map(res => res.json());
}
getContacts() {
return this.http.get('/api/v1/contacts/all').map(res => res.json())
}
createContact(contact: Contact) {
return this.http.post('/api/v1/contacts/create', JSON.stringify(contact)).map(res => res.json())
}
updateContact(contact: Contact) {
return this.http.put('/api/v1/contacts/update/' + contact.id, JSON.stringify(contact)).map(res => res.json())
}
deleteContact(id: number) {
return this.http.delete('/api/v1/contacts/delete/' + id).map(res => res.json())
}
deleteContacts(data: RemoveContactsData) {
return this.http.post('/api/v1/contacts/delete', JSON.stringify(data)).map(res => res.json())
}
getGroup(id: number) {
return this.http.get('/api/v1/contacts/group/get/' + id).map(res => res.json())
}
deleteGroup(id: number) {
return this.http.delete('/api/v1/contacts/group/delete/' + id).map(res => res.json())
}
createGroup(group: CreateGroupData) {
return this.http.post('/api/v1/contacts/group/create', JSON.stringify(group)).map(res => res.json())
}
updateGroup(data: UpdateGroupData) {
return this.http.post('/api/v1/contacts/group/update', JSON.stringify(data)).map(res => res.json())
}
addContactsToGroup(data: AddContactsToGroupData) {
return this.http.post('/api/v1/contacts/group/add', JSON.stringify(data)).map(res => res.json())
}
deleteContactFromGroup(data: RemoveContactsFromGroupData) {
return this.http.post('/api/v1/contacts/group/delete', JSON.stringify(data)).map(res => res.json())
}
}