@pipedream/teachable
Version:
Pipedream Teachable Components
52 lines (47 loc) • 997 B
JavaScript
import teachable from "../../teachable.app.mjs";
export default {
key: "teachable-update-student",
name: "Update Student",
description: "Updates an existing student. [See the documentation](https://docs.teachable.com/reference/updateuser)",
version: "0.0.1",
type: "action",
props: {
teachable,
studentId: {
propDefinition: [
teachable,
"studentId",
],
},
name: {
propDefinition: [
teachable,
"name",
],
},
src: {
propDefinition: [
teachable,
"src",
],
},
},
async run({ $ }) {
const data = {};
if (this.name) {
data.name = this.name;
}
if (this.src) {
data.src = this.src;
}
const student = await this.teachable.updateStudent({
studentId: this.studentId,
data,
$,
});
if (student.id) {
$.export("$summary", `Successfully updated student with ID ${student.id}`);
}
return student;
},
};