@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,34 @@
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
+ create: (request, options) => transport.send(CreateOperation, request, options),
10
+ get: (request, options) => transport.send(GetOperation, request, options),
11
+ runAction: (request, options) => transport.send(RunActionOperation, request, options),
12
+ };
13
+ }
14
+ const CreateOperation = {
15
+ method: "POST",
16
+ route: "/commerce/commission-imports",
17
+ body: "flat",
18
+ response: null,
19
+ errors: { "400": true, "401": true, "403": true },
20
+ };
21
+ const GetOperation = {
22
+ method: "GET",
23
+ route: "/commerce/commission-imports/{importId}",
24
+ query: { cursor: "cursor", limit: "limit", status: "status" },
25
+ response: null,
26
+ errors: { "400": true, "401": true, "403": true },
27
+ };
28
+ const RunActionOperation = {
29
+ method: "POST",
30
+ route: "/commerce/commission-imports/{importId}/actions",
31
+ body: "flat",
32
+ response: null,
33
+ errors: { "400": true, "401": true, "403": true },
34
+ };
@@ -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, CreateRequest, CreateResponse, GetRequest, GetResponse, RunActionRequest, RunActionResponse, } from "./client.js";
5
+ export type { BookingImportField, BookingImportMapping, CommissionImport, CommissionImportActionRunBody, CommissionImportCreateBody, CommissionImportCreateResponse, CommissionImportGetResponse, ImportAdvisor, ImportRow, ImportRowStatus, ImportRowValues, } 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,118 @@
1
+ import type { CommissionCategory, CommissionFileStatus, CommissionItemKind, CurrencyCode, UploadLink } from "../models.js";
2
+ export type BookingImportField = "bookedOn" | "category" | "clientName" | "commission" | "confirmationNumber" | "currency" | "dueOn" | "externalReference" | "gross" | "identifierNumber" | "kind" | "note" | "paymentTermDays" | "providerLocator" | "quantity" | "rate" | "supplierName" | "tags" | "travelEnd" | "travelStart" | "advisorEmail";
3
+ export interface BookingImportMapping {
4
+ columns: {
5
+ [key: string]: string;
6
+ };
7
+ dateFormat: "ISO" | "US" | "EU";
8
+ decimalSeparator: "." | ",";
9
+ defaults: {
10
+ [key: string]: string;
11
+ };
12
+ headerRow: number;
13
+ sheet: string | null;
14
+ }
15
+ export interface CommissionImport {
16
+ advisorUserId: string | null;
17
+ advisors: ImportAdvisor[];
18
+ committedAt: string | null;
19
+ companyName: string;
20
+ counts: {
21
+ committed: number;
22
+ duplicate: number;
23
+ invalid: number;
24
+ rows: number;
25
+ valid: number;
26
+ };
27
+ createdAt: string;
28
+ createdByUserId: string;
29
+ errorCode: string | null;
30
+ fileName: string;
31
+ format: "CSV" | "TSV" | "TXT" | "XLSX";
32
+ headers: string[];
33
+ importId: string;
34
+ jobId: string | null;
35
+ kind: "BOOKINGS";
36
+ mapping: BookingImportMapping | null;
37
+ presetId: string | null;
38
+ sizeBytes: number;
39
+ source: "FILE_IMPORT";
40
+ status: CommissionFileStatus;
41
+ updatedAt: string;
42
+ }
43
+ export type CommissionImportActionRunBody = {
44
+ mapping: BookingImportMapping;
45
+ type: "APPLY_MAPPING";
46
+ } | {
47
+ advisors: ImportAdvisor[];
48
+ type: "MAP_ADVISORS";
49
+ } | {
50
+ name: string;
51
+ type: "SAVE_PRESET";
52
+ } | {
53
+ type: "COMMIT";
54
+ } | {
55
+ type: "DISCARD";
56
+ };
57
+ export interface CommissionImportCreateBody {
58
+ advisorUserId?: string | null;
59
+ advisors?: ImportAdvisor[];
60
+ fileName: string;
61
+ format: "CSV" | "TSV" | "TXT" | "XLSX";
62
+ kind?: "BOOKINGS";
63
+ presetId?: string | null;
64
+ sha256: string;
65
+ sizeBytes: number;
66
+ source?: "FILE_IMPORT";
67
+ }
68
+ export interface CommissionImportCreateResponse {
69
+ import: CommissionImport;
70
+ upload: UploadLink;
71
+ }
72
+ export interface CommissionImportGetResponse {
73
+ import: CommissionImport;
74
+ nextCursor: string | null;
75
+ rows: ImportRow[];
76
+ }
77
+ export interface ImportAdvisor {
78
+ email: string;
79
+ userId: string;
80
+ }
81
+ export interface ImportRow {
82
+ cells: {
83
+ [key: string]: string;
84
+ };
85
+ commissionItemId: string | null;
86
+ errors: {
87
+ code: "REQUIRED" | "INVALID_DATE" | "INVALID_AMOUNT" | "INVALID_RATE" | "INVALID_VALUE" | "TRAVEL_END_BEFORE_START" | "NO_COMMISSION" | "UNKNOWN_IDENTIFIER" | "UNKNOWN_ADVISOR";
88
+ field: BookingImportField;
89
+ }[];
90
+ externalBookingId: string | null;
91
+ rowNumber: number;
92
+ status: ImportRowStatus;
93
+ values: ImportRowValues | null;
94
+ }
95
+ export type ImportRowStatus = "VALID" | "INVALID" | "DUPLICATE" | "COMMITTED" | "SKIPPED";
96
+ export interface ImportRowValues {
97
+ advisorEmail?: string;
98
+ bookedOn: string | null;
99
+ category: CommissionCategory;
100
+ clientName: string;
101
+ commissionMinor: number | null;
102
+ confirmationNumber: string | null;
103
+ currency: CurrencyCode;
104
+ dueOn: string | null;
105
+ externalReference: string | null;
106
+ grossMinor: number | null;
107
+ identifierNumber: string | null;
108
+ kind: CommissionItemKind;
109
+ note: string | null;
110
+ paymentTermDays: number | null;
111
+ providerLocator: string | null;
112
+ quantity: number;
113
+ rateBps: number | null;
114
+ supplierName: string;
115
+ tags: string[];
116
+ travelEnd: string;
117
+ travelStart: string;
118
+ }
@@ -0,0 +1,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};
@@ -0,0 +1,128 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
2
+ import type { CommissionTag } from "../models.js";
3
+ import type { CommissionItemActionRunBody, CommissionItemActionRunResponse, CommissionItemDetail, CommissionItemsListResponse, CommissionSummary } from "./models.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 commission item
13
+ *
14
+ * One commission item: its status and money, the booking facts, the
15
+ * identifier it was booked under, every revision, notes, attachments, and the
16
+ * actions the caller may run now. An advisor reads their own items; an admin
17
+ * the agency's, and a host the items it receives money for. Another company's
18
+ * item answers 404.
19
+ */
20
+ get(request: GetRequest, options?: RequestOptions): Promise<GetResponse>;
21
+ /**
22
+ * Get the commission summary
23
+ *
24
+ * The commission dashboard for the same filter as the list: totals per
25
+ * currency (expected, received, balance, overdue, due in the next 30 days),
26
+ * counts and amounts by status and by aging bucket, and the ten suppliers
27
+ * that owe the most; and the same in the reporting currency
28
+ * (`reportingTotals`, `reportingByStatus` with the revenue,
29
+ * `reportingByAgingBucket`, `reportingTopSuppliers`, in `reportingCurrency`,
30
+ * US dollars, counted as Sion counts them: each item's revenue at its rate
31
+ * frozen when its first money arrived or it was written off, today's until
32
+ * then; its commission what it received once paid, else its expected amount
33
+ * at today's rate; items needing a rate their currency lacks are left out and
34
+ * named in `unconvertedCurrencies`). Without `from`/`to` the period is the
35
+ * current calendar year on the date field. Cancelled and written-off items
36
+ * count by status but not in balances; an item that earns nothing reads
37
+ * UPCOMING until its travel ends, then PAID.
38
+ */
39
+ getSummary(request?: GetSummaryRequest, options?: RequestOptions): Promise<GetSummaryResponse>;
40
+ /**
41
+ * List commission items
42
+ *
43
+ * The commission list of every booking, whatever its source (Nicer checkout,
44
+ * GDS import, booked elsewhere, file import), with status, balance, due date
45
+ * and aging from `commission_item_status`. Keyset-paged on the date field
46
+ * (travel end by default), newest first; 25 per page, at most 100. Advisors
47
+ * see their own bookings; admins the agency's; `view=RECEIVABLES` lists what
48
+ * the agency receives as the owner of the identifier (a host sees its
49
+ * members' items; admins and staff). Finance staff may read any company,
50
+ * audited.
51
+ */
52
+ list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
53
+ /**
54
+ * Run an action on a commission item
55
+ *
56
+ * One action on a commission item. Advisors (on their own items), admins and
57
+ * staff: CHANGE_EXPECTED (on an item of a Nicer checkout it also clears
58
+ * `needsReview`, which such an item carries when its provider marked the rate
59
+ * commissionable without an amount), CHANGE_DATES (the due date follows
60
+ * unless it was set by hand; an item of a booking made elsewhere takes its
61
+ * dates from the booking's PUT, and this answers 400), SET_DUE_DATE, CANCEL,
62
+ * REOPEN a cancellation, CONFIRM_IMPORTED (an imported item only; a Nicer
63
+ * checkout item answers 409 COMMISSION_ITEM_NOT_IMPORTED), SET_FLAG,
64
+ * ADD_NOTE, SET_TAGS, ADD_ATTACHMENT (answers a presigned upload),
65
+ * REPORT_MISSING (after travel, while money is owed: the item is flagged and
66
+ * the note joins its notes, for whoever chases the supplier; 409
67
+ * COMMISSION_ITEM_NOT_CHASEABLE otherwise). Admins and staff:
68
+ * SET_COMMISSIONABLE (making a Nicer checkout item commissionable with
69
+ * nothing expected or received puts it in review, for its amount to be
70
+ * entered), WRITE_OFF, REOPEN a write-off, REASSIGN_ADVISOR. Changes to
71
+ * money, dates and parties send the `expectationVersion` read and write a
72
+ * revision; a newer change answers 409 COMMISSION_RECORD_CHANGED, a cancelled
73
+ * or written-off item 409 COMMISSION_ITEM_CLOSED, a new identifier once money
74
+ * arrived 409 COMMISSION_IDENTIFIER_LOCKED. An item Nicer collected
75
+ * (`collectedByNicer`: a planning fee, a Smith hotel) takes only SET_FLAG,
76
+ * ADD_NOTE, SET_TAGS and ADD_ATTACHMENT; anything else answers 409
77
+ * COMMISSION_ITEM_NICER_COLLECTED.
78
+ */
79
+ runAction(request: RunActionRequest, options?: RequestOptions): Promise<RunActionResponse>;
80
+ }
81
+ export declare function createClient(options: ClientOptions): Client;
82
+ export declare function bind(transport: Transport): Client;
83
+ export interface GetRequest {
84
+ commissionItemId: string;
85
+ }
86
+ export type GetResponse = CommissionItemDetail;
87
+ export interface GetSummaryRequest {
88
+ advisorUserId?: string;
89
+ agingBucket?: string;
90
+ category?: string;
91
+ dateField?: "TRAVEL_END" | "TRAVEL_START" | "BOOKED" | "DUE";
92
+ from?: string;
93
+ identifierId?: string;
94
+ kind?: string;
95
+ needsReview?: "true" | "false";
96
+ q?: string;
97
+ source?: string;
98
+ status?: string;
99
+ supplierId?: string;
100
+ tag?: CommissionTag;
101
+ to?: string;
102
+ view?: "BOOKINGS" | "RECEIVABLES";
103
+ }
104
+ export type GetSummaryResponse = CommissionSummary;
105
+ export interface ListRequest {
106
+ advisorUserId?: string;
107
+ agingBucket?: string;
108
+ category?: string;
109
+ dateField?: "TRAVEL_END" | "TRAVEL_START" | "BOOKED" | "DUE";
110
+ from?: string;
111
+ identifierId?: string;
112
+ kind?: string;
113
+ needsReview?: "true" | "false";
114
+ q?: string;
115
+ source?: string;
116
+ status?: string;
117
+ supplierId?: string;
118
+ tag?: CommissionTag;
119
+ to?: string;
120
+ view?: "BOOKINGS" | "RECEIVABLES";
121
+ cursor?: string;
122
+ limit?: number;
123
+ }
124
+ export type ListResponse = CommissionItemsListResponse;
125
+ export type RunActionRequest = {
126
+ commissionItemId: string;
127
+ } & CommissionItemActionRunBody;
128
+ export type RunActionResponse = CommissionItemActionRunResponse;
@@ -0,0 +1,41 @@
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
+ getSummary: (request, options) => transport.send(GetSummaryOperation, request, options),
11
+ list: (request, options) => transport.send(ListOperation, request, options),
12
+ runAction: (request, options) => transport.send(RunActionOperation, request, options),
13
+ };
14
+ }
15
+ const GetOperation = {
16
+ method: "GET",
17
+ route: "/commerce/commissions/{commissionItemId}",
18
+ response: null,
19
+ errors: { "400": true, "401": true, "403": true },
20
+ };
21
+ const GetSummaryOperation = {
22
+ method: "GET",
23
+ route: "/commerce/commissions/summary",
24
+ query: { advisorUserId: "advisorUserId", agingBucket: "agingBucket", category: "category", dateField: "dateField", from: "from", identifierId: "identifierId", kind: "kind", needsReview: "needsReview", q: "q", source: "source", status: "status", supplierId: "supplierId", tag: "tag", to: "to", view: "view" },
25
+ response: null,
26
+ errors: { "400": true, "401": true, "403": true },
27
+ };
28
+ const ListOperation = {
29
+ method: "GET",
30
+ route: "/commerce/commissions",
31
+ query: { advisorUserId: "advisorUserId", agingBucket: "agingBucket", category: "category", dateField: "dateField", from: "from", identifierId: "identifierId", kind: "kind", needsReview: "needsReview", q: "q", source: "source", status: "status", supplierId: "supplierId", tag: "tag", to: "to", view: "view", cursor: "cursor", limit: "limit" },
32
+ response: null,
33
+ errors: { "400": true, "401": true, "403": true },
34
+ };
35
+ const RunActionOperation = {
36
+ method: "POST",
37
+ route: "/commerce/commissions/{commissionItemId}/actions",
38
+ body: "flat",
39
+ response: null,
40
+ errors: { "400": true, "401": true, "403": true },
41
+ };
@@ -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, GetSummaryRequest, GetSummaryResponse, ListRequest, ListResponse, RunActionRequest, RunActionResponse, } from "./client.js";
5
+ export type { CommissionItemActionRunBody, CommissionItemActionRunResponse, CommissionItemDetail, CommissionItemRevision, CommissionItemsListResponse, CommissionSummary, } 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,217 @@
1
+ import type { AgingBucket, AttachmentContentType, CommissionAttachment, CommissionCategory, CommissionIdentifierRef, CommissionItemKind, CommissionItemSource, CommissionItemSummary, CommissionNote, CommissionPaymentStatus, CommissionTag, CurrencyCode, UploadLink } from "../models.js";
2
+ export type CommissionItemActionRunBody = {
3
+ commissionableMinor?: number;
4
+ expectationVersion: number;
5
+ expectedMinor?: number;
6
+ grossMinor?: number;
7
+ rateBps?: number;
8
+ reason: string;
9
+ supplierCostMinor?: number;
10
+ type: "CHANGE_EXPECTED";
11
+ } | {
12
+ bookedOn?: string;
13
+ expectationVersion: number;
14
+ reason: string;
15
+ travelEnd?: string;
16
+ travelStart?: string;
17
+ type: "CHANGE_DATES";
18
+ } | {
19
+ dueOn: string;
20
+ expectationVersion: number;
21
+ reason: string;
22
+ type: "SET_DUE_DATE";
23
+ } | {
24
+ expectationVersion: number;
25
+ reason: string;
26
+ type: "CANCEL";
27
+ } | {
28
+ expectationVersion: number;
29
+ reason: string;
30
+ type: "REOPEN";
31
+ } | {
32
+ expectationVersion: number;
33
+ isCommissionable: boolean;
34
+ reason: string;
35
+ type: "SET_COMMISSIONABLE";
36
+ } | {
37
+ expectationVersion: number;
38
+ reason: string;
39
+ type: "WRITE_OFF";
40
+ } | {
41
+ expectationVersion: number;
42
+ type: "CONFIRM_IMPORTED";
43
+ } | {
44
+ advisorUserId: string;
45
+ expectationVersion: number;
46
+ reason: string;
47
+ type: "REASSIGN_ADVISOR";
48
+ } | {
49
+ flagged: boolean;
50
+ type: "SET_FLAG";
51
+ } | {
52
+ bodyMarkdown: string;
53
+ type: "ADD_NOTE";
54
+ } | {
55
+ tags: CommissionTag[];
56
+ type: "SET_TAGS";
57
+ } | {
58
+ contentType: AttachmentContentType;
59
+ fileName: string;
60
+ label?: string;
61
+ sha256: string;
62
+ sizeBytes: number;
63
+ type: "ADD_ATTACHMENT";
64
+ } | {
65
+ note: string;
66
+ type: "REPORT_MISSING";
67
+ };
68
+ export interface CommissionItemActionRunResponse {
69
+ item: CommissionItemDetail;
70
+ upload: UploadLink | null;
71
+ }
72
+ export interface CommissionItemDetail {
73
+ advisorUserId: string | null;
74
+ agingBucket: AgingBucket;
75
+ allowedActions: ("CHANGE_EXPECTED" | "CHANGE_DATES" | "SET_DUE_DATE" | "CANCEL" | "REOPEN" | "SET_COMMISSIONABLE" | "WRITE_OFF" | "CONFIRM_IMPORTED" | "REASSIGN_ADVISOR" | "SET_FLAG" | "ADD_NOTE" | "SET_TAGS" | "ADD_ATTACHMENT" | "REPORT_MISSING")[];
76
+ attachments: CommissionAttachment[];
77
+ balanceMinor: number;
78
+ bookedOn: string;
79
+ cancelReason: string | null;
80
+ cancelledAt: string | null;
81
+ category: CommissionCategory;
82
+ clientName: string;
83
+ clientUserId: string | null;
84
+ collectedByNicer: boolean;
85
+ commissionItemId: string;
86
+ commissionableMinor: number;
87
+ companyName: string;
88
+ confirmationNumber: string | null;
89
+ createdAt: string;
90
+ createdByUserId: string | null;
91
+ currency: CurrencyCode;
92
+ daysPastDue: number;
93
+ dueOn: string;
94
+ expectationVersion: number;
95
+ expectedMinor: number;
96
+ externalBookingId: string | null;
97
+ grossMinor: number;
98
+ identifier: CommissionIdentifierRef | null;
99
+ isCommissionable: boolean;
100
+ isFlagged: boolean;
101
+ isOverdue: boolean;
102
+ kind: CommissionItemKind;
103
+ lastReceivedOn: string | null;
104
+ needsReview: boolean;
105
+ notes: CommissionNote[];
106
+ number: string;
107
+ orderId: string | null;
108
+ paymentStatus: CommissionPaymentStatus;
109
+ paymentTermDays: number;
110
+ percentPaid: number | null;
111
+ providerLocator: string | null;
112
+ quantity: number;
113
+ rateBps: number | null;
114
+ receivedMinor: number;
115
+ receivingCompanyName: string;
116
+ revisions: CommissionItemRevision[];
117
+ source: CommissionItemSource;
118
+ supplier: {
119
+ name: string | null;
120
+ supplierId: string | null;
121
+ verified: boolean;
122
+ };
123
+ supplierCostMinor: number;
124
+ tags: CommissionTag[];
125
+ travelEnd: string;
126
+ travelStart: string;
127
+ travelersTripId: string | null;
128
+ updatedAt: string;
129
+ writeOffReason: string | null;
130
+ writtenOffAt: string | null;
131
+ }
132
+ export interface CommissionItemRevision {
133
+ actorUserId: string | null;
134
+ changedFields: {
135
+ [key: string]: unknown;
136
+ };
137
+ createdAt: string;
138
+ reason: string;
139
+ version: number;
140
+ }
141
+ export interface CommissionItemsListResponse {
142
+ items: CommissionItemSummary[];
143
+ nextCursor: string | null;
144
+ }
145
+ export interface CommissionSummary {
146
+ byAgingBucket: {
147
+ agingBucket: AgingBucket;
148
+ balanceMinor: number;
149
+ count: number;
150
+ currency: CurrencyCode;
151
+ }[];
152
+ byStatus: {
153
+ balanceMinor: number;
154
+ count: number;
155
+ currency: CurrencyCode;
156
+ expectedMinor: number;
157
+ paymentStatus: CommissionPaymentStatus;
158
+ receivedMinor: number;
159
+ }[];
160
+ period: {
161
+ dateField: "TRAVEL_END" | "TRAVEL_START" | "BOOKED" | "DUE";
162
+ from: string | null;
163
+ to: string | null;
164
+ };
165
+ reportingByAgingBucket: {
166
+ agingBucket: AgingBucket;
167
+ balanceMinor: number;
168
+ count: number;
169
+ currency: CurrencyCode;
170
+ }[];
171
+ reportingByStatus: {
172
+ balanceMinor: number;
173
+ count: number;
174
+ currency: CurrencyCode;
175
+ expectedMinor: number;
176
+ grossMinor: number;
177
+ paymentStatus: CommissionPaymentStatus;
178
+ receivedMinor: number;
179
+ }[];
180
+ reportingCurrency: CurrencyCode;
181
+ reportingTopSuppliers: {
182
+ balanceMinor: number;
183
+ count: number;
184
+ currency: CurrencyCode;
185
+ name: string | null;
186
+ supplierId: string | null;
187
+ }[];
188
+ reportingTotals: {
189
+ balanceMinor: number;
190
+ count: number;
191
+ currency: CurrencyCode;
192
+ dueNext30Minor: number;
193
+ expectedMinor: number;
194
+ grossMinor: number;
195
+ overdueCount: number;
196
+ overdueMinor: number;
197
+ receivedMinor: number;
198
+ };
199
+ topSuppliers: {
200
+ balanceMinor: number;
201
+ count: number;
202
+ currency: CurrencyCode;
203
+ name: string | null;
204
+ supplierId: string | null;
205
+ }[];
206
+ totals: {
207
+ balanceMinor: number;
208
+ count: number;
209
+ currency: CurrencyCode;
210
+ dueNext30Minor: number;
211
+ expectedMinor: number;
212
+ overdueCount: number;
213
+ overdueMinor: number;
214
+ receivedMinor: number;
215
+ }[];
216
+ unconvertedCurrencies: CurrencyCode[];
217
+ }
@@ -0,0 +1,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};
@@ -0,0 +1,76 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
2
+ import type { CurrencyCode } from "../models.js";
3
+ import type { CommissionReport, PeriodComparison } from "./models.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 commission report
13
+ *
14
+ * A commission report of the company, keyset-paged (50 rows by default, at
15
+ * most 200), with totals per currency over the whole report.
16
+ * PRODUCTION_BY_SUPPLIER, PRODUCTION_BY_ADVISOR and PRODUCTION_BY_DESTINATION
17
+ * (by the supplier's country) add up the items of whole months, by when their
18
+ * travel ends (`basis` TRAVEL_END, the default), starts (TRAVEL_START, Sion's
19
+ * Check In) or they were booked (BOOKED, Sion's Created At), as they stand
20
+ * when read (an item booked with a supplier since merged counts under the
21
+ * survivor), largest expected first; PRODUCTION_BY_CLIENT reads the items by
22
+ * client name; RECEIVABLES_AGING is what suppliers owe today by aging bucket,
23
+ * largest balance first; RECONCILIATION_EXCEPTIONS lists unmatched and
24
+ * pending-review lines, overpaid items and pending claims, newest first;
25
+ * SUPPLIER_DIRECTORY lists every supplier the company sees (Nicer's shared
26
+ * directory and its own, merged ones under their survivor), first those with
27
+ * items in the period's whole months by revenue in the reporting currency (US
28
+ * dollars), then the others by name, filtered by name, supplier kind,
29
+ * verification, country and city, preferred programs and agency identifiers,
30
+ * with the totals of the period it compares with (`compare`: PREVIOUS_PERIOD,
31
+ * the default, the same number of whole months just before;
32
+ * SAME_PERIOD_LAST_YEAR the same days a year earlier; NONE none), and an
33
+ * exact count of the suppliers up to 10,000. Production and receivables rows
34
+ * also carry their amounts in the reporting currency (`reporting…`) and the
35
+ * report its `reportingTotals`, every currency added up, in
36
+ * `reportingCurrency`, counted as Sion counts them: each item converts on its
37
+ * own and rounds half up, its revenue at its frozen rate (the check-out
38
+ * day's, frozen when its first money arrived or it was written off; the
39
+ * latest rate on or before today until then), its commission what it received
40
+ * once paid (dollars as they arrived), else its expected amount at today's
41
+ * rate. An item that needs today's rate in a currency with none is left out,
42
+ * its row reads null and its currency is in `unconvertedCurrencies`. The
43
+ * period is the current year unless `from` or `to` is given. Advisors read
44
+ * production, receivables and the directory of their own bookings only; the
45
+ * other reports are for agency admins and finance staff (403 otherwise); a
46
+ * parameter the report does not take answers 400. Finance staff may read any
47
+ * company, audited.
48
+ */
49
+ get(request: GetRequest, options?: RequestOptions): Promise<GetResponse>;
50
+ }
51
+ export declare function createClient(options: ClientOptions): Client;
52
+ export declare function bind(transport: Transport): Client;
53
+ export interface GetRequest {
54
+ reportKind: string;
55
+ advisorUserId?: string;
56
+ basis?: "TRAVEL_END" | "BOOKED" | "TRAVEL_START";
57
+ category?: string;
58
+ city?: string;
59
+ compare?: PeriodComparison;
60
+ countryCode?: string;
61
+ currency?: CurrencyCode;
62
+ cursor?: string;
63
+ exception?: string;
64
+ from?: string;
65
+ hasBookings?: "true" | "false";
66
+ identifierId?: string;
67
+ kind?: string;
68
+ limit?: number;
69
+ programId?: string;
70
+ q?: string;
71
+ supplierId?: string;
72
+ supplierKind?: string;
73
+ to?: string;
74
+ verified?: "true" | "false";
75
+ }
76
+ export type GetResponse = CommissionReport;
@@ -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
+ get: (request, options) => transport.send(GetOperation, request, options),
10
+ };
11
+ }
12
+ const GetOperation = {
13
+ method: "GET",
14
+ route: "/commerce/commission-reports/{reportKind}",
15
+ query: { advisorUserId: "advisorUserId", basis: "basis", category: "category", city: "city", compare: "compare", countryCode: "countryCode", currency: "currency", cursor: "cursor", exception: "exception", from: "from", hasBookings: "hasBookings", identifierId: "identifierId", kind: "kind", limit: "limit", programId: "programId", q: "q", supplierId: "supplierId", supplierKind: "supplierKind", to: "to", verified: "verified" },
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, GetRequest, GetResponse, } from "./client.js";
5
+ export type { CommissionReport, CommissionReportPeriod, PeriodComparison, ProductionByAdvisorRow, ProductionByClientRow, ProductionByDestinationRow, ProductionBySupplierRow, ProductionTotal, ReceivablesAgingRow, ReceivablesTotal, ReconciliationExceptionKind, ReconciliationExceptionRow, ReconciliationExceptionTotal, SupplierDirectoryRow, } from "./models.js";