@velaro/cli 1.4.184 → 1.4.186
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/lib/commands/booking.js
CHANGED
|
@@ -23,6 +23,27 @@ export const bookingCommand = {
|
|
|
23
23
|
describe: 'Generic booking engine -- bookable resources, services, availability rules, and bookings',
|
|
24
24
|
builder: yargs => yargs
|
|
25
25
|
// -- resource --------------------------------------------------------------
|
|
26
|
+
.command({
|
|
27
|
+
command: 'upcoming',
|
|
28
|
+
describe: 'List upcoming appointments (week by default, at most 62 days)',
|
|
29
|
+
builder: y => y
|
|
30
|
+
.option('scope', { type: 'string', describe: 'me | team | group' })
|
|
31
|
+
.option('team-id', { type: 'number', describe: 'Team id for team scope' })
|
|
32
|
+
.option('from', { type: 'string', describe: 'Start, ISO 8601 UTC' })
|
|
33
|
+
.option('to', { type: 'string', describe: 'End, ISO 8601 UTC' }),
|
|
34
|
+
handler: runCommand(async (argv) => {
|
|
35
|
+
const q = new URLSearchParams();
|
|
36
|
+
if (argv.scope) q.set('scope', argv.scope);
|
|
37
|
+
if (argv.teamId != null) q.set('teamId', String(argv.teamId));
|
|
38
|
+
if (argv.from) q.set('fromUtc', argv.from);
|
|
39
|
+
if (argv.to) q.set('toUtc', argv.to);
|
|
40
|
+
const rows = await messagingGet(`/Appointments${q.toString() ? '?' + q : ''}`);
|
|
41
|
+
if (!Array.isArray(rows) || !rows.length) { console.log('\n No upcoming appointments.\n'); return; }
|
|
42
|
+
console.log('\nUpcoming appointments\n');
|
|
43
|
+
for (const a of rows) console.log(` id:${a.id} ${fmtDate(a.startUtc)} ${a.customerName || a.customerPhone || ''}`);
|
|
44
|
+
console.log('');
|
|
45
|
+
}),
|
|
46
|
+
})
|
|
26
47
|
.command({
|
|
27
48
|
command: 'resource <action>',
|
|
28
49
|
describe: 'Manage bookable resources (staff / room / equipment / virtual)',
|
|
@@ -48,6 +48,8 @@ export const publicApiCommand = {
|
|
|
48
48
|
(a) => send('POST', '/api/v1/webhooks', { url: a.url, events: a.events ? a.events.split(',') : undefined }))
|
|
49
49
|
.command('webhook-delete <id>', 'Delete a webhook', {}, (a) => send('DELETE', `/api/v1/webhooks/${a.id}`))
|
|
50
50
|
.command('note <contactId> <text>', 'Add a note to a contact', {}, (a) => send('POST', `/api/v1/contacts/${a.contactId}/notes`, { note: a.text }))
|
|
51
|
-
.
|
|
51
|
+
.command('contact-update <id>', 'Partially update a contact (only the flags you pass change)', { email: { type: 'string' }, 'first-name': { type: 'string' }, 'last-name': { type: 'string' }, phone: { type: 'string' }, mobile: { type: 'string' }, company: { type: 'string' }, 'job-title': { type: 'string' } },
|
|
52
|
+
(a) => send('PATCH', `/api/v1/contacts/${a.id}`, Object.fromEntries(Object.entries({ email: a.email, firstName: a['first-name'], lastName: a['last-name'], phone: a.phone, mobile: a.mobile, company: a.company, jobTitle: a['job-title'] }).filter(([, v]) => v !== undefined))))
|
|
53
|
+
.demandCommand(1, 'Specify: conversations | appointments | agents | teams | webhooks | webhook-create | webhook-delete | note | contact-update'),
|
|
52
54
|
handler: () => {},
|
|
53
55
|
};
|
package/package.json
CHANGED