Skip to content

Repository files navigation

Com.Lab5e.Span - the C# library for the The Span API

API for device, collection, output and firmware management

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 5.0.5 contented-jamila
  • SDK version: 5.0.5
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen For more information, please visit https://lab5e.com

Frameworks supported

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

usingCom.Lab5e.Span.Api;usingCom.Lab5e.Span.Client;usingCom.Lab5e.Span.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out Com.Lab5e.Span.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configurationc=newConfiguration();System.Net.WebProxywebProxy=newSystem.Net.WebProxy("http://myProxyUrl:80/");webProxy.Credentials=System.Net.CredentialCache.DefaultCredentials;c.Proxy=webProxy;

Getting Started

usingSystem.Collections.Generic;usingSystem.Diagnostics;usingCom.Lab5e.Span.Api;usingCom.Lab5e.Span.Client;usingCom.Lab5e.Span.Model;namespaceExample{publicclassExample{publicstaticvoidMain(){Configurationconfig=newConfiguration();config.BasePath="https://api.lab5e.com";// Configure API key authorization: APITokenconfig.ApiKey.Add("X-API-Token","YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// config.ApiKeyPrefix.Add("X-API-Token", "Bearer");varapiInstance=newBlobsApi(config);varcollectionId="collectionId_example";// string | varblobId="blobId_example";// string | try{// Remove a blob stored on a collectionObjectresult=apiInstance.DeleteBlob(collectionId,blobId);Debug.WriteLine(result);}catch(ApiExceptione){Debug.Print("Exception when calling BlobsApi.DeleteBlob: "+e.Message);Debug.Print("Status Code: "+e.ErrorCode);Debug.Print(e.StackTrace);}}}}

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
FotaApiAssignTargetImagePATCH /span/collections/{collectionId}/firmware/labeled/{imageId}/assignBETA: Assign a target image
FotaApiClearFirmwareErrorDELETE /span/collections/{collectionId}/devices/{deviceId}/fwerrorClear FOTA error
FotaApiCreateFirmwarePOST /span/collections/{collectionId}/firmwareCreate firmware
FotaApiCreateLabeledFirmwarePOST /span/collections/{collectionId}/firmware/labeledBETA: Create a labeled firmware image
FotaApiDeleteFirmwareDELETE /span/collections/{collectionId}/firmware/{imageId}Delete firmware
FotaApiDeleteLabeledImageDELETE /span/collections/{collectionId}/firmware/labeled/{imageId}BETA: Remove a tagged firmware image
FotaApiFirmwareUsageGET /span/collections/{collectionId}/firmware/{imageId}/usageFirmware usage
FotaApiGetImageStatePATCH /span/collections/{collectionId}/devices/{deviceId}/fotastateBETA: Get state for a single device
FotaApiListFirmwareGET /span/collections/{collectionId}/firmwareList firmware
FotaApiListImageStatesGET /span/collections/{collectionId}/firmware/labeled/statesBETA: List image assignments plus states
FotaApiListImageVersionHistoryPATCH /span/collections/{collectionId}/devices/{deviceId}/fotalogBETA: List version history for a single device
FotaApiListLabeledFirmwareGET /span/collections/{collectionId}/firmware/labeledBETA: List the labeled firmware images for a collection
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

About

C#/.NET Span API client

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages