Skip to content

MercerK/graal-minecraft-fetch-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FetchClient

This is a simple library implementation for Grakkit (or other GraalVM implementations within Minecraft) providing fetch functionality.

Grakkit - How to use

  • Add library file to your grakkit folder, such as ./plugins/grakkit
  • Add the following:
// Loads the jar
const FetchClient = core.load('./plugins/grakkit/fetchClient.jar', 'fetch.FetchClient') 

const client = new FetchClient()

// Adds the plugin; needed to fix async issues
client.setPlugin(core.plugin)
  • Once declared, you can start using it.
// Example
console.log((await client.fetch('https://api.publicapis.org/entries', 'GET', '', [])).body())

There are a total of four parameters (all required).

  • URL: This is the target URL.
  • Method: This is 'GET', 'POST', etc.
  • Payload: This is the string payload. For empty, you can do ''.
  • Headers: This accepts headers in an flat array.
    • Example: ['Content-Type', 'application/json; charset=utf-8']

Build it yourself

  • Clone repo locally.
  • Run ./gradlew shadowJar

Resources

  • Discord
  • Grakkit
  • CraftJS: These guys deserve a huge shoutout! They are the originating authors of the fetch functionality.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages