Categorygithub.com/lab5e/go-spanapi/v4
package
4.9.6
Repository: https://github.com/lab5e/go-spanapi.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

Go API client for spanapi

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.9.6 authoritarian-betty
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://lab5e.com

Installation

Install the following dependencies:

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

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

import spanapi "github.com/lab5e/go-spanapi"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), spanapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), spanapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), spanapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), spanapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

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

ClassMethodHTTP requestDescription
BlobsApiDeleteBlobDelete /span/collections/{collectionId}/blobs/{blobId}Remove a blob stored on a collection
BlobsApiListBlobsGet /span/collections/{collectionId}/blobsList the blobs for a collection
CertificatesApiCreateCertificatePost /span/collections/{collectionId}/certificates/createCreate certificate
CertificatesApiRetrieveCertificateChainGet /span/collections/{collectionId}/certificatesGet certificate chain
CertificatesApiSignCertificatePost /span/collections/{collectionId}/certificates/signSign certificate
CertificatesApiVerifyCertificatePost /span/collections/{collectionId}/certificates/verifyVerify certificate
CollectionsApiCreateCollectionPost /span/collectionsCreate collection
CollectionsApiDeleteCollectionDelete /span/collections/{collectionId}Delete collection
CollectionsApiListCollectionDataGet /span/collections/{collectionId}/dataRetrieve data from devices
CollectionsApiListCollectionsGet /span/collectionsList collections
CollectionsApiRetrieveCollectionGet /span/collections/{collectionId}Retrieve collection
CollectionsApiRetrieveCollectionStatsGet /span/collections/{collectionId}/statsRetrieve collection statistics
CollectionsApiUpdateCollectionPatch /span/collections/{collectionId}Update collection
DevicesApiAddDownstreamMessagePost /span/collections/{collectionId}/devices/{deviceId}/outboxAdd message to oubox
DevicesApiCreateDevicePost /span/collections/{collectionId}/devicesCreate device
DevicesApiDeleteDeviceDelete /span/collections/{collectionId}/devices/{deviceId}Remove device.
DevicesApiDeleteDownstreamMessageDelete /span/collections/{collectionId}/devices/{deviceId}/outbox/{messageId}Delete outgoing message
DevicesApiDeviceCertificateGet /span/collections/{collectionId}/devices/{deviceId}/certsGet issued certificate(s) for device
DevicesApiListDeviceDataGet /span/collections/{collectionId}/devices/{deviceId}/dataRetrieve data from device
DevicesApiListDevicesGet /span/collections/{collectionId}/devicesList devices in collection.
DevicesApiListDownstreamMessagesGet /span/collections/{collectionId}/devices/{deviceId}/outboxList the messages in the outbox
DevicesApiListUpstreamMessagesGet /span/collections/{collectionId}/devices/{deviceId}/inboxList incoming messages
DevicesApiRetrieveDeviceGet /span/collections/{collectionId}/devices/{deviceId}Retrieve device
DevicesApiRetrieveDeviceStatsGet /span/collections/{collectionId}/devices/{deviceId}/statsRetrieve device statistics
DevicesApiUpdateDevicePatch /span/collections/{existingCollectionId}/devices/{deviceId}Update device
FotaApiClearFirmwareErrorDelete /span/collections/{collectionId}/devices/{deviceId}/fwerrorClear FOTA error
FotaApiCreateFirmwarePost /span/collections/{collectionId}/firmwareCreate firmware
FotaApiDeleteFirmwareDelete /span/collections/{collectionId}/firmware/{imageId}Delete firmware
FotaApiFirmwareUsageGet /span/collections/{collectionId}/firmware/{imageId}/usageFirmware usage
FotaApiListFirmwareGet /span/collections/{collectionId}/firmwareList firmware
FotaApiRetrieveFirmwareGet /span/collections/{collectionId}/firmware/{imageId}Retrieve firmware
FotaApiRetrieveFirmwareStatsGet /span/collections/{collectionId}/firmware/{imageId}/statsRetrieve firmware statistics
FotaApiUpdateFirmwarePatch /span/collections/{existingCollectionId}/firmware/{imageId}Update firmware
GatewaysApiCreateGatewayPost /span/collections/{collectionId}/gatewaysCreate gateway
GatewaysApiDeleteGatewayDelete /span/collections/{collectionId}/gateways/{gatewayId}Delete gateway
GatewaysApiGatewayCertificatesGet /span/collections/{collectionId}/gateways/{gatewayId}/certsGet issued certificate(s) for gateway
GatewaysApiListGatewaysGet /span/collections/{collectionId}/gatewaysList gateways
GatewaysApiRetrieveGatewayGet /span/collections/{collectionId}/gateways/{gatewayId}Retrieve gateway
GatewaysApiRetrieveGatewayStatsGet /span/collections/{collectionId}/gateways/{gatewayId}/statsRetrieve gateway statistics
GatewaysApiUpdateGatewayPatch /span/collections/{existingCollectionId}/gateways/{gatewayId}Update gateway
OutputsApiCreateOutputPost /span/collections/{collectionId}/outputsCreate output
OutputsApiDeleteOutputDelete /span/collections/{collectionId}/outputs/{outputId}Delete output
OutputsApiListOutputsGet /span/collections/{collectionId}/outputsList outputs
OutputsApiLogsGet /span/collections/{collectionId}/outputs/{outputId}/logsOutput logs
OutputsApiRetrieveOutputGet /span/collections/{collectionId}/outputs/{outputId}Retrieve output
OutputsApiRetrieveOutputStatsGet /span/collections/{collectionId}/outputs/{outputId}/statsRetrieve output statistics
OutputsApiStatusGet /span/collections/{collectionId}/outputs/{outputId}/statusOutput status
OutputsApiUpdateOutputPatch /span/collections/{existingCollectionId}/outputs/{outputId}Update output
SpanApiGetSystemInfoGet /span/systemSystem information

Documentation For Models

Documentation For Authorization

APIToken

  • Type: API key
  • API key parameter name: X-API-Token
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-API-Token and passed in as the auth context for each request.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]