GithubHelp home page GithubHelp logo

fuse-contacts's Introduction

Fuse Contacts bindings Build Status Fuse Version

Library to use contacts in Fuse.

https://www.fusetools.com/community/forums/feature_requests/contacts_api

Issues, feature request and pull request are welcomed.

Installation

Using fusepm

$ fusepm install https://github.com/bolav/fuse-contacts

Usage:

UX

<Contacts ux:Global="Contacts" />

JS

contacts.authorize().then(function (status) {
	console.log(status);
	if (status === 'AuthorizationAuthorized') {
		console.log(JSON.stringify(contacts.getAll()));
	}
})

API

require

var contacts = require('Contacts');

authorize

Returns a promise with the status of authorization

var auth = contacts.authorize();
auth.then(function (status) {
	console.log(status);
})

status can be:

  • AuthorizationDenied
  • AuthorizationRestricted
  • AuthorizationAuthorized

(and some error results)

getAll

Returns an array of hashes of contacts

console.log(JSON.stringify(contacts.getAll()));

getPage

Returns an array of hashes of contacts, split by pages

readInLoop(0); // call the function, starting with page 0

function readInLoop(page) {
    var numEntries = 30; // number of entries per page
	var proceed = true; // boolean to track state of recursion
	var contactsPageList = contacts.getPage(numEntries, page); // retrieves the numEntries contacts objects, offset by (page * numEntries)
	if (contactsPageList.length < numEntries) proceed = false; // if the current page returned less results than numEntries, we have reached the end of all contacts
	// ... do something with contactsPageList here!
	if (proceed) readInLoop(page+1); // call ourselves recursively with next page
}

fuse-contacts's People

Contributors

eksperts avatar bolav avatar kusma avatar mortend avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.