txa
/
1.1.2
txa 1.1.2
Install from the command line:
Learn more about npm packages
$ npm install @ja-sonyun/txa@1.1.2
Install via package.json:
"@ja-sonyun/txa": "1.1.2"
About this version
Use jxa with typescript
npm install @ja-sonyun/txa
import txa from "@ja-sonyun/txa"
(async () => {
console.log(await txa.Reminders("get_list_names", {}))
})();
// txa.Reminders(action: string, ...)
// txa.Calendars(action: string, ...)
await txa.Calendars("get_calendar_names", {})
// [ "Events", "Important", "Busy", ... ]
await txa.Calendars("get_events_by_key", {
key: "startDate", // uid, summary
value: new Date(),
// ... until:Date if key is startDate
calendar_name: "home",
request_field: ["uid", "summary"], // uid, description, startDate, endDate, alldayEvent, location, url, status
max_size: 2
})
// [ { uid: '620602C3-31E1-4A7F-96E4-44AED7015500', summary: 'new' } ]
await txa.Calendars("create_new_event", {
calendar_name: "Events",// required
summary: "New Events", // required
description: "New Events",
location: "location",
startDate: new Date(), // required
endDate: new Date(), // required
alldayEvent: false, // required
// status: "none" | "confirmed" | "tentative" | "cancelled",
// url: string,
})
// 03DEA53B-4A9A-4D3F-BC27-D78622747130
await txa.Calendars("update_existing_event", {
calendar_name: "Events",// required
select_by_uid: "03DEA53B-4A9A-4D3F-BC27-D78622747130",
description: "updated descripiton",
// summary: "updated summary",
// location: "location",
// startDate: new Date(),
// endDate: new Date(),
// alldayEvent: false,
// status: "none" | "confirmed" | "tentative" | "cancelled",
// url: string,
})
// true
await txa.Calendars("delete_existing_event", {
calendar_name: "Events",// required
select_by_uid: "03DEA53B-4A9A-4D3F-BC27-D78622747130",
})
// true
await txa.Reminders("get_list_names", {})
// [ "your", "reminder", "lists" ]
await txa.Reminders("get_list_by_key", {
key: "name", // or "id"
value: "GitHub",
request_field: ["id", "name"] // color, emblem
})
// { id: 'F677E7BC-A288-4A64-BE06-2AF0B4EC46C8', name: 'GitHub' }
await txa.Reminders("get_todos_by_list_name", {
list_name: "GitHub",
request_field: ["id", "name", "completed"], // body, creationDate, dueDate, modificationDate, completionDate, priority, flagged
max_size: 2 // optional, greater value will takes more times.
})
//[
// {
// id: 'x-apple-reminder://712CBC5E-539A-4AA7-A9FC-659F432117DB',
// name: 'some todo',
// completed: false
// },
// {
// id: 'x-apple-reminder://982A8652-5163-4D32-9C19-D33149A4C6B1',
// name: 'other todo',
// completed: true
// }
//]
await txa.Reminders("get_todo_by_key", {
key:"id",
value: "x-apple-reminder://982A8652-5163-4D32-9C19-D33149A4C6B1",
list_name: "GitHub",
request_field: ["name"], // id, completed, body, creationDate, dueDate, modificationDate, completionDate, priority, flagged
})
// { name: 'other todo' }
await txa.Reminders("create_new_todo", {
list_name: "GitHub",
name: "Create new todo",
dueDate: new Date(),
// ... body:string, , priority:number, flagged:boolean
})
// 7
// return value is an index
await txa.Reminders("update_existing_todo", {
list_name: "GitHub",
select_by_id: "x-apple-reminder://982A8652-5163-4D32-9C19-D33149A4C6B1",
completed: true,
// ... dueDate:Date, body:string, name:string, priority:number, flagged:boolean
})
// true
await txa.Reminders("delete_existing_todo", {
list_name: "GitHub",
select_by_id: "x-apple-reminder://982A8652-5163-4D32-9C19-D33149A4C6B1",
})
// true
wrap glue codes with class