Skip to content

Orbit API client for Node.js. API support for member operations.

License

Notifications You must be signed in to change notification settings

orbit-love/js-orbit-members

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orbit Members Helper Library for Node.js

Build Status npm version Contributor Covenant

Orbit API helper library for Node.js.
This client can create, read, update and delete members and identities in your Orbit workspace.

Orbit

Installation

npm install @orbit-love/members

Constructor

const OrbitMembers = require('@orbit-love/members')
const orbitMembers = new OrbitMembers(orbitWorkspaceId, orbitApiKey)
  • orbitWorkspaceId - The part of your Orbit workspace URL that immediately follows the app.orbit.love. For example, if the URL was https://app.orbit.love/my-workspace, then your Orbit workspace ID is my-workspace.
  • orbitApiKey - This can be found in you Orbit Account Settings.

Initializing with environment variables

If you have the environment variables ORBIT_WORKSPACE_ID and ORBIT_API_KEY set, you can initialize the client like so:

const OrbitMembers = require('@orbit-love/members')
const orbitMembers = new OrbitMembers()

If you have environment variables set and also pass in values, the passed in values will be used.

Rate Limits & Page Sizes

Methods

listMembers(query)
const query = {
    page: 1,
    items: 50,
    company: 'ACME Corp'
}

orbitMembers.listMembers(query).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})

options is not a required parameter, but can include any query parameter shown in our API reference.

List members in a workspace API reference

getMember(memberId)
const memberId = 'janesmith04'

getMember(memberId).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})

Get a member API reference

findMember(query)
const query = {
    source: 'youtube',
    username: 'janesmith1990'
}

orbitMembers.findMember(query).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})

Provide a source and one of username/uid/email params to return a member with that identity, if one exists. Common values for source include github, twitter, and email.

Fine a member by an identity API reference

createMember(data)
const data = {
    member: {
        twitter: 'janesmith_',
        name: 'jane Smith',
        tags: ['champion', 'feedback']
    }
}

orbitMembers.createMember(data).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})

Create a member API reference

updateMember([memberId], data)
const memberId = 'janesmith04'
const data = {
    bio: 'New bio'
}

orbitMembers.updateMember(memberId, data).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})

You can omit memberId and provide only the data object, but you must then provide an identity object.

Update a member with memberID API Reference

Update a member without memberId API reference

deleteMember(memberId)
const memberId = 'janesmith04'

orbitMembers.deleteMember(memberId).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})

Delete a member API reference

addIdentity(memberId, data)
const memberId = 'janesmith04'
const data = {
    source: 'youtube',
    username: 'janesmith1990'
}

orbitMembers.addIdentity(memberId, data).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})
removeIdentity(memberId, data)
const memberId = 'janesmith04'
const data = {
    source: 'youtube',
    username: 'janesmith1990'
}

orbitMembers.removeIdentity(memberId, data).then(data => {
    console.log(data)
}).catch(error => {
    console.error(error)
})

Contributing

We 💜 contributions from everyone! Check out the Contributing Guidelines for more information.

License

This is available as open source under the terms of the MIT License.

Code of Conduct

This project uses the Contributor Code of Conduct. We ask everyone to please adhere by its guidelines.

About

Orbit API client for Node.js. API support for member operations.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published