clients.ipapi #
ipapi
To get started
import incubaid.herolib.clients. ipapi
mut client:= ipapi.get()!
client...
example heroscript
!!ipapi.configure
secret: '...'
host: 'localhost'
port: 8888
Constants #
const version = '1.14.3'
fn delete #
fn delete(args ArgsGet) !
fn exists #
fn exists(args ArgsGet) !bool
does the config exists?
fn get #
fn get(args ArgsGet) !&IPApi
fn heroscript_default #
fn heroscript_default() !string
Todo: THIS IS EXAMPLE CODE AND NEEDS TO BE CHANGED IN LINE TO STRUCT BELOW, IS STRUCTURED AS HEROSCRIPT
fn heroscript_dumps #
fn heroscript_dumps(obj IPApi) !string
///////////NORMALLY NO NEED TO TOUCH
fn heroscript_loads #
fn heroscript_loads(heroscript string) !IPApi
fn list #
fn list(args ArgsList) ![]&IPApi
if fromdb set: load from filesystem, and not from mem, will also reset what is in mem
fn new #
fn new(args ArgsGet) !&IPApi
fn play #
fn play(mut plbook PlayBook) !
fn set #
fn set(o IPApi) !
register the config for the future
fn switch #
fn switch(name string)
switch instance to be used for ipapi
struct ArgsGet #
@[params]
struct ArgsGet {
pub mut:
name string = 'default'
fromdb bool // will load from filesystem
create bool // default will not create if not exist
}
///////FACTORY
struct ArgsList #
@[params]
struct ArgsList {
pub mut:
fromdb bool // will load from filesystem
}
struct IPApi #
@[heap]
struct IPApi {
pub mut:
name string = 'default'
conn ?&httpconnection.HTTPConnection @[str: skip]
}
THIS THE THE SOURCE OF THE INFORMATION OF THIS FILE, HERE WE HAVE THE CONFIG OBJECT CONFIGURED AND MODELLED
fn (IPApi) connection #
fn (mut client IPApi) connection() !&httpconnection.HTTPConnection
fn (IPApi) get_ip_info #
fn (mut a IPApi) get_ip_info(ip string) !IPInfo
struct IPInfo #
struct IPInfo {
pub:
query string
status string
country string
country_code string @[json: 'countryCode']
region string
region_name string @[json: 'regionName']
city string
zip string
lat f32
lon f32
timezone string
isp string
org string
as string
}