tripit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -0
- package/index.ts +1024 -0
- package/package.json +45 -0
- package/src/auth.ts +242 -0
- package/src/constants.ts +141 -0
- package/src/index.ts +2 -0
- package/src/tripit.ts +1295 -0
- package/src/types.ts +296 -0
- package/src/utils.ts +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# tripit-cli (and library) for JS
|
|
2
|
+
|
|
3
|
+
`tripit` works as both:
|
|
4
|
+
|
|
5
|
+
- a CLI (`tripit ...`)
|
|
6
|
+
- a JavaScript package (`import TripIt from "tripit"`)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
Library:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install tripit
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
CLI:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g tripit
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## CLI
|
|
23
|
+
|
|
24
|
+
Show available commands:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
tripit --help
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Using through agent skills
|
|
31
|
+
|
|
32
|
+
- Either add `dvcrn/skills` or `dvcrn/tripit` as skill repository which should discover the `tripit` skill
|
|
33
|
+
- - You can also do a `npx skills add dvcrn/skills` or `npx skills add dvcrn/tripit`
|
|
34
|
+
|
|
35
|
+
### Common Workflow
|
|
36
|
+
|
|
37
|
+
1. Authenticate:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
tripit login
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. Create a trip:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
tripit trips create --name "Test Trip" --start 2026-03-20 --end 2026-03-23 --location "Tokyo" -o json
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
3. List and inspect the trip:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
tripit trips list
|
|
53
|
+
tripit trips get <TRIP_UUID>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
4. Add reservations/activities:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
tripit hotels create --trip <TRIP_UUID> --name "Test Hotel" --checkin 2026-03-20 --checkout 2026-03-23 --checkin-time 15:00 --checkout-time 11:00 --timezone UTC --address "1 Market St" --city "San Francisco" --country US -o json
|
|
60
|
+
|
|
61
|
+
tripit flights create --trip <TRIP_UUID> --name "Test Flight" --airline "Example Air" --from "San Francisco" --from-code US --to "Seattle" --to-code US --airline-code EA --flight-num 123 --depart-date 2026-03-20 --depart-time 10:00 --depart-tz UTC --arrive-date 2026-03-20 --arrive-time 14:00 --arrive-tz UTC -o json
|
|
62
|
+
|
|
63
|
+
tripit transport create --trip <TRIP_UUID> --from "1 Market St" --to "SFO Airport" --depart-date 2026-03-20 --depart-time 08:00 --arrive-date 2026-03-20 --arrive-time 09:00 --timezone UTC --name "Hotel to Airport" -o json
|
|
64
|
+
|
|
65
|
+
tripit activities create --trip <TRIP_UUID> --name "Dinner" --start-date 2026-03-20 --start-time 19:00 --end-date 2026-03-20 --end-time 21:00 --timezone UTC --address "200 Example St" --location-name "Downtown" -o json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
5. Update resources:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
tripit trips update <TRIP_UUID> --name "Updated Test Trip"
|
|
72
|
+
tripit hotels update <HOTEL_UUID> --name "Updated Hotel"
|
|
73
|
+
tripit flights update <FLIGHT_UUID> --name "Updated Flight"
|
|
74
|
+
tripit transport update <TRANSPORT_UUID> --name "Updated Transport"
|
|
75
|
+
tripit activities update <ACTIVITY_UUID> --name "Updated Activity"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
6. Attach and remove documents (images/PDFs):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
tripit documents attach <HOTEL_UUID> --file ./confirmation.pdf --caption "Booking Confirmation"
|
|
82
|
+
tripit documents attach <HOTEL_UUID> --file ./photo.png --type lodging
|
|
83
|
+
tripit documents remove <HOTEL_UUID> --caption "Booking Confirmation"
|
|
84
|
+
tripit documents remove <HOTEL_UUID> --index 1
|
|
85
|
+
tripit documents remove <HOTEL_UUID> --all
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The `--type` flag (lodging, activity, air, transport) is auto-detected from the UUID when omitted.
|
|
89
|
+
|
|
90
|
+
7. Delete resources:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
tripit activities delete <ACTIVITY_UUID>
|
|
94
|
+
tripit transport delete <TRANSPORT_UUID>
|
|
95
|
+
tripit flights delete <FLIGHT_UUID>
|
|
96
|
+
tripit hotels delete <HOTEL_UUID>
|
|
97
|
+
tripit trips delete <TRIP_UUID>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Library Usage
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import TripIt from "tripit";
|
|
104
|
+
|
|
105
|
+
const client = new TripIt({
|
|
106
|
+
clientId: process.env.TRIPIT_CLIENT_ID!,
|
|
107
|
+
clientSecret: process.env.TRIPIT_CLIENT_SECRET!,
|
|
108
|
+
username: process.env.TRIPIT_USERNAME!,
|
|
109
|
+
password: process.env.TRIPIT_PASSWORD!,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
await client.authenticate();
|
|
113
|
+
|
|
114
|
+
const list = await client.listTrips(20, 1, false);
|
|
115
|
+
console.log(list.Trip);
|
|
116
|
+
|
|
117
|
+
const created = await client.createTrip({
|
|
118
|
+
displayName: "SDK Trip Example",
|
|
119
|
+
startDate: "2026-04-01",
|
|
120
|
+
endDate: "2026-04-04",
|
|
121
|
+
primaryLocation: "New York",
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
console.log(created.Trip.uuid);
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The package also exports types from `src/types.ts`.
|