@microsoft/api2teams
Advanced tools
Comparing version 0.0.1 to 0.1.0-rc.0
@@ -28,2 +28,3 @@ "use strict"; | ||
function parseApi(yaml, options) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -52,2 +53,6 @@ try { | ||
const apis = (yield swagger_parser_1.default.validate(yaml)); | ||
if (!apis.openapi || apis.openapi < '3.0.0') { | ||
console.error('[ERROR] The OpenAPI Spec version must be 3.0.0 or higher'); | ||
return; | ||
} | ||
console.log(' > yaml file information: API name: %s, Version: %s', apis.info.title, apis.info.version); | ||
@@ -78,3 +83,16 @@ console.log('analyze requests'); | ||
console.log('generate help command card'); | ||
yield fs_extra_1.default.copy(__dirname + '/resources/helpCard.json', options.output + '/src/adaptiveCards/helpCard.json'); | ||
const helpCardJson = yield fs_extra_1.default.readJSON(__dirname + '/resources/helpCard.json', 'utf8'); | ||
if ((requestCards === null || requestCards === void 0 ? void 0 : requestCards.length) > 0) { | ||
helpCardJson.body.push({ | ||
type: 'TextBlock', | ||
text: 'Supported Commands', | ||
weight: 'Bolder' | ||
}); | ||
for (const card of requestCards) { | ||
if ((_b = (_a = card.content) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b[0]) { | ||
helpCardJson.body.push(card.content.body[0]); | ||
} | ||
} | ||
} | ||
yield fs_extra_1.default.outputJSON(options.output + '/src/adaptiveCards/helpCard.json', helpCardJson, { spaces: 2 }); | ||
console.log('generate action cards'); | ||
@@ -103,2 +121,4 @@ for (const card of responseCards) { | ||
} | ||
console.log('generate teams bot file'); | ||
yield fs_extra_1.default.copy(__dirname + '/resources/teamsBotTemplate.txt', options.output + '/src/teamsBot.ts'); | ||
console.log('generate index file'); | ||
@@ -105,0 +125,0 @@ const indexFile = yield (0, generateIndexFile_1.generateIndexFile)(responseCards); |
import * as restify from "restify"; | ||
import { BotBuilderCloudAdapter } from "@microsoft/teamsfx"; | ||
import ConversationBot = BotBuilderCloudAdapter.ConversationBot; | ||
import { TeamsBot } from "./teamsBot"; | ||
@@ -37,4 +38,7 @@ {{importStatements}} | ||
// in `templates/azure/provision/botservice.bicep`. | ||
const teamsBot = new TeamsBot(); | ||
server.post("/api/messages", async (req, res) => { | ||
await commandBot.requestHandler(req, res); | ||
await commandBot.requestHandler(req, res, async (context) => { | ||
await teamsBot.run(context); | ||
}); | ||
}); |
{ | ||
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.14/MicrosoftTeams.schema.json", | ||
"manifestVersion": "1.14", | ||
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.16/MicrosoftTeams.schema.json", | ||
"manifestVersion": "1.16", | ||
"version": "1.0.0", | ||
@@ -5,0 +5,0 @@ "id": "${{TEAMS_APP_ID}}", |
{ | ||
"name": "@microsoft/api2teams", | ||
"version": "0.0.1", | ||
"version": "0.1.0-rc.0", | ||
"description": "openapi spec to teams app", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126485
54
1410