@pipedream/wordpress_org 0.3.5 → 0.3.7

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/LICENSE CHANGED
@@ -1,7 +1,41 @@
1
- Copyright 2020 Pipedream, Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Pipedream Source Available License Version 1.0
2
+
3
+ This Pipedream Source Available License Agreement Version 1.0 (this “Agreement”) sets forth the terms on which Pipedream, Inc., a Delaware corporation (“Pipedream”) makes available certain software (the Software). By installing, downloading, accessing, using or distributing the Software, you agree to the terms of this Agreement. If you do not agree to such terms, you must not use the Software. If you are receiving the Software on behalf of a legal entity, you represent and warrant that you have the actual authority to agree to the terms and conditions of this Agreement on behalf of such entity. “Licensee” means you, an individual, or the entity on whose behalf you are receiving the Software.
4
+
5
+ LICENSE GRANT AND CONDITIONS.
6
+
7
+ 1.1 License. Subject to the terms and conditions of this Agreement, Pipedream hereby grants to Licensee a non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this Agreement to use, prepare modifications and derivative works, distribute (including without limitation in source code or object code form) and reproduce copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means any commercial use of the software including, but not limited to, making available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other online service that competes with the Software or any other Pipedream products or services.
8
+
9
+ 1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the following conditions:
10
+
11
+ a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee modified the Software.
12
+
13
+ b. On each Software copy, Licensee shall reproduce and not remove or alter all Pipedream or third party copyright or other proprietary notices contained in the Software, and Licensee must provide this with each copy: “This software is made available by Pipedream, Inc., under the terms of the Pipedream Source Available License, Version 1.0 located at https://github.com/PipedreamHQ/pipedream/blob/master/LICENSE. By installing, downloading, accessing, using or distributing the Software, you agree to the terms of such License Agreement.”
14
+
15
+ 1.3 Modifications. Licensee may add its own copyright notices to modifications made by Licensee and may provide additional or different license terms and conditions for use, reproduction, or distribution of Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not Pipedream, will be responsible for any such obligations.
16
+
17
+ 1.4 No Sublicensing. The License does not include the right to sublicense the Software; provided, however, that any recipient to which Licensee provides the Software may exercise the License so long as such recipient agrees to the terms and conditions of this Agreement.
18
+
19
+ TERM AND TERMINATION.
20
+
21
+ This Agreement will continue unless and until earlier terminated as set forth herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will terminate automatically and the License will terminate automatically and permanently.
22
+
23
+ INTELLECTUAL PROPERTY.
24
+
25
+ As between the parties, Pipedream retains all right, title, and interest in the Software, and all intellectual property rights therein. Pipedream hereby reserves all rights not expressly granted to Licensee in this Agreement. Pipedream reserves all rights in its trademarks and service marks, and no licenses thereto are granted by this Agreement.
26
+
27
+ DISCLAIMER.
28
+
29
+ PIPEDREAM HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE.
30
+
31
+ LIMITATION OF LIABILITY.
32
+
33
+ PIPEDREAM WILL NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW.
34
+
35
+ GENERAL.
36
+
37
+ 6.1 Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the state of California, without reference to its conflict of laws principles. If Licensee is located outside of the United States, any dispute, controversy or claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in accordance with the JAMS International Arbitration Rules. The tribunal will consist of one arbitrator. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction thereof. All disputes including arbitrations shall take place in Santa Clara County, California. The language to be used in any such proceedings shall be English.
38
+
39
+ 6.2. Assignment. Licensee is not authorized to assign its rights under this Agreement to any third party. Pipedream may freely assign its rights under this Agreement to any third party.
40
+
41
+ 6.3. Other. This Agreement is the entire agreement between the parties regarding the subject matter hereof. No amendment or modification of this Agreement will be valid or binding upon the parties unless made in writing and signed by the duly authorized representatives of both parties. In the event that any provision, including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and all licenses and rights granted hereunder will immediately terminate. Waiver by Pipedream of a breach of any provision of this Agreement or the failure by Pipedream to exercise any right hereunder will not be construed as a waiver of any subsequent breach of that right or as a waiver of any other right.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Overview
2
+
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:
9
+
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.
@@ -4,7 +4,7 @@ export default {
4
4
  key: "wordpress_org-create-post",
5
5
  name: "Create Post",
6
6
  description: "Creates a post. [See the docs here](https://developer.wordpress.org/rest-api/reference/posts/#create-a-post)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  props: {
10
10
  wordpress,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "wordpress_org-create-user",
5
5
  name: "Create User",
6
6
  description: "Creates a user. [See the docs here](https://developer.wordpress.org/rest-api/reference/users/#create-a-user)",
7
- version: "0.0.2",
7
+ version: "0.0.3",
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 docs here](https://developer.wordpress.org/rest-api/reference/users/#retrieve-a-user-2)",
7
+ version: "0.0.1",
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
+ };
@@ -4,7 +4,7 @@ export default {
4
4
  key: "wordpress_org-search-posts",
5
5
  name: "Search Posts",
6
6
  description: "Searches for specific posts. [See the docs here](https://developer.wordpress.org/rest-api/reference/posts/#list-posts)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  props: {
10
10
  wordpress,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "wordpress_org-update-post",
5
5
  name: "Update Post",
6
6
  description: "Updates a post specified by its ID. [See the docs here](https://developer.wordpress.org/rest-api/reference/posts/#update-a-post)",
7
- version: "0.0.1",
7
+ version: "0.0.2",
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 docs here](https://developer.wordpress.org/rest-api/reference/users/#update-a-user-2)",
8
+ version: "0.0.1",
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/wordpress_org",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "Pipedream Wordpress.org Components",
5
5
  "main": "wordpress_org.app.mjs",
6
6
  "keywords": [
@@ -9,8 +9,8 @@
9
9
  ],
10
10
  "homepage": "https://pipedream.com/apps/wordpress_org",
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
- "license": "MIT",
13
12
  "dependencies": {
13
+ "lodash.pickby": "^4.6.0",
14
14
  "wpapi": "^1.2.2"
15
15
  },
16
16
  "gitHead": "c351fb656d3754e65ef977f0d62e61967b4dc356",
@@ -137,6 +137,18 @@ export default {
137
137
  }));
138
138
  },
139
139
  },
140
+ user: {
141
+ type: "string",
142
+ label: "User",
143
+ description: "Identifier of the user",
144
+ async options({ page }) {
145
+ const users = await this.listUsers(page + 1);
146
+ return users.map((user) => ({
147
+ label: user?.name,
148
+ value: user?.id,
149
+ }));
150
+ },
151
+ },
140
152
  },
141
153
  methods: {
142
154
  async getClient() {
@@ -176,6 +188,20 @@ export default {
176
188
  return wp.posts().perPage(PER_PAGE)
177
189
  .page(page);
178
190
  },
191
+ async listUsers(page) {
192
+ const wp = await this.getClient();
193
+ return wp.users().perPage(PER_PAGE)
194
+ .page(page);
195
+ },
196
+ async getUser(userId) {
197
+ const wp = await this.getClient();
198
+ return wp.users().id(userId);
199
+ },
200
+ async updateUser(userId, params) {
201
+ const wp = await this.getClient();
202
+ return wp.users().id(userId)
203
+ .update(params);
204
+ },
179
205
  async searchPosts(params, page, perPage = PER_PAGE) {
180
206
  const {
181
207
  search,