Skip to content

hero.typescriptgenerator #

fn from_openrpc #

fn from_openrpc(openrpc_spec openrpc.OpenRPC, config IntermediateConfig) !IntermediateSpec

fn generate_typescript_client #

fn generate_typescript_client(spec IntermediateSpec, dest_path string) !

struct IntermediateConfig #

struct IntermediateConfig {
pub mut:
	base_url     string = 'http://localhost:8080'
	handler_type string = 'heromodels'
}

IntermediateConfig holds configuration for documentation generation

struct IntermediateMethod #

struct IntermediateMethod {
pub mut:
	name         string
	summary      string
	description  string
	params       []IntermediateParam
	result       IntermediateParam
	endpoint_url string
}

IntermediateMethod holds the information for a single method to be displayed.

struct IntermediateParam #

struct IntermediateParam {
pub mut:
	name        string
	description string
	type_info   string
	required    bool
}

IntermediateParam represents a parameter or result in the documentation

struct IntermediateProperty #

struct IntermediateProperty {
pub mut:
	name        string
	description string
	type_info   string
	required    bool
}

IntermediateProperty represents a property of a schema

struct IntermediateSchema #

struct IntermediateSchema {
pub mut:
	name        string
	description string
	properties  []IntermediateProperty
}

IntermediateSchema represents a schema in a format that's easy to consume for generation.

struct IntermediateSpec #

struct IntermediateSpec {
pub mut:
	info     openrpc.Info
	methods  []IntermediateMethod
	schemas  map[string]IntermediateSchema
	base_url string
}

IntermediateSpec is the main object passed to the typescript generator.