devices

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 (
	EndpointDevicesJSON = "/devices.json"
	EndpointDevicesCSV  = "/devices.csv"
)

API endpoints for devices

View Source
const (
	FieldSerialNumber        = "serial_number"
	FieldGroups              = "groups"
	FieldMDMUserOrDeviceName = "mdm_user_or_device_name"
	FieldLastSeenAt          = "last_seen_at"
	FieldCommandLastRunAt    = "command_last_run_at"
	FieldDeviceType          = "device_type"
	FieldOSVersion           = "os_version"
	FieldHomebrewPrefix      = "homebrew_prefix"
	FieldHomebrewVersion     = "homebrew_version"
	FieldWorkbrewVersion     = "workbrew_version"
	FieldFormulaeCount       = "formulae_count"
	FieldCasksCount          = "casks_count"
)

Field names for devices (from swagger spec)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	SerialNumber        string      `json:"serial_number"`
	Groups              []string    `json:"groups"`
	MDMUserOrDeviceName *string     `json:"mdm_user_or_device_name"` // nullable
	LastSeenAt          TimeOrNever `json:"last_seen_at"`            // date-time or "Never"
	CommandLastRunAt    TimeOrNever `json:"command_last_run_at"`     // date-time or "Never"
	DeviceType          string      `json:"device_type"`
	OSVersion           string      `json:"os_version"`
	HomebrewPrefix      string      `json:"homebrew_prefix"`
	HomebrewVersion     string      `json:"homebrew_version"`
	WorkbrewVersion     string      `json:"workbrew_version"`
	FormulaeCount       int         `json:"formulae_count"`
	CasksCount          int         `json:"casks_count"`
}

Device represents a device in the workspace Matches the schema from swagger specification

type DevicesResponse

type DevicesResponse []Device

DevicesResponse represents the response from the devices.json endpoint

type DevicesServiceInterface

type DevicesServiceInterface interface {
	// ListDevices returns a list of devices
	//
	// Returns devices with serial numbers, group assignments, MDM names, last seen timestamps, device types,
	// OS versions, Homebrew/Workbrew versions, and installed package counts.
	ListDevices(ctx context.Context) (*DevicesResponse, *interfaces.Response, error)

	// ListDevicesCSV returns a list of devices in CSV format
	//
	// Returns device data as CSV with columns: serial_number, groups, mdm_user_or_device_name, last_seen_at,
	// command_last_run_at, device_type, os_version, homebrew_prefix, homebrew_version, workbrew_version, formulae_count, casks_count.
	ListDevicesCSV(ctx context.Context) ([]byte, *interfaces.Response, error)
}

DevicesServiceInterface defines the interface for devices operations

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

type Service

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

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

func NewService

func NewService(client interfaces.HTTPClient) *Service

NewService creates a new devices service

func (*Service) ListDevices

func (s *Service) ListDevices(ctx context.Context) (*DevicesResponse, *interfaces.Response, error)

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

func (*Service) ListDevicesCSV

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

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

type TimeOrNever

type TimeOrNever struct {
	Time  *time.Time
	Never bool
}

TimeOrNever handles the "oneOf" type from swagger: date-time or "Never"

func (TimeOrNever) MarshalJSON

func (t TimeOrNever) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshaling for TimeOrNever

func (TimeOrNever) String

func (t TimeOrNever) String() string

String returns a string representation of TimeOrNever

func (*TimeOrNever) UnmarshalJSON

func (t *TimeOrNever) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshaling for TimeOrNever

type TimeOrStatus

type TimeOrStatus struct {
	Time   *time.Time
	Status string // "Never", "Not Started", "Not Finished", or empty if Time is set
}

TimeOrStatus handles the "oneOf" type from swagger: date-time or status strings Supports: "Never", "Not Started", "Not Finished", and RFC3339 date-time

func (TimeOrStatus) HasTime

func (t TimeOrStatus) HasTime() bool

HasTime returns true if a valid time is set

func (TimeOrStatus) IsNever

func (t TimeOrStatus) IsNever() bool

IsNever returns true if the status is "Never"

func (TimeOrStatus) IsNotFinished

func (t TimeOrStatus) IsNotFinished() bool

IsNotFinished returns true if the status is "Not Finished"

func (TimeOrStatus) IsNotStarted

func (t TimeOrStatus) IsNotStarted() bool

IsNotStarted returns true if the status is "Not Started"

func (TimeOrStatus) MarshalJSON

func (t TimeOrStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshaling for TimeOrStatus

func (TimeOrStatus) String

func (t TimeOrStatus) String() string

String returns a string representation of TimeOrStatus

func (*TimeOrStatus) UnmarshalJSON

func (t *TimeOrStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshaling for TimeOrStatus

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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