Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

@sapphire/plugin-api

Package Overview
Dependencies
Maintainers
3
Versions
790
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sapphire/plugin-api - npm Package Compare versions

Comparing version 2.1.5-next.73a35e98da56a27a05b2179188599fcaf1d87ff0.0 to 2.1.5-next.ab0f777.0

2

dist/lib/structures/api/CookieStore.d.ts

@@ -14,3 +14,3 @@ import type { ApiRequest } from './ApiRequest';

/**
* Parses a host using the {@link https://github.com/lupomontero/psl psl} library to extract the domain.
* Parses a host using the {@linkplain https://github.com/lupomontero/psl psl} library to extract the domain.
* This is used for the domain of the cookie

@@ -17,0 +17,0 @@ * @param host The hot to parse

@@ -103,3 +103,3 @@ "use strict";

/**
* Parses a host using the {@link https://github.com/lupomontero/psl psl} library to extract the domain.
* Parses a host using the {@linkplain https://github.com/lupomontero/psl psl} library to extract the domain.
* This is used for the domain of the cookie

@@ -106,0 +106,0 @@ * @param host The hot to parse

{
"name": "@sapphire/plugin-api",
"version": "2.1.5-next.73a35e98da56a27a05b2179188599fcaf1d87ff0.0",
"version": "2.1.5-next.ab0f777.0",
"description": "Plugin for @sapphire/framework to expose a REST API",

@@ -36,3 +36,5 @@ "author": "@sapphire",

"dependencies": {
"@types/node-fetch": "^2.5.10",
"@types/psl": "^1.1.0",
"@types/ws": "latest",
"node-fetch": "^2.6.1",

@@ -42,21 +44,2 @@ "psl": "^1.8.0",

},
"peerDependencies": {
"@sapphire/framework": "^1.x",
"@sapphire/pieces": "1.x",
"@types/node-fetch": "^2.x",
"@types/ws": "latest",
"discord-api-types": "^0.18.x",
"discord.js": "12.x"
},
"peerDependenciesMeta": {
"@types/ws": {
"optional": true
},
"@types/node-fetch": {
"optional": true
},
"discord-api-types": {
"optional": true
}
},
"repository": {

@@ -92,3 +75,3 @@ "type": "git",

},
"gitHead": "73a35e98da56a27a05b2179188599fcaf1d87ff0"
"gitHead": "ab0f77790d3d83175a1b49d9566be1a4c51b3e16"
}

@@ -19,3 +19,3 @@ <div align="center">

T.B.D.
This plugin provides an API endpoint for your bot that can be called from external services. A good exemplary use case for this is once your bot grows to have enough configuration options that you want to offer a website to your end-users to change those settings, and your website needs to interface with the bot for this to work.

@@ -28,7 +28,17 @@ ## Features

- Includes ESM ready entrypoint
- Premade OAuth 2.0 endpoints
## Installation
`@sapphire/plugin-api` depends on the following packages. Be sure to install these along with this package!
- [`@sapphire/framework`](https://www.npmjs.com/package/@sapphire/framework)
- [`@sapphire/pieces v1.x`](https://www.npmjs.com/package/@sapphire/pieces/v/1.2.5)
- [`discord.js`](https://www.npmjs.com/package/discord.js)
- [`discord-api-types`](https://www.npmjs.com/package/discord-api-types)
You can use the following command to install this package, or replace `npm install` with your package manager of choice.
```sh
yarn add @sapphire/plugin-api
npm install @sapphire/plugin-api @sapphire/framework @sapphire/pieces@1 discord.js discord-api-types
```

@@ -40,4 +50,49 @@

T.B.D.
Start by importing the registration file in your project to use the plugin:
**JavaScript**
```js
require('@sapphire/plugin-api/register');
```
**TypeScript**
```ts
import '@sapphire/plugin-api/register';
```
Then, you can use the following configuration options in your SapphireClient extension class or initializer. This will either be located in your `new SapphireClient` constructor call, or `super` in your constructor method if you use an extension class.
```js
{
auth: {
// The application/client ID of your bot.
// You can find this at https://discord.com/developers/applications
id: '',
// The client secret of your bot.
// You can find this at https://discord.com/developers/applications
secret: '',
// The name of the authentication cookie.
cookie: 'SAPPHIRE_AUTH',
// The URL that users should be redirected to after a successful authentication
redirect: '',
// The scopes that should be given to the authentication.
scopes: ['identify'],
// Transformers to transform the raw data from Discord to a different structure.
transformers: []
},
// The prefix for all routes, e.g. / or v1/.
prefix: '',
// The origin header to be set on every request at 'Access-Control-Allow-Origin.
origin: '*',
// Any options passed to the NodeJS "net" internal server.listen function
// See https://nodejs.org/api/net.html#net_server_listen_options_callback
listenOptions: {
// The port the API will listen on.
port: 4000
}
}
```
## API Documentation

@@ -44,0 +99,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc