Type licensing endpoints
This commit is contained in:
parent
b2b2648798
commit
85e86900d0
|
@ -64,7 +64,7 @@
|
|||
|
||||
const activateLicenseKey = async () => {
|
||||
try {
|
||||
await API.activateLicenseKey({ licenseKey })
|
||||
await API.activateLicenseKey(licenseKey)
|
||||
await auth.getSelf()
|
||||
await getLicenseKey()
|
||||
notifications.success("Successfully activated")
|
||||
|
@ -119,7 +119,7 @@
|
|||
|
||||
async function activateOfflineLicense(offlineLicenseToken) {
|
||||
try {
|
||||
await API.activateOfflineLicense({ offlineLicenseToken })
|
||||
await API.activateOfflineLicense(offlineLicenseToken)
|
||||
await auth.getSelf()
|
||||
await getOfflineLicense()
|
||||
notifications.success("Successfully activated")
|
||||
|
|
|
@ -1,10 +1,34 @@
|
|||
export const buildLicensingEndpoints = API => ({
|
||||
import {
|
||||
ActivateLicenseKeyRequest,
|
||||
ActivateOfflineLicenseTokenRequest,
|
||||
GetLicenseKeyResponse,
|
||||
GetOfflineIdentifierResponse,
|
||||
GetOfflineLicenseTokenResponse,
|
||||
QuotaUsage,
|
||||
} from "@budibase/types"
|
||||
import { BaseAPIClient } from "./types"
|
||||
|
||||
export interface LicensingEndpoints {
|
||||
activateLicenseKey: (licenseKey: string) => Promise<void>
|
||||
deleteLicenseKey: () => Promise<void>
|
||||
getLicenseKey: () => Promise<GetLicenseKeyResponse>
|
||||
activateOfflineLicense: (offlineLicenseToken: string) => Promise<void>
|
||||
deleteOfflineLicense: () => Promise<void>
|
||||
getOfflineLicense: () => Promise<GetOfflineLicenseTokenResponse>
|
||||
getOfflineLicenseIdentifier: () => Promise<GetOfflineIdentifierResponse>
|
||||
refreshLicense: () => Promise<void>
|
||||
getQuotaUsage: () => Promise<QuotaUsage>
|
||||
}
|
||||
|
||||
export const buildLicensingEndpoints = (
|
||||
API: BaseAPIClient
|
||||
): LicensingEndpoints => ({
|
||||
// LICENSE KEY
|
||||
|
||||
activateLicenseKey: async data => {
|
||||
return API.post({
|
||||
activateLicenseKey: async licenseKey => {
|
||||
return API.post<ActivateLicenseKeyRequest>({
|
||||
url: `/api/global/license/key`,
|
||||
body: data,
|
||||
body: { licenseKey },
|
||||
})
|
||||
},
|
||||
deleteLicenseKey: async () => {
|
||||
|
@ -26,8 +50,8 @@ export const buildLicensingEndpoints = API => ({
|
|||
|
||||
// OFFLINE LICENSE
|
||||
|
||||
activateOfflineLicense: async ({ offlineLicenseToken }) => {
|
||||
return API.post({
|
||||
activateOfflineLicense: async offlineLicenseToken => {
|
||||
return API.post<ActivateOfflineLicenseTokenRequest>({
|
||||
url: "/api/global/license/offline",
|
||||
body: {
|
||||
offlineLicenseToken,
|
|
@ -13,6 +13,7 @@ import { EventEndpoints } from "./events"
|
|||
import { FlagEndpoints } from "./flags"
|
||||
import { GroupEndpoints } from "./groups"
|
||||
import { LayoutEndpoints } from "./layouts"
|
||||
import { LicensingEndpoints } from "./licensing"
|
||||
|
||||
export enum HTTPMethod {
|
||||
POST = "POST",
|
||||
|
@ -87,4 +88,5 @@ export type APIClient = BaseAPIClient &
|
|||
EventEndpoints &
|
||||
FlagEndpoints &
|
||||
GroupEndpoints &
|
||||
LayoutEndpoints
|
||||
LayoutEndpoints &
|
||||
LicensingEndpoints
|
||||
|
|
Loading…
Reference in New Issue