File tree Expand file tree Collapse file tree 3 files changed +76
-15
lines changed Expand file tree Collapse file tree 3 files changed +76
-15
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,19 @@ export default {
1919 description : "The body of the page formatted as HTML" ,
2020 } ,
2121 categoryId : {
22- type : "string" ,
23- label : "Category ID" ,
24- description : "The category to publish the page to ",
25- optional : true ,
22+ propDefinition : [
23+ tettra ,
24+ "categoryId ",
25+ ] ,
2626 } ,
2727 subcategoryId : {
28- type : "string" ,
29- label : "Subcategory ID" ,
30- description : "The subcategory to publish the page to" ,
31- optional : true ,
28+ propDefinition : [
29+ tettra ,
30+ "subcategoryId" ,
31+ ( { categoryId } ) => ( {
32+ categoryId,
33+ } ) ,
34+ ] ,
3235 } ,
3336 } ,
3437 async run ( { $ } ) {
Original file line number Diff line number Diff line change @@ -20,16 +20,18 @@ export default {
2020 optional : true ,
2121 } ,
2222 category : {
23- type : "string" ,
24- label : "Category" ,
25- description : "The category to publish the page to ",
26- optional : true ,
23+ propDefinition : [
24+ tettra ,
25+ "categoryId ",
26+ ] ,
2727 } ,
2828 assignableId : {
29- type : "string" ,
29+ propDefinition : [
30+ tettra ,
31+ "userId" ,
32+ ] ,
3033 label : "Assignable ID" ,
31- description : "The ID of the user to assign the suggestion" ,
32- optional : true ,
34+ description : "Select a user to assign the suggestion, or provide a user ID" ,
3335 } ,
3436 } ,
3537 async run ( { $ } ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,47 @@ import { axios } from "@pipedream/platform";
33export default {
44 type : "app" ,
55 app : "tettra" ,
6+ propDefinitions : {
7+ categoryId : {
8+ type : "string" ,
9+ label : "Category ID" ,
10+ description : "Select a category or provide a category ID" ,
11+ optional : true ,
12+ async options ( ) {
13+ const { categories } = await this . getCategories ( ) ;
14+ return categories . map ( ( category ) => ( {
15+ label : category . name ,
16+ value : category . id ,
17+ } ) ) ;
18+ } ,
19+ } ,
20+ subcategoryId : {
21+ type : "string" ,
22+ label : "Subcategory ID" ,
23+ description : "Select a subcategory or provide a subcategory ID" ,
24+ optional : true ,
25+ async options ( { categoryId } ) {
26+ const { categoryItems } = await this . getCategory ( categoryId ) ;
27+ return categoryItems . filter ( ( item ) => item . type === "Subcategory" ) . map ( ( item ) => ( {
28+ label : item . title ,
29+ value : item . id ,
30+ } ) ) ;
31+ } ,
32+ } ,
33+ userId : {
34+ type : "string" ,
35+ label : "User ID" ,
36+ description : "Select a user or provide a user ID" ,
37+ optional : true ,
38+ async options ( ) {
39+ const { users } = await this . getUsers ( ) ;
40+ return users . map ( ( user ) => ( {
41+ label : user . display_name ?? user . email ,
42+ value : user . id ,
43+ } ) ) ;
44+ } ,
45+ } ,
46+ } ,
647 methods : {
748 async _makeRequest ( {
849 $ = this ,
@@ -36,5 +77,20 @@ export default {
3677 ...args ,
3778 } ) ;
3879 } ,
80+ async getCategories ( ) {
81+ return this . _makeRequest ( {
82+ url : "/categories" ,
83+ } ) ;
84+ } ,
85+ async getCategory ( categoryId ) {
86+ return this . _makeRequest ( {
87+ url : `/categories/${ categoryId } ` ,
88+ } ) ;
89+ } ,
90+ async getUsers ( ) {
91+ return this . _makeRequest ( {
92+ url : "/users" ,
93+ } ) ;
94+ } ,
3995 } ,
4096} ;
You can’t perform that action at this time.
0 commit comments