Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "wix_api_key-add-products-to-collection",
name: "Add Products To Collection",
description: "Adds a product or products to a specified collection. [See the documentation](https://dev.wix.com/api/rest/wix-stores/catalog/collections/add-products-to-collection)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
wix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "wix_api_key-create-contact",
name: "Create Contact",
description: "Creates a new contact. [See the documentation](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/create-contact)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
wix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "wix_api_key-create-product",
name: "Create Product",
description: "Creates a new product. [See the documentation](https://dev.wix.com/api/rest/wix-stores/catalog/products/create-product)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
wix,
Expand Down
2 changes: 1 addition & 1 deletion components/wix_api_key/actions/get-contact/get-contact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "wix_api_key-get-contact",
name: "Get Contact",
description: "Retrieves information about a contact. [See the documentation](https://dev.wix.com/api/rest/contacts/contacts/contacts-v4/get-contact)",
version: "0.0.1",
version: "0.0.2",
type: "action",
props: {
wix,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import wix from "../../wix_api_key.app.mjs";

export default {
key: "wix_api_key-publish-draft-post",
name: "Publish Draft Post",
description: "Publish a draft blog post [See the documentation](https://dev.wix.com/docs/rest/business-solutions/blog/draft-posts/publish-draft-post)",
version: "0.0.1",
type: "action",
props: {
wix,
alert: {

Check warning on line 11 in components/wix_api_key/actions/publish-draft-post/publish-draft-post.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 11 in components/wix_api_key/actions/publish-draft-post/publish-draft-post.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "Note: You must have 'Blog' installed in your Wix website or this will return an error.",
},
site: {
propDefinition: [
wix,
"site",
],
},
draftPostId: {
propDefinition: [
wix,
"draftPostId",
(c) => ({
siteId: c.site,
}),
],
},
},
async run({ $ }) {
const response = await this.wix.publishDraftPost({
$,
siteId: this.site,
postId: this.draftPostId,
});

$.export("$summary", `Successfully published draft post ${this.draftPostId}`);
return response;
},
};
2 changes: 1 addition & 1 deletion components/wix_api_key/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/wix_api_key",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Wix Components",
"main": "wix_api_key.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import common from "../common/common.mjs";
import constants from "../../common/constants.mjs";
import common from "../common/common.mjs";

export default {
...common,
key: "wix_api_key-new-member-registered",
name: "New Member Registered",
description: "Emit new event when a new member is registered. [See the documentation](https://dev.wix.com/api/rest/members/members/list-members)",
version: "0.0.1",
version: "0.0.2",
type: "source",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import common from "../common/common.mjs";
import constants from "../../common/constants.mjs";
import common from "../common/common.mjs";

export default {
...common,
key: "wix_api_key-new-order-created",
name: "New Order Created",
description: "Emit new event when a new order is created. [See the documentation](https://dev.wix.com/api/rest/wix-stores/orders/query-orders)",
version: "0.0.1",
version: "0.0.2",
type: "source",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import common from "../common/common.mjs";
import constants from "../../common/constants.mjs";
import common from "../common/common.mjs";

export default {
...common,
key: "wix_api_key-new-product-created",
name: "New Product Created",
description: "Emit new event when a new product is created. [See the documentation](https://dev.wix.com/api/rest/wix-stores/catalog/products/query-products)",
version: "0.0.1",
version: "0.0.2",
type: "source",
methods: {
...common.methods,
Expand Down
43 changes: 43 additions & 0 deletions components/wix_api_key/wix_api_key.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,33 @@ export default {
})) || [];
},
},
draftPostId: {
type: "string",
label: "Draft Post ID",
description: "The ID of the draft post to publish",
async options({
page, siteId,
}) {
const limit = constants.DEFAULT_LIMIT;
const params = {
"paging.limit": limit,
"paging.offset": page * limit,
"status": "UNPUBLISHED",
};

const { draftPosts } = await this.listDraftPosts({
siteId,
params,
});

return draftPosts?.map(({
id: value, title: label,
}) => ({
label,
value,
})) || [];
},
},
},
methods: {
_baseUrl() {
Expand Down Expand Up @@ -259,5 +286,21 @@ export default {
...args,
});
},
listDraftPosts(opts = {}) {
return this._makeRequest({
path: "/blog/v3/draft-posts",
...opts,
});
},
publishDraftPost({
postId,
...opts
}) {
return this._makeRequest({
method: "POST",
path: `/blog/v3/draft-posts/${postId}/publish`,
...opts,
});
},
},
};
3 changes: 1 addition & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading