Update more endpoints with new response messages
This commit is contained in:
parent
22d8994431
commit
4b499ca487
|
@ -1,11 +1,15 @@
|
|||
import { BaseAPIClient } from "./types"
|
||||
import { AnalyticsEnabledResponse, AnalyticsPingRequest } from "@budibase/types"
|
||||
import {
|
||||
AnalyticsEnabledResponse,
|
||||
AnalyticsPingRequest,
|
||||
AnalyticsPingResponse,
|
||||
} from "@budibase/types"
|
||||
|
||||
export interface AnalyticsEndpoints {
|
||||
getAnalyticsStatus: () => Promise<AnalyticsEnabledResponse>
|
||||
analyticsPing: (
|
||||
payload: Omit<AnalyticsPingRequest, "timezone">
|
||||
) => Promise<void>
|
||||
) => Promise<AnalyticsPingResponse>
|
||||
}
|
||||
|
||||
export const buildAnalyticsEndpoints = (
|
||||
|
@ -24,13 +28,12 @@ export const buildAnalyticsEndpoints = (
|
|||
* Notifies analytics of a certain environment
|
||||
*/
|
||||
analyticsPing: async request => {
|
||||
return await API.post<AnalyticsPingRequest>({
|
||||
return await API.post<AnalyticsPingRequest, AnalyticsPingResponse>({
|
||||
url: "/api/bbtel/ping",
|
||||
body: {
|
||||
...request,
|
||||
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||
},
|
||||
parseResponse: () => undefined,
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import {
|
||||
CreateEnvironmentVariableRequest,
|
||||
CreateEnvironmentVariableResponse,
|
||||
DeleteEnvironmentVariablesResponse,
|
||||
GetEnvironmentVariablesResponse,
|
||||
StatusEnvironmentVariableResponse,
|
||||
UpdateEnvironmentVariableRequest,
|
||||
UpdateEnvironmentVariableResponse,
|
||||
} from "@budibase/types"
|
||||
import { BaseAPIClient } from "./types"
|
||||
|
||||
|
@ -11,12 +14,14 @@ export interface EnvironmentVariableEndpoints {
|
|||
fetchEnvironmentVariables: () => Promise<GetEnvironmentVariablesResponse>
|
||||
createEnvironmentVariable: (
|
||||
data: CreateEnvironmentVariableRequest
|
||||
) => Promise<void>
|
||||
deleteEnvironmentVariable: (name: string) => Promise<void>
|
||||
) => Promise<CreateEnvironmentVariableResponse>
|
||||
deleteEnvironmentVariable: (
|
||||
name: string
|
||||
) => Promise<DeleteEnvironmentVariablesResponse>
|
||||
updateEnvironmentVariable: (
|
||||
name: string,
|
||||
data: UpdateEnvironmentVariableRequest
|
||||
) => Promise<void>
|
||||
) => Promise<UpdateEnvironmentVariableResponse>
|
||||
}
|
||||
|
||||
export const buildEnvironmentVariableEndpoints = (
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
import { EventPublishType, PostEventPublishRequest } from "@budibase/types"
|
||||
import {
|
||||
EventPublishType,
|
||||
PostEventPublishRequest,
|
||||
PostEventPublishResponse,
|
||||
} from "@budibase/types"
|
||||
import { BaseAPIClient } from "./types"
|
||||
|
||||
export interface EventEndpoints {
|
||||
publishEvent: (type: EventPublishType) => Promise<void>
|
||||
publishEvent: (type: EventPublishType) => Promise<PostEventPublishResponse>
|
||||
}
|
||||
|
||||
export const buildEventEndpoints = (API: BaseAPIClient): EventEndpoints => ({
|
||||
publishEvent: async type => {
|
||||
return await API.post<PostEventPublishRequest>({
|
||||
return await API.post<PostEventPublishRequest, PostEventPublishResponse>({
|
||||
url: `/api/global/event/publish`,
|
||||
body: {
|
||||
type,
|
||||
|
|
|
@ -1,22 +1,29 @@
|
|||
import {
|
||||
ActivateLicenseKeyRequest,
|
||||
ActivateLicenseKeyResponse,
|
||||
ActivateOfflineLicenseTokenRequest,
|
||||
ActivateOfflineLicenseTokenResponse,
|
||||
GetLicenseKeyResponse,
|
||||
GetOfflineIdentifierResponse,
|
||||
GetOfflineLicenseTokenResponse,
|
||||
QuotaUsage,
|
||||
RefreshOfflineLicenseResponse,
|
||||
} from "@budibase/types"
|
||||
import { BaseAPIClient } from "./types"
|
||||
|
||||
export interface LicensingEndpoints {
|
||||
activateLicenseKey: (licenseKey: string) => Promise<void>
|
||||
activateLicenseKey: (
|
||||
licenseKey: string
|
||||
) => Promise<ActivateLicenseKeyResponse>
|
||||
deleteLicenseKey: () => Promise<void>
|
||||
getLicenseKey: () => Promise<GetLicenseKeyResponse | void>
|
||||
activateOfflineLicense: (offlineLicenseToken: string) => Promise<void>
|
||||
activateOfflineLicense: (
|
||||
offlineLicenseToken: string
|
||||
) => Promise<ActivateOfflineLicenseTokenResponse>
|
||||
deleteOfflineLicense: () => Promise<void>
|
||||
getOfflineLicense: () => Promise<GetOfflineLicenseTokenResponse | void>
|
||||
getOfflineLicenseIdentifier: () => Promise<GetOfflineIdentifierResponse>
|
||||
refreshLicense: () => Promise<void>
|
||||
refreshLicense: () => Promise<RefreshOfflineLicenseResponse>
|
||||
getQuotaUsage: () => Promise<QuotaUsage>
|
||||
}
|
||||
|
||||
|
@ -25,7 +32,7 @@ export const buildLicensingEndpoints = (
|
|||
): LicensingEndpoints => ({
|
||||
// LICENSE KEY
|
||||
activateLicenseKey: async licenseKey => {
|
||||
return API.post<ActivateLicenseKeyRequest>({
|
||||
return API.post<ActivateLicenseKeyRequest, ActivateLicenseKeyResponse>({
|
||||
url: `/api/global/license/key`,
|
||||
body: { licenseKey },
|
||||
})
|
||||
|
@ -49,7 +56,10 @@ export const buildLicensingEndpoints = (
|
|||
|
||||
// OFFLINE LICENSE
|
||||
activateOfflineLicense: async offlineLicenseToken => {
|
||||
return API.post<ActivateOfflineLicenseTokenRequest>({
|
||||
return API.post<
|
||||
ActivateOfflineLicenseTokenRequest,
|
||||
ActivateOfflineLicenseTokenResponse
|
||||
>({
|
||||
url: "/api/global/license/offline",
|
||||
body: {
|
||||
offlineLicenseToken,
|
||||
|
@ -84,7 +94,6 @@ export const buildLicensingEndpoints = (
|
|||
refreshLicense: async () => {
|
||||
return API.post({
|
||||
url: "/api/global/license/refresh",
|
||||
parseResponse: () => undefined,
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue