Skip to content

Commit 921ff74

Browse files
authored
Membado new components (#16644)
* Package/pnpm * 'Add/Remove Tags' component * Version adjustment * add newline
1 parent 70aa45c commit 921ff74

File tree

4 files changed

+82
-6
lines changed

4 files changed

+82
-6
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import membado from "../../membado.app.mjs";
2+
3+
export default {
4+
name: "Add or Remove Tags from User",
5+
version: "0.0.1",
6+
key: "membado-add-remove-tags",
7+
description:
8+
"Assign tags to or remove them from a user. [See the documentation](https://membado.zendesk.com/hc/de/articles/18155937106204-API-Documentation)",
9+
type: "action",
10+
props: {
11+
membado,
12+
mail: {
13+
type: "string",
14+
label: "Email address",
15+
description:
16+
"The email address of the user to whom the tags should be assigned or removed",
17+
},
18+
tagsAdd: {
19+
type: "string[]",
20+
label: "Tags to add",
21+
description: "A list of tag IDs to assign to the user.",
22+
optional: true,
23+
},
24+
tagsRemove: {
25+
type: "string[]",
26+
label: "Tags to remove",
27+
description: "A list of tag IDs to remove from the user.",
28+
optional: true,
29+
},
30+
},
31+
async run({ $ }) {
32+
const response = await this.membado.addMember({
33+
$,
34+
data: {
35+
mail: this.mail,
36+
tags_add: this.tagsAdd?.join?.() ?? this.tagsAdd,
37+
tags_remove: this.tagsRemove?.join?.() ?? this.tagsRemove,
38+
},
39+
});
40+
41+
$.export(
42+
"$summary",
43+
`Successfully changed tags for ${this.mail}`,
44+
);
45+
46+
return response;
47+
},
48+
};

components/membado/membado.app.mjs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "membado",
46
propDefinitions: {},
57
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
8+
_baseRequest({
9+
$, data, headers, ...args
10+
}) {
11+
return axios($, {
12+
baseURL: `https://www.membado.io/api/${this.$auth.user_identifier}`,
13+
data: {
14+
...data,
15+
apikey: this.$auth.api_key,
16+
},
17+
headers: {
18+
...headers,
19+
"content-type": "application/x-www-form-urlencoded",
20+
},
21+
...args,
22+
});
23+
},
24+
addMember(args) {
25+
return this._baseRequest({
26+
method: "POST",
27+
url: "/add-member",
28+
...args,
29+
});
930
},
1031
},
1132
};

components/membado/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/membado",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Membado Components",
55
"main": "membado.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
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+
}

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)