Type env variable endpoints
This commit is contained in:
parent
accd21dd92
commit
dedd5f273a
|
@ -20,7 +20,7 @@ export interface DatasourceEndpoints {
|
|||
tablesFilter?: BuildSchemaFromSourceRequest["tablesFilter"]
|
||||
) => Promise<BuildSchemaFromSourceResponse>
|
||||
createDatasource: (
|
||||
request: CreateDatasourceRequest
|
||||
data: CreateDatasourceRequest
|
||||
) => Promise<CreateDatasourceResponse>
|
||||
updateDatasource: (
|
||||
datasource: Datasource
|
||||
|
@ -65,10 +65,10 @@ export const buildDatasourceEndpoints = (
|
|||
/**
|
||||
* Creates a datasource
|
||||
*/
|
||||
createDatasource: async request => {
|
||||
createDatasource: async data => {
|
||||
return await API.post({
|
||||
url: "/api/datasources",
|
||||
body: request,
|
||||
body: data,
|
||||
})
|
||||
},
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
export const buildEnvironmentVariableEndpoints = API => ({
|
||||
checkEnvironmentVariableStatus: async () => {
|
||||
return await API.get({
|
||||
url: `/api/env/variables/status`,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetches a list of environment variables
|
||||
*/
|
||||
fetchEnvironmentVariables: async () => {
|
||||
return await API.get({
|
||||
url: `/api/env/variables`,
|
||||
json: false,
|
||||
})
|
||||
},
|
||||
|
||||
createEnvironmentVariable: async data => {
|
||||
return await API.post({
|
||||
url: `/api/env/variables`,
|
||||
body: data,
|
||||
})
|
||||
},
|
||||
deleteEnvironmentVariable: async varName => {
|
||||
return await API.delete({
|
||||
url: `/api/env/variables/${varName}`,
|
||||
})
|
||||
},
|
||||
|
||||
updateEnvironmentVariable: async data => {
|
||||
return await API.patch({
|
||||
url: `/api/env/variables/${data.name}`,
|
||||
body: data,
|
||||
})
|
||||
},
|
||||
})
|
|
@ -0,0 +1,53 @@
|
|||
import {
|
||||
CreateEnvironmentVariableRequest,
|
||||
GetEnvironmentVariablesResponse,
|
||||
StatusEnvironmentVariableResponse,
|
||||
UpdateEnvironmentVariableRequest,
|
||||
} from "@budibase/types"
|
||||
import { BaseAPIClient } from "./types"
|
||||
|
||||
export interface EnvironmentVariableEndpoints {
|
||||
checkEnvironmentVariableStatus: () => Promise<StatusEnvironmentVariableResponse>
|
||||
fetchEnvironmentVariables: () => Promise<GetEnvironmentVariablesResponse>
|
||||
createEnvironmentVariable: (
|
||||
data: CreateEnvironmentVariableRequest
|
||||
) => Promise<void>
|
||||
deleteEnvironmentVariable: (name: string) => Promise<void>
|
||||
updateEnvironmentVariable: (
|
||||
name: string,
|
||||
data: UpdateEnvironmentVariableRequest
|
||||
) => Promise<void>
|
||||
}
|
||||
|
||||
export const buildEnvironmentVariableEndpoints = (
|
||||
API: BaseAPIClient
|
||||
): EnvironmentVariableEndpoints => ({
|
||||
checkEnvironmentVariableStatus: async () => {
|
||||
return await API.get({
|
||||
url: `/api/env/variables/status`,
|
||||
})
|
||||
},
|
||||
fetchEnvironmentVariables: async () => {
|
||||
return await API.get({
|
||||
url: `/api/env/variables`,
|
||||
json: false,
|
||||
})
|
||||
},
|
||||
createEnvironmentVariable: async data => {
|
||||
return await API.post({
|
||||
url: `/api/env/variables`,
|
||||
body: data,
|
||||
})
|
||||
},
|
||||
deleteEnvironmentVariable: async name => {
|
||||
return await API.delete({
|
||||
url: `/api/env/variables/${name}`,
|
||||
})
|
||||
},
|
||||
updateEnvironmentVariable: async (name, data) => {
|
||||
return await API.patch({
|
||||
url: `/api/env/variables/${name}`,
|
||||
body: data,
|
||||
})
|
||||
},
|
||||
})
|
|
@ -8,6 +8,7 @@ import { AutomationEndpoints } from "./automations"
|
|||
import { BackupEndpoints } from "./backups"
|
||||
import { ConfigEndpoints } from "./configs"
|
||||
import { DatasourceEndpoints } from "./datasources"
|
||||
import { EnvironmentVariableEndpoints } from "./environmentVariables"
|
||||
|
||||
export enum HTTPMethod {
|
||||
POST = "POST",
|
||||
|
@ -77,4 +78,5 @@ export type APIClient = BaseAPIClient &
|
|||
AutomationEndpoints &
|
||||
BackupEndpoints &
|
||||
ConfigEndpoints &
|
||||
DatasourceEndpoints & { [key: string]: any }
|
||||
DatasourceEndpoints &
|
||||
EnvironmentVariableEndpoints
|
||||
|
|
Loading…
Reference in New Issue