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,38 @@
import dynamicContentSnippet from "../../dynamic_content_snippet.app.mjs";

export default {
key: "dynamic_content_snippet-create-or-update-website-content",
name: "Create or Update Website Content",
description: "Create or update website content. [See the documentation](https://contentsnip.com/documentation.htm)",
version: "0.0.1",
type: "action",
annotations: {
destructiveHint: true,
openWorldHint: true,
readOnlyHint: false,
},
props: {
dynamicContentSnippet,
url: {
type: "string",
label: "URL",
description: "URL of the webpage where content will appear",
},
htmlContent: {
type: "string",
label: "HTML Content",
description: "HTML content to display at the target URL",
},
},
async run({ $ }) {
const response = await this.dynamicContentSnippet.createOrUpdateWebsiteContent({
$,
data: {
url: this.url,
htmlContent: this.htmlContent,
},
});
$.export("$summary", `Successfully created or updated website content for \`${this.url}.\``);
return response;
},
};
27 changes: 23 additions & 4 deletions components/dynamic_content_snippet/dynamic_content_snippet.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "dynamic_content_snippet",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://app.contentsnip.com/api";
},
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
...opts,
url: `${this._baseUrl()}${path}`,
headers: {
"x-api-key": `${this.$auth.api_key}`,
},
});
},
createOrUpdateWebsiteContent(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/mappings",
...opts,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/dynamic_content_snippet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/dynamic_content_snippet",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Dynamic Content Snippet Components",
"main": "dynamic_content_snippet.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.1"
}
}
}
36 changes: 15 additions & 21 deletions pnpm-lock.yaml

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

Loading