Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion components/cliniko/actions/get-patient/get-patient.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
name: "Get Patient",
key: "cliniko-get-patient",
description: "Get the details of a patient by patient ID.",
version: "0.1.0",
version: "0.1.1",
type: "action",
props: {
app,
Expand Down
6 changes: 6 additions & 0 deletions components/cliniko/cliniko.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,11 @@ export default {
...args,
});
},
listAppointments(args = {}) {
return this.makeRequest({
path: "/appointments",
...args,
});
},
},
};
2 changes: 1 addition & 1 deletion components/cliniko/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/cliniko",
"version": "0.1.0",
"version": "0.2.0",
"description": "Pipedream Cliniko Components",
"main": "cliniko.app.mjs",
"keywords": [
Expand Down
5 changes: 4 additions & 1 deletion components/cliniko/sources/common/polling.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ export default {
getResourcesFn() {
throw new ConfigurationError("getResourcesFn is not implemented");
},
getSort() {
return "created_at:desc";
},
getResourcesFnArgs() {
return {
debug: true,
params: {
per_page: constants.DEFAULT_LIMIT,
sort: "created_at:desc",
sort: this.getSort(),
},
};
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import common from "../common/polling.mjs";
import sampleEmit from "./test-event.mjs";

export default {
...common,
key: "cliniko-new-appointment-updated",
name: "New Appointment Updated",
description: "Emit new event when an appointment is updated in Cliniko.",
type: "source",
version: "0.0.2",
dedupe: "unique",
methods: {
...common.methods,
getResourceName() {
return "appointments";
},
getResourcesFn() {
return this.app.listAppointments;
},
generateMeta(resource) {
return {
id: `${resource.id}-${resource.updated_at}`,
summary: `Appointment updated: ${resource.id}`,
ts: Date.parse(resource.updated_at),
};
},
getSort() {
return "updated_at:desc";
},
},
sampleEmit,
};
78 changes: 78 additions & 0 deletions components/cliniko/sources/new-appointment-updated/test-event.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
export default {
"appointment_type": {
"links": {
"self": "https://api.au1.cliniko.com/v1/appointment_types/1"
}
},
"archived_at": "2019-08-24T14:15:22Z",
"attendees": {
"links": {
"self": "https://api.au1.cliniko.com/v1/individual_appointments/1/attendees"
}
},
"booking_ip_address": "10.0.0.43",
"business": {
"links": {
"self": "https://api.au1.cliniko.com/v1/businesses/1"
}
},
"cancellation_note": "string",
"cancellation_reason": 0,
"cancellation_reason_description": "Feeling Better",
"cancelled_at": "2019-08-24T14:15:22Z",
"conflicts": {
"links": {
"self": "https://api.au1.cliniko.com/v1/individual_appointments/1/conflicts"
}
},
"created_at": "2019-08-24T14:15:22Z",
"deleted_at": "2019-08-24T14:15:22Z",
"did_not_arrive": true,
"email_reminder_sent": true,
"ends_at": "2019-08-24T14:15:22Z",
"has_patient_appointment_notes": true,
"id": "string",
"invoice_status": 0,
"links": {
"self": "https://api.au1.cliniko.com/v1/individual_appointments/1"
},
"notes": "string",
"online_booking_policy_accepted": true,
"patient": {
"links": {
"self": "https://api.au1.cliniko.com/v1/patients/1"
}
},
"patient_arrived": true,
"patient_case": {
"links": {
"self": "https://api.au1.cliniko.com/v1/patient_cases/1"
}
},
"patient_name": "string",
"practitioner": {
"links": {
"self": "https://api.au1.cliniko.com/v1/practitioners/1"
}
},
"repeat_rule": {
"number_of_repeats": 0,
"repeat_type": "Daily",
"repeating_interval": 0
},
"repeated_from": {
"links": {
"self": "https://api.au1.cliniko.com/v1/individual_appointments/1"
}
},
"repeats": {
"links": {
"self": "https://api.au1.cliniko.com/v1/individual_appointments?q[]=repeated_from_id:=1"
}
},
"sms_reminder_sent": true,
"starts_at": "2019-08-24T14:15:22Z",
"telehealth_url": "http://example.com",
"treatment_note_status": 0,
"updated_at": "2019-08-24T14:15:22Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export default {
...common,
key: "cliniko-new-booking-created",
name: "New Booking Created",
description: "Emit new event when a booking is created in Cliniko. [See the documentation]()",
description: "Emit new event when a booking is created in Cliniko.",
type: "source",
version: "0.0.1",
version: "0.0.2",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export default {
...common,
key: "cliniko-new-contact-created",
name: "New Contact Created",
description: "Emit new event when a contact is created in Cliniko. [See the documentation]()",
description: "Emit new event when a contact is created in Cliniko.",
type: "source",
version: "0.0.1",
version: "0.0.2",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Loading
Loading