Skip to content

korewireless/OmniCore-CSharp-SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OmniCore - the C# library for the OmniCore Model and State Management API

This is an OmniCore Model and State Management server.

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

  • API version: 1.8.10
  • SDK version: 1.8.10
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen For more information, please visit http://www.korewireless.com

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

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

Generate the DLL using your preferred tool (e.g. dotnet build)

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

using OmniCore.Api;
using OmniCore.Client;
using OmniCore.Model;

Usage

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

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using OmniCore.Api;
using OmniCore.Client;
using OmniCore.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.korewireless.com";
            // Configure API key authorization: apiKey
            config.ApiKey.Add("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("x-api-key", "Bearer");
            // Configure Bearer token for authorization: bearerAuth
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new DeviceApi(config);
            var subscriptionId = "subscriptionId_example";  // string | Subscription ID
            var registryId = "registryId_example";  // string | Registry ID
            var bind = new BindRequest(); // BindRequest | application/json

            try
            {
                Info result = apiInstance.BindDevice(subscriptionId, registryId, bind);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling DeviceApi.BindDevice: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

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

Class Method HTTP request Description
DeviceApi BindDevice POST /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/bindDeviceToGateway
DeviceApi BindDevices POST /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/bindDevicesToGateway
DeviceApi BlockDeviceCommuncation PUT /omnicore/subscriptions/{subscriptionid}/registries/{registryId}/devices/{deviceId}/communication
DeviceApi CreateDevice POST /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/devices
DeviceApi DeleteDevice DELETE /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/devices/{deviceId}
DeviceApi GetConfig GET /omnicore/subscriptions/{subscriptionid}/registries/{registryId}/devices/{deviceId}/configVersions
DeviceApi GetDevice GET /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/devices/{deviceId}
DeviceApi GetDevices GET /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/devices
DeviceApi GetStates GET /omnicore/subscriptions/{subscriptionid}/registries/{registryId}/devices/{deviceId}/states
DeviceApi GetSubscriptionDevices GET /omnicore/subscriptions/{subscriptionId}/devices
DeviceApi SendCommandToDevice POST /omnicore/subscriptions/{subscriptionid}/registries/{registryId}/devices/{deviceId}/sendCommandToDevice
DeviceApi UnBindDevice POST /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/unbindDeviceFromGateway
DeviceApi UnBindDevices POST /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/unbindDevicesFromGateway
DeviceApi UpdateConfigurationToDevice POST /omnicore/subscriptions/{subscriptionid}/registries/{registryId}/devices/{deviceId}/updateConfigurationToDevice
DeviceApi UpdateCustomOnboardRequest POST /omnicore/subscriptions/{subscriptionid}/registries/{registryId}/devices/{deviceId}/updateCustomOnboardRequest
DeviceApi UpdateDevice PATCH /omnicore/subscriptions/{subscriptionId}/registries/{registryId}/devices/{deviceId}
MetricsApi GetMetrics GET /omnicore/subscriptions/{subscriptionId}/metrics
RegistryApi CreateRegistry POST /omnicore/subscriptions/{subscriptionId}/registries
RegistryApi DeleteRegistry DELETE /omnicore/subscriptions/{subscriptionId}/registries/{registryId}
RegistryApi GetRegistries GET /omnicore/subscriptions/{subscriptionId}/registries
RegistryApi GetRegistry GET /omnicore/subscriptions/{subscriptionId}/registries/{registryId}
RegistryApi SendBroadcastToDevices POST /omnicore/subscriptions/{subscriptionid}/registries/{registryId}/sendBroadcastToDevice
RegistryApi UpdateRegistry PATCH /omnicore/subscriptions/{subscriptionId}/registries/{registryId}
SinkApi CreateSink POST /omnicore/subscriptions/{subscriptionId}/sinks
SinkApi DeleteSink DELETE /omnicore/subscriptions/{subscriptionId}/sinks/{sinkId}
SinkApi GetASink GET /omnicore/subscriptions/{subscriptionId}/sinks/{sinkId}
SinkApi GetSinks GET /omnicore/subscriptions/{subscriptionId}/sinks Get All Sinks
VaultApi CreateVaultConfiguration POST /vault/subscriptions/{subscriptionid}/configurations
VaultApi CreateVaultKey POST /vault/subscriptions/{subscriptionid}/encryptionkeys
VaultApi DeleteConfiguration DELETE /vault/subscriptions/{subscriptionid}/configurations/{configid}
VaultApi DeleteVaultKey DELETE /vault/subscriptions/{subscriptionid}/encryptionkeys/{keyid}
VaultApi EnableEncryption POST /vault/subscriptions/{subscriptionid}/encryption
VaultApi GetExports GET /vault/subscriptions/{subscriptionid}/exports
VaultApi GetRegistryData GET /vault/subscriptions/{subscriptionid}/folders
VaultApi GetReplays GET /vault/subscriptions/{subscriptionid}/replays
VaultApi GetVaultAudit GET /vault/subscriptions/{subscriptionid}/audit
VaultApi GetVaultConfigurations GET /vault/subscriptions/{subscriptionid}/configurations
VaultApi GetVaultFiles GET /vault/subscriptions/{subscriptionid}/registry/{registryid}/files
VaultApi GetVaultKeys GET /vault/subscriptions/{subscriptionid}/encryptionkeys
VaultApi GetVaultMetrics GET /vault/subscriptions/{subscriptionid}/metrics
VaultApi GetVaultStatus GET /vault/subscriptions/{subscriptionid}/status
VaultApi SetRetention POST /vault/subscriptions/{subscriptionid}/retention
VaultApi StartExport POST /vault/subscriptions/{subscriptionid}/exports
VaultApi StartReplay POST /vault/subscriptions/{subscriptionid}/replays

Documentation for Models

Documentation for Authorization

bearerAuth

  • Type: Bearer Authentication

apiKey

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header