Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release/3.2.0 #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Hilscher Gesellschaft für Systemautomation mbH
Copyright (c) 2023 Hilscher Gesellschaft für Systemautomation mbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
319 changes: 168 additions & 151 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,151 +1,168 @@
# netFIELD SDK Node

*netFIELD-SDK-Node (node.js version >=10.x.x) and Node samples for REST API.*

## Installation

> Install sdk through 'npm' or download folder in your project

```js
npm install netfield-node-sdk --save
```

> Require 'netfield-sdk-node' in your file
```js
var netField = require('netfield-node-sdk');
```

## Configuration

> Advanced configuration options.
```js
netField.setConfiguration({
version: '1.0.0',
schema: 'https', // http or https
host: 'api.netfield.io',
post: 443,
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
'Authorization': 'your-token'
}
});
```

> Token configuration.
```js
netField.setToken('your-token'); //Done automatically by auth
netField.removeToken('your-token'); //Done automatically by revoke
```

> Helper functions.
```js
const token = netField.getToken();
```
```js
const options = netField.getConfiguration();
```

## Method Usage
> Callbacks (old way)
```js
const params = { email: '[email protected]', password: 'my-password' };

netField.generateUserToken(params, function (error, data) {
if(error){
throw new Error(error.message);
}
});
```

> Promises (new way)
```js
const params = { email: '[email protected]', password: 'my-password' };

netField.generateUserToken(params)
.then(data => {
// do something
})
.catch(error => {
throw new Error(error.message);
});
```

## Resources

1. [Auth](./docs/auth.md)

2. Device
* [Main](./docs/devices/devices.md)
* [Containers](./docs/devices/containers.md)
* [Containers Routes](./docs/devices/routes.md)
* [Notifications](./docs/devices/notifications.md)
* [Remote](./docs/devices/remote.md)

3. Containers
* [Main](./docs/containers/containers.md)
* [Versions](./docs/containers/versions.md)

4. Organisation
* [Main](./docs/organisations/organisations.md)
* [Manifest](./docs/organisations/manifests.md)

5. [Tenants](./docs/tenants.md)

6. [Users](./docs/users.md)

7. [Permissions](./docs/permissions.md)

8. [Roles](./docs/roles.md)

9. [EdgeOs](./docs/edgeos.md)

10. [Keys](./docs/keys.md)

11. [Webhooks](./docs/webhooks.md)

12. Deployments
* [Filters](./docs/deployments/filters.md)
* [Jobs](./docs/deployments/jobs.md)
* [Rollouts](./docs/deployments/rollouts.md)


## Tests
> Setup your testing environment to localmachine and change configuration through method
```js
netField.setConfiguration({
version: '1.0.0',
schema: 'https', // http or https
host: 'api.netfield.io',
post: 443,
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
'Authorization': 'your-token'
}
});
```

> Edit setings in configure file and change enviorment.js to be development
```js
const enviorment = exports.enviorment = {
enviorment: 'development'
}
```

> Run tests
```js
npm run test
```

## Error response
> Error responses are structured in following object
```js
let error = {
error: "Not Found" // Status message,
message: "OrganisationId not found." // Description message
}
```

## License
> See LICENSE file in project.
# netFIELD SDK Node

*netFIELD-SDK-Node (node.js version >=0.6.x) and Node samples for REST API.*

## Installation

> Install sdk through 'npm' or download folder in your project

```js
npm install netfield-node-sdk --save
```

> Require 'netfield-node-sdk' in your file
```js
var netField = require('netfield-node-sdk');
```

## Configuration

> Advanced configuration options.
```js
netField.setConfiguration({
version: '1.0.0',
schema: 'https', // http or https
host: 'api.netfield.io',
post: 443,
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
'Authorization': 'your-token'
}
});
```

> Token configuration.
```js
netField.setToken('your-token'); //Done automatically by auth
netField.removeToken('your-token'); //Done automatically by revoke
```

> Helper functions.
```js
const token = netField.getToken();
```
```js
const options = netField.getConfiguration();
```

## Method Usage
> Callbacks (old way)
```js
const params = { email: '[email protected]', password: 'my-password' };

netField.generateUserToken(params, function (error, data) {
if(error){
throw new Error(error.message);
}

});
```

> Promises (new way)
```js
const params = { email: '[email protected]', password: 'my-password' };

netField.generateUserToken(params)
.then(data => {
// do something
})
.catch(error => {
throw new Error(error.message);
});
```

## Resources

1. [Auth](./docs/auth.md)

2. Device
* [Main](./docs/devices/devices.md)
* [Containers](./docs/devices/containers.md)
* [Containers Routes](./docs/devices/routes.md)
* [Notifications](./docs/devices/notifications.md)
* [Remote](./docs/devices/remote.md)

3. Containers
* [Main](./docs/containers/containers.md)
* [Versions](./docs/containers/versions.md)
* [Sharings](./docs/containers/sharings.md)

4. Organisation
* [Main](./docs/organisations/organisations.md)
* [Manifest](./docs/organisations/manifests.md)

5. [Tenants](./docs/tenants.md)

6. [Users](./docs/users.md)

7. [Permissions](./docs/permissions.md)

8. [Roles](./docs/roles.md)

9. [EdgeOs](./docs/edgeos.md)

10. [Keys](./docs/keys.md)

11. [Webhooks](./docs/webhooks.md)

12. Deployments
* [Filters](./docs/deployments/filters.md)
* [Jobs](./docs/deployments/jobs.md)
* [Rollouts](./docs/deployments/rollouts.md)

13. AppStore
* [Orders](./docs/softwaremodules/appStore.md)
* [Artifacts](./docs/softwaremodules/artifacts.md)
* [Modules](./docs/softwaremodules/modules.md)

14. [Metrics](./docs/metrics.md)

15. [RolesManagement](./docs/rolesManagement.md)

16. [BugReports](./docs/bugreports)

17. [Announcements](./docs/announcements.md)

18. [Resources](./docs/resources.md)


## Tests
> Setup your testing environment to localmachine and change configuration through method
```js
netField.setConfiguration({
version: '1.0.0',
schema: 'https', // http or https
host: 'api.netfield.io',
post: 443,
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
'Authorization': 'your-token'
}
});
```

> Edit setings in configure file and chaneg enviorment.js to be development
```js
const enviorment = exports.enviorment = {
enviorment: 'development'
}
```

> Run tests
```js
npm run test
```

## Error response
> Error responses are structured in following object
```js
let error = {
error: "Not Found" // Status message,
message: "OrganisationId not found." // Description message
}
```

## License
> See LICENSE file in project.
10 changes: 9 additions & 1 deletion build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/index.js.map

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions docs/announcements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Announcements

## Overview
*The resources responsible for managing Announcements*

## Available Resources

1. [netField.announcements.getAll(type, sortBy, sortOrder, [callback])](#getall)

2. [netField.announcements.markAsRead(announcementId, [callback])](#mark)



## Resource Usage

### getall

Get current announcements

```javascript
/**
* @param {string} type optional
* @param {string} sortBy optional
* @param {string} sortOrder optional
* @param {function} callback optional
*/
netField.announcements.getAll(type, sortBy, sortOrder, [callback])
```

### mark

Mark announcement as read

```javascript
/**
* @param {string} announcementId
* @param {function} callback optional
*/
netField.announcements.markAsRead(announcementId, [callback])
```
22 changes: 22 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# API

## Overview
*The resources responsible for getting API information*

## Available Resources

1. [netField.api.getInformation([callback])](#getApiInformation)


## Resource Usage

### getApiInformation

Get API Information

```javascript
/**
* @param {function} callback optional
*/
netField.api.getInformation([callback])
```
Loading