spanclient

package module
v4.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2020 License: Apache-2.0 Imports: 25 Imported by: 2

README

Go API client for spanclient

API for device, collection, output and firmware management

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 4.1.3 factual-kahlil
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://lab5e.com/span

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context
go get github.com/antihax/optional

Put the package under your project folder and add the following in import:

import "./spanclient"

Documentation for API Endpoints

All URIs are relative to https://api.lab5e.com/span

Class Method HTTP request Description
CollectionsApi BroadcastMessage Post /collections/{collectionId}/to Broadcast message
CollectionsApi CreateCollection Post /collections Create collection
CollectionsApi DeleteCollection Delete /collections/{collectionId} Delete collection
CollectionsApi ListCollectionData Get /collections/{collectionId}/data Get payloads
CollectionsApi ListCollections Get /collections List collections
CollectionsApi RetrieveCollection Get /collections/{collectionId} Retrieve collection
CollectionsApi UpdateCollection Patch /collections/{collectionId} Update collection
DatadumpApi DataDump Post /datadump Data dump
DevicesApi CreateDevice Post /collections/{collectionId}/devices Create device
DevicesApi DeleteDevice Delete /collections/{collectionId}/devices/{deviceId} Remove device
DevicesApi ListDeviceData Get /collections/{collectionId}/devices/{deviceId}/data Get payloads
DevicesApi ListDevices Get /collections/{collectionId}/devices List devices
DevicesApi RetrieveDevice Get /collections/{collectionId}/devices/{deviceId} Retrieve device
DevicesApi SendMessage Post /collections/{collectionId}/devices/{deviceId}/to Send message
DevicesApi UpdateDevice Patch /collections/{existingCollectionId}/devices/{deviceId} Update device
FotaApi ClearFirmwareError Delete /collections/{collectionId}/devices/{deviceId}/fwerror Clear FOTA error
FotaApi CreateFirmware Post /collections/{collectionId}/firmware Create firmware
FotaApi DeleteFirmware Delete /collections/{collectionId}/firmware/{imageId} Delete firmware
FotaApi FirmwareUsage Patch /collections/{collectionId}/firmware/{imageId}/usage Firmware usage
FotaApi ListFirmware Get /collections/{collectionId}/firmware List firmware
FotaApi RetrieveFirmware Get /collections/{collectionId}/firmware/{imageId} Retrieve firmware
FotaApi UpdateFirmware Patch /collections/{collectionId}/firmware/{imageId} Update firmware
OutputsApi CreateOutput Post /collections/{collectionId}/outputs Create output
OutputsApi DeleteOutput Delete /collections/{collectionId}/outputs/{outputId} Delete output
OutputsApi ListOutputs Get /collections/{collectionId}/outputs List outputs
OutputsApi Logs Get /collections/{collectionId}/outputs/{outputId}/logs Output logs
OutputsApi RetrieveOutput Get /collections/{collectionId}/outputs/{outputId} Retrieve output
OutputsApi Status Get /collections/{collectionId}/outputs/{outputId}/status Output status
OutputsApi UpdateOutput Patch /collections/{collectionId}/outputs/{outputId} Update output
SystemApi GetSystemInfo Get /system System information

Documentation For Models

Documentation For Authorization

APIToken

  • Type: API key

Example

auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
    Key: "APIKEY",
    Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)

Author

dev@lab5e.com

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

func NewAuthContext

func NewAuthContext(apiToken string) context.Context

NewAuthContext is a convenience method to create an authentication context with an API key.

Types

type APIClient

type APIClient struct {
	CollectionsApi *CollectionsApiService

	DatadumpApi *DatadumpApiService

	DevicesApi *DevicesApiService

	FotaApi *FotaApiService

	OutputsApi *OutputsApiService

	SystemApi *SystemApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the The Span API API v4.1.3 factual-kahlil In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type CoApMetadata

type CoApMetadata struct {
	Code string `json:"code,omitempty"`
	Path string `json:"path,omitempty"`
}

CoApMetadata struct for CoApMetadata

type Collection

type Collection struct {
	// The ID of the collection. This is assigned by the backend.
	CollectionId string `json:"collectionId,omitempty"`
	// The team ID that owns the collection. This field is required. When you create new collections the default is to use your private team ID.
	TeamId    string             `json:"teamId,omitempty"`
	FieldMask FieldMask          `json:"fieldMask,omitempty"`
	Firmware  CollectionFirmware `json:"firmware,omitempty"`
	// Tags for the collection. Tags are metadata fields that you can assign to the collection.
	Tags map[string]string `json:"tags,omitempty"`
}

Collection struct for Collection

type CollectionFirmware

type CollectionFirmware struct {
	// The current firmware is the firmware that the devices are currently using.
	CurrentFirmwareId string `json:"currentFirmwareId,omitempty"`
	// The target firmware is set to the desired firmware image for the devices in this collection. If the management is set to \"device\" this will only be used if the target firmware isn't set on the device itself.
	TargetFirmwareId string                               `json:"targetFirmwareId,omitempty"`
	Management       CollectionFirmwareFirmwareManagement `json:"management,omitempty"`
}

CollectionFirmware struct for CollectionFirmware

type CollectionFirmwareFirmwareManagement

type CollectionFirmwareFirmwareManagement string

CollectionFirmwareFirmwareManagement The firmware management settings for a collection can either be \"disabled\", ie there is no firmware management for this collection, \"collection\"; devices are managed through the settings on the collection or \"device\" where each device is configured individual.

const (
	UNSPECIFIED CollectionFirmwareFirmwareManagement = "unspecified"
	DISABLED    CollectionFirmwareFirmwareManagement = "disabled"
	COLLECTION  CollectionFirmwareFirmwareManagement = "collection"
	DEVICE      CollectionFirmwareFirmwareManagement = "device"
)

List of CollectionFirmwareFirmwareManagement

type CollectionsApiService

type CollectionsApiService service

CollectionsApiService CollectionsApi service

func (*CollectionsApiService) BroadcastMessage

BroadcastMessage Broadcast message Broadcast a message to all devices in the collection. This request will always succeed if the collection exists, even if there are one or more send errors. Individual errors are returned as an array of error messages in the response. Use equivalent to resource for devices to send a message to single device.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param body

@return MultiSendMessageResponse

func (*CollectionsApiService) CreateCollection

func (a *CollectionsApiService) CreateCollection(ctx _context.Context, body Collection) (Collection, *_nethttp.Response, error)

CreateCollection Create collection The returned collection is the collection stored in the backend. Defaults have been set. There are no required fields in a collection

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return Collection

func (*CollectionsApiService) DeleteCollection

func (a *CollectionsApiService) DeleteCollection(ctx _context.Context, collectionId string) (Collection, *_nethttp.Response, error)

DeleteCollection Delete collection You must have write access to the collection

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId The ID of the collection you want to delete

@return Collection

func (*CollectionsApiService) ListCollectionData

func (a *CollectionsApiService) ListCollectionData(ctx _context.Context, collectionId string, localVarOptionals *ListCollectionDataOpts) (ListDataResponse, *_nethttp.Response, error)

ListCollectionData Get payloads List the data received from all the devices in the collection.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId The collection ID requested. This is included in the request path.
  • @param optional nil or *ListCollectionDataOpts - Optional Parameters:
  • @param "Limit" (optional.Int32) - Limit the number of payloads to return. The default is 512.
  • @param "Start" (optional.String) - Start of time range. The default is 24 hours ago. Value is in milliseconds since epoch.
  • @param "End" (optional.String) - End of time range. The default is the current time stamp. Value is in milliseconds since epoch.
  • @param "Offset" (optional.String) - The message offset based on the message ID. This parameter can't be combined with the start and end parameters. If no parameter is set the first N messages will be returned. If this parameter is set the next N messages (from newest to oldest) with message ID less than the offset will be returned.

@return ListDataResponse

func (*CollectionsApiService) ListCollections

ListCollections List collections Lists all the collections that one of your teams owns.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return ListCollectionResponse

func (*CollectionsApiService) RetrieveCollection

func (a *CollectionsApiService) RetrieveCollection(ctx _context.Context, collectionId string) (Collection, *_nethttp.Response, error)

RetrieveCollection Retrieve collection

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId The collection ID of the collection you are requesting

@return Collection

func (*CollectionsApiService) UpdateCollection

func (a *CollectionsApiService) UpdateCollection(ctx _context.Context, collectionId string, body Collection) (Collection, *_nethttp.Response, error)

UpdateCollection Update collection You must have write access to the collection, ie. you must administer it

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId The ID of the collection. This is assigned by the backend.
  • @param body

@return Collection

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerUrl

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type CreateFirmwareRequest

type CreateFirmwareRequest struct {
	CollectionId string            `json:"collectionId,omitempty"`
	Image        string            `json:"image,omitempty"`
	Version      string            `json:"version,omitempty"`
	Filename     string            `json:"filename,omitempty"`
	Tags         map[string]string `json:"tags,omitempty"`
}

CreateFirmwareRequest struct for CreateFirmwareRequest

type DataDumpResponse

type DataDumpResponse struct {
	Collections []DumpedCollection `json:"collections,omitempty"`
}

DataDumpResponse struct for DataDumpResponse

type DataStream

type DataStream interface {
	Recv() (OutputDataMessage, error)
	Close() error
}

DataStream is a stream of data from the Span service. The data stream uses a websocket under the hood.

func NewCollectionDataStream

func NewCollectionDataStream(ctx context.Context, config *Configuration, collectionID string) (DataStream, error)

NewCollectionDataStream creates a live data stream for devices in a collection. The context must contain the appropriate credentials.

func NewDeviceDataStream

func NewDeviceDataStream(ctx context.Context, config *Configuration, collectionID, deviceID string) (DataStream, error)

NewDeviceDataStream creates a live data stream for a single device. The context must contain the appropriate credentials.

type DatadumpApiService

type DatadumpApiService service

DatadumpApiService DatadumpApi service

func (*DatadumpApiService) DataDump

func (a *DatadumpApiService) DataDump(ctx _context.Context, body map[string]interface{}) (DataDumpResponse, *_nethttp.Response, error)

DataDump Data dump Do a complete data dump of your data, devices, outputs and collections.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param body

@return DataDumpResponse

type Device

type Device struct {
	// The device ID is assigned by the backend.
	DeviceId     string `json:"deviceId,omitempty"`
	CollectionId string `json:"collectionId,omitempty"`
	// The IMSI is the unique ID for the (e|nu|whatever)SIM card on your device. This is the primary identifier for your device on the network.
	Imsi string `json:"imsi,omitempty"`
	// The IMEI number is the unique ID for your hardware as seen by the network. Obviously you might have a completely different view on things.
	Imei string `json:"imei,omitempty"`
	// Tags are metadata for the device that you can set. These are just strings.
	Tags     map[string]string `json:"tags,omitempty"`
	Network  NetworkMetadata   `json:"network,omitempty"`
	Firmware FirmwareMetadata  `json:"firmware,omitempty"`
}

Device struct for Device

type DevicesApiService

type DevicesApiService service

DevicesApiService DevicesApi service

func (*DevicesApiService) CreateDevice

func (a *DevicesApiService) CreateDevice(ctx _context.Context, collectionId string, body Device) (Device, *_nethttp.Response, error)

CreateDevice Create device Create a new device. This will add a device to the collection. You must have write access to the collection.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId This is the containing collection
  • @param body

@return Device

func (*DevicesApiService) DeleteDevice

func (a *DevicesApiService) DeleteDevice(ctx _context.Context, collectionId string, deviceId string) (Device, *_nethttp.Response, error)

DeleteDevice Remove device

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param deviceId

@return Device

func (*DevicesApiService) ListDeviceData

func (a *DevicesApiService) ListDeviceData(ctx _context.Context, collectionId string, deviceId string, localVarOptionals *ListDeviceDataOpts) (ListDataResponse, *_nethttp.Response, error)

ListDeviceData Get payloads List the data received from the device. Use the query parameters to control what data you retrieve.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId The collection ID. This is included in the request path.
  • @param deviceId The device ID. This is included in the request path.
  • @param optional nil or *ListDeviceDataOpts - Optional Parameters:
  • @param "Limit" (optional.Int32) - Limit the number of payloads to return. The default is 512.
  • @param "Start" (optional.String) - Start of time range. The default is 24 hours ago. Value is in milliseconds since epoch.
  • @param "End" (optional.String) - End of time range. The default is the current time stamp. Value is in milliseconds since epoch.
  • @param "Offset" (optional.String) - The message offset based on the message ID. This parameter can't be combined with the start and end parameters. If no parameter is set the first N messages will be returned. If this parameter is set the next N messages (from newest to oldest) with message ID less than the offset will be returned.

@return ListDataResponse

func (*DevicesApiService) ListDevices

func (a *DevicesApiService) ListDevices(ctx _context.Context, collectionId string) (ListDevicesResponse, *_nethttp.Response, error)

ListDevices List devices

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId

@return ListDevicesResponse

func (*DevicesApiService) RetrieveDevice

func (a *DevicesApiService) RetrieveDevice(ctx _context.Context, collectionId string, deviceId string) (Device, *_nethttp.Response, error)

RetrieveDevice Retrieve device Retrieve a single device

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param deviceId

@return Device

func (*DevicesApiService) SendMessage

func (a *DevicesApiService) SendMessage(ctx _context.Context, collectionId string, deviceId string, body SendMessageRequest) (map[string]interface{}, *_nethttp.Response, error)

SendMessage Send message Send a message to the device

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param deviceId
  • @param body

@return map[string]interface{}

func (*DevicesApiService) UpdateDevice

func (a *DevicesApiService) UpdateDevice(ctx _context.Context, existingCollectionId string, deviceId string, body UpdateDeviceRequest) (Device, *_nethttp.Response, error)

UpdateDevice Update device

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param existingCollectionId
  • @param deviceId
  • @param body

@return Device

type DumpedCollection

type DumpedCollection struct {
	Collection Collection     `json:"collection,omitempty"`
	Devices    []DumpedDevice `json:"devices,omitempty"`
	Outputs    []Output       `json:"outputs,omitempty"`
}

DumpedCollection struct for DumpedCollection

type DumpedDevice

type DumpedDevice struct {
	Device Device `json:"device,omitempty"`
}

DumpedDevice struct for DumpedDevice

type FieldMask

type FieldMask struct {
	Imsi     bool `json:"imsi,omitempty"`
	Imei     bool `json:"imei,omitempty"`
	Msisdn   bool `json:"msisdn,omitempty"`
	Location bool `json:"location,omitempty"`
}

FieldMask struct for FieldMask

type Firmware

type Firmware struct {
	ImageId string `json:"imageId,omitempty"`
	// Make sure that the firmware image reports this version. If the version reported by this image is different the FOTA process won't be reported as successful since the device will report a version different from this.
	Version string `json:"version,omitempty"`
	// This is just for internal house keeping, making it potentially easier to identify the firmware image.
	Filename string `json:"filename,omitempty"`
	// To ensure each image is unique the SHA-256 hash for all images in a collection must be unqique
	Sha256 string `json:"sha256,omitempty"`
	Length int32  `json:"length,omitempty"`
	// Collection ID for the collection owning the firmware image.
	CollectionId string `json:"collectionId,omitempty"`
	Created      string `json:"created,omitempty"`
	// Tags for firmware image.
	Tags map[string]string `json:"tags,omitempty"`
}

Firmware Firmware images aren't served back out through the API, only the metadata.

type FirmwareMetadata

type FirmwareMetadata struct {
	CurrentFirmwareId string `json:"currentFirmwareId,omitempty"`
	TargetFirmwareId  string `json:"targetFirmwareId,omitempty"`
	// Last reported firmware version.
	FirmwareVersion string `json:"firmwareVersion,omitempty"`
	SerialNumber    string `json:"serialNumber,omitempty"`
	ModelNumber     string `json:"modelNumber,omitempty"`
	Manufacturer    string `json:"manufacturer,omitempty"`
	// State of the firmware.
	State        string `json:"state,omitempty"`
	StateMessage string `json:"stateMessage,omitempty"`
}

FirmwareMetadata Metadata about firmware on devices.

type FirmwareUsageResponse

type FirmwareUsageResponse struct {
	ImageId  string   `json:"imageId,omitempty"`
	Targeted []string `json:"targeted,omitempty"`
	Current  []string `json:"current,omitempty"`
}

FirmwareUsageResponse struct for FirmwareUsageResponse

type FotaApiService

type FotaApiService service

FotaApiService FotaApi service

func (*FotaApiService) ClearFirmwareError

func (a *FotaApiService) ClearFirmwareError(ctx _context.Context, collectionId string, deviceId string) (map[string]interface{}, *_nethttp.Response, error)

ClearFirmwareError Clear FOTA error

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param deviceId

@return map[string]interface{}

func (*FotaApiService) CreateFirmware

func (a *FotaApiService) CreateFirmware(ctx _context.Context, collectionId string, body CreateFirmwareRequest) (Firmware, *_nethttp.Response, error)

CreateFirmware Create firmware Create a new firmware image. This is also invoked by the custom HTTP uploader if the POST uses multipart/formdata for the request.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param body

@return Firmware

func (*FotaApiService) DeleteFirmware

func (a *FotaApiService) DeleteFirmware(ctx _context.Context, collectionId string, imageId string) (Firmware, *_nethttp.Response, error)

DeleteFirmware Delete firmware

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param imageId

@return Firmware

func (*FotaApiService) FirmwareUsage

func (a *FotaApiService) FirmwareUsage(ctx _context.Context, collectionId string, imageId string) (FirmwareUsageResponse, *_nethttp.Response, error)

FirmwareUsage Firmware usage Shows the firmware usage for devices in the collection

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param imageId

@return FirmwareUsageResponse

func (*FotaApiService) ListFirmware

func (a *FotaApiService) ListFirmware(ctx _context.Context, collectionId string) (ListFirmwareResponse, *_nethttp.Response, error)

ListFirmware List firmware Lists available firmware images in collection

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId

@return ListFirmwareResponse

func (*FotaApiService) RetrieveFirmware

func (a *FotaApiService) RetrieveFirmware(ctx _context.Context, collectionId string, imageId string) (Firmware, *_nethttp.Response, error)

RetrieveFirmware Retrieve firmware Retrieve information on a firmware image

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param imageId

@return Firmware

func (*FotaApiService) UpdateFirmware

func (a *FotaApiService) UpdateFirmware(ctx _context.Context, collectionId string, imageId string, body Firmware) (Firmware, *_nethttp.Response, error)

UpdateFirmware Update firmware

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId Collection ID Collection ID for the collection owning the firmware image.
  • @param imageId Firmware image ID
  • @param body

@return Firmware

type GenericOpenAPIError

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

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type ListCollectionDataOpts

type ListCollectionDataOpts struct {
	Limit  optional.Int32
	Start  optional.String
	End    optional.String
	Offset optional.String
}

ListCollectionDataOpts Optional parameters for the method 'ListCollectionData'

type ListCollectionResponse

type ListCollectionResponse struct {
	Collections []Collection `json:"collections,omitempty"`
}

ListCollectionResponse Collection list. The list contains all the collections you have access to.

type ListDataResponse

type ListDataResponse struct {
	Data []OutputDataMessage `json:"data,omitempty"`
}

ListDataResponse struct for ListDataResponse

type ListDeviceDataOpts

type ListDeviceDataOpts struct {
	Limit  optional.Int32
	Start  optional.String
	End    optional.String
	Offset optional.String
}

ListDeviceDataOpts Optional parameters for the method 'ListDeviceData'

type ListDevicesResponse

type ListDevicesResponse struct {
	Devices []Device `json:"devices,omitempty"`
}

ListDevicesResponse struct for ListDevicesResponse

type ListFirmwareResponse

type ListFirmwareResponse struct {
	Images []Firmware `json:"images,omitempty"`
}

ListFirmwareResponse struct for ListFirmwareResponse

type ListOutputResponse

type ListOutputResponse struct {
	CollectionId string   `json:"collectionId,omitempty"`
	Outputs      []Output `json:"outputs,omitempty"`
}

ListOutputResponse struct for ListOutputResponse

type MessageSendResult

type MessageSendResult struct {
	DeviceId string `json:"deviceId,omitempty"`
	Message  string `json:"message,omitempty"`
}

MessageSendResult struct for MessageSendResult

type MultiSendMessageResponse

type MultiSendMessageResponse struct {
	Errors []MessageSendResult `json:"errors,omitempty"`
	Sent   int32               `json:"sent,omitempty"`
	Failed int32               `json:"failed,omitempty"`
}

MultiSendMessageResponse Broadcast message result. The errors array contains the list of errors ocurred when sending a message.

type NetworkMetadata

type NetworkMetadata struct {
	// Allocated IP address.
	AllocatedIp string `json:"allocatedIp,omitempty"`
	AllocatedAt string `json:"allocatedAt,omitempty"`
	// Cell ID for device. This might not be set, depending on the provider in use.
	CellId string `json:"cellId,omitempty"`
}

NetworkMetadata Network metadata for devices.

type Output

type Output struct {
	OutputId     string            `json:"outputId,omitempty"`
	CollectionId string            `json:"collectionId,omitempty"`
	Type         OutputType        `json:"type,omitempty"`
	Config       OutputConfig      `json:"config,omitempty"`
	Enabled      bool              `json:"enabled,omitempty"`
	Tags         map[string]string `json:"tags,omitempty"`
}

Output struct for Output

type OutputConfig

type OutputConfig struct {
	Url               string `json:"url,omitempty"`
	BasicAuthUser     string `json:"basicAuthUser,omitempty"`
	BasicAuthPass     string `json:"basicAuthPass,omitempty"`
	CustomHeaderName  string `json:"customHeaderName,omitempty"`
	CustomHeaderValue string `json:"customHeaderValue,omitempty"`
	Host              string `json:"host,omitempty"`
	Port              int32  `json:"port,omitempty"`
	Key               string `json:"key,omitempty"`
	EventName         string `json:"eventName,omitempty"`
	AsIsPayload       bool   `json:"asIsPayload,omitempty"`
	Endpoint          string `json:"endpoint,omitempty"`
	// MQTT configuration: Disable certificate checks. Default is off.
	DisableCertCheck bool   `json:"disableCertCheck,omitempty"`
	Username         string `json:"username,omitempty"`
	Password         string `json:"password,omitempty"`
	ClientId         string `json:"clientId,omitempty"`
	TopicName        string `json:"topicName,omitempty"`
}

OutputConfig Output configuration.

type OutputDataMessage

type OutputDataMessage struct {
	Type    OutputDataMessageOutputMessageType `json:"type,omitempty"`
	Device  Device                             `json:"device,omitempty"`
	Payload string                             `json:"payload,omitempty"`
	// Received time for message. Value is ms since epoch.
	Received     string       `json:"received,omitempty"`
	Transport    string       `json:"transport,omitempty"`
	UdpMetaData  UdpMetadata  `json:"udpMetaData,omitempty"`
	CoapMetaData CoApMetadata `json:"coapMetaData,omitempty"`
	MessageId    string       `json:"messageId,omitempty"`
}

OutputDataMessage The output data message contains payload plus metadata for a payload received from a device.

func (*OutputDataMessage) PayloadBytes

func (d *OutputDataMessage) PayloadBytes() ([]byte, error)

PayloadBytes returns the payload for an OutputDataMessage as a byte array

type OutputDataMessageOutputMessageType

type OutputDataMessageOutputMessageType string

OutputDataMessageOutputMessageType the model 'OutputDataMessageOutputMessageType'

const (
	UNKNOWN   OutputDataMessageOutputMessageType = "unknown"
	KEEPALIVE OutputDataMessageOutputMessageType = "keepalive"
	DATA      OutputDataMessageOutputMessageType = "data"
)

List of OutputDataMessageOutputMessageType

type OutputLogEntry

type OutputLogEntry struct {
	Time     string `json:"time,omitempty"`
	Message  string `json:"message,omitempty"`
	Repeated int32  `json:"repeated,omitempty"`
}

OutputLogEntry struct for OutputLogEntry

type OutputLogs

type OutputLogs struct {
	Logs []OutputLogEntry `json:"logs,omitempty"`
}

OutputLogs struct for OutputLogs

type OutputStatus

type OutputStatus struct {
	CollectionId string `json:"collectionId,omitempty"`
	OutputId     string `json:"outputId,omitempty"`
	Enabled      bool   `json:"enabled,omitempty"`
	ErrorCount   int32  `json:"errorCount,omitempty"`
	Forwarded    int32  `json:"forwarded,omitempty"`
	Received     int32  `json:"received,omitempty"`
	Retransmits  int32  `json:"retransmits,omitempty"`
}

OutputStatus struct for OutputStatus

type OutputType

type OutputType string

OutputType the model 'OutputType'

const (
	UNDEFINED OutputType = "undefined"
	WEBHOOK   OutputType = "webhook"
	UDP       OutputType = "udp"
	MQTT      OutputType = "mqtt"
	IFTTT     OutputType = "ifttt"
)

List of OutputType

type OutputsApiService

type OutputsApiService service

OutputsApiService OutputsApi service

func (*OutputsApiService) CreateOutput

func (a *OutputsApiService) CreateOutput(ctx _context.Context, collectionId string, body Output) (Output, *_nethttp.Response, error)

CreateOutput Create output

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param body

@return Output

func (*OutputsApiService) DeleteOutput

func (a *OutputsApiService) DeleteOutput(ctx _context.Context, collectionId string, outputId string) (Output, *_nethttp.Response, error)

DeleteOutput Delete output

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param outputId

@return Output

func (*OutputsApiService) ListOutputs

func (a *OutputsApiService) ListOutputs(ctx _context.Context, collectionId string) (ListOutputResponse, *_nethttp.Response, error)

ListOutputs List outputs

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId

@return ListOutputResponse

func (*OutputsApiService) Logs

func (a *OutputsApiService) Logs(ctx _context.Context, collectionId string, outputId string) (OutputLogs, *_nethttp.Response, error)

Logs Output logs

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param outputId

@return OutputLogs

func (*OutputsApiService) RetrieveOutput

func (a *OutputsApiService) RetrieveOutput(ctx _context.Context, collectionId string, outputId string) (Output, *_nethttp.Response, error)

RetrieveOutput Retrieve output

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param outputId

@return Output

func (*OutputsApiService) Status

func (a *OutputsApiService) Status(ctx _context.Context, collectionId string, outputId string) (OutputStatus, *_nethttp.Response, error)

Status Output status

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param outputId

@return OutputStatus

func (*OutputsApiService) UpdateOutput

func (a *OutputsApiService) UpdateOutput(ctx _context.Context, collectionId string, outputId string, body Output) (Output, *_nethttp.Response, error)

UpdateOutput Update output Running outputs will be restarted if required. Note that the collection ID can't be changed on an existing output.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param collectionId
  • @param outputId
  • @param body

@return Output

type ProtobufAny

type ProtobufAny struct {
	// A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted).  In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows:  * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][]   value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the   URL, or have them precompiled into a binary to avoid any   lookup. Therefore, binary compatibility needs to be preserved   on changes to types. (Use versioned type names to manage   breaking changes.)  Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com.  Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics.
	TypeUrl string `json:"typeUrl,omitempty"`
	// Must be a valid serialized protocol buffer of the above specified type.
	Value string `json:"value,omitempty"`
}

ProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := ptypes.MarshalAny(foo) ... foo := &pb.Foo{} if err := ptypes.UnmarshalAny(any, foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": <string>, \"lastName\": <string> } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" }

type RuntimeError

type RuntimeError struct {
	Error   string        `json:"error,omitempty"`
	Code    int32         `json:"code,omitempty"`
	Message string        `json:"message,omitempty"`
	Details []ProtobufAny `json:"details,omitempty"`
}

RuntimeError struct for RuntimeError

type RuntimeStreamError

type RuntimeStreamError struct {
	GrpcCode   int32         `json:"grpcCode,omitempty"`
	HttpCode   int32         `json:"httpCode,omitempty"`
	Message    string        `json:"message,omitempty"`
	HttpStatus string        `json:"httpStatus,omitempty"`
	Details    []ProtobufAny `json:"details,omitempty"`
}

RuntimeStreamError struct for RuntimeStreamError

type SendMessageRequest

type SendMessageRequest struct {
	CollectionId string `json:"collectionId,omitempty"`
	DeviceId     string `json:"deviceId,omitempty"`
	Port         int32  `json:"port,omitempty"`
	Payload      string `json:"payload,omitempty"`
	// Valid transports are \"udp\", \"coap\", \"coap-pull\", \"udp-pull\", \"coap-push\", \"udp-push\". \"udp\" is equivalent to \"udp-push\" and \"coap\" is equivalent to \"coap-push\". Push messages are sent unsolicited to the device wheil pull messages are sent whenever the device wither sends data upstream (for UDP) or does a CoAP request to the CoAP service in span.
	Transport string `json:"transport,omitempty"`
	CoapPath  string `json:"coapPath,omitempty"`
}

SendMessageRequest struct for SendMessageRequest

type ServerConfiguration

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

type SystemApiService

type SystemApiService service

SystemApiService SystemApi service

func (*SystemApiService) GetSystemInfo

GetSystemInfo System information

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().

@return SystemInfoResponse

type SystemInfoResponse

type SystemInfoResponse struct {
	Version          string    `json:"version,omitempty"`
	BuildDate        string    `json:"buildDate,omitempty"`
	ReleaseName      string    `json:"releaseName,omitempty"`
	DefaultFieldMask FieldMask `json:"defaultFieldMask,omitempty"`
	ForcedFieldMask  FieldMask `json:"forcedFieldMask,omitempty"`
}

SystemInfoResponse struct for SystemInfoResponse

type UdpMetadata

type UdpMetadata struct {
	LocalPort  int32 `json:"localPort,omitempty"`
	RemotePort int32 `json:"remotePort,omitempty"`
}

UdpMetadata struct for UdpMetadata

type UpdateDeviceRequest

type UpdateDeviceRequest struct {
	ExistingCollectionId string `json:"existingCollectionId,omitempty"`
	DeviceId             string `json:"deviceId,omitempty"`
	// The collection id for the device. This field is optional and can be omitted if the collection id isn't changed. When changing to a new collection you must be an owner of the other collection, ie an administrator of the team that owns the new collection.
	CollectionId string `json:"collectionId,omitempty"`
	// The IMSI is the unique ID for the (e|nu|whatever)SIM card on your device. This is the primary identifier for your device on the network.
	Imsi string `json:"imsi,omitempty"`
	// The IMEI number is the unique ID for your hardware as seen by the network. Obviously you might have a completely different view on things.
	Imei string `json:"imei,omitempty"`
	// Tags are metadata for the device that you can set. These are just strings.
	Tags     map[string]string `json:"tags,omitempty"`
	Firmware FirmwareMetadata  `json:"firmware,omitempty"`
}

UpdateDeviceRequest struct for UpdateDeviceRequest

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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