https://github.com/scalajs-io/linkedin-api
LinkedIN SDK for Scala.js
https://github.com/scalajs-io/linkedin-api
linkedin scala scalajs sdk social-network
Last synced: 9 months ago
JSON representation
LinkedIN SDK for Scala.js
- Host: GitHub
- URL: https://github.com/scalajs-io/linkedin-api
- Owner: scalajs-io
- License: apache-2.0
- Created: 2017-02-11T08:36:44.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T23:09:35.000Z (over 6 years ago)
- Last Synced: 2025-01-17T22:42:33.928Z (11 months ago)
- Topics: linkedin, scala, scalajs, sdk, social-network
- Language: Scala
- Size: 17.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Linkedin API for Scala.js
================================
[linkedin](https://developer.linkedin.com/docs) - Linkedin SDK for Scala.js
### Description
Linkedin SDK for Scala.js
### Build Dependencies
* [SBT v1.2.x](http://www.scala-sbt.org/download.html)
### Build/publish the SDK locally
```bash
$ sbt clean publish-local
```
### Running the tests
Before running the tests the first time, you must ensure the npm packages are installed:
```bash
$ npm install
```
Then you can run the tests:
```bash
$ sbt test
```
### Examples
Inside of your HTML index page:
```html
api_key: [YOUR_API_KEY_GOES_HERE]
authorize: true
onLoad: linkedInInit
scope: r_basicprofile r_emailaddress rw_company_admin w_share
```
Within your Scala.js application:
```scala
import io.scalajs.social.linkedin._
import scalajs.js
js.Dynamic.global.linkedInInit = () => {
val injector = angular.element(jQuery("#Main")).injector()
injector.get[MySessionService]("MySession").toOption match {
case Some(mySession) =>
console.info("Initializing LinkedIn API...")
mySession.initLinkedIn(LinkedIn.IN)
case None =>
console.error("MySession could not be retrieved.")
}
}
```
Afterwards, you may call any LinkedIn API that you have the permissions to execute:
```scala
import io.scalajs.social.linkedin._
import scalajs.js
var linkedInID: js.UndefOr[String] = js.undefined
// read the authenticated user's profile
IN.API.Profile(js.Array("me")) onComplete {
case Success(response) =>
linkedInID = response.values.headOption.flatMap(_.id.toOption).orUndefined
case Failure(e) =>
console.error(s"Failed to retrieve LinkedIn profile - ${e.getMessage}")
}
```
### Artifacts and Resolvers
To add the `Linkedin` binding to your project, add the following to your build.sbt:
```sbt
libraryDependencies += "io.scalajs" %%% "linkedin-api" % "0.5.0"
```
Optionally, you may add the Sonatype Repository resolver:
```sbt
resolvers += Resolver.sonatypeRepo("releases")
```