# smitescript

> A framework for interacting with the Smite REST API

Latest version **0.0.6** (published 2015-01-20) · 0 weekly downloads

## Install

```sh
npm install smitescript
pnpm add smitescript
yarn add smitescript
bun add smitescript
```

## Health

**Score 10/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2015-01-20 |
| First published | 2015-01-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Messyfresh |
| Maintainers | messyfresh |

## Links

- npm: https://www.npmjs.com/package/smitescript
- npm.io page: https://npm.io/package/smitescript

## Dependencies (4)

- [MD5](https://npm.io/package/MD5.md) ^1.2.1
- [moment](https://npm.io/package/moment.md) ^2.8.4
- [request](https://npm.io/package/request.md) ^2.51.0
- [JSONStream](https://npm.io/package/JSONStream.md) ^0.10.0

## Recent versions

- 0.0.6 (latest) — 2015-01-20
- 0.0.5 — 2015-01-20
- 0.0.4 — 2015-01-20
- 0.0.3 — 2015-01-12
- 0.0.2 — 2015-01-12
- 0.0.1 — 2015-01-12

## README

# Smitescript
A node.js library for making calls to the HiRez Smite API.

# Updated 20 Jan 2015
	Added the following new calls
			- getPlayer
				List all info about a player
			- getFriends
				List all of a players friends
			- getGodRank
				List the rank of all of the gods for
				a player
			- getTopMatches
				Lists the 50 most watched / most recent
				recorded matches


# How to Use
	
	npm install smitescript

Simply include smitescript in your code and start making calls.

	var smite = require('smite');

	// Declare your smite developer credentials.
	var devId = 'XXXX';
	var authId = 'INSERT YOUR PRIVATE DEVELOPER KEY HERE';

	// Create a session (Good for 15 min)
	smite.createSession(devId, authKey);

	// Example call to retrieve all gods in the game.
	smite.getGods(devId, authKey, sessionId);
	smite.getItems(devId, authKey, sessionId);

	// This call will create a .json file in the local directory of the response.
	// At  this point a simple fs.createReadStream can be used to read the contents or
	// the contents of the file can be pushed into a mongoDB.

Here is another example for creating a session:

	var sessionId;
	
	try {
		sessionId = fs.readFileSync("session.txt", "utf8");
	} catch (e) {
		if (e.code === "ENOENT") {
			sessionId = createSession(devId, authKey);
		}
	}

# Current Issues
	The first initial call to create a session has to be made
	by itself or setTimeout in order to ensure a valid sessionId
	has had time to make it back from the server. This shouldn't
	be a problem for webservers are you can just create a sessionID
	at the first page load, but this is not a very good way of
	achieving that since the API has call limits.

# Currently implemented
	- createSession
		Generates a session with the Smite API Server
		(Sessions last 15 min)
	- getGods
		List all current gods with info on each
	- getItems
		List all current items with info for each
	- getPlayer
		List all info about a player
	- getFriends
		List all of a players friends
	- getGodRank
		List the rank of all of the gods for
		a player
	- getTopMatches
		Lists the 50 most watched / most recent
		recorded matches

# TODO
	- Create functions for all of the API calls.
	- Establish mechanism to check if a session is expired.
	- Be Awesome!

Be sure and check out the package and hack away at it!
I'm writing this to learn and for my own personal use.
Let me know what you come up with.

---
_Source: https://npm.io/package/smitescript · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
