Skip to content
Open
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
@@ -0,0 +1,79 @@
import app from "../../lightspeed_ecom_c_series.app.mjs";

export default {
key: "lightspeed_ecom_c_series-find-customers",
name: "Find Customers",
description: "Find a customer by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/customer/#get-all-customers)",
version: "0.0.1",
type: "action",
props: {
app,
customerEmail: {
propDefinition: [
app,
"customerEmail",
],
description: "Retrieve all customers from a specific customer based on the customer email",
optional: true,
},
sinceId: {
type: "string",
label: "Since ID",
description: "Restrict results to after the specified ID",
optional: true,
},
createdAtMin: {
propDefinition: [
app,
"createdAtMin",
],
description: "Show customers created after date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
createdAtMax: {
propDefinition: [
app,
"createdAtMax",
],
description: "Show customers created before date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
updatedAtMin: {
propDefinition: [
app,
"updatedAtMin",
],
description: "Show customers last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
updatedAtMax: {
propDefinition: [
app,
"updatedAtMax",
],
description: "Show customers last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
},
async run({ $ }) {
const response = this.app.paginate({
fn: this.app.listCustomers,
$,
params: {
email: this.customerEmail,
since_id: this.sinceId,
created_at_min: this.createdAtMin,
created_at_max: this.createdAtMax,
updated_at_min: this.updatedAtMin,
updated_at_max: this.updatedAtMax,
},
dataField: "customers",
});

const customers = [];
for await (const customer of response) {
customers.push(customer);
}

$.export("$summary", `Successfully found ${customers.length} customer${customers.length === 1
? ""
: "s"}`);
return customers;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import app from "../../lightspeed_ecom_c_series.app.mjs";

export default {
key: "lightspeed_ecom_c_series-find-invoice",
name: "Find Invoice",
description: "Find an invoice by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/invoice/#get-all-invoices)",
version: "0.0.1",
type: "action",
props: {
app,
customerId: {
propDefinition: [
app,
"customerId",
],
description: "Retrieve all invoices from a specific customer based on the customerid",
optional: true,
},
orderNumber: {
propDefinition: [
app,
"orderNumber",
],
description: "Retrieve an order based on the order number",
optional: true,
},
invoiceNumber: {
propDefinition: [
app,
"invoiceNumber",
],
description: "Retrieve an invoice based on the invoice number",
optional: true,
},
sinceId: {
type: "string",
label: "Since ID",
description: "Restrict results to after the specified ID",
optional: true,
},
createdAtMin: {
propDefinition: [
app,
"createdAtMin",
],
description: "Show invoices created after date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
createdAtMax: {
propDefinition: [
app,
"createdAtMax",
],
description: "Show invoices created before date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
updatedAtMin: {
propDefinition: [
app,
"updatedAtMin",
],
description: "Show invoices last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
updatedAtMax: {
propDefinition: [
app,
"updatedAtMax",
],
description: "Show invoices last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
},
async run({ $ }) {
const response = this.app.paginate({
fn: this.app.listInvoice,
$,
params: {
customer: this.customerId,
number: this.invoiceNumber,
order: this.orderNumber,
since_id: this.sinceId,
created_at_min: this.createdAtMin,
created_at_max: this.createdAtMax,
updated_at_min: this.updatedAtMin,
updated_at_max: this.updatedAtMax,
},
dataField: "invoices",
});

const invoices = [];
for await (const invoice of response) {
invoices.push(invoice);
}

$.export("$summary", `Successfully found ${invoices.length} invoice${invoices.length === 1
? ""
: "s"}`);
return invoices;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import app from "../../lightspeed_ecom_c_series.app.mjs";

export default {
key: "lightspeed_ecom_c_series-find-order",
name: "Find Order",
description: "Find an order by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/order/#get-all-orders)",
version: "0.0.1",
type: "action",
props: {
app,
customerId: {
propDefinition: [
app,
"customerId",
],
description: "Retrieve all orders from a specific customer based on the customerid",
optional: true,
},
orderNumber: {
propDefinition: [
app,
"orderNumber",
],
description: "Retrieve an order based on the order number",
optional: true,
},
sinceId: {
type: "string",
label: "Since ID",
description: "Restrict results to after the specified ID",
optional: true,
},
createdAtMin: {
propDefinition: [
app,
"createdAtMin",
],
description: "Show orders created after date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
createdAtMax: {
propDefinition: [
app,
"createdAtMax",
],
description: "Show orders created before date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
updatedAtMin: {
propDefinition: [
app,
"updatedAtMin",
],
description: "Show orders last updated after date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
updatedAtMax: {
propDefinition: [
app,
"updatedAtMax",
],
description: "Show orders last updated before date. **Format: `YYYY-MM-DD HH:MM:SS`**",
},
},
async run({ $ }) {
const response = this.app.paginate({
fn: this.app.listOrder,
$,
params: {
customer: this.customerId,
number: this.orderNumber,
since_id: this.sinceId,
created_at_min: this.createdAtMin,
created_at_max: this.createdAtMax,
updated_at_min: this.updatedAtMin,
updated_at_max: this.updatedAtMax,
},
dataField: "orders",
});

const orders = [];
for await (const order of response) {
orders.push(order);
}

$.export("$summary", `Successfully found ${orders.length} order${orders.length === 1
? ""
: "s"}`);
return orders;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import app from "../../lightspeed_ecom_c_series.app.mjs";

export default {
key: "lightspeed_ecom_c_series-find-product",
name: "Find Product",
description: "Find an product by ID. [See the documentation](https://developers.lightspeedhq.com/ecom/endpoints/product/#get-all-products)",
version: "0.0.1",
type: "action",
props: {
app,
brandId: {
propDefinition: [
app,
"brandId",
],
optional: true,
},
sinceId: {
type: "string",
label: "Since ID",
description: "Restrict results to after the specified ID",
optional: true,
},
createdAtMin: {
propDefinition: [
app,
"createdAtMin",
],
},
createdAtMax: {
propDefinition: [
app,
"createdAtMax",
],
},
updatedAtMin: {
propDefinition: [
app,
"updatedAtMin",
],
},
updatedAtMax: {
propDefinition: [
app,
"updatedAtMax",
],
},
},
async run({ $ }) {
const response = this.app.paginate({
fn: this.app.listProduct,
$,
params: {
brand: this.brandId,
since_id: this.sinceId,
created_at_min: this.createdAtMin,
created_at_max: this.createdAtMax,
updated_at_min: this.updatedAtMin,
updated_at_max: this.updatedAtMax,
},
dataField: "products",
});

const products = [];
for await (const product of response) {
products.push(product);
}

$.export("$summary", `Successfully found ${products.length} product${products.length === 1
? ""
: "s"}`);
return products;
},
};
Loading
Loading