Skip to content

Latest commit

 

History

History
293 lines (246 loc) · 19.8 KB

README.md

File metadata and controls

293 lines (246 loc) · 19.8 KB

Go API client for api

The Eliona REST API enables unified access to the resources and data of an Eliona environment.

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: 2.7.3
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://eliona.io

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 api "github.com/eliona-smart-building-assistant/go-eliona-api-client/v2"

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 api.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), api.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 api.ContextOperationServerIndices and api.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to https://name.eliona.io/v2

Class Method HTTP request Description
AgentsAPI GetAgentByClassAndId Get /agents/{agent-class}/{agent-id} Information about an agent
AgentsAPI GetAgentDeviceById Get /agent-devices/{agent-class}/{agent-device-id} Information about agent device
AgentsAPI GetAgentDeviceMappingById Get /agent-device-mappings/{agent-class}/{agent-device-mapping-id} Information about agent device mapping
AgentsAPI GetAgentDeviceMappingsByDeviceId Get /agent-devices/{agent-class}/{agent-device-id}/mappings Information about agent device mappings
AgentsAPI GetAgentDevicesByAgentId Get /agents/{agent-class}/{agent-id}/devices Information about agent devices
AgentsAPI GetAgents Get /agents Information about agents
AgentsAPI GetAgentsByClass Get /agents/{agent-class} Information about agents for a specific class
AgentsAPI PostAgentByClass Post /agents/{agent-class} Create an agent
AgentsAPI PostAgentDeviceByAgentId Post /agents/{agent-class}/{agent-id}/devices Create an agent device
AgentsAPI PostAgentDeviceMappingByDeviceId Post /agent-devices/{agent-class}/{agent-device-id}/mappings Create an agent device mapping
AgentsAPI PutAgentByClass Put /agents/{agent-class} Create or update an agent
AgentsAPI PutAgentByClassAndId Put /agents/{agent-class}/{agent-id} Update an agent
AgentsAPI PutAgentDeviceByAgentId Put /agents/{agent-class}/{agent-id}/devices Create or update an agent device
AgentsAPI PutAgentDeviceById Put /agent-devices/{agent-class}/{agent-device-id} Update an agent device
AgentsAPI PutAgentDeviceMappingByDeviceId Put /agent-devices/{agent-class}/{agent-device-id}/mappings Create or update an agent device mapping
AgentsAPI PutAgentDeviceMappingById Put /agent-device-mappings/{agent-class}/{agent-device-mapping-id} Update an agent device mapping
AggregationsAPI DeleteAggregationById Delete /aggregations/{aggregation-id} Delete an aggregation
AggregationsAPI GetAggregationById Get /aggregations/{aggregation-id} Information about an aggregation
AggregationsAPI GetAggregations Get /aggregations Information about aggregations
AggregationsAPI PostAggregation Post /aggregations Creates an aggregation
AggregationsAPI PutAggregation Put /aggregations Creates or updates an aggregation
AggregationsAPI PutAggregationById Put /aggregations/{aggregation-id} Updates an aggregation
AlarmRulesAPI DeleteAlarmRuleById Delete /alarm-rules/{alarm-rule-id} Delete an alarm rule
AlarmRulesAPI GetAlarmRuleById Get /alarm-rules/{alarm-rule-id} Information about an alarm rule
AlarmRulesAPI GetAlarmRules Get /alarm-rules Information about alarm rules
AlarmRulesAPI PostAlarmRule Post /alarm-rules Create an alarm rule
AlarmRulesAPI PutAlarmRule Put /alarm-rules Create or update an alarm rule
AlarmRulesAPI PutAlarmRuleById Put /alarm-rules/{alarm-rule-id} Update an alarm rule
AlarmsAPI DeleteAlarmById Delete /alarms/{alarm-rule-id} Removes an alarm
AlarmsAPI GetAlarmById Get /alarms/{alarm-rule-id} Information about alarm
AlarmsAPI GetAlarmHistoryById Get /alarms-history/{alarm-rule-id} Information about alarm history
AlarmsAPI GetAlarms Get /alarms Information about alarms
AlarmsAPI GetAlarmsHistory Get /alarms-history Information about alarms history
AlarmsAPI GetHighestAlarms Get /alarms-highest Information about most prioritized alarms
AlarmsAPI ListenAlarm Get /alarm-listener WebSocket connection for alarm changes
AlarmsAPI PatchAlarmById Patch /alarms/{alarm-rule-id} Update alarm
AlarmsAPI PutAlarm Put /alarms Create or update an alarm
AppsAPI GetAppByName Get /apps/{app-name} Information about an app
AppsAPI GetPatchByName Get /apps/{app-name}/patches/{patch-name} Information about a patch for an app
AppsAPI PatchAppByName Patch /apps/{app-name} Update an app
AppsAPI PatchPatchByName Patch /apps/{app-name}/patches/{patch-name} Updates a patch
AssetTypesAPI DeleteAssetTypeByName Delete /asset-types/{asset-type-name} Delete an asset type
AssetTypesAPI GetAssetTypeByName Get /asset-types/{asset-type-name} Information about an asset type
AssetTypesAPI GetAssetTypes Get /asset-types List of asset types
AssetTypesAPI PostAssetType Post /asset-types Create an asset type
AssetTypesAPI PostAssetTypeAttribute Post /asset-types/{asset-type-name}/attributes Create asset type attribute
AssetTypesAPI PutAssetType Put /asset-types Create or update an asset type
AssetTypesAPI PutAssetTypeAttribute Put /asset-types/{asset-type-name}/attributes Create or update an asset type attribute
AssetTypesAPI PutAssetTypeByName Put /asset-types/{asset-type-name} Update an asset type
AssetsAPI DeleteAssetById Delete /assets/{asset-id} Delete an asset
AssetsAPI DeleteBulkAssets Delete /assets-bulk Delete a list of assets
AssetsAPI DryRunDeleteBulkAssets Delete /assets-bulk/dry-run Dry-run for deleting a list of assets
AssetsAPI DryRunPostBulkAssets Post /assets-bulk/dry-run Dry-run for creating a list of assets
AssetsAPI DryRunPutBulkAssets Put /assets-bulk/dry-run Dry-run for creating or updating a list of assets
AssetsAPI GetAssetById Get /assets/{asset-id} Information about an asset
AssetsAPI GetAssets Get /assets Information about assets
AssetsAPI GetAttributeDisplay Get /attribute-display How attributes are displayed
AssetsAPI ListenAsset Get /asset-listener WebSocket connection for asset changes
AssetsAPI PostAsset Post /assets Create an asset
AssetsAPI PostBulkAssets Post /assets-bulk Create a list of assets
AssetsAPI PutAsset Put /assets Create or update an asset
AssetsAPI PutAssetById Put /assets/{asset-id} Update an asset
AssetsAPI PutAttributeDisplay Put /attribute-display Create or update how attributes are displayed
AssetsAPI PutBulkAssets Put /assets-bulk Create or update a list of assets
CalculationRulesAPI DeleteCalculationRuleById Delete /calculation-rules/{calculation-rule-id} Delete a calculation rule
CalculationRulesAPI GetCalculationRuleById Get /calculation-rules/{calculation-rule-id} Information about a calculation rules rule
CalculationRulesAPI GetCalculationRules Get /calculation-rules Information about calculation rules
CalculationRulesAPI PutCalculationRule Put /calculation-rules Creates or updates a calculation rule
CalculationRulesAPI PutCalculationRuleById Put /calculation-rules/{calculation-rule-id} Update a calculation rule
CommunicationAPI GetMessageReceiptById Get /message-receipts/{message-id} Information about a message
CommunicationAPI PostMail Post /send-mail Send e-mail
CommunicationAPI PostNotification Post /send-notification Send notification
DashboardsAPI GetDashboardById Get /dashboards/{dashboard-id} Information about a dashboard
DashboardsAPI GetDashboards Get /dashboards Information about dashboards
DashboardsAPI PostDashboard Post /dashboards Creates a new dashboard
DataAPI GetData Get /data Gets all data
DataAPI GetDataAggregated Get /data-aggregated Get aggregated data
DataAPI GetDataTrends Get /data-trends Get trend of historical data
DataAPI ListenData Get /data-listener WebSocket connection for asset data changes
DataAPI PutBulkData Put /data-bulk Create or update multiple asset data
DataAPI PutData Put /data Create or update asset data
NodesAPI GetNodeByIdent Get /nodes/{node-ident} Information about a node
NodesAPI GetNodes Get /nodes Information about nodes
NodesAPI PostNode Post /nodes Create a node
NodesAPI PutNode Put /nodes Create or update a node
NodesAPI PutNodeByIdent Put /nodes/{node-ident} Update a node
ProjectsAPI GetProjectById Get /projects/{project-id} Information about a project
ProjectsAPI GetProjects Get /projects Information about projects
ProjectsAPI PutProject Put /projects Create or update a project
QRCodesAPI GetQrCodeByAssetId Get /qr-codes/assets/{asset-id} QR code for assets
TagsAPI GetTagByName Get /tags/{tag-name} Information about a tag
TagsAPI GetTags Get /tags Information about tags
TagsAPI PutTag Put /tags Create or update a tag
UsersAPI GetUserById Get /users/{user-id} Information about an user
UsersAPI GetUsers Get /users Information about users
UsersAPI PutUser Put /users Create or update an user
VersionAPI GetOpenAPI Get /version/openapi.json OpenAPI specification for this API version
VersionAPI GetVersion Get /version Version of the API
WidgetsAPI GetDashboardWidgets Get /dashboards/{dashboard-id}/widgets Information about widgets on dashboard
WidgetsAPI PostDashboardWidget Post /dashboards/{dashboard-id}/widgets Adds widget to dashboard
WidgetsTypesAPI DeleteWidgetTypeByName Delete /widget-types/{widget-type-name} Delete a widget type
WidgetsTypesAPI GetWidgetTypeByName Get /widget-types/{widget-type-name} Information about a widget type
WidgetsTypesAPI GetWidgetTypes Get /widget-types List of widget types
WidgetsTypesAPI PostWidgetType Post /widget-types Create a widget type
WidgetsTypesAPI PutWidgetType Put /widget-types Create or update a widget type
WidgetsTypesAPI PutWidgetTypeByName Put /widget-types/{widget-type-name} Update a widget type

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKeyAuth

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

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

Example

auth := context.WithValue(
		context.Background(),
		api.ContextAPIKeys,
		map[string]api.APIKey{
			"X-API-Key": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

BearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), api.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

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

hello@eliona.io