Skip to content

Commit

Permalink
feat(add instance device to main): add instance device
Browse files Browse the repository at this point in the history
add instance device to main class
  • Loading branch information
septk committed May 5, 2019
1 parent fedff0e commit a91d7f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
19 changes: 3 additions & 16 deletions src/sigfox-js.ts
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)
}
}
3 changes: 0 additions & 3 deletions test/__snapshots__/sigfox-js.test.ts.snap

This file was deleted.

0 comments on commit a91d7f1

Please sign in to comment.