1
0
Fork 0
mirror of synced 2024-06-02 10:34:40 +12:00
budibase/qa-core/src/config/internal-api/TestConfiguration/applications.ts
2022-09-26 16:54:14 +01:00

28 lines
727 B
TypeScript

import {
Application,
} from "@budibase/server/api/controllers/public/mapping/types"
import { Response } from "node-fetch"
import InternalAPIClient from "./InternalAPIClient"
export default class AppApi {
api: InternalAPIClient
constructor(apiClient: InternalAPIClient) {
this.api = apiClient
}
async create(
body: any
): Promise<[Response, Application]> {
const response = await this.api.post(`/applications`, { body })
const json = await response.json()
return [response, json.data]
}
async read(id: string): Promise<[Response, Application]> {
const response = await this.api.get(`/applications/${id}`)
const json = await response.json()
return [response, json.data]
}
}