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
19 changes: 19 additions & 0 deletions components/tookan/actions/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import tookan from "../app/tookan.app";

export default {
props: {
tookan,
additionalOptions: {
propDefinition: [
tookan,
"additionalOptions",
],
},
timezone: {
propDefinition: [
tookan,
"timezone",
],
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { defineAction } from "@pipedream/types";
import { CreateAppointmentTaskParams } from "../../common/requestParams";
import tookan from "../../app/tookan.app";
import common from "../common";
import { TaskData } from "../../common/responseSchemas";

export default defineAction({
...common,
name: "Create Appointment Task",
description:
"Create an appointment task [See docs here](https://tookanapi.docs.apiary.io/#reference/task/create-task/create-an-appointment-task)",
key: "tookan-create-appointment-task",
version: "0.0.1",
type: "action",
props: {
...common.props,
customerAddress: {
propDefinition: [
tookan,
"customerAddress",
],
},
jobDeliveryDatetime: {
propDefinition: [
tookan,
"jobDeliveryDatetime",
],
},
jobPickupDatetime: {
propDefinition: [
tookan,
"jobPickupDatetime",
],
},
},
async run({ $ }) {
const params: CreateAppointmentTaskParams = {
$,
data: {
timezone: this.timezone,
customer_address: this.customerAddress,
job_delivery_datetime: this.jobDeliveryDatetime,
job_pickup_datetime: this.jobPickupDatetime,
has_delivery: 0,
has_pickup: 0,
layout_type: 1,
...this.additionalOptions,
},
};
const data: TaskData = await this.tookan.createAppointmentTask(params);

$.export("$summary", `Created appointment task successfully (id ${data.job_id})`);

return data;
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { defineAction } from "@pipedream/types";
import { CreateDeliveryTaskParams } from "../../common/requestParams";
import tookan from "../../app/tookan.app";
import common from "../common";
import { TaskData } from "../../common/responseSchemas";

export default defineAction({
...common,
name: "Create Delivery Task",
description:
"Create a delivery task [See docs here](https://tookanapi.docs.apiary.io/#reference/task/create-task/create-a-delivery-task)",
key: "tookan-create-delivery-task",
version: "0.0.1",
type: "action",
props: {
...common.props,
customerAddress: {
propDefinition: [
tookan,
"customerAddress",
],
},
jobDeliveryDatetime: {
propDefinition: [
tookan,
"jobDeliveryDatetime",
],
},
},
async run({ $ }) {
const params: CreateDeliveryTaskParams = {
$,
data: {
timezone: this.timezone,
customer_address: this.customerAddress,
job_delivery_datetime: this.jobDeliveryDatetime,
has_delivery: 1,
has_pickup: 0,
layout_type: 0,
...this.additionalOptions,
},
};
const data: TaskData = await this.tookan.createDeliveryTask(params);

$.export("$summary", `Created delivery task successfully (id ${data.job_id})`);

return data;
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { defineAction } from "@pipedream/types";
import { CreateFieldWorkforceTaskParams } from "../../common/requestParams";
import tookan from "../../app/tookan.app";
import common from "../common";
import { TaskData } from "../../common/responseSchemas";

export default defineAction({
...common,
name: "Create Field Workforce Task",
description:
"Create a field workforce task [See docs here](https://tookanapi.docs.apiary.io/#reference/task/create-task/create-a-field-workforce-task)",
key: "tookan-create-field-workforce-task",
version: "0.0.1",
type: "action",
props: {
...common.props,
customerAddress: {
propDefinition: [
tookan,
"customerAddress",
],
},
jobDeliveryDatetime: {
propDefinition: [
tookan,
"jobDeliveryDatetime",
],
},
jobPickupDatetime: {
propDefinition: [
tookan,
"jobPickupDatetime",
],
},
},
async run({ $ }) {
const params: CreateFieldWorkforceTaskParams = {
$,
data: {
timezone: this.timezone,
customer_address: this.customerAddress,
job_delivery_datetime: this.jobDeliveryDatetime,
job_pickup_datetime: this.jobPickupDatetime,
has_delivery: 0,
has_pickup: 0,
layout_type: 2,
...this.additionalOptions,
},
};
const data: TaskData = await this.tookan.createFieldWorkforceTask(params);

$.export("$summary", `Created field workforce task successfully (id ${data.job_id})`);

return data;
},
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { defineAction } from "@pipedream/types";
import { CreatePickupAndDeliveryTaskParams } from "../../common/requestParams";
import tookan from "../../app/tookan.app";
import common from "../common";
import { TaskData } from "../../common/responseSchemas";

export default defineAction({
...common,
name: "Create Pickup And Delivery Task",
description:
"Create a pickup and delivery task [See docs here](https://tookanapi.docs.apiary.io/#reference/task/create-task/create-a-pickup-and-delivery-task)",
key: "tookan-create-pickup-and-delivery-task",
version: "0.0.1",
type: "action",
props: {
...common.props,
customerAddress: {
propDefinition: [
tookan,
"customerAddress",
],
},
jobDeliveryDatetime: {
propDefinition: [
tookan,
"jobDeliveryDatetime",
],
},
jobPickupAddress: {
propDefinition: [
tookan,
"jobPickupAddress",
],
},
jobPickupDatetime: {
propDefinition: [
tookan,
"jobPickupDatetime",
],
},
},
async run({ $ }) {
const params: CreatePickupAndDeliveryTaskParams = {
$,
data: {
timezone: this.timezone,
customer_address: this.customerAddress,
job_delivery_datetime: this.jobDeliveryDatetime,
job_pickup_address: this.jobPickupAddress,
job_pickup_datetime: this.jobPickupDatetime,
has_delivery: 1,
has_pickup: 1,
layout_type: 0,
...this.additionalOptions,
},
};
const data: TaskData = await this.tookan.createPickupAndDeliveryTask(
params,
);

$.export(
"$summary",
`Created pickup and delivery task successfully (id ${data.job_id})`,
);

return data;
},
});
49 changes: 49 additions & 0 deletions components/tookan/actions/create-pickup-task/create-pickup-task.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { defineAction } from "@pipedream/types";
import { CreatePickupTaskParams } from "../../common/requestParams";
import tookan from "../../app/tookan.app";
import common from "../common";
import { TaskData } from "../../common/responseSchemas";

export default defineAction({
...common,
name: "Create Pickup Task",
description:
"Create a pickup task [See docs here](https://tookanapi.docs.apiary.io/#reference/task/create-task/create-a-pickup-task)",
key: "tookan-create-pickup-task",
version: "0.0.1",
type: "action",
props: {
...common.props,
jobPickupAddress: {
propDefinition: [
tookan,
"jobPickupAddress",
],
},
jobPickupDatetime: {
propDefinition: [
tookan,
"jobPickupDatetime",
],
},
},
async run({ $ }) {
const params: CreatePickupTaskParams = {
$,
data: {
timezone: this.timezone,
job_pickup_address: this.jobPickupAddress,
job_pickup_datetime: this.jobPickupDatetime,
has_delivery: 0,
has_pickup: 1,
layout_type: 0,
...this.additionalOptions,
},
};
const data: TaskData = await this.tookan.createPickupTask(params);

$.export("$summary", `Created pickup task successfully (id ${data.job_id})`);

return data;
},
});
Loading