You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.1 KiB

import httpClient from '../lib/httpClient'
import { SendSMSRequestPayload } from './types'
class GatewayService {
async generateApiKey() {
const res = await httpClient.post(`/auth/api-keys`, {})
return res.data.data
}
async getApiKeyList() {
const res = await httpClient.get(`/auth/api-keys`)
return res.data.data
}
async deleteApiKey(id: string) {
const res = await httpClient.delete(`/auth/api-keys/${id}`)
return res.data.data
}
async getDeviceList() {
const res = await httpClient.get(`/gateway/devices`)
return res.data.data
}
async deleteDevice(id: string) {
const res = await httpClient.delete(`/gateway/devices/${id}`)
return res.data.data
}
async sendSMS(deviceId: string, payload: SendSMSRequestPayload) {
const res = await httpClient.post(
`/gateway/devices/${deviceId}/sendSMS`,
payload
)
return res.data.data
}
async getReceivedSMSList(deviceId: string) {
const res = await httpClient.get(`/gateway/devices/${deviceId}/getReceivedSMS`)
return res.data.data
}
}
export const gatewayService = new GatewayService()