brewfiles

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EndpointBrewfilesJSON is the endpoint for brewfiles in JSON format
	EndpointBrewfilesJSON = "/brewfiles.json"

	// EndpointBrewfilesCSV is the endpoint for brewfiles in CSV format
	EndpointBrewfilesCSV = "/brewfiles.csv"

	// EndpointBrewfileLabelFormat is the format string for a specific brewfile by label
	EndpointBrewfileLabelFormat = "/brewfiles/%s.json"

	// EndpointBrewfileRunsJSONFormat is the format string for brewfile runs in JSON
	EndpointBrewfileRunsJSONFormat = "/brewfiles/%s/runs.json"

	// EndpointBrewfileRunsCSVFormat is the format string for brewfile runs in CSV
	EndpointBrewfileRunsCSVFormat = "/brewfiles/%s/runs.csv"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Brewfile

type Brewfile struct {
	Label             string           `json:"label,omitempty"`
	Slug              string           `json:"slug,omitempty"`
	Content           string           `json:"content,omitempty"`
	LastUpdatedByUser string           `json:"last_updated_by_user"`
	StartedAt         string           `json:"started_at"`
	FinishedAt        string           `json:"finished_at"`
	Devices           []BrewfileDevice `json:"devices"`
	RunCount          int              `json:"run_count"`
}

Brewfile represents a single brewfile entry

type BrewfileDevice

type BrewfileDevice struct {
	SerialNumber string `json:"serial_number,omitempty"`
}

BrewfileDevice represents a device associated with a brewfile

type BrewfileMessageResponse

type BrewfileMessageResponse struct {
	Message string `json:"message"`
}

BrewfileMessageResponse represents a simple message response

type BrewfileRun

type BrewfileRun struct {
	Label      string `json:"label"`
	Device     string `json:"device"`
	CreatedAt  string `json:"created_at"`
	UpdatedAt  string `json:"updated_at"`
	Success    bool   `json:"success"`
	Output     string `json:"output"`
	StartedAt  string `json:"started_at"`
	FinishedAt string `json:"finished_at"`
}

BrewfileRun represents a single brewfile run Matches the actual API response schema

type BrewfileRunsResponse

type BrewfileRunsResponse []BrewfileRun

BrewfileRunsResponse is the response from GET /brewfiles/{label}/runs.json

type BrewfilesResponse

type BrewfilesResponse []Brewfile

BrewfilesResponse is the response from GET /brewfiles.json

type BrewfilesServiceInterface

type BrewfilesServiceInterface interface {
	// ListBrewfiles returns a list of brewfiles with their status and device assignments
	//
	// Returns brewfiles with last updated user, start/finish timestamps, assigned devices, and run count
	ListBrewfiles(ctx context.Context) (*BrewfilesResponse, *interfaces.Response, error)

	// ListBrewfilesCSV returns a list of brewfiles in CSV format
	//
	// Returns the same brewfiles data as ListBrewfiles but formatted as CSV
	ListBrewfilesCSV(ctx context.Context) ([]byte, *interfaces.Response, error)

	// CreateBrewfile creates a new brewfile with specified label, content, and device/group assignment
	//
	// Requires label and content fields. Can assign to specific devices via device_serial_numbers or to a device group via device_group_id
	CreateBrewfile(ctx context.Context, request *CreateBrewfileRequest) (*BrewfileMessageResponse, *interfaces.Response, error)

	// UpdateBrewfile updates an existing brewfile's content and device assignments
	//
	// Updates the brewfile identified by label. Can update content, device_serial_numbers, or device_group_id
	UpdateBrewfile(ctx context.Context, label string, request *UpdateBrewfileRequest) (*BrewfileMessageResponse, *interfaces.Response, error)

	// DeleteBrewfile deletes a brewfile by its label
	//
	// Permanently removes the brewfile identified by the specified label
	DeleteBrewfile(ctx context.Context, label string) (*BrewfileMessageResponse, *interfaces.Response, error)

	// ListBrewfileRuns returns a list of brewfile runs for a specific brewfile
	//
	// Returns run history including label, device, timestamps, success status, and output for the specified brewfile label
	ListBrewfileRuns(ctx context.Context, label string) (*BrewfileRunsResponse, *interfaces.Response, error)

	// ListBrewfileRunsCSV returns a list of brewfile runs in CSV format
	//
	// Returns the same run data as ListBrewfileRuns but formatted as CSV
	ListBrewfileRunsCSV(ctx context.Context, label string) ([]byte, *interfaces.Response, error)
}

BrewfilesServiceInterface defines the interface for brewfiles operations

Workbrew API docs: https://console.workbrew.com/documentation/api

type CreateBrewfileRequest

type CreateBrewfileRequest struct {
	Label               string  `json:"label"`
	Content             string  `json:"content"`
	DeviceSerialNumbers *string `json:"device_serial_numbers,omitempty"`
	DeviceGroupID       *string `json:"device_group_id,omitempty"`
}

CreateBrewfileRequest represents the request body for creating a brewfile

type Service

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

Service handles communication with the brewfiles related methods of the Workbrew API.

Workbrew API docs: https://console.workbrew.com/documentation/api

func NewService

func NewService(client interfaces.HTTPClient) *Service

NewService creates a new brewfiles service

func (*Service) CreateBrewfile

CreateBrewfile creates a new brewfile URL: POST https://console.workbrew.com/workspaces/{workspace_name}/brewfiles.json

func (*Service) DeleteBrewfile

func (s *Service) DeleteBrewfile(ctx context.Context, label string) (*BrewfileMessageResponse, *interfaces.Response, error)

DeleteBrewfile deletes a brewfile URL: DELETE https://console.workbrew.com/workspaces/{workspace_name}/brewfiles/{label}.json

Response codes:

  • 200: Brewfile deleted successfully

func (*Service) ListBrewfileRuns

func (s *Service) ListBrewfileRuns(ctx context.Context, label string) (*BrewfileRunsResponse, *interfaces.Response, error)

ListBrewfileRuns retrieves all runs for a specific brewfile in JSON format URL: GET https://console.workbrew.com/workspaces/{workspace_name}/brewfiles/{label}/runs.json

func (*Service) ListBrewfileRunsCSV

func (s *Service) ListBrewfileRunsCSV(ctx context.Context, label string) ([]byte, *interfaces.Response, error)

ListBrewfileRunsCSV retrieves all runs for a specific brewfile in CSV format URL: GET https://console.workbrew.com/workspaces/{workspace_name}/brewfiles/{label}/runs.csv

func (*Service) ListBrewfiles

func (s *Service) ListBrewfiles(ctx context.Context) (*BrewfilesResponse, *interfaces.Response, error)

ListBrewfiles retrieves all brewfiles in JSON format URL: GET https://console.workbrew.com/workspaces/{workspace_name}/brewfiles.json

func (*Service) ListBrewfilesCSV

func (s *Service) ListBrewfilesCSV(ctx context.Context) ([]byte, *interfaces.Response, error)

ListBrewfilesCSV retrieves all brewfiles in CSV format URL: GET https://console.workbrew.com/workspaces/{workspace_name}/brewfiles.csv

func (*Service) UpdateBrewfile

func (s *Service) UpdateBrewfile(ctx context.Context, label string, request *UpdateBrewfileRequest) (*BrewfileMessageResponse, *interfaces.Response, error)

UpdateBrewfile updates an existing brewfile URL: PUT https://console.workbrew.com/workspaces/{workspace_name}/brewfiles/{label}.json

Response codes:

  • 200: Brewfile updated successfully
  • 422: Validation error

type UpdateBrewfileRequest

type UpdateBrewfileRequest struct {
	Content             string  `json:"content"`
	DeviceSerialNumbers *string `json:"device_serial_numbers,omitempty"`
	DeviceGroupID       *string `json:"device_group_id,omitempty"`
}

UpdateBrewfileRequest represents the request body for updating a brewfile

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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