@orbit-love/members
v1.0.0
Published
Orbit API client for Node.js. API support for member operations.
Downloads
4
Readme
Orbit Members Helper Library for Node.js
Orbit API helper library for Node.js. This client can create, read, update and delete members and identities in your Orbit workspace.
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
- Information about Orbit API Rate Limiting
- For list methods, you can ask request a number of results per request between 1 and 100.
Methods
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
const memberId = 'janesmith04'
getMember(memberId).then(data => {
console.log(data)
}).catch(error => {
console.error(error)
})
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
const data = {
member: {
twitter: 'janesmith_',
name: 'jane Smith',
tags: ['champion', 'feedback']
}
}
orbitMembers.createMember(data).then(data => {
console.log(data)
}).catch(error => {
console.error(error)
})
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
const memberId = 'janesmith04'
orbitMembers.deleteMember(memberId).then(data => {
console.log(data)
}).catch(error => {
console.error(error)
})
const memberId = 'janesmith04'
const data = {
source: 'youtube',
username: 'janesmith1990'
}
orbitMembers.addIdentity(memberId, data).then(data => {
console.log(data)
}).catch(error => {
console.error(error)
})
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.