# TrackMeApi.DevicesApi

All URIs are relative to *https://trackme.lk/api/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**deviceDelete**](DevicesApi.md#deviceDelete) | **DELETE** /devices | 
[**devicePost**](DevicesApi.md#devicePost) | **POST** /devices | 
[**devicePut**](DevicesApi.md#devicePut) | **PUT** /devices | 
[**deviceShare**](DevicesApi.md#deviceShare) | **POST** /devices/{deviceId}/share | 
[**deviceStopSharing**](DevicesApi.md#deviceStopSharing) | **DELETE** /devices/{deviceId}/share | 
[**devicesGet**](DevicesApi.md#devicesGet) | **GET** /devices | 


<a name="deviceDelete"></a>
# **deviceDelete**
> deviceDelete(opts)



Removes existing device

### Example
```javascript
var TrackMeApi = require('track_me_api');
var defaultClient = TrackMeApi.ApiClient.default;

// Configure API key authorization: TrackMe-Api-Key
var TrackMe-Api-Key = defaultClient.authentications['TrackMe-Api-Key'];
TrackMe-Api-Key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TrackMe-Api-Key.apiKeyPrefix = 'Token';

var apiInstance = new TrackMeApi.DevicesApi();

var opts = { 
  'id': 789, // Number | identifier of device to be deleted
  'uniqueId': "uniqueId_example" // String | IMEI of device to be deleted
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deviceDelete(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **id** | **Number**| identifier of device to be deleted | [optional] 
 **uniqueId** | **String**| IMEI of device to be deleted | [optional] 

### Return type

null (empty response body)

### Authorization

[TrackMe-Api-Key](../README.md#TrackMe-Api-Key)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="devicePost"></a>
# **devicePost**
> Device devicePost(body)



Register new device

### Example
```javascript
var TrackMeApi = require('track_me_api');
var defaultClient = TrackMeApi.ApiClient.default;

// Configure API key authorization: TrackMe-Api-Key
var TrackMe-Api-Key = defaultClient.authentications['TrackMe-Api-Key'];
TrackMe-Api-Key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TrackMe-Api-Key.apiKeyPrefix = 'Token';

var apiInstance = new TrackMeApi.DevicesApi();

var body = new TrackMeApi.Device(); // Device | user to add to the system


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.devicePost(body, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**Device**](Device.md)| user to add to the system | 

### Return type

[**Device**](Device.md)

### Authorization

[TrackMe-Api-Key](../README.md#TrackMe-Api-Key)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="devicePut"></a>
# **devicePut**
> Device devicePut(body)



Updates existing device

### Example
```javascript
var TrackMeApi = require('track_me_api');
var defaultClient = TrackMeApi.ApiClient.default;

// Configure API key authorization: TrackMe-Api-Key
var TrackMe-Api-Key = defaultClient.authentications['TrackMe-Api-Key'];
TrackMe-Api-Key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TrackMe-Api-Key.apiKeyPrefix = 'Token';

var apiInstance = new TrackMeApi.DevicesApi();

var body = new TrackMeApi.Device(); // Device | user to add to the system


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.devicePut(body, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **body** | [**Device**](Device.md)| user to add to the system | 

### Return type

[**Device**](Device.md)

### Authorization

[TrackMe-Api-Key](../README.md#TrackMe-Api-Key)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="deviceShare"></a>
# **deviceShare**
> deviceShare(deviceId, opts)



Shares existing device to user

### Example
```javascript
var TrackMeApi = require('track_me_api');
var defaultClient = TrackMeApi.ApiClient.default;

// Configure API key authorization: TrackMe-Api-Key
var TrackMe-Api-Key = defaultClient.authentications['TrackMe-Api-Key'];
TrackMe-Api-Key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TrackMe-Api-Key.apiKeyPrefix = 'Token';

var apiInstance = new TrackMeApi.DevicesApi();

var deviceId = 789; // Number | identifier of device to be shared

var opts = { 
  'userId': 789, // Number | identifier of user to share device to
  'userEmail': "userEmail_example", // String | email of user to share device to
  'userName': "userName_example" // String | username of user to share device to
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deviceShare(deviceId, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **deviceId** | **Number**| identifier of device to be shared | 
 **userId** | **Number**| identifier of user to share device to | [optional] 
 **userEmail** | **String**| email of user to share device to | [optional] 
 **userName** | **String**| username of user to share device to | [optional] 

### Return type

null (empty response body)

### Authorization

[TrackMe-Api-Key](../README.md#TrackMe-Api-Key)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="deviceStopSharing"></a>
# **deviceStopSharing**
> deviceStopSharing(deviceId, opts)



Stop sharing existing device to user

### Example
```javascript
var TrackMeApi = require('track_me_api');
var defaultClient = TrackMeApi.ApiClient.default;

// Configure API key authorization: TrackMe-Api-Key
var TrackMe-Api-Key = defaultClient.authentications['TrackMe-Api-Key'];
TrackMe-Api-Key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TrackMe-Api-Key.apiKeyPrefix = 'Token';

var apiInstance = new TrackMeApi.DevicesApi();

var deviceId = 789; // Number | identifier of device

var opts = { 
  'userId': 789, // Number | identifier of user
  'userEmail': "userEmail_example", // String | email of user to share device to
  'userName': "userName_example" // String | username of user to share device to
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deviceStopSharing(deviceId, opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **deviceId** | **Number**| identifier of device | 
 **userId** | **Number**| identifier of user | [optional] 
 **userEmail** | **String**| email of user to share device to | [optional] 
 **userName** | **String**| username of user to share device to | [optional] 

### Return type

null (empty response body)

### Authorization

[TrackMe-Api-Key](../README.md#TrackMe-Api-Key)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

<a name="devicesGet"></a>
# **devicesGet**
> devicesGet()



List all available devices for user

### Example
```javascript
var TrackMeApi = require('track_me_api');
var defaultClient = TrackMeApi.ApiClient.default;

// Configure API key authorization: TrackMe-Api-Key
var TrackMe-Api-Key = defaultClient.authentications['TrackMe-Api-Key'];
TrackMe-Api-Key.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//TrackMe-Api-Key.apiKeyPrefix = 'Token';

var apiInstance = new TrackMeApi.DevicesApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.devicesGet(callback);
```

### Parameters
This endpoint does not need any parameter.

### Return type

null (empty response body)

### Authorization

[TrackMe-Api-Key](../README.md#TrackMe-Api-Key)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: application/json

