Documentation
¶
Index ¶
- Constants
- type Device
- type DevicesResponse
- type DevicesServiceInterface
- type Service
- type TimeOrNever
- type TimeOrStatus
- func (t TimeOrStatus) HasTime() bool
- func (t TimeOrStatus) IsNever() bool
- func (t TimeOrStatus) IsNotFinished() bool
- func (t TimeOrStatus) IsNotStarted() bool
- func (t TimeOrStatus) MarshalJSON() ([]byte, error)
- func (t TimeOrStatus) String() string
- func (t *TimeOrStatus) UnmarshalJSON(data []byte) error
Constants ¶
const ( EndpointDevicesJSON = "/devices.json" EndpointDevicesCSV = "/devices.csv" )
API endpoints for devices
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 ¶
ListDevicesCSV retrieves all devices in CSV format URL: GET https://console.workbrew.com/workspaces/{workspace_name}/devices.csv
type TimeOrNever ¶
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