@withnicer/sdk 0.0.0 → 1.0.0-beta.2
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 +89 -4
- package/dist/_/codec.d.ts +93 -0
- package/dist/_/codec.js +298 -0
- package/dist/_/error.d.ts +27 -0
- package/dist/_/error.js +68 -0
- package/dist/_/hooks/envelope.d.ts +11 -0
- package/dist/_/hooks/envelope.js +15 -0
- package/dist/_/index.d.ts +3 -0
- package/dist/_/index.js +5 -0
- package/dist/_/transport.d.ts +146 -0
- package/dist/_/transport.js +220 -0
- package/dist/activity/client.d.ts +42 -0
- package/dist/activity/client.js +18 -0
- package/dist/activity/index.d.ts +5 -0
- package/dist/activity/index.js +4 -0
- package/dist/activity/models.d.ts +65 -0
- package/dist/activity/models.js +3 -0
- package/dist/client.d.ts +1680 -0
- package/dist/client.js +749 -0
- package/dist/crmSettings/client.d.ts +50 -0
- package/dist/crmSettings/client.js +25 -0
- package/dist/crmSettings/index.d.ts +5 -0
- package/dist/crmSettings/index.js +4 -0
- package/dist/crmSettings/models.d.ts +313 -0
- package/dist/crmSettings/models.js +3 -0
- package/dist/crmTrips/client.d.ts +100 -0
- package/dist/crmTrips/client.js +38 -0
- package/dist/crmTrips/index.d.ts +5 -0
- package/dist/crmTrips/index.js +4 -0
- package/dist/crmTrips/models.d.ts +193 -0
- package/dist/crmTrips/models.js +3 -0
- package/dist/crmTrips/travelers/client.d.ts +33 -0
- package/dist/crmTrips/travelers/client.js +18 -0
- package/dist/crmTrips/travelers/index.d.ts +5 -0
- package/dist/crmTrips/travelers/index.js +4 -0
- package/dist/crmTrips/travelers/models.d.ts +14 -0
- package/dist/crmTrips/travelers/models.js +3 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/me/client.d.ts +56 -0
- package/dist/me/client.js +25 -0
- package/dist/me/index.d.ts +5 -0
- package/dist/me/index.js +4 -0
- package/dist/me/models.d.ts +95 -0
- package/dist/me/models.js +3 -0
- package/dist/models.d.ts +8539 -0
- package/dist/models.js +4 -0
- package/dist/notes/client.d.ts +82 -0
- package/dist/notes/client.js +41 -0
- package/dist/notes/index.d.ts +5 -0
- package/dist/notes/index.js +4 -0
- package/dist/notes/models.d.ts +116 -0
- package/dist/notes/models.js +3 -0
- package/dist/options/index.d.ts +114 -0
- package/dist/options/index.js +115 -0
- package/dist/profileForms/client.d.ts +38 -0
- package/dist/profileForms/client.js +25 -0
- package/dist/profileForms/index.d.ts +5 -0
- package/dist/profileForms/index.js +4 -0
- package/dist/profileForms/models.d.ts +24 -0
- package/dist/profileForms/models.js +3 -0
- package/dist/taskTemplates/client.d.ts +36 -0
- package/dist/taskTemplates/client.js +18 -0
- package/dist/taskTemplates/index.d.ts +5 -0
- package/dist/taskTemplates/index.js +4 -0
- package/dist/taskTemplates/models.d.ts +15 -0
- package/dist/taskTemplates/models.js +3 -0
- package/dist/tasks/client.d.ts +105 -0
- package/dist/tasks/client.js +41 -0
- package/dist/tasks/index.d.ts +5 -0
- package/dist/tasks/index.js +4 -0
- package/dist/tasks/models.d.ts +59 -0
- package/dist/tasks/models.js +3 -0
- package/dist/travelers/client.d.ts +214 -0
- package/dist/travelers/client.js +76 -0
- package/dist/travelers/index.d.ts +5 -0
- package/dist/travelers/index.js +4 -0
- package/dist/travelers/models.d.ts +576 -0
- package/dist/travelers/models.js +3 -0
- package/package.json +35 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
|
|
2
|
+
import type { CrmSettings, CrmSettingsUpdate } from "./models.js";
|
|
3
|
+
export interface ClientOptions extends BaseClientOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The URL the paths of the API are relative to.
|
|
6
|
+
*/
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Client {
|
|
10
|
+
/**
|
|
11
|
+
* Get the CRM settings
|
|
12
|
+
*
|
|
13
|
+
* Returns how the agency uses its CRM: the custom fields its travelers carry
|
|
14
|
+
* (the keys and types a traveler's customFields takes), its task templates
|
|
15
|
+
* (the templateId POST /crm/task-templates/{templateId}/apply takes), its
|
|
16
|
+
* saved segments (the segmentId GET /crm/travelers takes), who sees a new
|
|
17
|
+
* traveler by default, and its webhooks with the last four characters of each
|
|
18
|
+
* signing secret, never the secret itself. The revision is the one PUT
|
|
19
|
+
* /crm/settings needs; an agency that never saved its settings reads the
|
|
20
|
+
* defaults at revision 0. The agency's advisors and admins may read them.
|
|
21
|
+
* Errors: 403 ERROR_UNAUTHORIZED for a traveler.
|
|
22
|
+
*/
|
|
23
|
+
get(request?: GetRequest, options?: RequestOptions): Promise<GetResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Update the CRM settings
|
|
26
|
+
*
|
|
27
|
+
* Replaces the sections of the settings the body names (customFields,
|
|
28
|
+
* defaultVisibility, segments, taskTemplates, webhooks) if the settings are
|
|
29
|
+
* still at the revision sent, and answers the settings as GET /crm/settings
|
|
30
|
+
* does, at the next revision. Each list sent replaces the stored one whole:
|
|
31
|
+
* an item sent with its id keeps it, one without is new and gets an id, and a
|
|
32
|
+
* stored item left out is deleted; a section left out stays as it is. A
|
|
33
|
+
* webhook sent without the webhookId of a stored one is new: its signing
|
|
34
|
+
* secret is in this answer, as that webhook's secret, and in no answer again,
|
|
35
|
+
* so store it now. Every delivery to the webhook is signed with it
|
|
36
|
+
* (X-Nicer-Signature). The change publishes crm.settings-updated.v1 with the
|
|
37
|
+
* sections it replaced. Admins only. Errors: 400 ERROR_BODY_VALIDATION, also
|
|
38
|
+
* for a body with the revision alone or two custom fields with one key; 403
|
|
39
|
+
* ERROR_UNAUTHORIZED for anyone but an admin; 409 CRM_REVISION_CONFLICT when
|
|
40
|
+
* the settings changed since they were read: read them again.
|
|
41
|
+
*/
|
|
42
|
+
update(request: UpdateRequest, options?: RequestOptions): Promise<UpdateResponse>;
|
|
43
|
+
}
|
|
44
|
+
export declare function createClient(options: ClientOptions): Client;
|
|
45
|
+
export declare function bind(transport: Transport): Client;
|
|
46
|
+
export interface GetRequest {
|
|
47
|
+
}
|
|
48
|
+
export type GetResponse = CrmSettings;
|
|
49
|
+
export type UpdateRequest = CrmSettingsUpdate;
|
|
50
|
+
export type UpdateResponse = CrmSettings;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Code generated by forge. DO NOT EDIT.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { Transport, } from "../_/index.js";
|
|
4
|
+
export function createClient(options) {
|
|
5
|
+
return bind(new Transport(options));
|
|
6
|
+
}
|
|
7
|
+
export function bind(transport) {
|
|
8
|
+
return {
|
|
9
|
+
get: (request, options) => transport.send(GetOperation, request, options),
|
|
10
|
+
update: (request, options) => transport.send(UpdateOperation, request, options),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const GetOperation = {
|
|
14
|
+
method: "GET",
|
|
15
|
+
route: "/crm/settings",
|
|
16
|
+
response: null,
|
|
17
|
+
errors: { "400": true, "401": true, "403": true },
|
|
18
|
+
};
|
|
19
|
+
const UpdateOperation = {
|
|
20
|
+
method: "PUT",
|
|
21
|
+
route: "/crm/settings",
|
|
22
|
+
body: "flat",
|
|
23
|
+
response: null,
|
|
24
|
+
errors: { "400": true, "401": true, "403": true },
|
|
25
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ApiError } from "../_/index.js";
|
|
2
|
+
export type { RequestOptions } from "../_/index.js";
|
|
3
|
+
export { createClient } from "./client.js";
|
|
4
|
+
export type { Client, ClientOptions, GetRequest, GetResponse, UpdateRequest, UpdateResponse, } from "./client.js";
|
|
5
|
+
export type { CrmEventName, CrmSettings, CrmSettingsUpdate, CustomFieldDefinition, CustomFieldType, Segment, SegmentFilter, SegmentInput, TaskTemplate, TaskTemplateAnchor, TaskTemplateInput, TaskTemplateStep, Webhook, WebhookInput, } from "./models.js";
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import type { TravelerStage, TravelerTag, TravelerVisibility } from "../models.js";
|
|
2
|
+
/**
|
|
3
|
+
* The name of an event the CRM publishes.
|
|
4
|
+
*/
|
|
5
|
+
export type CrmEventName = "crm.advisor-reminders-due.v1" | "crm.note-changed.v1" | "crm.settings-updated.v1" | "crm.task-changed.v1" | "crm.traveler-advisors-changed.v1" | "crm.traveler-created.v1" | "crm.traveler-documents-changed.v1" | "crm.traveler-erased.v1" | "crm.traveler-invitation-requested.v1" | "crm.traveler-linked.v1" | "crm.traveler-unlinked.v1" | "crm.traveler-updated.v1" | "crm.travelers-merged.v1" | "crm.trip-updated.v1";
|
|
6
|
+
/**
|
|
7
|
+
* How an agency uses its CRM: custom fields, task templates, saved segments,
|
|
8
|
+
* who sees new travelers and its webhooks.
|
|
9
|
+
*/
|
|
10
|
+
export interface CrmSettings {
|
|
11
|
+
/**
|
|
12
|
+
* The agency the settings belong to.
|
|
13
|
+
*/
|
|
14
|
+
companyName: string;
|
|
15
|
+
/**
|
|
16
|
+
* The fields the agency adds to its travelers.
|
|
17
|
+
*/
|
|
18
|
+
customFields: CustomFieldDefinition[];
|
|
19
|
+
/**
|
|
20
|
+
* Who sees a new traveler unless it says otherwise.
|
|
21
|
+
*/
|
|
22
|
+
defaultVisibility: TravelerVisibility;
|
|
23
|
+
/**
|
|
24
|
+
* The settings' revision, to send back with a change; 0 until the settings
|
|
25
|
+
* are saved for the first time.
|
|
26
|
+
*/
|
|
27
|
+
revision: number;
|
|
28
|
+
/**
|
|
29
|
+
* The agency's saved filters of travelers.
|
|
30
|
+
*/
|
|
31
|
+
segments: Segment[];
|
|
32
|
+
/**
|
|
33
|
+
* The agency's task templates.
|
|
34
|
+
*/
|
|
35
|
+
taskTemplates: TaskTemplate[];
|
|
36
|
+
/**
|
|
37
|
+
* When the settings last changed; null until the first save.
|
|
38
|
+
*/
|
|
39
|
+
updatedAt: string | null;
|
|
40
|
+
/**
|
|
41
|
+
* The agency's webhooks. Only the answer to an update carries a secret, and
|
|
42
|
+
* only on the webhooks that update created.
|
|
43
|
+
*/
|
|
44
|
+
webhooks: Webhook[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The sections of the settings to replace, with the revision read; at least one
|
|
48
|
+
* section besides the revision. Each list sent replaces the stored one whole,
|
|
49
|
+
* and a section left out stays as it is.
|
|
50
|
+
*/
|
|
51
|
+
export interface CrmSettingsUpdate {
|
|
52
|
+
/**
|
|
53
|
+
* Every custom field to keep, up to 50, each key once; a stored field left
|
|
54
|
+
* out is deleted.
|
|
55
|
+
*/
|
|
56
|
+
customFields?: CustomFieldDefinition[];
|
|
57
|
+
/**
|
|
58
|
+
* Who sees a new traveler unless it says otherwise.
|
|
59
|
+
*/
|
|
60
|
+
defaultVisibility?: TravelerVisibility;
|
|
61
|
+
/**
|
|
62
|
+
* The revision of the settings as read; a change made since answers 409
|
|
63
|
+
* CRM_REVISION_CONFLICT.
|
|
64
|
+
*/
|
|
65
|
+
revision: number;
|
|
66
|
+
/**
|
|
67
|
+
* Every segment to keep, up to 50; a stored segment left out is deleted.
|
|
68
|
+
*/
|
|
69
|
+
segments?: SegmentInput[];
|
|
70
|
+
/**
|
|
71
|
+
* Every task template to keep, up to 30; a stored template left out is
|
|
72
|
+
* deleted.
|
|
73
|
+
*/
|
|
74
|
+
taskTemplates?: TaskTemplateInput[];
|
|
75
|
+
/**
|
|
76
|
+
* Every webhook to keep, up to 10; a stored webhook left out is deleted and
|
|
77
|
+
* its secret with it.
|
|
78
|
+
*/
|
|
79
|
+
webhooks?: WebhookInput[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A field the agency adds to its travelers, set in a traveler's customFields
|
|
83
|
+
* under its key.
|
|
84
|
+
*/
|
|
85
|
+
export interface CustomFieldDefinition {
|
|
86
|
+
/**
|
|
87
|
+
* The key a traveler's value is stored under in their customFields, in
|
|
88
|
+
* camelCase: a lowercase letter, then up to 39 letters or digits, e.g.
|
|
89
|
+
* favoriteAirline. Unique among the agency's fields.
|
|
90
|
+
*/
|
|
91
|
+
key: string;
|
|
92
|
+
/**
|
|
93
|
+
* The name the agency's screens show for the field, 1 to 60 characters.
|
|
94
|
+
*/
|
|
95
|
+
label: string;
|
|
96
|
+
/**
|
|
97
|
+
* The choices of a SELECT field, up to 30, each 1 to 60 characters; a
|
|
98
|
+
* traveler's value must be one of them. The other types ignore it: send an
|
|
99
|
+
* empty list.
|
|
100
|
+
*/
|
|
101
|
+
options: string[];
|
|
102
|
+
/**
|
|
103
|
+
* The kind of value the field holds; a traveler's value that is not of this
|
|
104
|
+
* kind is refused.
|
|
105
|
+
*/
|
|
106
|
+
type: CustomFieldType;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The kind of value a custom field holds: BOOLEAN (true or false), DATE
|
|
110
|
+
* (YYYY-MM-DD), NUMBER, SELECT (one of the field's options) or TEXT.
|
|
111
|
+
*/
|
|
112
|
+
export type CustomFieldType = "BOOLEAN" | "DATE" | "NUMBER" | "SELECT" | "TEXT";
|
|
113
|
+
/**
|
|
114
|
+
* A saved filter of travelers, listed with GET /crm/travelers?segmentId=.
|
|
115
|
+
*/
|
|
116
|
+
export interface Segment {
|
|
117
|
+
/**
|
|
118
|
+
* The conditions the segment's travelers meet.
|
|
119
|
+
*/
|
|
120
|
+
filter: SegmentFilter;
|
|
121
|
+
/**
|
|
122
|
+
* The segment's name, 1 to 80 characters.
|
|
123
|
+
*/
|
|
124
|
+
name: string;
|
|
125
|
+
/**
|
|
126
|
+
* The segment's id: what GET /crm/travelers?segmentId= takes.
|
|
127
|
+
*/
|
|
128
|
+
segmentId: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The conditions a segment's travelers meet, all of them at once; a condition
|
|
132
|
+
* left out keeps everyone.
|
|
133
|
+
*/
|
|
134
|
+
export interface SegmentFilter {
|
|
135
|
+
/**
|
|
136
|
+
* Travelers this advisor serves, by user id. Left out, any advisor.
|
|
137
|
+
*/
|
|
138
|
+
assignedAdvisorUserId?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Travelers with a document that expires within this many days, 1 to 730.
|
|
141
|
+
*/
|
|
142
|
+
documentExpiringWithinDays?: number;
|
|
143
|
+
/**
|
|
144
|
+
* True keeps archived travelers, false the ones not archived. Left out, the
|
|
145
|
+
* list's own isArchived decides: travelers not archived, unless it says
|
|
146
|
+
* otherwise.
|
|
147
|
+
*/
|
|
148
|
+
isArchived?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Travelers whose next trip starts within this many days, 1 to 365.
|
|
151
|
+
*/
|
|
152
|
+
nextTripWithinDays?: number;
|
|
153
|
+
/**
|
|
154
|
+
* Travelers at this stage only.
|
|
155
|
+
*/
|
|
156
|
+
stage?: TravelerStage;
|
|
157
|
+
/**
|
|
158
|
+
* Travelers with this tag only.
|
|
159
|
+
*/
|
|
160
|
+
tag?: TravelerTag;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A segment as an update sends it: a stored one with its segmentId, or a new
|
|
164
|
+
* one without.
|
|
165
|
+
*/
|
|
166
|
+
export interface SegmentInput {
|
|
167
|
+
/**
|
|
168
|
+
* The conditions the segment's travelers meet.
|
|
169
|
+
*/
|
|
170
|
+
filter: SegmentFilter;
|
|
171
|
+
/**
|
|
172
|
+
* The segment's name, 1 to 80 characters.
|
|
173
|
+
*/
|
|
174
|
+
name: string;
|
|
175
|
+
/**
|
|
176
|
+
* The id of the stored segment this one replaces; left out for a new segment,
|
|
177
|
+
* which gets an id.
|
|
178
|
+
*/
|
|
179
|
+
segmentId?: string;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* A list of tasks dated from a trip's creation, start or end, applied to a trip
|
|
183
|
+
* in one step.
|
|
184
|
+
*/
|
|
185
|
+
export interface TaskTemplate {
|
|
186
|
+
/**
|
|
187
|
+
* Whether the template is applied to every trip of the agency as soon as the
|
|
188
|
+
* trip is created.
|
|
189
|
+
*/
|
|
190
|
+
applyOnTripCreated: boolean;
|
|
191
|
+
/**
|
|
192
|
+
* The template's name, 1 to 80 characters.
|
|
193
|
+
*/
|
|
194
|
+
name: string;
|
|
195
|
+
/**
|
|
196
|
+
* The tasks the template adds to a trip, 1 to 30.
|
|
197
|
+
*/
|
|
198
|
+
tasks: TaskTemplateStep[];
|
|
199
|
+
/**
|
|
200
|
+
* The template's id: what POST /crm/task-templates/{templateId}/apply takes.
|
|
201
|
+
*/
|
|
202
|
+
templateId: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The trip date a template's task is dated from: TRIP_CREATED (the day the trip
|
|
206
|
+
* was created), TRIP_START (its first day) or TRIP_END (its last day). A task
|
|
207
|
+
* whose date the trip lacks has no date.
|
|
208
|
+
*/
|
|
209
|
+
export type TaskTemplateAnchor = "TRIP_CREATED" | "TRIP_END" | "TRIP_START";
|
|
210
|
+
/**
|
|
211
|
+
* A task template as an update sends it: a stored one with its templateId, or a
|
|
212
|
+
* new one without.
|
|
213
|
+
*/
|
|
214
|
+
export interface TaskTemplateInput {
|
|
215
|
+
/**
|
|
216
|
+
* Whether the template is applied to every trip of the agency as soon as the
|
|
217
|
+
* trip is created.
|
|
218
|
+
*/
|
|
219
|
+
applyOnTripCreated: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* The template's name, 1 to 80 characters.
|
|
222
|
+
*/
|
|
223
|
+
name: string;
|
|
224
|
+
/**
|
|
225
|
+
* The tasks the template adds to a trip, 1 to 30.
|
|
226
|
+
*/
|
|
227
|
+
tasks: TaskTemplateStep[];
|
|
228
|
+
/**
|
|
229
|
+
* The id of the stored template this one replaces; left out for a new
|
|
230
|
+
* template, which gets an id.
|
|
231
|
+
*/
|
|
232
|
+
templateId?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* One task of a task template: its title and its date, as days before or after
|
|
236
|
+
* a date of the trip.
|
|
237
|
+
*/
|
|
238
|
+
export interface TaskTemplateStep {
|
|
239
|
+
/**
|
|
240
|
+
* The trip date the task's date counts from.
|
|
241
|
+
*/
|
|
242
|
+
anchor: TaskTemplateAnchor;
|
|
243
|
+
/**
|
|
244
|
+
* Days after the anchor, -365 to 365; negative is before it, 0 is the
|
|
245
|
+
* anchor's day.
|
|
246
|
+
*/
|
|
247
|
+
offsetDays: number;
|
|
248
|
+
/**
|
|
249
|
+
* The title of the task the template adds, 1 to 255 characters.
|
|
250
|
+
*/
|
|
251
|
+
title: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* An HTTPS endpoint of the agency that receives the CRM events it subscribes
|
|
255
|
+
* to, signed with its secret.
|
|
256
|
+
*/
|
|
257
|
+
export interface Webhook {
|
|
258
|
+
/**
|
|
259
|
+
* When the webhook was added.
|
|
260
|
+
*/
|
|
261
|
+
createdAt: string;
|
|
262
|
+
/**
|
|
263
|
+
* The events sent to the webhook.
|
|
264
|
+
*/
|
|
265
|
+
events: CrmEventName[];
|
|
266
|
+
/**
|
|
267
|
+
* Whether events are sent to it; false pauses it without losing it.
|
|
268
|
+
*/
|
|
269
|
+
isActive: boolean;
|
|
270
|
+
/**
|
|
271
|
+
* The signing secret (whsec_…) the endpoint checks each delivery's
|
|
272
|
+
* X-Nicer-Signature with. Present only in the answer to the update that
|
|
273
|
+
* created the webhook, and never again: store it then.
|
|
274
|
+
*/
|
|
275
|
+
secret?: string;
|
|
276
|
+
/**
|
|
277
|
+
* The last four characters of the signing secret, to tell secrets apart.
|
|
278
|
+
*/
|
|
279
|
+
secretLast4: string;
|
|
280
|
+
/**
|
|
281
|
+
* The HTTPS address the events are posted to.
|
|
282
|
+
*/
|
|
283
|
+
url: string;
|
|
284
|
+
/**
|
|
285
|
+
* The webhook's id, sent back in an update to keep the webhook and its
|
|
286
|
+
* secret.
|
|
287
|
+
*/
|
|
288
|
+
webhookId: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* A webhook as an update sends it: a stored one with its webhookId, or a new
|
|
292
|
+
* one without.
|
|
293
|
+
*/
|
|
294
|
+
export interface WebhookInput {
|
|
295
|
+
/**
|
|
296
|
+
* The events to send to it, at least one.
|
|
297
|
+
*/
|
|
298
|
+
events: CrmEventName[];
|
|
299
|
+
/**
|
|
300
|
+
* Whether events are sent to it; false pauses it.
|
|
301
|
+
*/
|
|
302
|
+
isActive: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* The HTTPS address the events are posted to, at most 2,048 characters.
|
|
305
|
+
*/
|
|
306
|
+
url: string;
|
|
307
|
+
/**
|
|
308
|
+
* The id of the stored webhook this one replaces, which keeps its secret and
|
|
309
|
+
* creation time. Left out, or one the agency does not have, the webhook is
|
|
310
|
+
* new: it gets an id and a signing secret, answered once.
|
|
311
|
+
*/
|
|
312
|
+
webhookId?: string;
|
|
313
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
|
|
2
|
+
import type { CrmTrip, CrmTripList, CrmTripUpdate } from "./models.js";
|
|
3
|
+
import { type Client as TravelersClient } from "./travelers/client.js";
|
|
4
|
+
export interface ClientOptions extends BaseClientOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The URL the paths of the API are relative to.
|
|
7
|
+
*/
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Client {
|
|
11
|
+
/**
|
|
12
|
+
* Get a trip's travelers
|
|
13
|
+
*
|
|
14
|
+
* Returns the trip as a CrmTrip with its travelers: who travels on it, the
|
|
15
|
+
* PRIMARY traveler first, each with the details a checkout needs, and the
|
|
16
|
+
* trip's sales stage, primary traveler, traveler count, itinerary and the
|
|
17
|
+
* revision PUT /crm/trips/{travelersTripId} sends back. The trip's staff (its
|
|
18
|
+
* advisor of record and the agency's admins) and the trip's own members
|
|
19
|
+
* signed in may read it; a payment link never does. Staff read every
|
|
20
|
+
* traveler's documents; a traveler on the trip reads only their own and those
|
|
21
|
+
* of the relatives they fill in for (a child, spouse or partner without an
|
|
22
|
+
* account of their own), and every other companion comes back with no
|
|
23
|
+
* documents. A trip the CRM keeps nothing of yet answers revision 0 and
|
|
24
|
+
* salesStage null. Errors: 404 ERROR_ITEM_NOT_FOUND for a trip that does not
|
|
25
|
+
* exist or that the caller may not read.
|
|
26
|
+
*/
|
|
27
|
+
get(request: GetRequest, options?: RequestOptions): Promise<GetResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* List the sales pipeline
|
|
30
|
+
*
|
|
31
|
+
* Lists the agency's trips by sales stage, soonest first and undated trips
|
|
32
|
+
* last: an advisor's own trips, or for an admin every trip or one advisor's
|
|
33
|
+
* (assignedAdvisorUserId). salesStage keeps one column of the pipeline, NONE
|
|
34
|
+
* the trips without a stage; left out, the list runs stage by stage. Each
|
|
35
|
+
* trip is a CrmTrip without travelers: its primary traveler's id and name,
|
|
36
|
+
* how many travel on it, its itinerary and the revision PUT
|
|
37
|
+
* /crm/trips/{travelersTripId} needs. GET /crm/trips/{travelersTripId}
|
|
38
|
+
* answers who travels on one. 50 a page unless limit says otherwise; send the
|
|
39
|
+
* answer's nextToken back to read the next page, until it is null. The
|
|
40
|
+
* agency's advisors and admins may list. Errors: 400 ERROR_INVALID_QUERY for
|
|
41
|
+
* an unknown parameter, a limit out of range, a salesStage outside the
|
|
42
|
+
* pipeline or a nextToken of another list; 403 ERROR_UNAUTHORIZED for a
|
|
43
|
+
* traveler.
|
|
44
|
+
*/
|
|
45
|
+
list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* Update a trip's travelers or sales stage
|
|
48
|
+
*
|
|
49
|
+
* Keeps exactly the travelers in the body and moves the trip to salesStage,
|
|
50
|
+
* if the trip is still at the revision sent, and answers the trip with its
|
|
51
|
+
* travelers as GET /crm/trips/{travelersTripId} does, at the next revision. A
|
|
52
|
+
* traveler on the trip left out of travelers leaves it, and stays among the
|
|
53
|
+
* agency's travelers; a body without travelers leaves the list as it is. A
|
|
54
|
+
* traveler sent as a participant, as a checkout collects them, is found by
|
|
55
|
+
* email or phone or added to the agency; a traveler added that way stays the
|
|
56
|
+
* agency's even if the trip's own change then fails. The trip's staff (its
|
|
57
|
+
* advisor of record and the agency's admins) and its members signed in may
|
|
58
|
+
* update its travelers; only staff move its sales stage. The change publishes
|
|
59
|
+
* crm.trip-updated.v1 with the sections it changed. Errors: 400
|
|
60
|
+
* ERROR_BODY_VALIDATION, also for a body with neither travelers nor
|
|
61
|
+
* salesStage; 403 ERROR_UNAUTHORIZED for a member moving the sales stage; 404
|
|
62
|
+
* ERROR_ITEM_NOT_FOUND for a trip the caller may not read, or a traveler they
|
|
63
|
+
* may not name; 409 CRM_REVISION_CONFLICT when the trip changed since it was
|
|
64
|
+
* read: read it again.
|
|
65
|
+
*/
|
|
66
|
+
update(request: UpdateRequest, options?: RequestOptions): Promise<UpdateResponse>;
|
|
67
|
+
readonly travelers: TravelersClient;
|
|
68
|
+
}
|
|
69
|
+
export declare function createClient(options: ClientOptions): Client;
|
|
70
|
+
export declare function bind(transport: Transport): Client;
|
|
71
|
+
export interface GetRequest {
|
|
72
|
+
travelersTripId: string;
|
|
73
|
+
}
|
|
74
|
+
export type GetResponse = CrmTrip;
|
|
75
|
+
export interface ListRequest {
|
|
76
|
+
/**
|
|
77
|
+
* Admins: only this advisor's trips, by user id. An advisor always lists
|
|
78
|
+
* their own trips.
|
|
79
|
+
*/
|
|
80
|
+
assignedAdvisorUserId?: string;
|
|
81
|
+
/**
|
|
82
|
+
* How many trips a page holds, 1 to 100; 50 when left out.
|
|
83
|
+
*/
|
|
84
|
+
limit?: number;
|
|
85
|
+
/**
|
|
86
|
+
* The nextToken of the page before, to read the next one; left out for the
|
|
87
|
+
* first page.
|
|
88
|
+
*/
|
|
89
|
+
nextToken?: string;
|
|
90
|
+
/**
|
|
91
|
+
* One column of the pipeline: a sales stage, or NONE for the trips without
|
|
92
|
+
* one. Left out, every trip, stage by stage.
|
|
93
|
+
*/
|
|
94
|
+
salesStage?: "BOOKED" | "COMPLETED" | "INQUIRY" | "LOST" | "PLANNING" | "PROPOSAL" | "TRAVELING" | "NONE";
|
|
95
|
+
}
|
|
96
|
+
export type ListResponse = CrmTripList;
|
|
97
|
+
export type UpdateRequest = {
|
|
98
|
+
travelersTripId: string;
|
|
99
|
+
} & CrmTripUpdate;
|
|
100
|
+
export type UpdateResponse = CrmTrip;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Code generated by forge. DO NOT EDIT.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { Transport, } from "../_/index.js";
|
|
4
|
+
import { bind as bindTravelers, } from "./travelers/client.js";
|
|
5
|
+
export function createClient(options) {
|
|
6
|
+
return bind(new Transport(options));
|
|
7
|
+
}
|
|
8
|
+
export function bind(transport) {
|
|
9
|
+
let travelersClient;
|
|
10
|
+
return {
|
|
11
|
+
get: (request, options) => transport.send(GetOperation, request, options),
|
|
12
|
+
list: (request, options) => transport.send(ListOperation, request, options),
|
|
13
|
+
update: (request, options) => transport.send(UpdateOperation, request, options),
|
|
14
|
+
get travelers() {
|
|
15
|
+
return (travelersClient ??= bindTravelers(transport));
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const GetOperation = {
|
|
20
|
+
method: "GET",
|
|
21
|
+
route: "/crm/trips/{travelersTripId}",
|
|
22
|
+
response: null,
|
|
23
|
+
errors: { "400": true, "401": true, "403": true },
|
|
24
|
+
};
|
|
25
|
+
const ListOperation = {
|
|
26
|
+
method: "GET",
|
|
27
|
+
route: "/crm/trips",
|
|
28
|
+
query: { assignedAdvisorUserId: "assignedAdvisorUserId", limit: "limit", nextToken: "nextToken", salesStage: "salesStage" },
|
|
29
|
+
response: null,
|
|
30
|
+
errors: { "400": true, "401": true, "403": true },
|
|
31
|
+
};
|
|
32
|
+
const UpdateOperation = {
|
|
33
|
+
method: "PUT",
|
|
34
|
+
route: "/crm/trips/{travelersTripId}",
|
|
35
|
+
body: "flat",
|
|
36
|
+
response: null,
|
|
37
|
+
errors: { "400": true, "401": true, "403": true },
|
|
38
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ApiError } from "../_/index.js";
|
|
2
|
+
export type { RequestOptions } from "../_/index.js";
|
|
3
|
+
export { createClient } from "./client.js";
|
|
4
|
+
export type { Client, ClientOptions, GetRequest, GetResponse, ListRequest, ListResponse, UpdateRequest, UpdateResponse, } from "./client.js";
|
|
5
|
+
export type { CrmTrip, CrmTripList, CrmTripUpdate, TripParticipant, TripTraveler, TripTravelerInput, } from "./models.js";
|