api

package
v0.0.0-...-13f32b5 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ShapeEndpoint is the endpoint for getting information about the shapes of metal
	ShapeEndpoint = "/configrator_ajax.php/shape"
	// PriceEndpoint is the endpoint for determining the price of a piece of metal
	PriceEndpoint = "/configrator_ajax_result.php/shape"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API for MetalByTheFoot website

func NewAPI

func NewAPI() *API

NewAPI creates a new API instance

func (*API) GetDocument

func (api *API) GetDocument(endpoint string, parameters map[string]string) (*Document, error)

GetDocument retrieves a document from the server

type Document

type Document struct {
	API        *API
	Endpoint   string
	Parameters map[string]string
	Response   *html.Node
}

Document represents one document response from the server

func (*Document) GetNextShapeOptionsName

func (doc *Document) GetNextShapeOptionsName() string

GetNextShapeOptionsName gets the name of the next option available for a shape

func (*Document) GetPrice

func (doc *Document) GetPrice() float64

GetPrice gets the price information from the document

func (*Document) GetShapeOptions

func (doc *Document) GetShapeOptions(name string) []string

GetShapeOptions gets a list of all options available for a shape

func (*Document) GetShapeOptionsNames

func (doc *Document) GetShapeOptionsNames() []string

GetShapeOptionsNames gets the names of all the options available for a shape

func (*Document) GetShapeTextFieldNames

func (doc *Document) GetShapeTextFieldNames() []string

GetShapeTextFieldNames gets the names of all the text fields available for a shape

func (*Document) Mutate

func (doc *Document) Mutate(endpoint string, parameters map[string]string) (*Document, error)

Mutate changes a set of parameters about the document and gets a new document from the server

Jump to

Keyboard shortcuts

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