npm.io
0.0.4 • Published 3 years ago

bulk-contact

Licence
MIT
Version
0.0.4
Deps
0
Size
30 kB
Vulns
0
Weekly
0

bulk-contact

Allow to save multiple contact detail in ionic capacitor

Install

npm install bulk-contact
npx cap sync

Example

BulkContact.getPermissions().then(permissionResponse => {
  if (permissionResponse) {
    if (permissionResponse.granted) {
      for (const currentContact of contactList) {
        BulkContact.saveContact({
          name: currentContact.name, 
          mobile: currentContact.mobile
        }).then(() => {
          console.log('contact saved');
        }).catch((exception) => {
          console.log(exception);
        }); 
      }
    } else {
      console.log('permission denied');
    }
  }
});

API

getPermissions()
getPermissions() => Promise<PermissionStatus>

Returns: Promise<PermissionStatus>


getContacts()
getContacts() => Promise<{ contacts: Contact[]; }>

Returns: Promise<{ contacts: Contact[]; }>


saveContact(...)
saveContact(contact: NewContact) => Promise<void>
Param Type
contact NewContact

Interfaces
PermissionStatus
Prop Type
granted boolean
Contact
Prop Type
contactId string
displayName string
phoneNumbers PhoneNumber[]
emails EmailAddress[]
photoThumbnail string
organizationName string
organizationRole string
birthday string
PhoneNumber
Prop Type
label string
number string
EmailAddress
Prop Type
label string
address string
NewContact

New contact schema.

Prop Type
name string
mobile string

Keywords