README MD still need work
Command (args) (shortcut)
/TwixGet <User> (twg)
/TwixPost <message> (twp)
/TwixVerify (twv)
Check out Prebuilt API for common usage
The main way to use this plugin is to interact with TwixBuilder, tokens URL method are mandatory, most of them are self explanatory
Or
There's a few special ones like setID() and then()
DISCLAIMER: This has nothing to do with promises, and DOES NOT function like promises
Then() is a special function invoked AFTER your request(will be done in async) has been executed (this will be done in main thread) (this is not mandatory)
Your function is expected to be $function = function(TwixResult $result) {}
only one and no more
DO NOT PASS callable like [$this,'callback'] since it's done in async PHP wont like it, your function is expected to type hint "TwixResult" which will provide a few useful things for you,
You can see TwixResult will provide server, respond and HTTP respond, if you dont fancy working in functions, you can callback to your plugin but there's no diffrences in doing that
You should also not do $function = function(TwixResult $result)use($something) {}
or anything similars, even tho most are accounted for.. some may not be expected
By default errors will be silenced automatically, and returns null on response/http
setId() is basically a handy way for you to pass values around without creating too much mess, this value will be available in then(), useful for identification purpose or just telling whoever send that, that their request succeeded
Please note that DO NOT try to put something non serializable into it(example Server/Player) you should try to re-obtain that instance somehow(ex storing the name and get player by name using the Server provided by TwixResult)
This is called when error are thrown in onCompletion task
Your function is expected to be $function = function(CompletionError $result) {}
You can see CompletionError for more info
By default errors will be silenced automatically
This is called when error are thrown in onCompletion task
Your function is expected to be $function = function(FetchError $result) {}
By default errors will be silenced automatically, and returns null on response/http
This throws a MissingValueException if a mandatory value is not given, returns TwixFetcher if everything is fulfilled, please note that YOU are responsible to schedule the async task