parser

package
Version: v0.0.0-...-2cc726f Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GET - For getting a resource.
	GET instructionMethod = "GET"
	// SEND - For sending a message.
	SEND instructionMethod = "SEND"
)
View Source
const (
	// GUILDS - This signfies the instruction pertains to Guilds.
	GUILDS instructionResource = "GUILDS"
	// CHANNELS - This signfies the instruction pertains to Channels.
	CHANNELS instructionResource = "CHANNELS"
)

Variables

View Source
var ErrInvalidRequest = errors.New("Invalid Request")

ErrInvalidRequest - This error will be returned from Parse if the request is malformed.

Functions

This section is empty.

Types

type Instruction

type Instruction struct {
	Type instructionMethod

	Name instructionResource

	// ResourceID - If present, denotes a single resource.
	ResourceID string

	Arg string
}

Instruction - An unmarshalled instruction.

type InstructionParser

type InstructionParser interface {
	// Parse - Actual method which parses the request.
	Parse(r *http.Request) (*Instruction, error)
	// Pattern - Method which returns the format of the input.
	Pattern() string
}

InstructionParser - Which unmarshalls an instruction from a *http.Request.

func NewInstructionParser

func NewInstructionParser() InstructionParser

NewInstructionParser - Gets an instruction parser.

Jump to

Keyboard shortcuts

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