A simple Node.js library to interact with the Infinite Craft API.
You can install the library via npm from GitHub:
npm install git+https://github.com/ActiveTutorial/ic-proxy.git
Alternatively, if you're using TypeScript, ensure you also install the necessary types for TypeScript users:
npm install git+https://github.com/ActiveTutorial/ic-proxy.git
For JavaScript (ES modules) users:
import InfiniteCraftProxy from 'ic-proxy';
(async () => {
// Create and initialize the instance using the static create() method.
const api = await InfiniteCraftProxy.create();
try {
const pairResult = await api.pair('Water', 'Fire');
console.log('Pair Result:', pairResult);
const checkResult = await api.check('Fire', 'Water', 'Steam');
console.log('Check Result:', checkResult);
} catch (error) {
console.error('Error:', error);
} finally {
await api.close();
}
})();
For TypeScript users, simply import and use the API as follows:
import InfiniteCraftProxy from 'ic-proxy';
(async () => {
// Create and initialize the instance using the static create() method.
const api = await InfiniteCraftProxy.create();
try {
const pairResult = await api.pair('Water', 'Fire');
console.log('Pair Result:', pairResult);
const checkResult = await api.check('Fire', 'Water', 'Steam');
console.log('Check Result:', checkResult);
} catch (error) {
console.error('Error:', error);
} finally {
await api.close();
}
})();
Creates and initializes an instance of InfiniteCraftProxy
.
Note: Direct instantiation with new InfiniteCraftProxy()
will throw an error.
Returns: A promise that resolves to a fully initialized instance.
- Description: Retrieves a pair result from the Infinite Craft API.
- Parameters:
first
(string): The first item.second
(string): The second item.
- Returns: A promise that resolves to the pair result from the API, containing an object with
result
,emoji
, andisNew
properties.
- Description: Validates a result from the Infinite Craft API for a given pair of items.
- Parameters:
first
(string): The first item.second
(string): The second item.result
(string): The expected result.
- Returns: A promise that resolves to the check result from the API, containing an object with
valid
andemoji
properties.
- Description: Closes the Puppeteer browser instance.
- Returns: A promise that resolves once the browser is closed.
This project is licensed under the MIT License. See the LICENSE file for details.