Base of API - still needs pro implementation.

This commit is contained in:
mike12345567 2023-09-21 18:04:15 +01:00
parent 85887d0371
commit cf24d90f4b
5 changed files with 143 additions and 1 deletions

View File

@ -2163,6 +2163,48 @@
}
}
},
"/applications/{appId}/import": {
"post": {
"operationId": "appImport",
"summary": "Import an app to an existing app",
"tags": [
"applications"
],
"parameters": [
{
"$ref": "#/components/parameters/appIdUrl"
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"encryptedPassword": {
"description": "Password for the export if it is encrypted.",
"type": "string"
},
"appExport": {
"description": "The app export to import.",
"type": "string",
"format": "binary"
}
},
"required": [
"appExport"
]
}
}
}
},
"responses": {
"204": {
"description": "Application has been updated."
}
}
}
},
"/applications/search": {
"post": {
"operationId": "appSearch",

View File

@ -1763,6 +1763,32 @@ paths:
examples:
deployment:
$ref: "#/components/examples/deploymentOutput"
"/applications/{appId}/import":
post:
operationId: appImport
summary: Import an app to an existing app
tags:
- applications
parameters:
- $ref: "#/components/parameters/appIdUrl"
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
encryptedPassword:
description: Password for the export if it is encrypted.
type: string
appExport:
description: The app export to import.
type: string
format: binary
required:
- appExport
responses:
"204":
description: Application has been updated.
/applications/search:
post:
operationId: appSearch

View File

@ -80,6 +80,8 @@ export async function destroy(ctx: UserCtx, next: Next) {
export async function unpublish(ctx: UserCtx, next: Next) {
await context.doInAppContext(ctx.params.appId, async () => {
await controller.unpublish(ctx)
ctx.body = undefined
ctx.status = 204
await next()
})
}
@ -91,12 +93,23 @@ export async function publish(ctx: UserCtx, next: Next) {
})
}
export async function importToApp(ctx: UserCtx, next: Next) {
await context.doInAppContext(ctx.params.appId, async () => {
// TODO: paid control
await controller.importToApp(ctx)
ctx.body = undefined
ctx.status = 204
await next()
})
}
export default {
create,
update,
read,
destroy,
search,
publish,
unpublish,
publish,
importToApp,
}

View File

@ -137,6 +137,39 @@ write.push(
new Endpoint("post", "/applications/:appId/publish", controller.publish)
)
/**
* @openapi
* /applications/{appId}/import:
* post:
* operationId: appImport
* summary: Import an app to an existing app
* tags:
* - applications
* parameters:
* - $ref: '#/components/parameters/appIdUrl'
* requestBody:
* content:
* multipart/form-data:
* schema:
* type: object
* properties:
* encryptedPassword:
* description: Password for the export if it is encrypted.
* type: string
* appExport:
* description: The app export to import.
* type: string
* format: binary
* required:
* - appExport
* responses:
* 204:
* description: Application has been updated.
*/
write.push(
new Endpoint("post", "/applications/:appId/import", controller.importToApp)
)
/**
* @openapi
* /applications/{appId}:

View File

@ -18,6 +18,9 @@ export interface paths {
"/applications/{appId}/publish": {
post: operations["appPublish"];
};
"/applications/{appId}/import": {
post: operations["appImport"];
};
"/applications/search": {
/** Based on application properties (currently only name) search for applications. */
post: operations["appSearch"];
@ -889,6 +892,31 @@ export interface operations {
};
};
};
appImport: {
parameters: {
path: {
/** The ID of the app which this request is targeting. */
appId: components["parameters"]["appIdUrl"];
};
};
responses: {
/** Application has been updated. */
204: never;
};
requestBody: {
content: {
"multipart/form-data": {
/** @description Password for the export if it is encrypted. */
encryptedPassword?: string;
/**
* Format: binary
* @description The app export to import.
*/
appExport: string;
};
};
};
};
/** Based on application properties (currently only name) search for applications. */
appSearch: {
responses: {