api

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SuspendedBillingAccountResponse = ErrorResponse{
	Code:   http.StatusForbidden,
	Status: "Forbidden",
	Error:  "this billing account is suspended",
}

Functions

This section is empty.

Types

type ContactResponse

type ContactResponse struct {
	Name         string `json:"name"`
	Email        string `json:"email"`
	Role         string `json:"role"`
	Organization string `json:"organization"`
}

ContactResponse v1

The response object for an app contact.

type DFUEnv added in v1.5.1

type DFUEnv struct {
	Card *DFUState `json:"card,omitempty"`
	User *DFUState `json:"user,omitempty"`
}

DFUEnv is the data structure passed to Notehub when DFU info changes

type DFUState added in v1.5.1

type DFUState struct {
	Type               string `json:"type,omitempty"`
	File               string `json:"file,omitempty"`
	Length             uint32 `json:"length,omitempty"`
	CRC32              uint32 `json:"crc32,omitempty"`
	MD5                string `json:"md5,omitempty"`
	Phase              string `json:"mode,omitempty"`
	Status             string `json:"status,omitempty"`
	BeganSecs          uint32 `json:"began,omitempty"`
	RetryCount         uint32 `json:"retry,omitempty"`
	ConsecutiveErrors  uint32 `json:"errors,omitempty"`
	ReadFromService    uint32 `json:"read,omitempty"`
	UpdatedSecs        uint32 `json:"updated,omitempty"`
	DownloadComplete   bool   `json:"dl_complete,omitempty"`
	DisabledReason     string `json:"disabled,omitempty"`
	MinNotecardVersion string `json:"min_card_version,omitempty"`

	// This will always point to the current running version
	Version string `json:"version,omitempty"`
}

DFUState is the state of the DFU in progress

type DeleteAppEnvironmentVariableResponse

type DeleteAppEnvironmentVariableResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this app.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

DeleteAppEnvironmentVariableResponse v1

The response object for deleting an app environment variable.

type DeleteDeviceEnvironmentVariableResponse

type DeleteDeviceEnvironmentVariableResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this device that have been set using host firmware or the Notehub API or UI.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

DeleteDeviceEnvironmentVariableResponse v1

The response object for deleting a device environment variable.

type DeleteDeviceFleetsRequest added in v1.4.8

type DeleteDeviceFleetsRequest struct {
	// FleetUIDs
	//
	// The fleets the device should be disassociated from
	//
	// required: true
	FleetUIDs []string `json:"fleet_uids"`
}

DeleteDeviceFleetsRequest v1

The request object for removing a device from fleets

type DeleteFleetEnvironmentVariableResponse

type DeleteFleetEnvironmentVariableResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this fleet.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

DeleteFleetEnvironmentVariableResponse v1

The response object for deleting an fleet environment variable.

type DevicePublicKey added in v1.4.8

type DevicePublicKey struct {
	UID       string `json:"uid"`
	PublicKey string `json:"key"`
}

DevicePublicKey v1

A structure representing the public key for a specific device

type DeviceResponse

type DeviceResponse struct {
	UID          string `json:"uid"`
	SerialNumber string `json:"serial_number,omitempty"`
	SKU          string `json:"sku,omitempty"`

	// RFC3339 timestamps, in UTC.
	Provisioned  string  `json:"provisioned"`
	LastActivity *string `json:"last_activity"`

	Contact *ContactResponse `json:"contact,omitempty"`

	ProductUID string   `json:"product_uid"`
	FleetUIDs  []string `json:"fleet_uids"`

	TowerInfo            *TowerInformation `json:"tower_info,omitempty"`
	TowerLocation        *Location         `json:"tower_location,omitempty"`
	GPSLocation          *Location         `json:"gps_location,omitempty"`
	TriangulatedLocation *Location         `json:"triangulated_location,omitempty"`

	Voltage     float64 `json:"voltage"`
	Temperature float64 `json:"temperature"`
	DFUEnv      *DFUEnv `json:"dfu,omitempty"`
	Disabled    bool    `json:"disabled,omitempty"`
	Tags        string  `json:"tags,omitempty"`
}

DeviceResponse v1

The response object for a device.

type DfuPhase added in v1.7.2

type DfuPhase string
const (
	DfuPhaseUnknown     DfuPhase = ""
	DfuPhaseIdle        DfuPhase = "idle"
	DfuPhaseError       DfuPhase = "error"
	DfuPhaseDownloading DfuPhase = "downloading"
	DfuPhaseSideloading DfuPhase = "sideloading"
	DfuPhaseReady       DfuPhase = "ready"
	DfuPhaseReadyRetry  DfuPhase = "ready-retry"
	DfuPhaseUpdating    DfuPhase = "updating"
	DfuPhaseCompleted   DfuPhase = "completed"
)

func ParseDfuPhase added in v1.7.2

func ParseDfuPhase(phase string) DfuPhase

func (DfuPhase) IsTerminal added in v1.7.2

func (phase DfuPhase) IsTerminal() bool

type ErrorResponse

type ErrorResponse struct {
	// Error represents the human readable error message.
	//
	// required: true
	// type: string
	Error string `json:"err"`

	// Code represents the standard status code
	//
	// required: true
	// type: int
	Code int `json:"code"`

	// Status is the machine readable string representation of the error code.
	//
	// required: true
	// type: string
	Status string `json:"status"`

	// Request is the request that was made that resulted in error. The url path would be sufficient.
	//
	// required: false
	// type: string
	Request string `json:"request,omitempty"`

	// Details are any additional information about the request that would be nice to in the response.
	// The request body would be nice especially if there are a lot of parameters.
	//
	// required: false
	// type: object
	Details map[string]interface{} `json:"details,omitempty"`

	// Debug is any customer-facing information to aid in debugging.
	//
	// required: false
	// type: string
	Debug string `json:"debug,omitempty"`
}

ErrorResponse v1

The structure returned from HTTPS API calls when there is an error.

func ErrBadRequest

func ErrBadRequest() ErrorResponse

ErrBadRequest returns the default for an HTTP 400 BadRequest

func ErrConflict

func ErrConflict() ErrorResponse

ErrConflict returns the default for an HTTP 409 Conflict

func ErrEventsQueryTimeout added in v1.7.1

func ErrEventsQueryTimeout() ErrorResponse

ErrEventsQueryTimeout returns the default for a GetEvents (and related) request that took too long

func ErrForbidden

func ErrForbidden() ErrorResponse

ErrForbidden returns the default for an HTTP 403 Forbidden

func ErrInternalServerError

func ErrInternalServerError() ErrorResponse

ErrInternalServerError returns the default for an HTTP 500 InternalServerError

func ErrMethodNotAllowed added in v1.4.9

func ErrMethodNotAllowed() ErrorResponse

ErrMethodNotAllowed returns the default for an HTTP 405 Method Not Allowed

func ErrNotFound

func ErrNotFound() ErrorResponse

ErrNotFound returns the default for an HTTP 404 NotFound

func ErrUnauthorized

func ErrUnauthorized() ErrorResponse

ErrUnauthorized returns the default for an HTTP 401 Unauthorized

func ErrUnsupportedMediaType

func ErrUnsupportedMediaType() ErrorResponse

ErrUnsupportedMediaType returns the default for an HTTP 415 UnsupportedMediaType

func (ErrorResponse) WithDebug added in v1.8.0

func (e ErrorResponse) WithDebug(msg string) ErrorResponse

WithDebug adds a debug string onto the error response object

func (ErrorResponse) WithError

func (e ErrorResponse) WithError(err error) ErrorResponse

WithError adds an error string from an error object into the response.

func (ErrorResponse) WithRequest

func (e ErrorResponse) WithRequest(r *http.Request) ErrorResponse

WithRequest is a an easy way to add http.Request information to an error. It takes a http.Request object, parses the URI string into response.Request and adds the request Body (if it exists) into the response.Details["body"] as a string

type FleetResponse

type FleetResponse struct {
	UID   string `json:"uid"`
	Label string `json:"label"`
	// RFC3339 timestamp, in UTC.
	Created string `json:"created"`

	SmartRule string `json:"smart_rule,omitempty"`
}

FleetResponse v1

The response object for a fleet.

type GenerateClientAppResponse added in v1.5.0

type GenerateClientAppResponse struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

GenerateClientAppResponse v1

The response object for generating a new client app for a specific app

type GetAppEnvironmentVariablesResponse

type GetAppEnvironmentVariablesResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this app.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

GetAppEnvironmentVariablesResponse v1

The response object for getting app environment variables.

type GetAppResponse

type GetAppResponse struct {
	UID   string `json:"uid"`
	Label string `json:"label"`
	// RFC3339 timestamp, in UTC.
	Created string `json:"created"`

	AdministrativeContact *ContactResponse `json:"administrative_contact"`
	TechnicalContact      *ContactResponse `json:"technical_contact"`

	// "owner", "developer", or "viewer"
	Role *string `json:"role"`
}

GetAppResponse v1

The response object for getting an app.

type GetBillingAccountResponse added in v1.5.1

type GetBillingAccountResponse struct {
	UID  string `json:"uid"`
	Name string `json:"name"`
	// "billing_admin", "billing_manager", or "project_creator"
	Role string `json:"role"`
}

GetBillingAccountResponse v1

The response object for getting a billing account.

type GetBillingAccountsResponse added in v1.5.1

type GetBillingAccountsResponse struct {
	BillingAccounts []GetBillingAccountResponse `json:"billing_accounts"`
}

type GetDeviceEnvironmentVariablesResponse

type GetDeviceEnvironmentVariablesResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this device that have been set using host firmware or the Notehub API or UI.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`

	// EnvironmentVariablesEnvDefault
	//
	// The environment variables that have been set using the env.default request through the Notecard API.
	//
	// required: true
	EnvironmentVariablesEnvDefault map[string]string `json:"environment_variables_env_default"`
}

GetDeviceEnvironmentVariablesResponse v1

The response object for getting device environment variables.

type GetDeviceEnvironmentVariablesWithPINResponse

type GetDeviceEnvironmentVariablesWithPINResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this device that have been set using host firmware or the Notehub API or UI.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`

	// EnvironmentVariablesEnvDefault
	//
	// The environment variables that have been set using the env.default request through the Notecard API.
	//
	// required: true
	EnvironmentVariablesEnvDefault map[string]string `json:"environment_variables_env_default"`
}

GetDeviceEnvironmentVariablesWithPINResponse v1

The response object for getting device environment variables with a PIN.

type GetDeviceHealthLogResponse

type GetDeviceHealthLogResponse struct {
	HealthLog []HealthLogEntry `json:"health_log"`
}

GetDeviceHealthLogResponse v1

The response object for getting a device's health log.

type GetDeviceLatestResponse

type GetDeviceLatestResponse struct {
	LatestEvents []note.Event `json:"latest_events"`
}

GetDeviceLatestResponse v1

The response object for retrieving the latest notefile values for a device

type GetDeviceSessionsResponse added in v1.4.9

type GetDeviceSessionsResponse struct {
	// Sessions
	//
	// The requested page of session logs for the device
	//
	// required: true
	Sessions []note.DeviceSession `json:"sessions"`

	// HasMore
	//
	// A boolean indicating whether there is at least one more
	// page of data available after this page
	//
	// required: true
	HasMore bool `json:"has_more"`
}

GetDeviceSessionsResponse is the structure returned from a GetDeviceSessions call

type GetDevicesPublicKeysResponse added in v1.4.8

type GetDevicesPublicKeysResponse struct {
	DevicePublicKeys []DevicePublicKey `json:"device_public_keys"`
	HasMore          bool              `json:"has_more"`
}

GetDevicesPublicKeysResponse v1

The response object for retrieving a collection of devices' public keys

type GetDevicesResponse

type GetDevicesResponse struct {
	Devices []DeviceResponse `json:"devices"`
	HasMore bool             `json:"has_more"`
}

GetDevicesResponse v1

The response object for getting devices.

type GetEventsByCursorResponse added in v1.5.0

type GetEventsByCursorResponse struct {
	Events     []note.Event `json:"events"`
	NextCursor string       `json:"next_cursor"`
	HasMore    bool         `json:"has_more"`
}

GetEventsByCursorResponse v1

The response object for getting events by cursor.

type GetEventsResponse

type GetEventsResponse struct {
	Events  []note.Event `json:"events"`
	Through string       `json:"through,omitempty"`
	HasMore bool         `json:"has_more"`
}

GetEventsResponse v1

The response object for getting events.

type GetEventsResponseSelectedFields added in v1.8.0

type GetEventsResponseSelectedFields struct {
	Events  []note.Event `json:"events"`
	Through string       `json:"through,omitempty"`
	HasMore bool         `json:"has_more"`
}

GetEventsResponseSelectedFields v1

The response object for getting events with selected fields.

type GetFleetEnvironmentVariablesResponse

type GetFleetEnvironmentVariablesResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this fleet.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

GetFleetEnvironmentVariablesResponse v1

The response object for getting fleet environment variables.

type GetFleetsResponse

type GetFleetsResponse struct {
	Fleets []FleetResponse `json:"fleets"`
}

GetFleetsResponse v1

The response object for getting fleets.

type GetProductsResponse

type GetProductsResponse struct {
	Products []ProductResponse `json:"products"`
}

GetProductsResponse v1

The response object for getting products.

type HealthLogEntry

type HealthLogEntry struct {
	When  string `json:"when"`
	Alert bool   `json:"alert"`
	Text  string `json:"text"`
}

HealthLogEntry v1

The response object for a health log entry.

type Location

type Location struct {
	When      string  `json:"when"`
	Name      string  `json:"name"`
	Country   string  `json:"country"`
	Timezone  string  `json:"timezone"`
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

Location v1

The response object for a location.

type PostFleetRequest added in v1.4.8

type PostFleetRequest struct {
	Label string `json:"label"`

	SmartRule string `json:"smart_rule,omitempty"`
}

PostFleetRequest v1

The request object for adding a fleet for a project

type PostProductRequest

type PostProductRequest struct {
	ProductUID string `json:"product_uid"`
	Label      string `json:"label"`
	// Not required
	AutoProvisionFleets []string `json:"auto_provision_fleets"`
	// Not required
	DisableDevicesByDefault bool `json:"disable_devices_by_default"`
}

PostProductRequest v1

The request object for adding a product.

type ProductResponse

type ProductResponse struct {
	UID                     string    `json:"uid"`
	Label                   string    `json:"label"`
	AutoProvisionFleets     *[]string `json:"auto_provision_fleets"`
	DisableDevicesByDefault bool      `json:"disable_devices_by_default"`
}

ProductResponse v1

The response object for a product.

type ProvisionDeviceRequest added in v1.4.8

type ProvisionDeviceRequest struct {
	ProductUID string    `json:"product_uid"`
	DeviceSN   string    `json:"device_sn"`
	FleetUIDs  *[]string `json:"fleet_uids,omitempty"`
}

ProvisionDeviceRequest v1

The request object for provisioning a device

type PutAppEnvironmentVariablesRequest

type PutAppEnvironmentVariablesRequest struct {
	// EnvironmentVariables
	//
	// The environment variables scoped at the app level
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutAppEnvironmentVariablesRequest v1

The request object for setting app environment variables.

type PutAppEnvironmentVariablesResponse

type PutAppEnvironmentVariablesResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this app.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutAppEnvironmentVariablesResponse v1

The response object for setting app environment variables.

type PutDeviceEnvironmentVariablesRequest

type PutDeviceEnvironmentVariablesRequest struct {
	// EnvironmentVariables
	//
	// The environment variables scoped at the device level
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutDeviceEnvironmentVariablesRequest v1

The request object for setting device environment variables.

type PutDeviceEnvironmentVariablesResponse

type PutDeviceEnvironmentVariablesResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this device that have been set using host firmware or the Notehub API or UI.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutDeviceEnvironmentVariablesResponse v1

The response object for setting device environment variables.

type PutDeviceEnvironmentVariablesWithPINRequest

type PutDeviceEnvironmentVariablesWithPINRequest struct {
	// EnvironmentVariables
	//
	// The environment variables scoped at the device level
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutDeviceEnvironmentVariablesWithPINRequest v1

The request object for setting device environment variables with a PIN. (The PIN comes in via a header)

type PutDeviceEnvironmentVariablesWithPINResponse

type PutDeviceEnvironmentVariablesWithPINResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this device that have been set using host firmware or the Notehub API or UI.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutDeviceEnvironmentVariablesWithPINResponse v1

The response object for setting device environment variables with a PIN.

type PutDeviceFleetsRequest added in v1.4.8

type PutDeviceFleetsRequest struct {
	// FleetUIDs
	//
	// The fleets the device belong to
	//
	// required: true
	FleetUIDs []string `json:"fleet_uids"`
}

PutDeviceFleetsRequest v1

The request object for adding a device to fleets

type PutFleetEnvironmentVariablesRequest

type PutFleetEnvironmentVariablesRequest struct {
	// EnvironmentVariables
	//
	// The environment variables scoped at the fleet level
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutFleetEnvironmentVariablesRequest v1

The request object for setting fleet environment variables.

type PutFleetEnvironmentVariablesResponse

type PutFleetEnvironmentVariablesResponse struct {
	// EnvironmentVariables
	//
	// The environment variables for this fleet.
	//
	// required: true
	EnvironmentVariables map[string]string `json:"environment_variables"`
}

PutFleetEnvironmentVariablesResponse v1

The response object for setting fleet environment variables.

type PutFleetRequest added in v1.4.8

type PutFleetRequest struct {
	Label         string   `json:"label"`
	AddDevices    []string `json:"addDevices,omitempty"`
	RemoveDevices []string `json:"removeDevices,omitempty"`

	SmartRule string `json:"smart_rule,omitempty"`
}

PutFleetRequest v1

The request object for updating a fleet within a project

type TowerInformation

type TowerInformation struct {
	// Mobile Country Code
	MCC int `json:"mcc"`
	// Mobile Network Code
	MNC int `json:"mnc"`
	// Location Area Code
	LAC    int `json:"lac"`
	CellID int `json:"cell_id"`
}

TowerInformation v1

The response object for tower information.

Jump to

Keyboard shortcuts

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