Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { ConfigurationError } from "@pipedream/platform";
import gloww from "../../gloww.app.mjs";

export default {
key: "gloww-create-live-session",
name: "Create Live Session",
version: "0.0.1",
description: "Create a new Live Session [See the documentation](https://gloww.com/faq/)",
type: "action",
props: {
gloww,
sessionId: {
propDefinition: [
gloww,
"sessionId",
],
optional: true,
},
templateId: {
propDefinition: [
gloww,
"templateId",
],
optional: true,
},
name: {
type: "string",
label: "Name",
description: "The name of the Live Session.",
},
},
async run({ $ }) {
if ((!this.sessionId && !this.templateId) || (this.sessionId && this.templateId)) {
throw new ConfigurationError("You must provide either Session Id or Template Id.");
}

const response = await this.gloww.createSession({
$,
data: {
name: this.sessionName,
},
params: {
fromTemplateId: this.templateId,
fromSessionId: this.sessionId,
},
});

$.export("$summary", `A new live session with Id: ${response.id} was successfully created!`);
return response;
},
};
69 changes: 64 additions & 5 deletions components/gloww/gloww.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,70 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "gloww",
propDefinitions: {},
propDefinitions: {
sessionId: {
type: "string",
label: "Session Id",
description: "The Id of the session on which the new session is based.",
async options() {
const { sessions } = await this.listSuggestions();

return sessions.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
templateId: {
type: "string",
label: "Template Id",
description: "The Id of the template on which the new session is based.",
async options() {
const { templates } = await this.listSuggestions();

return templates.map(({
id: value, name: label,
}) => ({
label,
value,
}));
},
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_apiUrl() {
return "https://api.gloww.com";
},
_getHeaders() {
return {
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
};
},
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
url: `${this._apiUrl()}${path}`,
headers: this._getHeaders(),
...opts,
});
},
createSession(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/api/liveSessions",
...opts,
});
},
listSuggestions(opts = {}) {
return this._makeRequest({
path: "/integrations/suggestions/sessions",
...opts,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/gloww/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/gloww",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Gloww Components",
"main": "gloww.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^2.0.0"
}
}
}
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.