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.
34 lines
841 B
34 lines
841 B
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 sendSMS(deviceId: string, payload: SendSMSRequestPayload) {
|
|
const res = await httpClient.post(
|
|
`/gateway/devices/${deviceId}/sendSMS`,
|
|
payload
|
|
)
|
|
return res.data.data
|
|
}
|
|
}
|
|
|
|
export const gatewayService = new GatewayService()
|