Skip to content

clients.ipapi #

ipapi

To get started



import freeflowuniverse.herolib.clients. ipapi

mut client:= ipapi.get()!

client...

example heroscript

!!ipapi.configure
    secret: '...'
    host: 'localhost'
    port: 8888

Constants #

const version = '1.14.3'

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 play #

fn play(args_ PlayArgs) !

fn switch #

fn switch(name string)

switch instance to be used for ipapi

struct ArgsGet #

@[params]
struct ArgsGet {
pub mut:
	name string
}

///////FACTORY

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
}

struct PlayArgs #

@[params]
struct PlayArgs {
pub mut:
	heroscript string // if filled in then plbook will be made out of it
	plbook     ?playbook.PlayBook
	reset      bool
}