This repository has been archived by the owner on Jun 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
411 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Node.js Package | ||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [created] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Setup repo | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
# Setup .npmrc file to publish to npm && Install Node 16 | ||
- name: Install Node v16 | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 16 | ||
registry-url: https://registry.npmjs.org/ | ||
cache: npm | ||
|
||
# Checks the perviously released version of dev branch | ||
- name: Check previous released version | ||
id: pre-release | ||
run: | | ||
if [[ $(npm view tyblox.js@dev version | grep -e "$(jq --raw-output '.version' package.json).*.$(git rev-parse --short HEAD | cut -b1-3)") ]]; \ | ||
then echo '::set-output name=release::false'; \ | ||
else echo '::set-output name=release::true'; fi | ||
# Runs npm install | ||
- name: Install | ||
run: npm install | ||
|
||
# Deprecate old versions | ||
- name: Deprecate old versions | ||
if: steps.pre-release.outputs.release == 'true' | ||
run: npm deprecate tyblox.js@"~$(jq --raw-output '.version' package.json)" "This version of tyblox.js is no longer supported, please upgrade to a later version." || true | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
|
||
# Publishes Pkg to Dev Branch | ||
- name: Publish | ||
run: | | ||
npm version --git-tag-version=false $(jq --raw-output '.version' package.json).$(date +%s).$(git rev-parse --short HEAD) | ||
npm publish --tag dev || true | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
# tyblox | ||
# **tyblox.js** | ||
|
||
## **The most powerful ROBLOX API Wrapper** | ||
|
||
--- | ||
|
||
**tyblox.js** is the most powerful [Node.js](https://nodejs.org/) package which allows you to quickly, and easily interact with the Roblox API. | ||
|
||
- Object-Oriented | ||
- Performant | ||
- Typescript Capable | ||
|
||
## Installation | ||
|
||
**Node.js 16.6.0 or newer is required for this to work properly** | ||
|
||
**NPM 7.0.0 or newer is required to work properly.** | ||
|
||
```sh | ||
$ npm install tyblox.js | ||
``` | ||
|
||
--- | ||
|
||
## Getting started | ||
|
||
Below is an example to login and access many features of tyblox.js | ||
|
||
```js | ||
require("dotenv").config(); | ||
const { Client } = require("../src/index"); | ||
|
||
const client = new Client(); | ||
|
||
client.on("ready", () => { | ||
console.log("Ready!"); | ||
|
||
console.log("Logged in as " + client.user.username); | ||
}); | ||
|
||
client.login(process.env.example_cookie); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,32 @@ | ||
const Axios = require("axios"); | ||
const axios = Axios.default; | ||
const { RequestOptions } = require("../typings/index.d.ts"); | ||
const axios = require('axios').default; | ||
|
||
/** | ||
* Do a `GET` request to an API, usually roblox. | ||
* @param {RequestOptions} [options] The request options. | ||
* @param {import('../typings/index').RequestOptions} [options] The request options. | ||
* @returns {Promise} | ||
* @example | ||
* getUser.usingId('123456'); | ||
*/ | ||
exports.get = async (options) => { | ||
if (!options) throw new Error("OPTIONS REQUIRED") | ||
if (!options.baseUrl) throw new Error("BASE URL REQUIRED") | ||
|
||
let finalUrl = | ||
options.baseUrl + | ||
(options.inUrlParam1 || "") + | ||
(options.extendedUrl || "") + | ||
(options.inUrlParam2 || ""); | ||
|
||
let finalHeaders = {}; | ||
if (options.cookie) finalHeaders.Cookie = options.cookie; | ||
options.headers.forEach((header) => { | ||
if (options.cookie) finalHeaders.Cookie = `.ROBLOSECURITY=${options.cookie};`; | ||
if (options.headers) options.headers.forEach((header) => { | ||
finalHeaders[header.key] = header.value; | ||
}); | ||
|
||
axios.get(finalUrl, { | ||
return await axios.get(finalUrl, { | ||
withCredentials: true, | ||
headers: finalHeaders, | ||
}).then((res) => { | ||
return res.data; | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface v1_users_mobileapi_userinfo { | ||
UserID: string; | ||
UserName: string; | ||
RobuxBalance: number; | ||
ThumbnailUrl: string; | ||
IsAnyBuildersClub: boolean; | ||
IsPremium: boolean; | ||
} |