@nicertravel/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.
Files changed (270) hide show
  1. package/README.md +89 -3
  2. package/dist/_/codec.d.ts +93 -0
  3. package/dist/_/codec.js +298 -0
  4. package/dist/_/error.d.ts +27 -0
  5. package/dist/_/error.js +68 -0
  6. package/dist/_/hooks/envelope.d.ts +11 -0
  7. package/dist/_/hooks/envelope.js +15 -0
  8. package/dist/_/index.d.ts +3 -0
  9. package/dist/_/index.js +5 -0
  10. package/dist/_/transport.d.ts +146 -0
  11. package/dist/_/transport.js +220 -0
  12. package/dist/activities/client.d.ts +35 -0
  13. package/dist/activities/client.js +23 -0
  14. package/dist/activities/index.d.ts +5 -0
  15. package/dist/activities/index.js +4 -0
  16. package/dist/activities/models.d.ts +27 -0
  17. package/dist/activities/models.js +3 -0
  18. package/dist/activityDestinations/client.d.ts +24 -0
  19. package/dist/activityDestinations/client.js +17 -0
  20. package/dist/activityDestinations/index.d.ts +4 -0
  21. package/dist/activityDestinations/index.js +4 -0
  22. package/dist/balances/client.d.ts +29 -0
  23. package/dist/balances/client.js +18 -0
  24. package/dist/balances/index.d.ts +5 -0
  25. package/dist/balances/index.js +4 -0
  26. package/dist/balances/models.d.ts +12 -0
  27. package/dist/balances/models.js +3 -0
  28. package/dist/bookingSelections/client.d.ts +54 -0
  29. package/dist/bookingSelections/client.js +25 -0
  30. package/dist/bookingSelections/index.d.ts +5 -0
  31. package/dist/bookingSelections/index.js +4 -0
  32. package/dist/bookingSelections/models.d.ts +35 -0
  33. package/dist/bookingSelections/models.js +3 -0
  34. package/dist/carRentals/client.d.ts +55 -0
  35. package/dist/carRentals/client.js +25 -0
  36. package/dist/carRentals/index.d.ts +5 -0
  37. package/dist/carRentals/index.js +4 -0
  38. package/dist/carRentals/models.d.ts +157 -0
  39. package/dist/carRentals/models.js +3 -0
  40. package/dist/carriers/client.d.ts +32 -0
  41. package/dist/carriers/client.js +18 -0
  42. package/dist/carriers/index.d.ts +5 -0
  43. package/dist/carriers/index.js +4 -0
  44. package/dist/carriers/models.d.ts +9 -0
  45. package/dist/carriers/models.js +3 -0
  46. package/dist/chats/client.d.ts +69 -0
  47. package/dist/chats/client.js +38 -0
  48. package/dist/chats/index.d.ts +5 -0
  49. package/dist/chats/index.js +4 -0
  50. package/dist/chats/models.d.ts +25 -0
  51. package/dist/chats/models.js +3 -0
  52. package/dist/checkouts/client.d.ts +27 -0
  53. package/dist/checkouts/client.js +18 -0
  54. package/dist/checkouts/index.d.ts +5 -0
  55. package/dist/checkouts/index.js +4 -0
  56. package/dist/checkouts/models.d.ts +23 -0
  57. package/dist/checkouts/models.js +3 -0
  58. package/dist/client.d.ts +95 -0
  59. package/dist/client.js +220 -0
  60. package/dist/commissionExports/client.d.ts +62 -0
  61. package/dist/commissionExports/client.js +33 -0
  62. package/dist/commissionExports/index.d.ts +5 -0
  63. package/dist/commissionExports/index.js +4 -0
  64. package/dist/commissionExports/models.d.ts +165 -0
  65. package/dist/commissionExports/models.js +3 -0
  66. package/dist/commissionImports/client.d.ts +61 -0
  67. package/dist/commissionImports/client.js +34 -0
  68. package/dist/commissionImports/index.d.ts +5 -0
  69. package/dist/commissionImports/index.js +4 -0
  70. package/dist/commissionImports/models.d.ts +118 -0
  71. package/dist/commissionImports/models.js +3 -0
  72. package/dist/commissionItems/client.d.ts +128 -0
  73. package/dist/commissionItems/client.js +41 -0
  74. package/dist/commissionItems/index.d.ts +5 -0
  75. package/dist/commissionItems/index.js +4 -0
  76. package/dist/commissionItems/models.d.ts +217 -0
  77. package/dist/commissionItems/models.js +3 -0
  78. package/dist/commissionReports/client.d.ts +76 -0
  79. package/dist/commissionReports/client.js +18 -0
  80. package/dist/commissionReports/index.d.ts +5 -0
  81. package/dist/commissionReports/index.js +4 -0
  82. package/dist/commissionReports/models.d.ts +208 -0
  83. package/dist/commissionReports/models.js +3 -0
  84. package/dist/crmSettings/client.d.ts +50 -0
  85. package/dist/crmSettings/client.js +25 -0
  86. package/dist/crmSettings/index.d.ts +5 -0
  87. package/dist/crmSettings/index.js +4 -0
  88. package/dist/crmSettings/models.d.ts +313 -0
  89. package/dist/crmSettings/models.js +3 -0
  90. package/dist/earnings/client.d.ts +30 -0
  91. package/dist/earnings/client.js +18 -0
  92. package/dist/earnings/index.d.ts +5 -0
  93. package/dist/earnings/index.js +4 -0
  94. package/dist/earnings/models.d.ts +16 -0
  95. package/dist/earnings/models.js +3 -0
  96. package/dist/externalBookings/client.d.ts +56 -0
  97. package/dist/externalBookings/client.js +33 -0
  98. package/dist/externalBookings/index.d.ts +5 -0
  99. package/dist/externalBookings/index.js +4 -0
  100. package/dist/externalBookings/models.d.ts +93 -0
  101. package/dist/externalBookings/models.js +3 -0
  102. package/dist/externalPayments/client.d.ts +23 -0
  103. package/dist/externalPayments/client.js +18 -0
  104. package/dist/externalPayments/index.d.ts +5 -0
  105. package/dist/externalPayments/index.js +4 -0
  106. package/dist/externalPayments/models.d.ts +47 -0
  107. package/dist/externalPayments/models.js +3 -0
  108. package/dist/favorites/client.d.ts +87 -0
  109. package/dist/favorites/client.js +63 -0
  110. package/dist/favorites/index.d.ts +5 -0
  111. package/dist/favorites/index.js +4 -0
  112. package/dist/favorites/models.d.ts +79 -0
  113. package/dist/favorites/models.js +3 -0
  114. package/dist/flightSchedules/client.d.ts +29 -0
  115. package/dist/flightSchedules/client.js +18 -0
  116. package/dist/flightSchedules/index.d.ts +5 -0
  117. package/dist/flightSchedules/index.js +4 -0
  118. package/dist/flightSchedules/models.d.ts +25 -0
  119. package/dist/flightSchedules/models.js +3 -0
  120. package/dist/flights/client.d.ts +73 -0
  121. package/dist/flights/client.js +25 -0
  122. package/dist/flights/index.d.ts +5 -0
  123. package/dist/flights/index.js +4 -0
  124. package/dist/flights/models.d.ts +345 -0
  125. package/dist/flights/models.js +3 -0
  126. package/dist/hotels/client.d.ts +104 -0
  127. package/dist/hotels/client.js +26 -0
  128. package/dist/hotels/index.d.ts +5 -0
  129. package/dist/hotels/index.js +4 -0
  130. package/dist/hotels/models.d.ts +355 -0
  131. package/dist/hotels/models.js +3 -0
  132. package/dist/index.d.ts +5 -0
  133. package/dist/index.js +4 -0
  134. package/dist/insuranceQuotes/client.d.ts +27 -0
  135. package/dist/insuranceQuotes/client.js +18 -0
  136. package/dist/insuranceQuotes/index.d.ts +5 -0
  137. package/dist/insuranceQuotes/index.js +4 -0
  138. package/dist/insuranceQuotes/models.d.ts +76 -0
  139. package/dist/insuranceQuotes/models.js +3 -0
  140. package/dist/itineraries/client.d.ts +165 -0
  141. package/dist/itineraries/client.js +86 -0
  142. package/dist/itineraries/index.d.ts +5 -0
  143. package/dist/itineraries/index.js +4 -0
  144. package/dist/itineraries/models.d.ts +1619 -0
  145. package/dist/itineraries/models.js +4 -0
  146. package/dist/models.d.ts +1361 -0
  147. package/dist/models.js +3 -0
  148. package/dist/notes/client.d.ts +82 -0
  149. package/dist/notes/client.js +41 -0
  150. package/dist/notes/index.d.ts +5 -0
  151. package/dist/notes/index.js +4 -0
  152. package/dist/notes/models.d.ts +116 -0
  153. package/dist/notes/models.js +3 -0
  154. package/dist/offers/client.d.ts +27 -0
  155. package/dist/offers/client.js +17 -0
  156. package/dist/offers/index.d.ts +5 -0
  157. package/dist/offers/index.js +4 -0
  158. package/dist/offers/models.d.ts +19 -0
  159. package/dist/offers/models.js +3 -0
  160. package/dist/options/index.d.ts +114 -0
  161. package/dist/options/index.js +115 -0
  162. package/dist/orders/client.d.ts +154 -0
  163. package/dist/orders/client.js +65 -0
  164. package/dist/orders/index.d.ts +5 -0
  165. package/dist/orders/index.js +4 -0
  166. package/dist/orders/models.d.ts +2510 -0
  167. package/dist/orders/models.js +3 -0
  168. package/dist/payees/client.d.ts +48 -0
  169. package/dist/payees/client.js +26 -0
  170. package/dist/payees/index.d.ts +5 -0
  171. package/dist/payees/index.js +4 -0
  172. package/dist/payees/models.d.ts +50 -0
  173. package/dist/payees/models.js +3 -0
  174. package/dist/paymentMethods/client.d.ts +24 -0
  175. package/dist/paymentMethods/client.js +18 -0
  176. package/dist/paymentMethods/index.d.ts +5 -0
  177. package/dist/paymentMethods/index.js +4 -0
  178. package/dist/paymentMethods/models.d.ts +60 -0
  179. package/dist/paymentMethods/models.js +3 -0
  180. package/dist/places/client.d.ts +61 -0
  181. package/dist/places/client.js +25 -0
  182. package/dist/places/index.d.ts +5 -0
  183. package/dist/places/index.js +4 -0
  184. package/dist/places/models.d.ts +51 -0
  185. package/dist/places/models.js +3 -0
  186. package/dist/profileForms/client.d.ts +38 -0
  187. package/dist/profileForms/client.js +25 -0
  188. package/dist/profileForms/index.d.ts +5 -0
  189. package/dist/profileForms/index.js +4 -0
  190. package/dist/profileForms/models.d.ts +24 -0
  191. package/dist/profileForms/models.js +3 -0
  192. package/dist/quotes/client.d.ts +30 -0
  193. package/dist/quotes/client.js +18 -0
  194. package/dist/quotes/index.d.ts +5 -0
  195. package/dist/quotes/index.js +4 -0
  196. package/dist/quotes/models.d.ts +47 -0
  197. package/dist/quotes/models.js +3 -0
  198. package/dist/remittanceBatches/client.d.ts +78 -0
  199. package/dist/remittanceBatches/client.js +42 -0
  200. package/dist/remittanceBatches/index.d.ts +5 -0
  201. package/dist/remittanceBatches/index.js +4 -0
  202. package/dist/remittanceBatches/models.d.ts +131 -0
  203. package/dist/remittanceBatches/models.js +3 -0
  204. package/dist/remittanceClaims/client.d.ts +27 -0
  205. package/dist/remittanceClaims/client.js +18 -0
  206. package/dist/remittanceClaims/index.d.ts +5 -0
  207. package/dist/remittanceClaims/index.js +4 -0
  208. package/dist/remittanceClaims/models.d.ts +5 -0
  209. package/dist/remittanceClaims/models.js +3 -0
  210. package/dist/remittanceLines/client.d.ts +27 -0
  211. package/dist/remittanceLines/client.js +18 -0
  212. package/dist/remittanceLines/index.d.ts +5 -0
  213. package/dist/remittanceLines/index.js +4 -0
  214. package/dist/remittanceLines/models.d.ts +5 -0
  215. package/dist/remittanceLines/models.js +3 -0
  216. package/dist/remittances/client.d.ts +78 -0
  217. package/dist/remittances/client.js +42 -0
  218. package/dist/remittances/index.d.ts +5 -0
  219. package/dist/remittances/index.js +4 -0
  220. package/dist/remittances/models.d.ts +116 -0
  221. package/dist/remittances/models.js +3 -0
  222. package/dist/statements/client.d.ts +75 -0
  223. package/dist/statements/client.js +34 -0
  224. package/dist/statements/index.d.ts +5 -0
  225. package/dist/statements/index.js +4 -0
  226. package/dist/statements/models.d.ts +147 -0
  227. package/dist/statements/models.js +3 -0
  228. package/dist/suppliers/client.d.ts +71 -0
  229. package/dist/suppliers/client.js +41 -0
  230. package/dist/suppliers/index.d.ts +5 -0
  231. package/dist/suppliers/index.js +4 -0
  232. package/dist/suppliers/models.d.ts +130 -0
  233. package/dist/suppliers/models.js +3 -0
  234. package/dist/taskTemplates/client.d.ts +36 -0
  235. package/dist/taskTemplates/client.js +18 -0
  236. package/dist/taskTemplates/index.d.ts +5 -0
  237. package/dist/taskTemplates/index.js +4 -0
  238. package/dist/taskTemplates/models.d.ts +15 -0
  239. package/dist/taskTemplates/models.js +3 -0
  240. package/dist/tasks/client.d.ts +105 -0
  241. package/dist/tasks/client.js +41 -0
  242. package/dist/tasks/index.d.ts +5 -0
  243. package/dist/tasks/index.js +4 -0
  244. package/dist/tasks/models.d.ts +59 -0
  245. package/dist/tasks/models.js +3 -0
  246. package/dist/timeline/client.d.ts +42 -0
  247. package/dist/timeline/client.js +18 -0
  248. package/dist/timeline/index.d.ts +5 -0
  249. package/dist/timeline/index.js +4 -0
  250. package/dist/timeline/models.d.ts +65 -0
  251. package/dist/timeline/models.js +3 -0
  252. package/dist/travelProfile/client.d.ts +56 -0
  253. package/dist/travelProfile/client.js +25 -0
  254. package/dist/travelProfile/index.d.ts +5 -0
  255. package/dist/travelProfile/index.js +4 -0
  256. package/dist/travelProfile/models.d.ts +95 -0
  257. package/dist/travelProfile/models.js +3 -0
  258. package/dist/travelers/client.d.ts +214 -0
  259. package/dist/travelers/client.js +76 -0
  260. package/dist/travelers/index.d.ts +5 -0
  261. package/dist/travelers/index.js +4 -0
  262. package/dist/travelers/models.d.ts +576 -0
  263. package/dist/travelers/models.js +3 -0
  264. package/dist/trips/client.d.ts +224 -0
  265. package/dist/trips/client.js +88 -0
  266. package/dist/trips/index.d.ts +5 -0
  267. package/dist/trips/index.js +4 -0
  268. package/dist/trips/models.d.ts +486 -0
  269. package/dist/trips/models.js +3 -0
  270. package/package.json +35 -2
@@ -0,0 +1,4 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export { ApiError } from "../_/index.js";
4
+ export { createClient } from "./client.js";
@@ -0,0 +1,208 @@
1
+ import type { AgingBucket, CurrencyCode, SupplierAddress, SupplierKind } from "../models.js";
2
+ export type CommissionReport = {
3
+ nextCursor: string | null;
4
+ period: CommissionReportPeriod;
5
+ reportKind: "PRODUCTION_BY_SUPPLIER";
6
+ reportingCurrency: CurrencyCode;
7
+ reportingTotals: ProductionTotal;
8
+ rows: ProductionBySupplierRow[];
9
+ totals: ProductionTotal[];
10
+ unconvertedCurrencies: CurrencyCode[];
11
+ } | {
12
+ nextCursor: string | null;
13
+ period: CommissionReportPeriod;
14
+ reportKind: "PRODUCTION_BY_ADVISOR";
15
+ reportingCurrency: CurrencyCode;
16
+ reportingTotals: ProductionTotal;
17
+ rows: ProductionByAdvisorRow[];
18
+ totals: ProductionTotal[];
19
+ unconvertedCurrencies: CurrencyCode[];
20
+ } | {
21
+ nextCursor: string | null;
22
+ period: CommissionReportPeriod;
23
+ reportKind: "PRODUCTION_BY_CLIENT";
24
+ reportingCurrency: CurrencyCode;
25
+ reportingTotals: ProductionTotal;
26
+ rows: ProductionByClientRow[];
27
+ totals: ProductionTotal[];
28
+ unconvertedCurrencies: CurrencyCode[];
29
+ } | {
30
+ nextCursor: string | null;
31
+ period: CommissionReportPeriod;
32
+ reportKind: "PRODUCTION_BY_DESTINATION";
33
+ reportingCurrency: CurrencyCode;
34
+ reportingTotals: ProductionTotal;
35
+ rows: ProductionByDestinationRow[];
36
+ totals: ProductionTotal[];
37
+ unconvertedCurrencies: CurrencyCode[];
38
+ } | {
39
+ nextCursor: string | null;
40
+ period: CommissionReportPeriod;
41
+ reportKind: "RECEIVABLES_AGING";
42
+ reportingCurrency: CurrencyCode;
43
+ reportingTotals: ReceivablesTotal;
44
+ rows: ReceivablesAgingRow[];
45
+ totals: ReceivablesTotal[];
46
+ unconvertedCurrencies: CurrencyCode[];
47
+ } | {
48
+ nextCursor: string | null;
49
+ period: CommissionReportPeriod;
50
+ reportKind: "RECONCILIATION_EXCEPTIONS";
51
+ rows: ReconciliationExceptionRow[];
52
+ totals: ReconciliationExceptionTotal[];
53
+ } | {
54
+ nextCursor: string | null;
55
+ period: CommissionReportPeriod;
56
+ previousPeriod: CommissionReportPeriod;
57
+ previousTotals: ProductionTotal[];
58
+ reportKind: "SUPPLIER_DIRECTORY";
59
+ reportingCurrency: CurrencyCode;
60
+ rows: SupplierDirectoryRow[];
61
+ supplierCount: number | null;
62
+ totals: ProductionTotal[];
63
+ unconvertedCurrencies: CurrencyCode[];
64
+ };
65
+ export interface CommissionReportPeriod {
66
+ asOf: string;
67
+ basis: "TRAVEL_END" | "BOOKED" | "TRAVEL_START" | null;
68
+ from: string | null;
69
+ to: string | null;
70
+ }
71
+ export type PeriodComparison = "PREVIOUS_PERIOD" | "SAME_PERIOD_LAST_YEAR" | "NONE";
72
+ export interface ProductionByAdvisorRow {
73
+ advisorUserId: string | null;
74
+ closedCount: number;
75
+ commissionableMinor: number;
76
+ count: number;
77
+ currency: CurrencyCode;
78
+ expectedMinor: number;
79
+ grossMinor: number;
80
+ receivedMinor: number;
81
+ reportingCommissionableMinor: number | null;
82
+ reportingExpectedMinor: number | null;
83
+ reportingGrossMinor: number | null;
84
+ reportingReceivedMinor: number | null;
85
+ }
86
+ export interface ProductionByClientRow {
87
+ clientName: string;
88
+ clientUserId: string | null;
89
+ closedCount: number;
90
+ commissionableMinor: number;
91
+ count: number;
92
+ currency: CurrencyCode;
93
+ expectedMinor: number;
94
+ grossMinor: number;
95
+ receivedMinor: number;
96
+ reportingCommissionableMinor: number | null;
97
+ reportingExpectedMinor: number | null;
98
+ reportingGrossMinor: number | null;
99
+ reportingReceivedMinor: number | null;
100
+ }
101
+ export interface ProductionByDestinationRow {
102
+ closedCount: number;
103
+ commissionableMinor: number;
104
+ count: number;
105
+ countryCode: string | null;
106
+ currency: CurrencyCode;
107
+ expectedMinor: number;
108
+ grossMinor: number;
109
+ receivedMinor: number;
110
+ reportingCommissionableMinor: number | null;
111
+ reportingExpectedMinor: number | null;
112
+ reportingGrossMinor: number | null;
113
+ reportingReceivedMinor: number | null;
114
+ }
115
+ export interface ProductionBySupplierRow {
116
+ city: string | null;
117
+ closedCount: number;
118
+ commissionableMinor: number;
119
+ count: number;
120
+ countryCode: string | null;
121
+ currency: CurrencyCode;
122
+ expectedMinor: number;
123
+ grossMinor: number;
124
+ kind: SupplierKind | null;
125
+ receivedMinor: number;
126
+ reportingCommissionableMinor: number | null;
127
+ reportingExpectedMinor: number | null;
128
+ reportingGrossMinor: number | null;
129
+ reportingReceivedMinor: number | null;
130
+ supplierId: string | null;
131
+ supplierName: string | null;
132
+ verified: boolean | null;
133
+ }
134
+ export interface ProductionTotal {
135
+ closedCount: number;
136
+ commissionableMinor: number;
137
+ count: number;
138
+ currency: CurrencyCode;
139
+ expectedMinor: number;
140
+ grossMinor: number;
141
+ receivedMinor: number;
142
+ }
143
+ export interface ReceivablesAgingRow {
144
+ balanceMinor: number;
145
+ byAgingBucket: {
146
+ agingBucket: AgingBucket;
147
+ balanceMinor: number;
148
+ count: number;
149
+ }[];
150
+ count: number;
151
+ currency: CurrencyCode;
152
+ overdueCount: number;
153
+ overdueMinor: number;
154
+ reportingBalanceMinor: number | null;
155
+ reportingOverdueMinor: number | null;
156
+ supplierId: string | null;
157
+ supplierName: string | null;
158
+ }
159
+ export interface ReceivablesTotal {
160
+ balanceMinor: number;
161
+ byAgingBucket: {
162
+ agingBucket: AgingBucket;
163
+ balanceMinor: number;
164
+ count: number;
165
+ }[];
166
+ count: number;
167
+ currency: CurrencyCode;
168
+ overdueCount: number;
169
+ overdueMinor: number;
170
+ }
171
+ export type ReconciliationExceptionKind = "UNMATCHED_LINE" | "PENDING_REVIEW_LINE" | "OVERPAID_ITEM" | "PENDING_CLAIM";
172
+ export interface ReconciliationExceptionRow {
173
+ amountMinor: number;
174
+ currency: CurrencyCode;
175
+ exception: ReconciliationExceptionKind;
176
+ occurredOn: string;
177
+ reference: string;
178
+ remittanceId: string | null;
179
+ subjectId: string;
180
+ subjectKind: "REMITTANCE_LINE" | "COMMISSION_ITEM" | "REMITTANCE_CLAIM";
181
+ supplierName: string | null;
182
+ }
183
+ export interface ReconciliationExceptionTotal {
184
+ amountMinor: number;
185
+ count: number;
186
+ currency: CurrencyCode;
187
+ exception: ReconciliationExceptionKind;
188
+ }
189
+ export interface SupplierDirectoryRow {
190
+ address: SupplierAddress | null;
191
+ closedCount: number;
192
+ commissionableMinor: number | null;
193
+ count: number;
194
+ currency: CurrencyCode;
195
+ expectedMinor: number | null;
196
+ grossMinor: number | null;
197
+ kind: SupplierKind;
198
+ name: string;
199
+ programs: {
200
+ name: string;
201
+ programId: string;
202
+ validFrom: string | null;
203
+ validTo: string | null;
204
+ }[];
205
+ receivedMinor: number | null;
206
+ supplierId: string;
207
+ verified: boolean;
208
+ }
@@ -0,0 +1,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};
@@ -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,4 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export { ApiError } from "../_/index.js";
4
+ export { createClient } from "./client.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,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};
@@ -0,0 +1,30 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
2
+ import type { EarningsListResponse } 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
+ * List advisor earnings
12
+ *
13
+ * Lists the company's earning entries, the last changed first, optionally
14
+ * filtered by beneficiary and status: a page of `limit` (50 by default, 200
15
+ * at most), with `nextCursor` to send back as `cursor` while more remain.
16
+ * Advisors and travelers see their own; admins anyone's of the company, and
17
+ * Nicer staff anyone's of the company they name in `x-nicer-company` (each
18
+ * staff read is audited).
19
+ */
20
+ list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
21
+ }
22
+ export declare function createClient(options: ClientOptions): Client;
23
+ export declare function bind(transport: Transport): Client;
24
+ export interface ListRequest {
25
+ beneficiaryId?: string;
26
+ cursor?: string;
27
+ limit?: number;
28
+ status?: "PENDING" | "AVAILABLE" | "REVERSED";
29
+ }
30
+ export type ListResponse = EarningsListResponse;
@@ -0,0 +1,18 @@
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
+ list: (request, options) => transport.send(ListOperation, request, options),
10
+ };
11
+ }
12
+ const ListOperation = {
13
+ method: "GET",
14
+ route: "/commerce/finance/earnings",
15
+ query: { beneficiaryId: "beneficiaryId", cursor: "cursor", limit: "limit", status: "status" },
16
+ response: null,
17
+ errors: { "400": true, "401": true, "403": true },
18
+ };
@@ -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, ListRequest, ListResponse, } from "./client.js";
5
+ export type { EarningsListResponse } from "./models.js";
@@ -0,0 +1,4 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export { ApiError } from "../_/index.js";
4
+ export { createClient } from "./client.js";