Socket
Socket
Sign inDemoInstall

leoapi.xyz

Package Overview
Dependencies
65
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.2.2

2

package.json
{
"name": "leoapi.xyz",
"version": "1.2.1",
"version": "1.2.2",
"description": "Use the Leo API with ease",

@@ -5,0 +5,0 @@ "homepage": "https://leoapi.xyz",

@@ -52,20 +52,2 @@ # Leo API Wrapper

})
```
# Create Code Bins
To create code bins you must have a token, you can get one by going to our [discord server](https://leoapi.xyz/discord)
```js
const API = require('leoapi.xyz')
const leo = new API()
leo.code({
title: 'leo api',
description: 'https://leoapi.xyz/discord',
code: 'console.log("Leo API is the best")',
token: 'your-token'
}).then(data => {
console.log(data)
})
```

@@ -28,8 +28,4 @@ const fetch = require('node-fetch');

const res = await fetch(`https://api.leoapi.xyz/data/${endpoint}?${qParams}`)
const res = await fetch(`https://api.leoapi.xyz/data/${endpoint}?${qParams}`).then(res => res.json());
const json = await res.json();
if(json.error) throw new Error(json.error)
return json
return res

@@ -44,7 +40,5 @@

const res = await fetch(`https://api.leoapi.xyz/text/${endpoint}?${qParams}`)
const res = await fetch(`https://api.leoapi.xyz/text/${endpoint}?${qParams}`).then(res => res.json());
const json = await res.json();
if(json.error) throw new Error(json.error)
return json
return res

@@ -58,7 +52,5 @@ }

const res = await fetch(`https://api.leoapi.xyz/fun/${endpoint}?${qParams}`)
const res = await fetch(`https://api.leoapi.xyz/fun/${endpoint}?${qParams}`).then(res => res.json());
const json = await res.json();
if(json.error) throw new Error(json.error)
return json
return res

@@ -68,14 +60,13 @@ }

async code({ title, description, code, token}) {
if(!token) throw new Error('[leoapi] | Please provide a token, to get one go to https://leoapi.xyz/discord');
if(!code) throw new Error("[leoapi] | Please provide a code to create a bin with");
const res = await fetch(`https://code.leoapi.xyz/api/create?code=${code}&title=${title ? title : 'code.leoapi.xyz'}&description=${description ? description : "Share your code with ease"}`, {
method: "POST",
headers: {'Content-Type': 'application/json','Authorization': `Bearer ${token}`}
})
const json = await res.json()
if(json.error) throw new Error(json.error)
return json.url;
}
if(!token) throw new Error('[leoapi] | Please provide a token, to get one go to https://leoapi.xyz/discord');
if(!code) throw new Error("[leoapi] | Please provide a code to create a bin with");
const res = await fetch(`https://code.leoapi.xyz/api/create?code=${code}&title=${title ? title : 'code.leoapi.xyz'}&description=${description ? description : "Share your code with ease"}`, {
method: "POST",
headers: {'Content-Type': 'application/json','Authorization': `Bearer ${token}`}
})
const json = await res.json()
if(json.error) throw new Error(json.error)
return json.url;
}
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc