Package com.telenordigital.nbiot
Class Client
- java.lang.Object
-
- com.telenordigital.nbiot.Client
-
public class Client extends Object
This is the client for the Telenor NB-IoT REST API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceClient.OutputHandler
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collectioncollection(String collectionID)Retrieve a collection.OutputStreamcollectionOutput(String collectionID, Client.OutputHandler handler)Receive data messages sent by all devices in a collection.Collection[]collections()Retrieve all collections the user has access to.CollectioncreateCollection(Collection template)Create a new collection.DevicecreateDevice(String collectionID, Device template)Create a device.OutputcreateOutput(String collectionID, Output template)Create an output.TeamcreateTeam(Team template)Create a new team.voiddeleteCollection(String collectionID)Delete a collection.voiddeleteDevice(String collectionID, String deviceID)Delete a device.voiddeleteOutput(String collectionID, String outputID)Delete an output.voiddeleteTeam(String teamID)Delete a team.Devicedevice(String collectionID, String deviceID)Retrieve a device.OutputStreamdeviceOutput(String collectionID, String deviceID, Client.OutputHandler handler)Receive data messages sent by a device.Device[]devices(String collectionID)Retrieve all devices in a collection.Outputoutput(String collectionID, String outputID)Retrieve an output.Output[]outputs(String collectionID)Retrieve all outputs in a collection.Teamteam(String teamID)Retrieve a team.Team[]teams()Retrieve all teams the user has access to.CollectionupdateCollection(Collection collection)Update a collection.DeviceupdateDevice(String collectionID, Device device)Update a device.OutputupdateOutput(String collectionID, Output output)Update an output.TeamupdateTeam(Team team)Update a team.
-
-
-
Constructor Detail
-
Client
public Client() throws ClientExceptionCreate a new Telenor NB-IoT client using the configuration. The configuration can either be set by adding a ${HOME}/.telenor-nbiot file or by setting the environment variables TELENOR_NBIOT_ADDRESS and TELENOR_NBIOT_TOKEN. The environment variables override the configuration file.- Throws:
ClientException
-
-
Method Detail
-
team
public Team team(String teamID) throws ClientException
Retrieve a team.- Throws:
ClientException
-
teams
public Team[] teams() throws ClientException
Retrieve all teams the user has access to.- Throws:
ClientException
-
createTeam
public Team createTeam(Team template) throws ClientException
Create a new team.- Throws:
ClientException
-
updateTeam
public Team updateTeam(Team team) throws ClientException
Update a team.- Throws:
ClientException
-
deleteTeam
public void deleteTeam(String teamID) throws ClientException
Delete a team.- Throws:
ClientException
-
collection
public Collection collection(String collectionID) throws ClientException
Retrieve a collection.- Throws:
ClientException
-
collections
public Collection[] collections() throws ClientException
Retrieve all collections the user has access to.- Throws:
ClientException
-
createCollection
public Collection createCollection(Collection template) throws ClientException
Create a new collection.- Throws:
ClientException
-
updateCollection
public Collection updateCollection(Collection collection) throws ClientException
Update a collection.- Throws:
ClientException
-
deleteCollection
public void deleteCollection(String collectionID) throws ClientException
Delete a collection.- Throws:
ClientException
-
device
public Device device(String collectionID, String deviceID) throws ClientException
Retrieve a device.- Throws:
ClientException
-
devices
public Device[] devices(String collectionID) throws ClientException
Retrieve all devices in a collection.- Throws:
ClientException
-
createDevice
public Device createDevice(String collectionID, Device template) throws ClientException
Create a device.- Throws:
ClientException
-
updateDevice
public Device updateDevice(String collectionID, Device device) throws ClientException
Update a device.- Throws:
ClientException
-
deleteDevice
public void deleteDevice(String collectionID, String deviceID) throws ClientException
Delete a device.- Throws:
ClientException
-
output
public Output output(String collectionID, String outputID) throws ClientException
Retrieve an output.- Throws:
ClientException
-
outputs
public Output[] outputs(String collectionID) throws ClientException
Retrieve all outputs in a collection.- Throws:
ClientException
-
createOutput
public Output createOutput(String collectionID, Output template) throws ClientException
Create an output.- Throws:
ClientException
-
updateOutput
public Output updateOutput(String collectionID, Output output) throws ClientException
Update an output.- Throws:
ClientException
-
deleteOutput
public void deleteOutput(String collectionID, String outputID) throws ClientException
Delete an output.- Throws:
ClientException
-
collectionOutput
public OutputStream collectionOutput(String collectionID, Client.OutputHandler handler) throws ClientException
Receive data messages sent by all devices in a collection.- Throws:
ClientException
-
deviceOutput
public OutputStream deviceOutput(String collectionID, String deviceID, Client.OutputHandler handler) throws ClientException
Receive data messages sent by a device.- Throws:
ClientException
-
-