0.0.4 • Published 1 year ago

bulk-contact v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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>
ParamType
contactNewContact

Interfaces

PermissionStatus

PropType
grantedboolean

Contact

PropType
contactIdstring
displayNamestring
phoneNumbersPhoneNumber[]
emailsEmailAddress[]
photoThumbnailstring
organizationNamestring
organizationRolestring
birthdaystring

PhoneNumber

PropType
labelstring
numberstring

EmailAddress

PropType
labelstring
addressstring

NewContact

New contact schema.

PropType
namestring
mobilestring