proto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package proto is used to parse the CDP protocol definitions (JSON).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyType

type AnyType struct {
	IDName       string    `json:"id,omitempty"`
	NameName     string    `json:"name,omitempty"`
	Type         string    `json:"type,omitempty"`
	Description  string    `json:"description,omitempty"`
	Ref          string    `json:"$ref,omitempty"`
	Properties   []AnyType `json:"properties,omitempty"`
	Enum         []Enum    `json:"enum,omitempty"`
	Items        *AnyType  `json:"items,omitempty"`
	MinItems     int       `json:"minItems,omitempty"`
	MaxItems     int       `json:"maxItems,omitempty"`
	Optional     bool      `json:"optional,omitempty"`
	Deprecated   bool      `json:"deprecated,omitempty"`
	Experimental bool      `json:"experimental,omitempty"`
}

AnyType is a catch-all struct for properties, parameters, etc.

func (AnyType) Desc

func (at AnyType) Desc(indent, startOffset int) string

Desc returns the cleaned description.

func (AnyType) ExportedName

func (at AnyType) ExportedName(d Domain) string

ExportedName returns an exported name.

func (AnyType) GetSuffix

func (at AnyType) GetSuffix(pkg string, d Domain) string

func (AnyType) GoType

func (at AnyType) GoType(pkg string, d Domain) string

GoType returns the Go representation for a protocol type.

func (AnyType) IsEnum

func (at AnyType) IsEnum() bool

IsEnum returns true if type is an enum.

func (AnyType) IsLocalEnum

func (at AnyType) IsLocalEnum() bool

IsLocalEnum returns true if type is enumerated without an exported type.

func (AnyType) Name

func (at AnyType) Name(d Domain) string

Name returns a Go-ified name for the AnyType.

func (AnyType) Recvr

func (at AnyType) Recvr(d Domain) string

Recvr returns the receiver for the type.

type Command

type Command struct {
	NameName     string    `json:"name,omitempty"`
	Description  string    `json:"description,omitempty"`
	Parameters   []AnyType `json:"parameters,omitempty"`
	Returns      []AnyType `json:"returns,omitempty"`
	Optional     bool      `json:"optional,omitempty"`
	Experimental bool      `json:"experimental,omitempty"`
	Redirect     string    `json:"redirect,omitempty"`
	Handlers     []string  `json:"handlers,omitempty"`
	Deprecated   bool      `json:"deprecated,omitempty"`
}

Command represents a command belonging to a domain, e.g. Network.setCookie.

func (Command) ArgsName

func (c Command) ArgsName(d Domain) string

ArgsName returns the name of command arguments.

func (Command) CmdName

func (c Command) CmdName(d Domain, export bool) string

CmdName returns the full name of a command.

func (Command) Desc

func (c Command) Desc(lineEndComment bool, indent, startOffset int) string

Desc returns a cleaned description.

func (Command) Name

func (c Command) Name() string

Name rturns the linted command name.

func (Command) ReplyName

func (c Command) ReplyName(d Domain) string

ReplyName returns the name of the command reply.

type Domain

type Domain struct {
	Domain       string    `json:"domain,omitempty"`
	Experimental bool      `json:"experimental,omitempty"`
	Description  string    `json:"description,omitempty"`
	Dependencies []string  `json:"dependencies,omitempty"`
	Types        []AnyType `json:"types,omitempty"`
	Commands     []Command `json:"commands,omitempty"`
	Events       []Event   `json:"events,omitempty"`
	Deprecated   bool      `json:"deprecated,omitempty"`
}

Domain represents a domain, e.g. Page, Network, etc.

func (Domain) Desc

func (d Domain) Desc(indent, startOffset int) string

Desc returns the domain decription.

func (Domain) Name

func (d Domain) Name() string

Name returns the domain name.

func (Domain) Type

func (d Domain) Type() string

Type returns the domain type.

type Enum

type Enum string

Enum represents an enumerable value.

func (Enum) Name

func (e Enum) Name() string

Name returns the Go-ified name for the enum.

type Event

type Event struct {
	NameName     string    `json:"name,omitempty"`
	Description  string    `json:"description,omitempty"`
	Parameters   []AnyType `json:"parameters,omitempty"`
	Experimental bool      `json:"experimental,omitempty"`
	Deprecated   bool      `json:"deprecated,omitempty"`
}

Event represents an subscribeable event.

func (Event) Desc

func (e Event) Desc(lineEndComment bool, indent, startOffset int) string

Desc returns the cleaned description.

func (Event) EventName

func (e Event) EventName(d Domain) string

EventName returns the name of the event as a go type.

func (Event) Name

func (e Event) Name() string

Name returns the name of the event.

func (Event) ReplyName

func (e Event) ReplyName(d Domain) string

ReplyName returns the name of the event reply struct.

type Protocol

type Protocol struct {
	Version Version  `json:"version,omitempty"`
	Domains []Domain `json:"domains,omitempty"`
}

Protocol represents the JSON protocol structure.

type Version

type Version struct {
	Major string `json:"major,omitempty"`
	Minor string `json:"minor,omitempty"`
}

Version contains protocol version information.

Jump to

Keyboard shortcuts

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