octoprint

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Octoprinter

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

A representation of a octoprint server

func NewOctoprinter

func NewOctoprinter(ctx context.Context, hostname string, apiKey string) (*Octoprinter, error)

func (*Octoprinter) GetPrinter

func (m *Octoprinter) GetPrinter() (*PrinterState, error)

func (*Octoprinter) GetPrinterProfiles

func (m *Octoprinter) GetPrinterProfiles() (*PrinterProfileList, error)

func (*Octoprinter) PrintFile

func (m *Octoprinter) PrintFile(file *os.File, context context.Context) error

func (*Octoprinter) SendFile

func (m *Octoprinter) SendFile(file *os.File, context context.Context) error

type PrinterProfile

type PrinterProfile struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	Color    string `json:"color"`
	Model    string `json:"model"`
	Default  bool   `json:"default"`
	Current  bool   `json:"current"`
	Resource string `json:"resource"` //url
	Volume   struct {
		FormFactor string `json:"formFactor"` // "rectangular"
		Origin     string `json:"origin"`     // "lowerleft"
		Width      int    `json:"width"`
		Depth      int    `json:"depth"`
		Height     int    `json:"height"`
	} `json:"volume"`
	HeatedBed     bool `json:"heatedBed"`
	HeatedChamber bool `json:"heatedChamber"`
	Axes          struct {
		X struct {
			Speed    int  `json:"speed"`
			Inverted bool `json:"inverted"`
		} `json:"x"`
		Y struct {
			Speed    int  `json:"speed"`
			Inverted bool `json:"inverted"`
		} `json:"y"`
		Z struct {
			Speed    int  `json:"speed"`
			Inverted bool `json:"inverted"`
		} `json:"z"`
		E struct {
			Speed    int  `json:"speed"`
			Inverted bool `json:"inverted"`
		} `json:"e"`
	} `json:"axes"`
	Extruder struct {
		Count   int `json:"count"`
		Offsets []struct {
			X float32 `json:"x"`
			Y float32 `json:"y"`
		} `json:"offsets"`
	} `json:"extruder"`
}

type PrinterProfileList

type PrinterProfileList struct {
	Profiles map[string]PrinterProfile `json:"profiles"`
}

type PrinterState

type PrinterState struct {
	Temperature struct {
		Tool0 struct {
			Actual float32 `json:"actual"`
			Target float32 `json:"target"`
			Offset int     `json:"offset"`
		} `json:"tool0"`

		Tool1 struct {
			Actual float32 `json:"actual"`
			Target float32 `json:"target"`
			Offset int     `json:"offset"`
		} `json:"tool1"`

		Bed struct {
			Actual float32 `json:"actual"`
			Target float32 `json:"target"`
			Offset int     `json:"offset"`
		} `json:"bed"`

		History []struct {
			Time  int `json:"time"`
			Tool0 struct {
				Actual float32 `json:"actual"`
				Target float32 `json:"target"`
				Offset int     `json:"offset"`
			} `json:"tool0"`

			Tool1 struct {
				Actual float32 `json:"actual"`
				Target float32 `json:"target"`
				Offset int     `json:"offset"`
			} `json:"tool1"`

			Bed struct {
				Actual float32 `json:"actual"`
				Target float32 `json:"target"`
				Offset int     `json:"offset"`
			} `json:"bed"`
		}
	} `json:"temperature"`

	Sd struct {
		Ready bool `json:"ready"`
	} `json:"sd"`

	State struct {
		Text  string `json:"text"`
		Flags struct {
			Operational   bool `json:"operational"`
			Paused        bool `json:"paused"`
			Printing      bool `json:"printing"`
			Cancelling    bool `json:"cancelling"`
			Pausing       bool `json:"pausing"`
			SdReady       bool `json:"sdReady"`
			Error         bool `json:"error"`
			Ready         bool `json:"ready"`
			ClosedOrError bool `json:"closedOrError"`
		} `json:"flags"`
	} `json:"state"`
}

response from /api/printer

Jump to

Keyboard shortcuts

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