- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.5k
 
New Components - google_appsheet #15509
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import common from "../common/base.mjs"; | ||
| 
     | 
||
| export default { | ||
| ...common, | ||
| key: "google_appsheet-add-row", | ||
| name: "Add Row", | ||
| description: "Adds a new row to a specific table in the AppSheet app. [See the documentation](https://support.google.com/appsheet/answer/10104797?hl=en&ref_topic=10105767&sjid=1665780.0.1444403316-SA#)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| methods: { | ||
| ...common.methods, | ||
| getAction() { | ||
| return "Add"; | ||
| }, | ||
| getSummary() { | ||
| return "Added a new row successfully"; | ||
| }, | ||
| }, | ||
| }; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import appsheet from "../../google_appsheet.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| props: { | ||
| appsheet, | ||
| tableName: { | ||
| propDefinition: [ | ||
| appsheet, | ||
| "tableName", | ||
| ], | ||
| }, | ||
| row: { | ||
| propDefinition: [ | ||
| appsheet, | ||
| "row", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| getData() { | ||
| return {}; | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const dataRow = parseObject(this.row); | ||
| const rows = dataRow | ||
| ? [ | ||
| dataRow, | ||
| ] | ||
| : []; | ||
| 
     | 
||
| const response = await this.appsheet.post({ | ||
| $, | ||
| tableName: this.tableName, | ||
| data: { | ||
| Action: this.getAction(), | ||
| Rows: rows, | ||
| ...this.getData(), | ||
| }, | ||
| }); | ||
| console.log("response: ", response); | ||
| 
     | 
||
| $.export("$summary", this.getSummary(response)); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import common from "../common/base.mjs"; | ||
| 
     | 
||
| export default { | ||
| ...common, | ||
| key: "google_appsheet-delete-row", | ||
| name: "Delete Row", | ||
| description: "Deletes a specific row from a table in the AppSheet app. [See the documentation](https://support.google.com/appsheet/answer/10105399?hl=en&ref_topic=10105767&sjid=1665780.0.1444403316-SA)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| ...common.props, | ||
| alert: { | ||
| 
         Check warning on line 12 in components/google_appsheet/actions/delete-row/delete-row.mjs 
    
   | 
||
| type: "alert", | ||
| alertType: "info", | ||
| content: "The `Row` value may contain field values of the key field values of the record to be deleted.", | ||
| }, | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| row: { | ||
| propDefinition: [ | ||
| common.props.appsheet, | ||
| "row", | ||
| ], | ||
| description: "The `Row` value may contain field values of the key field values of the record to be deleted.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| ...common.methods, | ||
| getAction() { | ||
| return "Delete"; | ||
| }, | ||
| getSummary(response) { | ||
| return `${response.Rows.length} successfully delete!`; | ||
| }, | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import common from "../common/base.mjs"; | ||
| 
     | 
||
| export default { | ||
| ...common, | ||
| key: "google_appsheet-get-rows", | ||
| name: "Get Rows", | ||
| description: "Read existing records in a table in the AppSheet app. [See the documentation](https://support.google.com/appsheet/answer/10104797?hl=en&ref_topic=10105767&sjid=1665780.0.1444403316-SA#)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| ...common.props, | ||
| selector: { | ||
| type: "string", | ||
| label: "Selector", | ||
| description: "You can specify an expression to select and format the rows returned. **Example: Filter(TableName, [Column] = \"Value\")** [See the documentation](https://support.google.com/appsheet/answer/10105770?hl=en&ref_topic=10105767&sjid=3242006823758562345-NC)", | ||
| optional: true, | ||
| }, | ||
| row: { | ||
| propDefinition: [ | ||
| common.props.appsheet, | ||
| "row", | ||
| ], | ||
| description: "You can also filter the results using the `Row` value. The `Row` value may contain field values of the key field values of the record to be retrieved. **Example:** `{ \"First Name\": \"John\" }`", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| ...common.methods, | ||
| getAction() { | ||
| return "Find"; | ||
| }, | ||
| getData() { | ||
| return this.selector | ||
| ? { | ||
| Properties: { | ||
| Selector: this.selector, | ||
| }, | ||
| } | ||
| : {}; | ||
| }, | ||
| getSummary(response) { | ||
| return `Successfully retrieved ${ response.length || 0} rows`; | ||
| }, | ||
| }, | ||
| }; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import common from "../common/base.mjs"; | ||
| 
     | 
||
| export default { | ||
| ...common, | ||
| key: "google_appsheet-update-row", | ||
| name: "Update Row", | ||
| description: "Updates an existing row in a specific table in the AppSheet app. [See the documentation](https://support.google.com/appsheet/answer/10105002?hl=en&ref_topic=10105767&sjid=1665780.0.1444403316-SA)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| ...common.props, | ||
| alert: { | ||
| 
         Check warning on line 12 in components/google_appsheet/actions/update-row/update-row.mjs 
    
   | 
||
| type: "alert", | ||
| alertType: "info", | ||
| content: `The \`Row\` value must include the key field values of the record to be updated. | ||
| \nThe \`Row\` value may contain one or more field values of other fields to be updated in the record. | ||
| \nIf a field's name is omitted, that field's value is not changed. If the field can be assigned a string value and the field value you specify is "" then the field's value will be cleared.`, | ||
| }, | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| }, | ||
| methods: { | ||
| ...common.methods, | ||
| getAction() { | ||
| return "Edit"; | ||
| }, | ||
| getSummary(response) { | ||
| return `${response.Rows.length} successfully updated!`; | ||
| }, | ||
| }, | ||
| }; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| export const parseObject = (obj) => { | ||
| if (!obj) return undefined; | ||
| 
     | 
||
| if (Array.isArray(obj)) { | ||
| return obj.map((item) => { | ||
| if (typeof item === "string") { | ||
| try { | ||
| return JSON.parse(item); | ||
| } catch (e) { | ||
| return item; | ||
| } | ||
| } | ||
| return item; | ||
| }); | ||
| } | ||
| if (typeof obj === "string") { | ||
| try { | ||
| return JSON.parse(obj); | ||
| } catch (e) { | ||
| return obj; | ||
| } | ||
| } | ||
| return obj; | ||
| }; | 
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| 
     | 
||
| export default { | ||
| type: "app", | ||
| app: "google_appsheet", | ||
| propDefinitions: { | ||
| tableName: { | ||
| type: "string", | ||
| label: "Table Name", | ||
| description: "Name of the table. **Select Data > Tables** and expand the table details to view the table name.", | ||
| }, | ||
| row: { | ||
| type: "object", | ||
| label: "Row", | ||
| description: "JSON object representing the row data", | ||
| }, | ||
| }, | ||
| methods: { | ||
| _baseUrl(tableName) { | ||
| return `https://api.appsheet.com/api/v2/apps/${this.$auth.app_id}/tables/${encodeURIComponent(tableName)}/Action`; | ||
| }, | ||
| _headers() { | ||
| return { | ||
| "ApplicationAccessKey": `${this.$auth.api_key}`, | ||
| }; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, tableName, ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: this._baseUrl(tableName), | ||
| headers: this._headers(), | ||
| ...opts, | ||
| }); | ||
| }, | ||
                
      
                  luancazarine marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| post(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| { | ||
| "name": "@pipedream/google_appsheet", | ||
| "version": "0.0.3", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Google Appsheet Components", | ||
| "main": "dist/app/google_appsheet.app.mjs", | ||
| "main": "google_appsheet.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "google_appsheet" | ||
| ], | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "homepage": "https://pipedream.com/apps/google_appsheet", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | 
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.