ArkScript
A small, fast, functional and scripting language for video games
|
Create a header map to use with the http client.
Parameters They work as pairs with:
name
: stringvalue
: stringReturn value UserType<httpHeaders>
Author
Example
Create an http client to query a server.
Parameters
Return value List
if the request succeeded: [status, body]
, otherwise nil
Author
Example
Get content from an online ressource.
Parameters
client
: UserType<httpClient>
route
: stringheaders
: UserType<httpHeaders>
, optional, always come lastReturn value List
if the request succeeded: [status, body]
, otherwise nil
Author
Example
Make a POST request with either a String as the request's body or httpParams
(request type would be application/x-www-form-urlencoded
).
Parameters
client
: UserType<httpClient>
route
: stringbodyOrParams
: string if given a request body, UserType<httpParams>
if given parametersmimetype
: string, optional (defaults to text/plain
)headers
: UserType<httpHeaders>
, optional, always come lastReturn value List
if the request succeeded: [status, body]
, otherwise nil
Author
Example
Make a PUT request with either a String as the request's body or httpParams
(request type would be application/x-www-form-urlencoded
).
Parameters
client
: UserType<httpClient>
route
: stringbody
: stringmimetype
: string, optional (defaults to text/plain
)headers
: UserType<httpHeaders>
, optional, always come lastReturn value List
if the request succeeded: [status, body]
, otherwise nil
Author
Works exactly like http:client:post
.
Make a DELETE request with a String as the request's body.
Parameters
client
: UserType<httpClient>
route
: stringbody
: stringmimetype
: string, optional (defaults to text/plain
)headers
: UserType<httpHeaders>
, optional, always come lastReturn value List
if the request succeeded: [status, body]
, otherwise nil
Author
Example
Used to create a parameter list for a POST/PUT/DELETE request (application/x-www-form-urlencoded
).
It works like http:headers:create
, you need to give an even number of Strings (key -> value mapping).
Return value UserType<Params>
Author
Example
Convert an httpParams
to an ArkScript readable list.
Parameters
httpParams
: UserType<Params>, can generated by the module with http:params:create
Return value List
Author
Choose if the request should follow the redirection or not.
Parameters
followLocation
: boolReturn value nil
Author
Example
Set the connection timeout.
Parameters
seconds
: numbermicroseconds
: number, for even more precision ; can be 0Return value nil
Author
Set the read timeout.
Parameters
seconds
: numbermicroseconds
: number, for even more precision ; can be 0Return value nil
Author
Set the write timeout.
Parameters
seconds
: numbermicroseconds
: number, for even more precision ; can be 0Return value nil
Author
Set the basic authentification username and password for a client to use.
Parameters
username
: stringpassword
: stringReturn value nil
Author
Set the basic bearer token authentification for a client to use.
Parameters
token
: stringReturn value nil
Author
Tell the server to keep the connection alive or not.
Parameters
keepAlive
: boolReturn value nil
Author
Set the parameters (host and port) of a proxy, to be used by a client.
Parameters
host
: string, address of the proxy, eg cache.edu.mit.org
port
: numberReturn value nil
Author
Set the basic proxy authentification username and password for a client to use.
Parameters
username
: stringpassword
: stringReturn value nil
Author
Set the basic proxy bearer token authentification for a client to use.
Parameters
token
: stringReturn value nil
Author