Skip to content

Type safe and scala friendly wrapper around google people api

License

Notifications You must be signed in to change notification settings

coreyauger/scala-js-google-people-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-js-google-people-api

Type safe and scala friendly wrapper around google people api

example usage

  // getting a users contacts
  // NOTE: that this method must be called as the result of an event (eg: button push) as it opens a window to perform auth
  def myEventHandler() = {
    val CLIENT_ID = "YOU_CLIENT_ID"
    val scopes = scalajs.js.Array("https://www.googleapis.com/auth/contacts.readonly")
    gapi.auth.authorize(AuthParams(CLIENT_ID, scopes), { authResult: GoogleApiOAuth2TokenObject =>
      if (authResult.error.isDefined) println(s"error: ${authResult.error}")
      else {
        gapi.client.load("https://people.googleapis.com/$discovery/rest", "v1").toFuture.foreach { _ =>
          val primaryListFuture = people.connections(500).map { connections: people.Connections =>
            people.get(connections.connections).flatMap { person =>
              val name = people.get(person.names).headOption.map(_.displayName.getOrElse("")).getOrElse("")
              // do cool shiz ..
            }
          }
        }
      }
}

About

Type safe and scala friendly wrapper around google people api

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages