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