-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(add instance device to main): add instance device
add instance device to main class
- Loading branch information
Showing
2 changed files
with
3 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,25 @@ | ||
import axios, { AxiosInstance } from 'axios' | ||
|
||
import { ConfigParams } from './types/config-params' | ||
import { Device } from './types/device' | ||
import { API_CONFIG } from './config/constants' | ||
import { Devices } from './modules/devices' | ||
|
||
/** | ||
* @class SigfoxApiWrapper | ||
* | ||
*/ | ||
|
||
export default class SigfoxApi { | ||
public rest: AxiosInstance | ||
public customParams: object | ||
public devices: Devices | ||
|
||
/** | ||
* @constructor | ||
* @param {ConfigParams} customParams ID Client Setup | ||
*/ | ||
constructor(ConfigParams: ConfigParams) { | ||
this.rest = axios.create({ baseURL: API_CONFIG.baseURL }) | ||
this.customParams = { | ||
auth: ConfigParams, | ||
API_CONFIG | ||
} | ||
} | ||
|
||
/** | ||
* The endpoint to get Device Info. | ||
* @returns {device} | ||
*/ | ||
public getDeviceInfo(deviceId: string) { | ||
return this.rest | ||
.get<Device>(API_CONFIG.baseURL + `/devices/${deviceId}`, this.customParams) | ||
.then(response => response.data) | ||
.catch(error => error.response.statusText) | ||
this.devices = new Devices(this.customParams) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.