Licensing API typing.
This commit is contained in:
parent
cbab77ea24
commit
c0df3e67b3
|
@ -1,5 +1,7 @@
|
||||||
// LICENSE KEY
|
// LICENSE KEY
|
||||||
|
|
||||||
|
import { QuotaUsage } from "../../../documents"
|
||||||
|
|
||||||
export interface ActivateLicenseKeyRequest {
|
export interface ActivateLicenseKeyRequest {
|
||||||
licenseKey: string
|
licenseKey: string
|
||||||
}
|
}
|
||||||
|
@ -23,3 +25,5 @@ export interface GetOfflineLicenseTokenResponse {
|
||||||
export interface GetOfflineIdentifierResponse {
|
export interface GetOfflineIdentifierResponse {
|
||||||
identifierBase64: string
|
identifierBase64: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface GetQuotaUsageResponse extends QuotaUsage {}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
GetLicenseKeyResponse,
|
GetLicenseKeyResponse,
|
||||||
GetOfflineIdentifierResponse,
|
GetOfflineIdentifierResponse,
|
||||||
GetOfflineLicenseTokenResponse,
|
GetOfflineLicenseTokenResponse,
|
||||||
|
GetQuotaUsageResponse,
|
||||||
UserCtx,
|
UserCtx,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
|
|
||||||
|
@ -36,7 +37,7 @@ export async function deleteLicenseKey(ctx: UserCtx<void, void>) {
|
||||||
// OFFLINE LICENSE
|
// OFFLINE LICENSE
|
||||||
|
|
||||||
export async function activateOfflineLicenseToken(
|
export async function activateOfflineLicenseToken(
|
||||||
ctx: UserCtx<ActivateOfflineLicenseTokenRequest>
|
ctx: UserCtx<ActivateOfflineLicenseTokenRequest, void>
|
||||||
) {
|
) {
|
||||||
const { offlineLicenseToken } = ctx.request.body
|
const { offlineLicenseToken } = ctx.request.body
|
||||||
await licensing.offline.activateOfflineLicenseToken(offlineLicenseToken)
|
await licensing.offline.activateOfflineLicenseToken(offlineLicenseToken)
|
||||||
|
@ -70,14 +71,16 @@ export async function getOfflineLicenseIdentifier(
|
||||||
|
|
||||||
// LICENSES
|
// LICENSES
|
||||||
|
|
||||||
export const refresh = async (ctx: any) => {
|
export const refresh = async (ctx: UserCtx<void, void>) => {
|
||||||
await licensing.cache.refresh()
|
await licensing.cache.refresh()
|
||||||
ctx.status = 200
|
ctx.status = 200
|
||||||
}
|
}
|
||||||
|
|
||||||
// USAGE
|
// USAGE
|
||||||
|
|
||||||
export const getQuotaUsage = async (ctx: any) => {
|
export const getQuotaUsage = async (
|
||||||
|
ctx: UserCtx<void, GetQuotaUsageResponse>
|
||||||
|
) => {
|
||||||
ctx.body = await quotas.getQuotaUsage()
|
ctx.body = await quotas.getQuotaUsage()
|
||||||
ctx.status = 200
|
ctx.status = 200
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue