Class Application
Extends
Resource.
Application Resource
Defined in: application.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Application(spire, data)
Represents an application in the spire api.
|
| Field Attributes | Field Name and Description |
|---|---|
|
Actual data from the spire.io api.
|
|
|
Reference to spire object.
|
| Method Attributes | Method Name and Description |
|---|---|
|
authenticateMember(login, password, cb)
Authenticates a member.
|
|
|
channelByName(channelName, cb)
Gets a channel by name.
|
|
|
channels(cb)
Gets the channels collection.
|
|
|
channels$(cb)
Gets the channels collection.
|
|
|
createChannel(name, cb)
Creates a channel.
|
|
|
createMember(parameters, cb)
Creates a member.
|
|
|
createSubscription(options, timeout, cb)
Creates a subscription to any number of channels.
|
|
|
key()
Returns the application key.
|
|
|
memberByEmail(memberEmail, cb)
Gets a member by login.
|
|
|
members(Object, cb)
Gets the members collection.
|
|
|
members$(Object, cb)
Gets the members collection.
|
|
|
name()
Returns the application name.
|
|
|
requestMemberPasswordReset(email, cb)
Resets a member password.
|
|
|
resetPassword(login, password, cb)
Resets a member password using a reset key.
|
|
|
subscriptionByName(subscriptionName, cb)
Gets a subscription by name.
|
|
|
subscriptions(cb)
Gets the subscriptions collection.
|
|
|
subscriptions$(cb)
Gets the subscriptions collection.
|
- Methods borrowed from class Resource:
- authorization, capabilities, capability, get, getIfCapable, mediaType, request, schema, update, url
Class Detail
Application(spire, data)
Represents an application in the spire api.
- Parameters:
- {object} spire
- Spire object
- {object} data
- Application data from the spire api
Field Detail
data
Actual data from the spire.io api.
spire
Reference to spire object.
Method Detail
authenticateMember(login, password, cb)
Authenticates a member. Returns a Member resource. Error if authenication fails.
- Parameters:
- {string} login
- Member login
- {string} password
- Member password
- {function (err|member)} cb
- Callback
channelByName(channelName, cb)
Gets a channel by name. Returns a Channel resource
Always gets a fresh value from the api.
spire.session.channelByName('name_of_channel', function (err, channel) {
if (!err) {
// `channel` now contains a channel object
}
});
- Parameters:
- {String} channelName
- Name of channel
- {function (err|channel)} cb
- Callback
channels(cb)
Gets the channels collection. Returns a hash of Channel resources.
Returns a value from the cache, if one if available.
application.channels(function (err, channels) {
if (!err) {
// `channels` is a hash of all the applications's channels
}
});
- Parameters:
- {function (err|channels)} cb
- Callback
channels$(cb)
Gets the channels collection. Returns a hash of Channel resources.
Always gets a fresh value from the api.
application.channels$(function (err, channels) {
if (!err) {
// `channels` is a hash of all the applications's channels
}
});
- Parameters:
- {function (err|channels)} cb
- Callback
createChannel(name, cb)
Creates a channel. Returns a Channel resource. Errors if a channel with the
specified name exists.
- Parameters:
- {string} name
- Channel name
- {function (err|channel)} cb
- Callback
createMember(parameters, cb)
Creates a member. Returns a Member resource. Errors if a member with the
specified login exists.
- Parameters:
- {object} parameters
- including login, password, and an optional email
- {function (err|member)} cb
- Callback
createSubscription(options, timeout, cb)
Creates a subscription to any number of channels. Returns a Subscription
resource. Errors if a subscription with the specified name exists.
- Parameters:
- {object} options
- Options
- {string} options.name
- Subscription name
- {array} options.channelNames
- Channel names to subscribe to
- {array} options.channelUrls
- Channel urls to subscribe to
- {number} timeout
- Subscription timeout
- {function (err|subscription)} cb
- Callback
{string}
key()
Returns the application key.
- Returns:
- {string} Application key
memberByEmail(memberEmail, cb)
Gets a member by login. Returns a Member resource
Always gets a fresh value from the api.
spire.session.memberByEmail('login_of_member', function (err, member) {
if (!err) {
// `member` now contains a member object
}
});
- Parameters:
- {String} memberEmail
- Email of member
- {function (err|member)} cb
- Callback
members(Object, cb)
Gets the members collection. Returns a hash of Member resources.
Returns a value from the cache, if one if available.
application.members({limit: 10},function (err, members) {
if (!err) {
// `members` is a hash of all the applications's members
}
});
- Parameters:
- Object
- options Options for retrieving members (limit and after)
- {function (err|members)} cb
- Callback
members$(Object, cb)
Gets the members collection. Returns a hash of Members resources.
Always gets a fresh value from the api.
application.members$({limit: 10}, function (err, members) {
if (!err) {
// `members` is a hash of all the applications's members
}
});
- Parameters:
- Object
- options Options for retrieving members (limit and after)
- {function (err|members)} cb
- Callback
{string}
name()
Returns the application name.
- Returns:
- {string} Application name
requestMemberPasswordReset(email, cb)
Resets a member password. Empty response unless an error occurs.
- Parameters:
- {string} email
- Member email or login
- {function (err)} cb
- Callback
resetPassword(login, password, cb)
Resets a member password using a reset key. Can also update the user password (optional).
Error if authenication fails.
- Parameters:
- {string} login
- Member login
- {string} password
- Member password
- {function (err|member)} cb
- Callback
subscriptionByName(subscriptionName, cb)
Gets a subscription by name. Returns a Subscription resource
Always gets a fresh value from the api.
spire.session.subscriptionByName('name_of_subscription', function (err, subscription) {
if (!err) {
// `subscription` now contains a subscription object
}
});
- Parameters:
- {String} subscriptionName
- Name of subscription
- {function (err|subscription)} cb
- Callback
subscriptions(cb)
Gets the subscriptions collection. Returns a hash of Subscription resources.
Returns a value from the cache, if one if available.
application.subscriptions(function (err, subscriptions) {
if (!err) {
// `subscriptions` is a hash of all the applications's subscriptions
}
});
- Parameters:
- {function (err|subscriptions)} cb
- Callback
subscriptions$(cb)
Gets the subscriptions collection. Returns a hash of Subscription resources.
Always gets a fresh value from the api.
application.subscriptions$(function (err, subscriptions) {
if (!err) {
// `subscriptions` is a hash of all the application's subscriptions
}
});
- Parameters:
- {function (err|subscriptions)} cb
- Callback