botdoc

package
v0.0.0-...-aa11ac5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package botdoc implement types definition extraction from documentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexOneOf

func IndexOneOf(s string, subs ...string) (idx int, variant string)

IndexOneOf is like strings.Index, but for multiple substrings.

It returns index like strings.Index and found substring.

Types

type API

type API struct {
	Version string
	Types   []Definition
	Methods []Definition
}

API definition.

func Extract

func Extract(doc *goquery.Document) (a API)

Extract API definition from goquery document.

func (API) OAS

func (a API) OAS() (*ogen.Spec, error)

OAS generates OpenAPI v3 Specification from API definition.

type Definition

type Definition struct {
	Name              string
	RawText           string
	PrettyDescription string
	Fields            []Field
	Ret               *Type
}

Definition of structure (method or object).

type Field

type Field struct {
	Type              Type
	Name              string
	RawText           string
	PrettyDescription string
	Enum              []string
	Optional          bool
}

Field of object or argument of function.

type Kind

type Kind string

Kind of Type.

const (
	KindPrimitive Kind = "primitive"
	KindArray     Kind = "array"
	KindObject    Kind = "object"
	KindSum       Kind = "sum"
)

Possible types.

type Primitive

type Primitive string

Primitive type.

const (
	String  Primitive = "String"
	Integer Primitive = "Integer"
	Float   Primitive = "Float"
	Boolean Primitive = "Boolean"
)

Possible primitives.

func (Primitive) String

func (p Primitive) String() string

type Type

type Type struct {
	Name      string
	Kind      Kind
	Primitive Primitive
	Item      *Type
	Sum       []Type
}

Type of field or parameter.

func ParseType

func ParseType(s string) Type

ParseType parses telegram documentation Type from string

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL