The OpenAPI definition for the Notehub.io API.
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: 1.2.0
- Package version: 1.0.0
- Generator version: 7.17.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://dev.blues.io/support/
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/contextPut the package under your project folder and add the following in import:
import notehub "github.com/blues/notehub-go"To use a proxy, set the environment variable HTTP_PROXY:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")When the openapi.yaml file is updated in the original Notehub repo which this library supports, the updated file is copied over into a new feature branch in this repo through the magic of GitHub Actions.
When this occurs, it's time to regenerate the notehub-go Go package based on the newly updated openapi.yaml.
To regenerate the notehub-go package:
-
Git clone the repo from GitHub.
git clone git@github.com:blues/notehub-go.git
-
Check out the newly created remote branch from GitHub locally. (It will be named something like feat-XYZ.)
-
At the root of the project, run the following script command from your terminal:
./scripts.sh generate_and_format
This command will run the following subcommands:
- remove_deprecated_parameters - This makes a copy of the openapi.yaml file named openapi_filtered.yaml which has removed any query parameters marked as deprecated from the openapi.yaml file. Removing these now deprecated params ensures the generated SDK docs and sample code is clear and up to date, and no longer has potentially confusing artifacts to trip up users.
- generate_package - This kicks off the OpenAPI Generator tool to generate a new copy of the library (using the newly updated openapi_filtered.yaml file).
- format_code - This runs gofmt and goimports on the Go files, and Prettier on the markdown docs within the docs/ directory to make them look nice.
- init_go_module - This initializes the Go module if it doesn't exist.
- tidy_go_dependencies - This tidies up the Go module dependencies.
Once all of these steps have successfully run, you'll be ready to merge the change to main and publish a new release.
Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.
For using other server than the one defined on index 0 set context value notehub.ContextServerIndex of type int.
ctx := context.WithValue(context.Background(), notehub.ContextServerIndex, 1)Templated server URL is formatted using default variables from configuration or from context value notehub.ContextServerVariables of type map[string]string.
ctx := context.WithValue(context.Background(), notehub.ContextServerVariables, map[string]string{
"basePath": "v2",
})Note, enum values are always validated and all unused variables are silently ignored.
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 notehub.ContextOperationServerIndices and notehub.ContextOperationServerVariables context maps.
ctx := context.WithValue(context.Background(), notehub.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), notehub.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})All URIs are relative to https://api.notefile.net
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AlertAPI | GetAlerts | Get /v1/projects/{projectOrProductUID}/alerts | |
| AuthorizationAPI | Login | Post /auth/login | |
| AuthorizationAPI | OAuth2ClientCredentials | Post /oauth2/token | Issue an OAuth 2.0 access token (Client Credentials) |
| BillingAccountAPI | GetBillingAccounts | Get /v1/billing-accounts | |
| DeviceAPI | AddDbNote | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | |
| DeviceAPI | AddQiNote | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID} | |
| DeviceAPI | DeleteDbNote | Delete /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | |
| DeviceAPI | DeleteDevice | Delete /v1/projects/{projectOrProductUID}/devices/{deviceUID} | |
| DeviceAPI | DeleteDeviceEnvironmentVariable | Delete /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables/{key} | |
| DeviceAPI | DeleteNotefiles | Delete /v1/projects/{projectOrProductUID}/devices/{deviceUID}/files | |
| DeviceAPI | DisableDevice | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/disable | |
| DeviceAPI | DisableDeviceConnectivityAssurance | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/disable-connectivity-assurance | |
| DeviceAPI | EnableDevice | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/enable | |
| DeviceAPI | EnableDeviceConnectivityAssurance | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/enable-connectivity-assurance | |
| DeviceAPI | GetDbNote | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | |
| DeviceAPI | GetDevice | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID} | |
| DeviceAPI | GetDeviceEnvironmentHierarchy | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_hierarchy | Get environment variable hierarchy for a device |
| DeviceAPI | GetDeviceEnvironmentVariables | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables | |
| DeviceAPI | GetDeviceEnvironmentVariablesByPin | Get /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin | |
| DeviceAPI | GetDeviceHealthLog | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/health-log | |
| DeviceAPI | GetDeviceLatestEvents | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/latest | |
| DeviceAPI | GetDevicePlans | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/plans | |
| DeviceAPI | GetDevicePublicKey | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/public-key | |
| DeviceAPI | GetDevicePublicKeys | Get /v1/projects/{projectOrProductUID}/devices/public-keys | |
| DeviceAPI | GetDeviceSessions | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/sessions | |
| DeviceAPI | GetDevices | Get /v1/projects/{projectOrProductUID}/devices | |
| DeviceAPI | GetFleetDevices | Get /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/devices | |
| DeviceAPI | GetNotefile | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/changes | |
| DeviceAPI | ListNotefiles | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/files/changes | |
| DeviceAPI | ListPendingNotefiles | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/files/changes/pending | |
| DeviceAPI | ProvisionDevice | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/provision | |
| DeviceAPI | SetDeviceEnvironmentVariables | Put /v1/projects/{projectOrProductUID}/devices/{deviceUID}/environment_variables | |
| DeviceAPI | SetDeviceEnvironmentVariablesByPin | Put /v1/products/{productUID}/devices/{deviceUID}/environment_variables_with_pin | |
| DeviceAPI | SignalDevice | Post /v1/projects/{projectOrProductUID}/devices/{deviceUID}/signal | |
| DeviceAPI | UpdateDbNote | Put /v1/projects/{projectOrProductUID}/devices/{deviceUID}/notes/{notefileID}/{noteID} | |
| EventAPI | GetEvents | Get /v1/projects/{projectOrProductUID}/events | |
| EventAPI | GetEventsByCursor | Get /v1/projects/{projectOrProductUID}/events-cursor | |
| EventAPI | GetFleetEvents | Get /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/events | |
| EventAPI | GetFleetEventsByCursor | Get /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/events-cursor | |
| EventAPI | GetRouteLogsByEvent | Get /v1/projects/{projectOrProductUID}/events/{eventUID}/route-logs | |
| ExternalDevicesAPI | CreateEventExtDevice | Post /v1/products/{productUID}/ext-devices/{deviceUID}/event | |
| ExternalDevicesAPI | ExtDeviceSessionClose | Post /v1/products/{productUID}/ext-devices/{deviceUID}/session/close | |
| ExternalDevicesAPI | ExtDeviceSessionOpen | Post /v1/products/{productUID}/ext-devices/{deviceUID}/session/open | |
| MonitorAPI | CreateMonitor | Post /v1/projects/{projectOrProductUID}/monitors | |
| MonitorAPI | DeleteMonitor | Delete /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | |
| MonitorAPI | GetMonitor | Get /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | |
| MonitorAPI | GetMonitors | Get /v1/projects/{projectOrProductUID}/monitors | |
| MonitorAPI | UpdateMonitor | Put /v1/projects/{projectOrProductUID}/monitors/{monitorUID} | |
| ProjectAPI | AddDeviceToFleets | Put /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | |
| ProjectAPI | CloneProject | Post /v1/projects/{projectOrProductUID}/clone | |
| ProjectAPI | CreateFleet | Post /v1/projects/{projectOrProductUID}/fleets | |
| ProjectAPI | CreateProduct | Post /v1/projects/{projectOrProductUID}/products | |
| ProjectAPI | CreateProject | Post /v1/projects | |
| ProjectAPI | DeleteDeviceFromFleets | Delete /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | |
| ProjectAPI | DeleteFleet | Delete /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | |
| ProjectAPI | DeleteFleetEnvironmentVariable | Delete /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables/{key} | |
| ProjectAPI | DeleteProduct | Delete /v1/projects/{projectOrProductUID}/products/{productUID} | |
| ProjectAPI | DeleteProject | Delete /v1/projects/{projectOrProductUID} | |
| ProjectAPI | DeleteProjectEnvironmentVariable | Delete /v1/projects/{projectOrProductUID}/environment_variables/{key} | |
| ProjectAPI | DisableGlobalEventTransformation | Post /v1/projects/{projectOrProductUID}/global-transformation/disable | |
| ProjectAPI | EnableGlobalEventTransformation | Post /v1/projects/{projectOrProductUID}/global-transformation/enable | |
| ProjectAPI | GetDeviceDfuHistory | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/history | |
| ProjectAPI | GetDeviceDfuStatus | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/dfu/{firmwareType}/status | |
| ProjectAPI | GetDeviceFleets | Get /v1/projects/{projectOrProductUID}/devices/{deviceUID}/fleets | |
| ProjectAPI | GetDevicesDfuHistory | Get /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/history | |
| ProjectAPI | GetDevicesDfuStatus | Get /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/status | |
| ProjectAPI | GetFirmwareInfo | Get /v1/projects/{projectOrProductUID}/firmware | |
| ProjectAPI | GetFleet | Get /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | |
| ProjectAPI | GetFleetEnvironmentHierarchy | Get /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_hierarchy | Get environment variable hierarchy for a device |
| ProjectAPI | GetFleetEnvironmentVariables | Get /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables | |
| ProjectAPI | GetFleets | Get /v1/projects/{projectOrProductUID}/fleets | |
| ProjectAPI | GetNotefileSchemas | Get /v1/projects/{projectOrProductUID}/schemas | Get variable format for a notefile |
| ProjectAPI | GetProducts | Get /v1/projects/{projectOrProductUID}/products | |
| ProjectAPI | GetProject | Get /v1/projects/{projectOrProductUID} | |
| ProjectAPI | GetProjectByProduct | Get /v1/products/{productUID}/project | |
| ProjectAPI | GetProjectEnvironmentHierarchy | Get /v1/projects/{projectOrProductUID}/environment_hierarchy | Get environment variable hierarchy for a device |
| ProjectAPI | GetProjectEnvironmentVariables | Get /v1/projects/{projectOrProductUID}/environment_variables | |
| ProjectAPI | GetProjectMembers | Get /v1/projects/{projectOrProductUID}/members | |
| ProjectAPI | GetProjects | Get /v1/projects | |
| ProjectAPI | PerformDfuAction | Post /v1/projects/{projectOrProductUID}/dfu/{firmwareType}/{action} | |
| ProjectAPI | SetFleetEnvironmentVariables | Put /v1/projects/{projectOrProductUID}/fleets/{fleetUID}/environment_variables | |
| ProjectAPI | SetGlobalEventTransformation | Post /v1/projects/{projectOrProductUID}/global-transformation | |
| ProjectAPI | SetProjectEnvironmentVariables | Put /v1/projects/{projectOrProductUID}/environment_variables | |
| ProjectAPI | UpdateFleet | Put /v1/projects/{projectOrProductUID}/fleets/{fleetUID} | |
| ProjectAPI | UploadFirmware | Put /v1/projects/{projectOrProductUID}/firmware/{firmwareType}/{filename} | |
| RouteAPI | CreateRoute | Post /v1/projects/{projectOrProductUID}/routes | |
| RouteAPI | DeleteRoute | Delete /v1/projects/{projectOrProductUID}/routes/{routeUID} | |
| RouteAPI | GetRoute | Get /v1/projects/{projectOrProductUID}/routes/{routeUID} | |
| RouteAPI | GetRouteLogsByRoute | Get /v1/projects/{projectOrProductUID}/routes/{routeUID}/route-logs | |
| RouteAPI | GetRoutes | Get /v1/projects/{projectOrProductUID}/routes | |
| RouteAPI | UpdateRoute | Put /v1/projects/{projectOrProductUID}/routes/{routeUID} | |
| UsageAPI | GetDataUsage | Get /v1/projects/{projectOrProductUID}/usage/data | |
| UsageAPI | GetEventsUsage | Get /v1/projects/{projectOrProductUID}/usage/events | |
| UsageAPI | GetSessionsUsage | Get /v1/projects/{projectOrProductUID}/usage/sessions | |
| WebhookAPI | CreateWebhook | Post /v1/projects/{projectOrProductUID}/webhooks/{webhookUID} | |
| WebhookAPI | DeleteWebhook | Delete /v1/projects/{projectOrProductUID}/webhooks/{webhookUID} | |
| WebhookAPI | GetWebhook | Get /v1/projects/{projectOrProductUID}/webhooks/{webhookUID} | |
| WebhookAPI | GetWebhooks | Get /v1/projects/{projectOrProductUID}/webhooks | |
| WebhookAPI | UpdateWebhook | Put /v1/projects/{projectOrProductUID}/webhooks/{webhookUID} |
- AddDeviceToFleetsRequest
- Alert
- AlertDataInner
- AlertNotificationsInner
- AwsRoute
- AzureRoute
- BillingAccount
- BillingAccountRole
- BlynkRoute
- Body
- CellularPlan
- CloneProjectRequest
- Contact
- CreateFleetRequest
- CreateMonitor
- CreateProductRequest
- CreateProjectRequest
- CreateUpdateRepository
- CurrentFirmware
- DFUEnv
- DFUState
- DataField
- DataSetField
- DataUsage
- DatacakeRoute
- DeleteDeviceFromFleetsRequest
- DeleteNotefilesRequest
- Device
- DeviceDfuHistory
- DeviceDfuHistoryCurrent
- DeviceDfuHistoryPage
- DeviceDfuStateMachine
- DeviceDfuStateMachineNode
- DeviceDfuStatus
- DeviceDfuStatusPage
- DeviceSession
- DeviceTowerInfo
- DeviceUsage
- DfuActionRequest
- EmailNotification
- EnvTreeJsonNode
- EnvVar
- EnvironmentVariables
- Error
- Event
- Filter
- Firmware
- FirmwareInfo
- Fleet
- FleetConnectivityAssurance
- GetAlerts200Response
- GetBillingAccounts200Response
- GetDataUsage200Response
- GetDataUsage200ResponseDataInner
- GetDbNote200Response
- GetDeviceEnvironmentVariablesByPin200Response
- GetDeviceFleets200Response
- GetDeviceHealthLog200Response
- GetDeviceHealthLog200ResponseHealthLogInner
- GetDeviceLatestEvents200Response
- GetDevicePlans200Response
- GetDevicePublicKey200Response
- GetDevicePublicKeys200Response
- GetDevicePublicKeys200ResponseDevicePublicKeysInner
- GetDeviceSessions200Response
- GetDevices200Response
- GetEvents200Response
- GetEventsByCursor200Response
- GetNotefile200Response
- GetProducts200Response
- GetProjectMembers200Response
- GetProjects200Response
- GetSessionsUsage200Response
- GetWebhooks200Response
- GoogleRoute
- HttpRoute
- InlineObject
- InlineObject1
- ListNotefiles200Response
- ListPendingNotefiles200Response
- Location
- Login200Response
- LoginRequest
- Monitor
- MonitorAlertRoutesInner
- MqttRoute
- Note
- NotefileSchema
- NotehubRoute
- NotehubRouteSummary
- OAuth2Error
- OAuth2TokenResponse
- PersonalAccessToken
- PersonalAccessTokenCreatedBy
- PersonalAccessTokenInfo
- PersonalAccessTokenSecret
- Product
- Project
- ProjectMember
- ProvisionDeviceRequest
- ProxyRoute
- QubitroRoute
- RadRoute
- Repository
- Role
- RouteLog
- RouteTransformSettings
- S3ArchiveRoute
- SatellitePlan
- SchemaProperty
- SignalDevice200Response
- SimUsage
- SlackBearerNotification
- SlackRoute
- SlackWebHookNotification
- SnowflakeRoute
- SnowpipeStreamingRoute
- ThingworxRoute
- TowerLocation
- TwilioRoute
- UpdateFleetRequest
- UploadMetadata
- UsageData
- UsageEventsData
- UsageEventsResponse
- UsageRouteLogsData
- UsageSessionsData
- UserDfuStateMachine
- UserDfuStateMachineStatus
- UserFirmwareInfo
- WebhookSettings
Authentication schemes defined for the API:
- Type: HTTP Bearer token authentication
Example
auth := context.WithValue(context.Background(), notehub.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)- Type: API key
- API key parameter name: X-Auth-Token
- Location: HTTP header
Note, each API key must be added to a map of map[string]APIKey where the key is: pin and passed in as the auth context for each request.
Example
auth := context.WithValue(
context.Background(),
notehub.ContextAPIKeys,
map[string]notehub.APIKey{
"pin": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)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:
PtrBoolPtrIntPtrInt32PtrInt64PtrFloatPtrFloat32PtrFloat64PtrStringPtrTime