npm.io
1.0.1 • Published 3 years ago

sporepedia

Licence
ISC
Version
1.0.1
Deps
2
Size
18 kB
Vulns
0
Weekly
0

sporepedia.js

A JavaScript library for easy API access to the Sporepedia - the content library for the 2008 god game 'Spore' by Maxis. This is essentially a wrapper for the REST API provided by Spore.

Installation

With npm

$ npm install sporepedia.js
const spore = require("sporepedia");

import is not supported

Usage

When startIndex is referred to, this is how many assets are skipped when loading a list. In conjunction with length, this is for pagination.

For example, if startIndex is 0 and length is 100, it'll load the first 100 assets. If startIndex is then set to 100, it'll load the second 100, and so on.

Functions

stats() ⇒ String

Get daily stats about Spore.com

creatureStats(assetID) ⇒ String

Get various stats like height, diet, abilities etc. for a creature

user(username) ⇒ String

Get profile pic, tagline, user id and creation date

userAssets(username, [startIndex], [length]) ⇒ String

Get asset id, name, creation date, type, parent and rating for a list of assets created by a user

userSporecasts(username) ⇒ String

Get id, name, tags, subscription count, rating etc. for Sporecasts subscribed to by a user

userAchievements(username, [startIndex], [length]) ⇒ String

Get number of achievements for user and a list of achievement ids and unlock-dates

userBuddies(username, startIndex, length) ⇒ String

For a given username, get a list of buddy names and ids and total buddy count

userSubscribers(username, startIndex, length) ⇒ String

For a given username, get the list of users who have added that username as a buddy.

sporecastAssets(sporecastID, [startIndex], [length]) ⇒ String

Get asset id, and name for assets in a sporecast

asset(assetID) ⇒ String

For a given asset id, get name, description, tags, 10 latest comments, type, parent, rating, creation date and author name/id

assetComments(assetID, [startIndex], [length]) ⇒ String

For a given asset id, get a list of comments, sender names and comment dates

assetData(dataType, assetID) ⇒ String

Get XML and PNGs for an asset ID.

achievementIcon(achievementID) ⇒ String

Get the official Spore achievement icon for a given achievement id

search(viewType, startIndex, length) ⇒ String

List creations for a given view

stats() ⇒ String

Get daily stats about Spore.com

Kind: global function Returns: String - JavaScript object containing some stats

creatureStats(assetID) ⇒ String

Get various stats like height, diet, abilities etc. for a creature

Kind: global function Returns: JavaScript object containing creature stats

Param Type Description
assetID String The asset ID of the creature

user(username) ⇒ String

Get profile pic, tagline, user id and creation date

Kind: global function Returns: String - JavaScript object containg user data

Param Type
username String

userAssets(username, [startIndex], [length]) ⇒ String

Get asset id, name, creation date, type, parent and rating for a list of assets created by a user

Kind: global function Returns: String - JavaScript object containing list of assets

Param Type Default Description
username String
[startIndex] Number 0 The start index - i.e if it was 5 the first 5 assets would be skipped
[length] Number 100 The number of assets to fetch

userSporecasts(username) ⇒ String

Get id, name, tags, subscription count, rating etc. for Sporecasts subscribed to by a user

Kind: global function Returns: String - JavaScript object containing info for Sporecasts

Param Type
username *

userAchievements(username, [startIndex], [length]) ⇒ String

Get number of achievements for user and a list of achievement ids and unlock-dates

Kind: global function Returns: String - JavaScript object containing list of achievements

Param Type Default Description
username String
[startIndex] Number 0 The start index - i.e if it was 5 the first 5 achievements would be skipped
[length] Number 100 The number of achievements to fetch

userBuddies(username, startIndex, length) ⇒ String

For a given username, get a list of buddy names and ids and total buddy count

Kind: global function Returns: String - JavaScript object containing a list of buddies

Param Type Description
username String
startIndex Number The start index - i.e if it was 5 the first 5 buddies would be skipped
length Number The number of buddies to fetch

userSubscribers(username, startIndex, length) ⇒ String

For a given username, get the list of users who have added that username as a buddy.

Kind: global function Returns: String - JavaScript object containing list of subscribers

Param Type Description
username String
startIndex Number The start index - i.e if it was 5 the first 5 subscribers would be skipped
length Number The number of subscribers to fetch

sporecastAssets(sporecastID, [startIndex], [length]) ⇒ String

Get asset id, and name for assets in a sporecast

Kind: global function Returns: String - JavaScript object containing info for assets

Param Type Default Description
sporecastID * ID of sporecast
[startIndex] Number 0 The start index - i.e if it was 5 the first 5 sporecasts would be skipped
[length] Number 100 The number of sporecasts to fetch

asset(assetID) ⇒ String

For a given asset id, get name, description, tags, 10 latest comments, type, parent, rating, creation date and author name/id

Kind: global function Returns: String - JavaScript object containing info for an asset

Param Type
assetID *

assetComments(assetID, [startIndex], [length]) ⇒ String

For a given asset id, get a list of comments, sender names and comment dates

Kind: global function Returns: String - JavaScript object containing list of comments

Param Type Default Description
assetID *
[startIndex] Number 0 The start index - i.e if it was 5 the first 5 comments would be skipped
[length] Number 100 The number of comments to fetch

assetData(dataType, assetID) ⇒ String

Get XML and PNGs for an asset ID.

Kind: global function Returns: String - If dataType is 'model', returns an XML string with the model info. Otherwise returns the URL of the image

Param Type Description
dataType 'model' | 'image' | 'thumb' 'model' returns the XML for a spore model, 'thumb' returns the URL to a
smaller thumbnail of the asset, 'image' returns the URL to a full size image of the asset
assetID String

achievementIcon(achievementID) ⇒ String

Get the official Spore achievement icon for a given achievement id

Kind: global function Returns: String - The URL of the achievement icon

Param Type
achievementID *

search(viewType, startIndex, length) ⇒ String

List creations for a given view

Kind: global function

Param Type Description
viewType "TOP_RATED" | "TOP_RATED_NEW"
| "NEWEST" | "FEATURED" | "RANDOM" | "CUTE_AND_CREEPY"
startIndex * The start index - i.e if it was 5 the first 5 creations would be skipped
length * The number of creations to fetch

README generated with jsdoc-to-markdown

Keywords