File tree Expand file tree Collapse file tree 3 files changed +66
-6
lines changed
components/dynamic_content_snippet
actions/create-or-update-website-content Expand file tree Collapse file tree 3 files changed +66
-6
lines changed Original file line number Diff line number Diff line change 1+ import dynamicContentSnippet from "../../dynamic_content_snippet.app.mjs" ;
2+
3+ export default {
4+ key : "dynamic_content_snippet-create-or-update-website-content" ,
5+ name : "Create or Update Website Content" ,
6+ description : "Create or update website content. [See the documentation](https://contentsnip.com/documentation.htm)" ,
7+ version : "0.0.1" ,
8+ type : "action" ,
9+ annotations : {
10+ destructiveHint : true ,
11+ openWorldHint : true ,
12+ readOnlyHint : false ,
13+ } ,
14+ props : {
15+ dynamicContentSnippet,
16+ url : {
17+ type : "string" ,
18+ label : "URL" ,
19+ description : "URL of the webpage where content will appear" ,
20+ } ,
21+ htmlContent : {
22+ type : "string" ,
23+ label : "HTML Content" ,
24+ description : "HTML content to display at the target URL" ,
25+ } ,
26+ } ,
27+ async run ( { $ } ) {
28+ const response = await this . dynamicContentSnippet . createOrUpdateWebsiteContent ( {
29+ $,
30+ data : {
31+ url : this . url ,
32+ htmlContent : this . htmlContent ,
33+ } ,
34+ } ) ;
35+ $ . export ( "$summary" , `Successfully created or updated website content for \`${ this . url } .\`` ) ;
36+ return response ;
37+ } ,
38+ } ;
Original file line number Diff line number Diff line change 1+ import { axios } from "@pipedream/platform" ;
2+
13export default {
24 type : "app" ,
35 app : "dynamic_content_snippet" ,
46 propDefinitions : { } ,
57 methods : {
6- // this.$auth contains connected account data
7- authKeys ( ) {
8- console . log ( Object . keys ( this . $auth ) ) ;
8+ _baseUrl ( ) {
9+ return "https://app.contentsnip.com/api" ;
10+ } ,
11+ _makeRequest ( {
12+ $ = this , path, ...opts
13+ } ) {
14+ return axios ( $ , {
15+ ...opts ,
16+ url : `${ this . _baseUrl ( ) } ${ path } ` ,
17+ headers : {
18+ "x-api-key" : `${ this . $auth . api_key } ` ,
19+ } ,
20+ } ) ;
21+ } ,
22+ createOrUpdateWebsiteContent ( opts = { } ) {
23+ return this . _makeRequest ( {
24+ method : "POST" ,
25+ path : "/mappings" ,
26+ ...opts ,
27+ } ) ;
928 } ,
1029 } ,
11- } ;
30+ } ;
Original file line number Diff line number Diff line change 11{
22 "name" : " @pipedream/dynamic_content_snippet" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.1.0 " ,
44 "description" : " Pipedream Dynamic Content Snippet Components" ,
55 "main" : " dynamic_content_snippet.app.mjs" ,
66 "keywords" : [
1111 "author" :
" Pipedream <[email protected] > (https://pipedream.com/)" ,
1212 "publishConfig" : {
1313 "access" : " public"
14+ },
15+ "dependencies" : {
16+ "@pipedream/platform" : " ^3.1.1"
1417 }
15- }
18+ }
You can’t perform that action at this time.
0 commit comments