Skip to content

Commit 1b6d82b

Browse files
committed
Adalo: Added collection as auth parameter in requests
1 parent 2fb7dd6 commit 1b6d82b

File tree

8 files changed

+29
-53
lines changed

8 files changed

+29
-53
lines changed

components/adalo/actions/common/base.mjs

Lines changed: 0 additions & 12 deletions
This file was deleted.

components/adalo/actions/create-record/create-record.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import base from "../common/base.mjs";
1+
import adalo from "../../adalo.app.mjs";
22

33
export default {
4-
...base,
54
key: "adalo-create-record",
65
name: "Create Record",
76
description: "Create a new record. [See docs here](https://help.adalo.com/integrations/the-adalo-api/collections)",
8-
version: "0.0.1",
7+
version: "0.0.2",
98
type: "action",
109
props: {
11-
...base.props,
10+
adalo,
1211
data: {
1312
label: "Data",
1413
description: "The data to create record. E.g. `{ \"Email\": \"string\", \"Username\": \"string\", \"Full Name\": \"string\" }`",
@@ -18,7 +17,6 @@ export default {
1817
async run({ $ }) {
1918
const response = await this.adalo.createRecord({
2019
$,
21-
collectionId: this.collectionId,
2220
data: JSON.parse(this.data),
2321
});
2422

components/adalo/actions/get-records/get-records.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import base from "../common/base.mjs";
1+
import adalo from "../../adalo.app.mjs";
22

33
export default {
4-
...base,
54
key: "adalo-get-records",
65
name: "Get Records",
76
description: "Get all records from a collection. [See docs here](https://help.adalo.com/integrations/the-adalo-api/collections)",
8-
version: "0.0.2",
7+
version: "0.0.3",
98
type: "action",
9+
props: {
10+
adalo,
11+
},
1012
async run({ $ }) {
1113
let resources = [];
1214
let offset = 0;
@@ -18,7 +20,6 @@ export default {
1820
requestFn: this.adalo.getRecords,
1921
requestArgs: {
2022
$,
21-
collectionId: this.collectionId,
2223
params: {
2324
offset,
2425
},

components/adalo/actions/update-record/update-record.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import base from "../common/base.mjs";
1+
import adalo from "../../adalo.app.mjs";
22

33
export default {
4-
...base,
54
key: "adalo-update-record",
65
name: "Update Record",
76
description: "Update a record. [See docs here](https://help.adalo.com/integrations/the-adalo-api/collections)",
8-
version: "0.0.1",
7+
version: "0.0.2",
98
type: "action",
109
props: {
11-
...base.props,
10+
adalo,
1211
recordId: {
1312
label: "Record ID",
1413
description: "The ID of a record",
@@ -23,7 +22,6 @@ export default {
2322
async run({ $ }) {
2423
const response = await this.adalo.updateRecord({
2524
$,
26-
collectionId: this.collectionId,
2725
recordId: this.recordId,
2826
data: JSON.parse(this.data),
2927
});

components/adalo/adalo.app.mjs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { axios } from "@pipedream/platform";
33
export default {
44
type: "app",
55
app: "adalo",
6-
propDefinitions: {},
76
methods: {
7+
_collectionId() {
8+
return this.$auth.collection_id;
9+
},
810
_apiKey() {
911
return this.$auth.api_key;
1012
},
@@ -49,30 +51,26 @@ export default {
4951
},
5052
};
5153
},
52-
async getRecords({
53-
collectionId, ...args
54-
} = {}) {
54+
async getRecords(args = {}) {
5555
const response = await this._makeRequest({
56-
path: `/collections/${collectionId}`,
56+
path: `/collections/${this._collectionId()}`,
5757
...args,
5858
});
5959

6060
return response.records;
6161
},
62-
async createRecord({
63-
collectionId, ...args
64-
} = {}) {
62+
createRecord(args = {}) {
6563
return this._makeRequest({
66-
path: `/collections/${collectionId}`,
64+
path: `/collections/${this._collectionId()}`,
6765
method: "post",
6866
...args,
6967
});
7068
},
71-
async updateRecord({
72-
collectionId, recordId, ...args
69+
updateRecord({
70+
recordId, ...args
7371
} = {}) {
7472
return this._makeRequest({
75-
path: `/collections/${collectionId}/${recordId}`,
73+
path: `/collections/${this._collectionId()}/${recordId}`,
7674
method: "put",
7775
...args,
7876
});

components/adalo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/adalo",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"description": "Pipedream Adalo Components",
55
"main": "adalo.app.mjs",
66
"keywords": [
@@ -14,6 +14,6 @@
1414
"access": "public"
1515
},
1616
"dependencies": {
17-
"@pipedream/platform": "^1.2.0"
17+
"@pipedream/platform": "^3.0.1"
1818
}
1919
}

components/adalo/sources/new-record/new-record.mjs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "adalo-new-record",
66
name: "New Record",
77
description: "Emit new event when is created a record.",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
type: "source",
1010
dedupe: "unique",
1111
props: {
@@ -16,11 +16,6 @@ export default {
1616
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
1717
},
1818
},
19-
collectionId: {
20-
label: "Collection ID",
21-
description: "The ID the collection",
22-
type: "string",
23-
},
2419
},
2520
methods: {
2621
emitEvent(event) {
@@ -34,7 +29,6 @@ export default {
3429
hooks: {
3530
async deploy() {
3631
const records = await this.adalo.getRecords({
37-
collectionId: this.collectionId,
3832
params: {
3933
limit: 10,
4034
},
@@ -49,7 +43,6 @@ export default {
4943
while (offset >= 0) {
5044
const records = await this.adalo.getRecords({
5145
$,
52-
collectionId: this.collectionId,
5346
params: {
5447
offset,
5548
},

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)