- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
DocuGenerate - new components #18164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 19 commits
      Commits
    
    
            Show all changes
          
          
            25 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      ee977d0
              
                Create the "List Templates" action.
              
              
                docugenerate d222ea5
              
                Update "List Templates" action with the correct URL.
              
              
                docugenerate 82ea93f
              
                Update for the "templateId" prop.
              
              
                docugenerate 13365fe
              
                Add success message with $.export("$summary")
              
              
                docugenerate edf128f
              
                Add the "Delete Template" action.
              
              
                docugenerate 33b92b7
              
                Create the "List Documents" action.
              
              
                docugenerate 7dd2c3a
              
                Add the "Get Document" action.
              
              
                docugenerate f64d548
              
                Update the "Get Document" action.
              
              
                docugenerate 9e7c4a2
              
                Add the "Update Document" action.
              
              
                docugenerate 8f23625
              
                Add the "Delete Document" action.
              
              
                docugenerate d3b9341
              
                Add "Generate Document" action.
              
              
                docugenerate 99471ff
              
                Add "Generate Document" action.
              
              
                docugenerate b3f30aa
              
                Add optional fields.
              
              
                docugenerate e338990
              
                Update output format options.
              
              
                docugenerate cb1c952
              
                Update summary message.
              
              
                docugenerate 128e97c
              
                Set version: "1.0.0" for all actions.
              
              
                docugenerate d0d6347
              
                Update package.json
              
              
                docugenerate a95e98f
              
                Update README file.
              
              
                docugenerate 7957346
              
                Merge branch 'master' into docugenerate
              
              
                docugenerate 86b0a53
              
                Fix step numbering in README.
              
              
                docugenerate 70fa53a
              
                Merge branch 'master' into docugenerate
              
              
                GTFalcao eb7bdcb
              
                Running eslint --fix
              
              
                GTFalcao 67aacce
              
                Moving actions to individual folders
              
              
                GTFalcao 5bd9e80
              
                Adding docs links to descriptions
              
              
                GTFalcao d21218f
              
                Fixing package version
              
              
                GTFalcao File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-delete-document", | ||
| name: "Delete Document", | ||
| description: "Deletes a specific document", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| documentId: { | ||
| type: "string", | ||
| label: "Document", | ||
| description: "The ID of the document", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.deleteDocument($, this.documentId); | ||
|  | ||
| $.export("$summary", `Successfully deleted the document ${this.documentId}`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-delete-template", | ||
| name: "Delete Template", | ||
| description: "Deletes a specific template", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| templateId: { | ||
| propDefinition: [ | ||
| app, | ||
| "templateId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.deleteTemplate($, this.templateId); | ||
|  | ||
| $.export("$summary", `Successfully deleted the template ${this.templateId}`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-generate-document", | ||
| name: "Generate Document", | ||
| description: "Generates a document from a template", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| templateId: { | ||
| propDefinition: [ | ||
| app, | ||
| "templateId", | ||
| ], | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "Name of the generated document. Defaults to the template’s name.", | ||
| optional: true, | ||
| }, | ||
| format: { | ||
| type: "string", | ||
| label: "Format", | ||
| description: "Output format of the generated document. Defaults to .docx.", | ||
| optional: true, | ||
| options: [ | ||
| { label: 'PDF (.pdf)', value: '.pdf' }, | ||
| { label: 'Microsoft Word (.docx)', value: '.docx' }, | ||
| { label: 'Microsoft Word 2007 (.doc)', value: '.doc' }, | ||
| { label: 'OpenDocument Format (.odt)', value: '.odt' }, | ||
| { label: 'Plain Text (.txt)', value: '.txt' }, | ||
| { label: 'PNG (.png)', value: '.png' }, | ||
| ], | ||
| }, | ||
| data: { | ||
| type: "object", | ||
| label: "Data", | ||
| description: "Data that is used to generate the document.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const body = { | ||
| template_id: this.templateId, | ||
| name: this.name, | ||
| output_format: this.format, | ||
| data: this.data, | ||
| }; | ||
|  | ||
| const response = await this.app.generateDocument($, body); | ||
|  | ||
| $.export("$summary", `Successfully generated the document ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-get-document", | ||
| name: "Get Document", | ||
| description: "Retrieves a specific document", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| documentId: { | ||
| type: "string", | ||
| label: "Document", | ||
| description: "The ID of the document", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getDocument($, this.documentId); | ||
|  | ||
| $.export("$summary", `Successfully retrieved the document ${this.documentId}`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-get-template", | ||
| name: "Get Template", | ||
| description: "Retrieves a specific template", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| templateId: { | ||
| propDefinition: [ | ||
| app, | ||
| "templateId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getTemplate($, this.templateId); | ||
|  | ||
| $.export("$summary", `Successfully retrieved the template ${this.templateId}`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-list-documents", | ||
| name: "List Documents", | ||
| description: "Retrieves a list of documents generated from a template", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| templateId: { | ||
| propDefinition: [ | ||
| app, | ||
| "templateId", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.listDocuments($, this.templateId); | ||
|  | ||
| $.export("$summary", `Successfully retrieved ${response?.length || 0} documents`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-list-templates", | ||
| name: "List Templates", | ||
| description: "Retrieves a list of all templates", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.listTemplates($); | ||
|  | ||
| $.export("$summary", `Successfully retrieved ${response?.length || 0} templates`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import app from "../docugenerate.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "docugenerate-update-document", | ||
| name: "Update Document", | ||
| description: "Updates a specific document", | ||
| version: "1.0.0", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| documentId: { | ||
| type: "string", | ||
| label: "Document", | ||
| description: "The ID of the document", | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The new name for the document", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.updateDocument($, this.documentId, { | ||
| name: this.name | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully updated the document ${this.documentId}`); | ||
| return response; | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,11 +1,99 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|  | ||
| export default { | ||
| type: "app", | ||
| app: "docugenerate", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| templateId: { | ||
| type: "string", | ||
| label: "Template", | ||
| description: "The selected template", | ||
| async options() { | ||
| const response = await this.listTemplates(); | ||
| return response.map(template => ({ | ||
| label: template.name, | ||
| value: template.id, | ||
| })); | ||
| }, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| getBaseUrl() { | ||
| return "https://api.docugenerate.com/v1"; | ||
| }, | ||
| getHeaders() { | ||
| return { | ||
| "Authorization": `${this.$auth.api_key}`, | ||
| "Content-Type": "application/json", | ||
| }; | ||
| }, | ||
| async makeRequest({ | ||
| $ = this, | ||
| method = "GET", | ||
| path, | ||
| ...args | ||
| }) { | ||
| const config = { | ||
| method, | ||
| url: `${this.getBaseUrl()}${path}`, | ||
| headers: this.getHeaders(), | ||
| ...args, | ||
| }; | ||
| return axios($, config); | ||
| }, | ||
| async listTemplates($ = this) { | ||
| return this.makeRequest({ | ||
| $, | ||
| path: "/template", | ||
| }); | ||
| }, | ||
| async getTemplate($ = this, templateId) { | ||
| return this.makeRequest({ | ||
| $, | ||
| path: `/template/${templateId}`, | ||
| }); | ||
| }, | ||
| async deleteTemplate($ = this, templateId) { | ||
| return this.makeRequest({ | ||
| $, | ||
| method: "DELETE", | ||
| path: `/template/${templateId}`, | ||
| }); | ||
| }, | ||
| async listDocuments($ = this, templateId) { | ||
| return this.makeRequest({ | ||
| $, | ||
| path: `/document?template_id=${templateId}`, | ||
| }); | ||
| }, | ||
| async getDocument($ = this, documentId) { | ||
| return this.makeRequest({ | ||
| $, | ||
| path: `/document/${documentId}`, | ||
| }); | ||
| }, | ||
| async updateDocument($ = this, documentId, body) { | ||
| return this.makeRequest({ | ||
| $, | ||
| method: "PUT", | ||
| path: `/document/${documentId}`, | ||
| data: body, | ||
| }); | ||
| }, | ||
| async deleteDocument($ = this, documentId) { | ||
| return this.makeRequest({ | ||
| $, | ||
| method: "DELETE", | ||
| path: `/document/${documentId}`, | ||
| }); | ||
| }, | ||
| async generateDocument($ = this, body) { | ||
| return this.makeRequest({ | ||
| $, | ||
| method: "POST", | ||
| path: "/document", | ||
| data: body, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.