MineStoreCMS v3 API connector
npm install @batlify/minestore-api-connectorA TypeScript API client library for interacting with the Minestore webstore backend.
Provides classes to manage users, authentication, cart, products, payments, and more.
---
npm:
``bash`
npm i @batlify/minestore-api-connector
yarn:
`bash`
yarn add @batlify/minestore-api-connector
pnpm:
`bash`
pnpm add @batlify/minestore-api-connector
---
Logs in a user using classic username authentication.
Note: Authorization token is not required.---
$3
- init(username: string): Promise
Initializes Minecraft in-game authentication.
- check(username: string): Promise
Checks Minecraft in-game authentication status.
Note: Authorization token is not required.---
$3
- getUrl(): Promise<{url: string}>
Gets OAuth URL for Discord login.
Note: Authorization token is not required.---
$3
- getUser(token: string): Promise
Retrieves the currently logged-in user's data.
Note: Authorization token is required.---
$3
- check(): Promise
Checks website accessibility for user's IP/country.
Note: Authorization token is not required.---
$3
(Submodule for cart discounts, detailed functions as implemented)---
$3
- getCart(token: string): Promise
Gets the current cart data.
- isCartEmpty(token: string): Promise
Checks if the cart is empty.
- addPackage(token: string, id: string, promoted: boolean, payment_type: boolean): Promise
Adds a package to the cart.
- removePackage(token: string, id: string): Promise
Removes a package from the cart.
- quantityPackage(token: string, id: string, quantity: number): Promise
Updates package quantity in the cart.
- pricePackage(token: string, id: string, price: number): Promise
Updates package price in the cart.
- variablePackage(token: string, id: string, variable: number, value: string): Promise
Updates package variable in the cart.
- selectServerPackage(token: string, id: string, server: number): Promise
Selects a server for the package.
- getSelectableServers(token: string): Promise
Retrieves list of selectable servers.
- checkStatus(orderId: string): Promise
Checks payment status by order ID.
Note: Authorization token is not required.---
$3
- apply(code: string, token: string): Promise
Applies a referral code to the user's cart.
- remove(token: string): Promise
Removes the referral code from the cart.---
$3
- get(): Promise
Retrieves the list of product categories.
Note: Authorization token is not required.---
$3
- get(token: string, id: string): Promise
Gets product details by ID (authorized user).
- getFromCategory(token: string, path: string): Promise
Gets products by category path (authorized user).
- getFeatured(token: string): Promise
Gets featured/highlighted products.
Note: Authorization token is required.---
$3
- get(id: string): Promise
Gets product details by ID without authorization (guest access).---
$3
- get(): Promise
Retrieves site announcements.
Note: Authorization token is not required.---
$3
- get(path: string): Promise
Retrieves page content by URL path.
Note: Authorization token is not required.---
$3
- get(username: string): Promise
Retrieves user profile by username.
Note: Authorization token is not required.---
$3
- get(): Promise
Retrieves list of staff members.
Note: Authorization token is not required.---
$3
- get(): Promise
Retrieves webstore settings.
Note: Authorization token is not required.---
$3
- get(): Promise
Retrieves list of patrons/supporters.
Note: Authorization token is not required.---
$3
- getMethods(token: string): Promise
Gets available payment methods.
- create(token: string, data: any): Promise
Creates a payment with provided data.---
$3
Base class providing the generic request method for API calls with optional authorization and error handling.---
Usage Example
``tsconst auth = new AuthClassic();
const loginResponse = await auth.login('myusername');
if (loginResponse.status === 'success') {
const user = new User();
const userData = await user.getUser(loginResponse.token);
console.log(userData);
}