diff --git a/components/lessonspace/.gitignore b/components/lessonspace/.gitignore deleted file mode 100644 index ec761ccab7595..0000000000000 --- a/components/lessonspace/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.js -*.mjs -dist \ No newline at end of file diff --git a/components/lessonspace/actions/launch-space/launch-space.mjs b/components/lessonspace/actions/launch-space/launch-space.mjs new file mode 100644 index 0000000000000..259e476ece95c --- /dev/null +++ b/components/lessonspace/actions/launch-space/launch-space.mjs @@ -0,0 +1,73 @@ +import app from "../../lessonspace.app.mjs"; + +export default { + key: "lessonspace-launch-space", + name: "Launch Space", + description: "Launch a unified space on Lessonspace. [See the documentation](https://api.thelessonspace.com/v2/docs/#tag/Spaces-greater-Launch)", + version: "0.0.1", + type: "action", + props: { + app, + spaceId: { + propDefinition: [ + app, + "spaceId", + ], + }, + name: { + propDefinition: [ + app, + "name", + ], + }, + allowGuests: { + propDefinition: [ + app, + "allowGuests", + ], + }, + recordContent: { + propDefinition: [ + app, + "recordContent", + ], + }, + transcribe: { + propDefinition: [ + app, + "transcribe", + ], + }, + recordAv: { + propDefinition: [ + app, + "recordAv", + ], + }, + userName: { + propDefinition: [ + app, + "userName", + ], + }, + }, + + async run({ $ }) { + const response = await this.app.launchSpace({ + $, + data: { + id: this.spaceId, + name: this.name, + allow_guests: this.allowGuests, + record_content: this.recordContent, + transcribe: this.transcribe, + record_av: this.recordAv, + user: { + name: this.userName, + }, + }, + }); + $.export("$summary", `Successfully launched space named ${this.name}`); + return response; + }, +}; diff --git a/components/lessonspace/app/lessonspace.app.ts b/components/lessonspace/app/lessonspace.app.ts deleted file mode 100644 index 65c584a2ee7d6..0000000000000 --- a/components/lessonspace/app/lessonspace.app.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineApp } from "@pipedream/types"; - -export default defineApp({ - type: "app", - app: "lessonspace", - propDefinitions: {}, - methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); - }, - }, -}); \ No newline at end of file diff --git a/components/lessonspace/lessonspace.app.mjs b/components/lessonspace/lessonspace.app.mjs new file mode 100644 index 0000000000000..35d969cefa456 --- /dev/null +++ b/components/lessonspace/lessonspace.app.mjs @@ -0,0 +1,72 @@ +import { axios } from "@pipedream/platform"; + +export default { + type: "app", + app: "lessonspace", + propDefinitions: { + spaceId: { + type: "string", + label: "Space ID", + description: "The ID of the Space", + }, + name: { + type: "string", + label: "Name", + description: "The name of the Space", + }, + allowGuests: { + type: "boolean", + label: "Allow Guests", + description: "Whether to allow guests or not in the Space", + }, + recordContent: { + type: "boolean", + label: "Record Content", + description: "Whether or not the space content will be recorded for this session", + }, + transcribe: { + type: "boolean", + label: "Transcribe", + description: "Whether or not a transcription will be generated for this session", + }, + recordAv: { + type: "boolean", + label: "Record AV", + description: "Whether or not audio and video will be recorded in this session", + }, + userName: { + type: "string", + label: "User Name", + description: "Full name of the person joining this space", + }, + }, + methods: { + _baseUrl() { + return "https://api.thelessonspace.com/v2"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, + path, + headers, + ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + url: this._baseUrl() + path, + headers: { + "Authorization": `Organisation ${this.$auth.api_key}`, + ...headers, + }, + }); + }, + + async launchSpace(args = {}) { + return this._makeRequest({ + path: "/spaces/launch/", + method: "post", + ...args, + }); + }, + }, +}; diff --git a/components/lessonspace/package.json b/components/lessonspace/package.json index 6a2d6c4fd340e..fadf9462cc446 100644 --- a/components/lessonspace/package.json +++ b/components/lessonspace/package.json @@ -1,16 +1,18 @@ { "name": "@pipedream/lessonspace", - "version": "0.0.2", + "version": "0.1.0", "description": "Pipedream Lessonspace Components", - "main": "dist/app/lessonspace.app.mjs", + "main": "lessonspace.app.mjs", "keywords": [ "pipedream", "lessonspace" ], - "files": ["dist"], "homepage": "https://pipedream.com/apps/lessonspace", "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7eb3daed2a689..a4559aaa07cef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5919,7 +5919,11 @@ importers: components/lessaccounting: {} - components/lessonspace: {} + components/lessonspace: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/letterdrop: dependencies: