# pxs-psn-api

> a simple psn api wrapper

Latest version **2.0.0** (published 2020-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install pxs-psn-api
pnpm add pxs-psn-api
yarn add pxs-psn-api
bun add pxs-psn-api
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2020-04-19 |
| First published | 2019-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 34 |
| Author | fakeshadow |
| Maintainers | fakeshadow |
| Keywords | psn, api |

## Links

- npm: https://www.npmjs.com/package/pxs-psn-api
- Repository: https://github.com/fakeshadow/pxs-psn-api
- Homepage: https://github.com/fakeshadow/pxs-psn-api#readme
- Issues: https://github.com/fakeshadow/pxs-psn-api/issues
- npm.io page: https://npm.io/package/pxs-psn-api

## Dependencies (3)

- [request](https://npm.io/package/request.md) ^2.88.0
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0
- [form-data-fork](https://npm.io/package/form-data-fork.md) ^2.3.3

## Recent versions

- 2.0.0 (latest) — 2020-04-19
- 1.0.3 — 2019-03-04
- 1.0.2 — 2019-03-02
- 1.0.1 — 2019-03-02
- 1.0.0 — 2019-03-02

## README

# Example:

- You need access token to interact with PSN APIs. They can be obtained with a uuid and twoFA code. See [**HERE**](https://tusticles.com/psn-php/first_login.html) for detail how to get them

- chage your npsso in example.js and run
`node example.js`


```javascript
// import class
const PSN = require('./index.js');

// psn object accept optional params when construct.
const psn = new PSN({
    lang: "en",  //(default value en)
    region: "hk",  // server region(default value us)
    refresh_token: null, //refresh_token(default value null)
    access_token: null  //access_token(default value null)
});

const npsso = "put your npsso code here in string form";

async function main() {
    try {
        // access token is used to call other api, and refresh token is used to get new access_token when it's expired
        const { access_token, refresh_token } = await psn.auth(npsso);

        console.log(psn.access_token, psn.refresh_token);

        // get user profile with access_token
        const profile = await psn.getProfile("Hakoom");
        console.log(profile);

    } catch (e) {
        console.log('error: ', e);
    }
}

main();
 ```

```javascript
// other useful api calls

psn.searchGame(name, lang, region, age)   // find a named game from PSN store

psn.sendMessage(threadId, message, file_path)   // send a message to an PSN user(the target user must have a according privacy setting)

psn.getSummary(offset, onlineId) // get trophy summary of a given PSN user

 ```

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