File tree Expand file tree Collapse file tree 3 files changed +75
-7
lines changed Expand file tree Collapse file tree 3 files changed +75
-7
lines changed Original file line number Diff line number Diff line change 1+ import  shortMenu  from  "../../short_menu.app.mjs" ; 
2+ 
3+ export  default  { 
4+   key : "short_menu-create-short-link" , 
5+   name : "Create Short Link" , 
6+   description : "Create a new short link. [See the documentationo](https://docs.shortmenu.com/api-reference/endpoint/create-link)" , 
7+   version : "0.0.1" , 
8+   type : "action" , 
9+   props : { 
10+     shortMenu, 
11+     destinationUrl : { 
12+       type : "string" , 
13+       label : "Destination URL" , 
14+       description : "Destination URL of the new short link. Must be a valid URL starting with a scheme such as `https`." , 
15+     } , 
16+     slug : { 
17+       type : "string" , 
18+       label : "Slug" , 
19+       description : "Optional slug for the new short link. If empty, a random slug will be generated. Must be unique within the domain." , 
20+       optional : true , 
21+     } , 
22+     tags : { 
23+       type : "string[]" , 
24+       label : "Tags" , 
25+       description : "Tags to assign to the new short link" , 
26+       optional : true , 
27+     } , 
28+   } , 
29+   async  run ( {  $ } )  { 
30+     const  response  =  await  this . shortMenu . createShortLink ( { 
31+       $, 
32+       data : { 
33+         destinationUrl : this . destinationUrl , 
34+         domain : this . shortMenu . $auth . custom_domain , 
35+         slug : this . slug , 
36+         tags : this . tags ?. map ( ( tag )  =>  ( { 
37+           name : tag , 
38+         } ) )  ||  [ ] , 
39+       } , 
40+     } ) ; 
41+ 
42+     $ . export ( "$summary" ,  `Successfully created short link ${ response . shortUrl }  ` ) ; 
43+     return  response ; 
44+   } , 
45+ } ; 
Original file line number Diff line number Diff line change 11{
22  "name" : " @pipedream/short_menu"  ,
3-   "version" : " 0.0.1 "  ,
3+   "version" : " 0.1.0 "  ,
44  "description" : " Pipedream Short Menu Components"  ,
55  "main" : " short_menu.app.mjs"  ,
66  "keywords" : [
1111  "author" : 
" Pipedream <[email protected] > (https://pipedream.com/)" ,
 1212  "publishConfig" : {
1313    "access" : " public" 
14+   },
15+   "dependencies" : {
16+     "@pipedream/platform" : " ^3.0.3" 
1417  }
15- }
18+ }
Original file line number Diff line number Diff line change 1+ import  {  axios  }  from  "@pipedream/platform" ; 
2+ 
13export  default  { 
24  type : "app" , 
35  app : "short_menu" , 
4-   propDefinitions : { } , 
56  methods : { 
6-     // this.$auth contains connected account data 
7-     authKeys ( )  { 
8-       console . log ( Object . keys ( this . $auth ) ) ; 
7+     _baseUrl ( )  { 
8+       return  "https://api.shortmenu.com" ; 
9+     } , 
10+     _makeRequest ( { 
11+       $ =  this , 
12+       path, 
13+       ...opts 
14+     } )  { 
15+       return  axios ( $ ,  { 
16+         url : `${ this . _baseUrl ( ) } ${ path }  ` , 
17+         headers : { 
18+           "x-api-key" : `${ this . $auth . api_key }  ` , 
19+         } , 
20+         ...opts , 
21+       } ) ; 
22+     } , 
23+     createShortLink ( opts  =  { } )  { 
24+       return  this . _makeRequest ( { 
25+         method : "POST" , 
26+         path : "/links" , 
27+         ...opts , 
28+       } ) ; 
929    } , 
1030  } , 
11- } ; 
31+ } ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments