@pipedream/wordpress_org 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -12
- package/actions/create-post/create-post.mjs +2 -2
- package/actions/create-user/create-user.mjs +2 -2
- package/actions/get-user/get-user.mjs +25 -0
- package/actions/search-posts/search-posts.mjs +2 -2
- package/actions/update-post/update-post.mjs +2 -2
- package/actions/update-user/update-user.mjs +101 -0
- package/common/constants.mjs +4 -0
- package/package.json +2 -1
- package/wordpress_org.app.mjs +28 -1
package/README.md
CHANGED
@@ -1,15 +1,32 @@
|
|
1
1
|
# Overview
|
2
2
|
|
3
|
-
WordPress API can help you create a variety of different projects with greater
|
3
|
+
WordPress API can help you create a variety of different projects with greater
|
4
|
+
efficiency and functionality. Whether it’s developing and creating a custom
|
5
|
+
WordPress site, creating an API for a product, or developing a plugin for a
|
6
|
+
program, the WordPress API offers more possibilities than ever to customize and
|
7
|
+
enhance your online experience. Here are a few examples of things you can build
|
8
|
+
using the WordPress API:
|
4
9
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
- Custom WordPress Sites: With WordPress API, you can create specialized and
|
11
|
+
customized sites that fit your exact needs and vision. From e-commerce stores
|
12
|
+
to magazine websites and anything else imaginable, WordPress API can help you
|
13
|
+
create and customize a website that’s tailored to your exact needs.
|
14
|
+
- Product API: If you’re a developer and you have products that require an API,
|
15
|
+
WordPress API can help you easily create one. You can create a custom API
|
16
|
+
that helps you manage your products and make them available to other
|
17
|
+
applications and websites.
|
18
|
+
- Plugin Creation: If you need a plugin for something you’re developing, the
|
19
|
+
WordPress API can help you create something tailored to your exact needs.
|
20
|
+
From custom shortcodes to mini programs and full-fledged plugins, the
|
21
|
+
WordPress API has what you need.
|
22
|
+
- Widgets: Widgets are small pieces of code that you can use on your website to
|
23
|
+
display different types of content. You can use the WordPress API to create
|
24
|
+
custom widgets that help you display plugins, videos, images, and more.
|
25
|
+
- Custom Social Network Platforms: The WordPress API offers more possibilities
|
26
|
+
than ever to create custom social network platforms. With access to the API,
|
27
|
+
you can create specialized networks for your website, unfettered by
|
28
|
+
third-party restrictions.
|
29
|
+
- Mobile Applications:Do you need to create a mobile application that interacts
|
30
|
+
with your website? The WordPress API can provide the tools and features you
|
31
|
+
need to create a smooth and seamless integration between your website and
|
32
|
+
your app.
|
@@ -3,8 +3,8 @@ import wordpress from "../../wordpress_org.app.mjs";
|
|
3
3
|
export default {
|
4
4
|
key: "wordpress_org-create-post",
|
5
5
|
name: "Create Post",
|
6
|
-
description: "Creates a post. [See the
|
7
|
-
version: "0.0.
|
6
|
+
description: "Creates a post. [See the documentation](https://developer.wordpress.org/rest-api/reference/posts/#create-a-post)",
|
7
|
+
version: "0.0.3",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
wordpress,
|
@@ -3,8 +3,8 @@ import wordpress from "../../wordpress_org.app.mjs";
|
|
3
3
|
export default {
|
4
4
|
key: "wordpress_org-create-user",
|
5
5
|
name: "Create User",
|
6
|
-
description: "Creates a user. [See the
|
7
|
-
version: "0.0.
|
6
|
+
description: "Creates a user. [See the documentation](https://developer.wordpress.org/rest-api/reference/users/#create-a-user)",
|
7
|
+
version: "0.0.4",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
wordpress,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import wordpress from "../../wordpress_org.app.mjs";
|
2
|
+
|
3
|
+
export default {
|
4
|
+
key: "wordpress_org-get-user",
|
5
|
+
name: "Get User",
|
6
|
+
description: "Retrieves information for a user. [See the documentation](https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user-2)",
|
7
|
+
version: "0.0.2",
|
8
|
+
type: "action",
|
9
|
+
props: {
|
10
|
+
wordpress,
|
11
|
+
user: {
|
12
|
+
propDefinition: [
|
13
|
+
wordpress,
|
14
|
+
"user",
|
15
|
+
],
|
16
|
+
},
|
17
|
+
},
|
18
|
+
async run({ $ }) {
|
19
|
+
const response = await this.wordpress.getUser(this.user);
|
20
|
+
|
21
|
+
$.export("$summary", `Retrieved information for user with ID ${this.user}`);
|
22
|
+
|
23
|
+
return response;
|
24
|
+
},
|
25
|
+
};
|
@@ -3,8 +3,8 @@ import wordpress from "../../wordpress_org.app.mjs";
|
|
3
3
|
export default {
|
4
4
|
key: "wordpress_org-search-posts",
|
5
5
|
name: "Search Posts",
|
6
|
-
description: "Searches for specific posts. [See the
|
7
|
-
version: "0.0.
|
6
|
+
description: "Searches for specific posts. [See the documentation](https://developer.wordpress.org/rest-api/reference/posts/#list-posts)",
|
7
|
+
version: "0.0.3",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
wordpress,
|
@@ -3,8 +3,8 @@ import wordpress from "../../wordpress_org.app.mjs";
|
|
3
3
|
export default {
|
4
4
|
key: "wordpress_org-update-post",
|
5
5
|
name: "Update Post",
|
6
|
-
description: "Updates a post specified by its ID. [See the
|
7
|
-
version: "0.0.
|
6
|
+
description: "Updates a post specified by its ID. [See the documentation](https://developer.wordpress.org/rest-api/reference/posts/#update-a-post)",
|
7
|
+
version: "0.0.3",
|
8
8
|
type: "action",
|
9
9
|
props: {
|
10
10
|
wordpress,
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import wordpress from "../../wordpress_org.app.mjs";
|
2
|
+
import pickBy from "lodash.pickby";
|
3
|
+
|
4
|
+
export default {
|
5
|
+
key: "wordpress_org-update-user",
|
6
|
+
name: "Update User",
|
7
|
+
description: "Updates the information of a user. [See the documentation](https://developer.wordpress.org/rest-api/reference/users/#update-a-user-2)",
|
8
|
+
version: "0.0.2",
|
9
|
+
type: "action",
|
10
|
+
props: {
|
11
|
+
wordpress,
|
12
|
+
user: {
|
13
|
+
propDefinition: [
|
14
|
+
wordpress,
|
15
|
+
"user",
|
16
|
+
],
|
17
|
+
},
|
18
|
+
name: {
|
19
|
+
propDefinition: [
|
20
|
+
wordpress,
|
21
|
+
"name",
|
22
|
+
],
|
23
|
+
},
|
24
|
+
firstName: {
|
25
|
+
propDefinition: [
|
26
|
+
wordpress,
|
27
|
+
"firstName",
|
28
|
+
],
|
29
|
+
},
|
30
|
+
lastName: {
|
31
|
+
propDefinition: [
|
32
|
+
wordpress,
|
33
|
+
"lastName",
|
34
|
+
],
|
35
|
+
},
|
36
|
+
email: {
|
37
|
+
propDefinition: [
|
38
|
+
wordpress,
|
39
|
+
"email",
|
40
|
+
],
|
41
|
+
optional: true,
|
42
|
+
},
|
43
|
+
url: {
|
44
|
+
propDefinition: [
|
45
|
+
wordpress,
|
46
|
+
"url",
|
47
|
+
],
|
48
|
+
},
|
49
|
+
description: {
|
50
|
+
propDefinition: [
|
51
|
+
wordpress,
|
52
|
+
"description",
|
53
|
+
],
|
54
|
+
},
|
55
|
+
roles: {
|
56
|
+
propDefinition: [
|
57
|
+
wordpress,
|
58
|
+
"roles",
|
59
|
+
],
|
60
|
+
},
|
61
|
+
password: {
|
62
|
+
propDefinition: [
|
63
|
+
wordpress,
|
64
|
+
"password",
|
65
|
+
],
|
66
|
+
optional: true,
|
67
|
+
},
|
68
|
+
meta: {
|
69
|
+
type: "object",
|
70
|
+
label: "Meta",
|
71
|
+
description: "Metafields for the user",
|
72
|
+
optional: true,
|
73
|
+
},
|
74
|
+
},
|
75
|
+
async run({ $ }) {
|
76
|
+
const params = pickBy({
|
77
|
+
name: this.name,
|
78
|
+
first_name: this.firstName,
|
79
|
+
last_name: this.lastName,
|
80
|
+
email: this.email,
|
81
|
+
url: this.url,
|
82
|
+
description: this.description,
|
83
|
+
roles: this.roles && [
|
84
|
+
this.roles,
|
85
|
+
],
|
86
|
+
password: this.password,
|
87
|
+
meta: this.meta,
|
88
|
+
});
|
89
|
+
|
90
|
+
let response;
|
91
|
+
try {
|
92
|
+
response = await this.wordpress.updateUser(this.user, params);
|
93
|
+
} catch (e) {
|
94
|
+
throw new Error(JSON.stringify(e));
|
95
|
+
}
|
96
|
+
|
97
|
+
$.export("$summary", `Updated user with ID ${this.user}`);
|
98
|
+
|
99
|
+
return response;
|
100
|
+
},
|
101
|
+
};
|
package/common/constants.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pipedream/wordpress_org",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.8",
|
4
4
|
"description": "Pipedream Wordpress.org Components",
|
5
5
|
"main": "wordpress_org.app.mjs",
|
6
6
|
"keywords": [
|
@@ -10,6 +10,7 @@
|
|
10
10
|
"homepage": "https://pipedream.com/apps/wordpress_org",
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
12
12
|
"dependencies": {
|
13
|
+
"lodash.pickby": "^4.6.0",
|
13
14
|
"wpapi": "^1.2.2"
|
14
15
|
},
|
15
16
|
"gitHead": "c351fb656d3754e65ef977f0d62e61967b4dc356",
|
package/wordpress_org.app.mjs
CHANGED
@@ -29,9 +29,10 @@ export default {
|
|
29
29
|
optional: true,
|
30
30
|
},
|
31
31
|
commentStatus: {
|
32
|
-
type: "
|
32
|
+
type: "string",
|
33
33
|
label: "Comment Status",
|
34
34
|
description: "Whether or not comments are allowed on the post",
|
35
|
+
options: constants.COMMENT_STATUS,
|
35
36
|
optional: true,
|
36
37
|
},
|
37
38
|
username: {
|
@@ -137,6 +138,18 @@ export default {
|
|
137
138
|
}));
|
138
139
|
},
|
139
140
|
},
|
141
|
+
user: {
|
142
|
+
type: "string",
|
143
|
+
label: "User",
|
144
|
+
description: "Identifier of the user",
|
145
|
+
async options({ page }) {
|
146
|
+
const users = await this.listUsers(page + 1);
|
147
|
+
return users.map((user) => ({
|
148
|
+
label: user?.name,
|
149
|
+
value: user?.id,
|
150
|
+
}));
|
151
|
+
},
|
152
|
+
},
|
140
153
|
},
|
141
154
|
methods: {
|
142
155
|
async getClient() {
|
@@ -176,6 +189,20 @@ export default {
|
|
176
189
|
return wp.posts().perPage(PER_PAGE)
|
177
190
|
.page(page);
|
178
191
|
},
|
192
|
+
async listUsers(page) {
|
193
|
+
const wp = await this.getClient();
|
194
|
+
return wp.users().perPage(PER_PAGE)
|
195
|
+
.page(page);
|
196
|
+
},
|
197
|
+
async getUser(userId) {
|
198
|
+
const wp = await this.getClient();
|
199
|
+
return wp.users().id(userId);
|
200
|
+
},
|
201
|
+
async updateUser(userId, params) {
|
202
|
+
const wp = await this.getClient();
|
203
|
+
return wp.users().id(userId)
|
204
|
+
.update(params);
|
205
|
+
},
|
179
206
|
async searchPosts(params, page, perPage = PER_PAGE) {
|
180
207
|
const {
|
181
208
|
search,
|