@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,75 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
2
+ import type { CurrencyCode } from "../models.js";
3
+ import type { StatementActionRunBody, StatementActionRunResponse, StatementDetail, StatementsListResponse } 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 statement
13
+ *
14
+ * One statement with a page of its lines (100 by default, at most 500), each
15
+ * with the booking it was earned on, its adjustments and notes, its payout, a
16
+ * link to its PDF signed for minutes, and the actions the caller may run. An
17
+ * advisor reads only their own; another company's statement answers 404.
18
+ * Every staff read is audited.
19
+ */
20
+ get(request: GetRequest, options?: RequestOptions): Promise<GetResponse>;
21
+ /**
22
+ * List statements
23
+ *
24
+ * The company's payee statements, newest cycle first (25 by default, at most
25
+ * 100, keyset-paged by cycle date): number, payee, cycle date and period,
26
+ * status, earnings, adjustments and total. Advisors see their own; agency
27
+ * admins every payee of the company; finance staff any company, audited.
28
+ */
29
+ list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
30
+ /**
31
+ * Run a statement action
32
+ *
33
+ * One action on a statement. ADD_ADJUSTMENT and REMOVE_ADJUSTMENT (a credit
34
+ * or debit, unit amount times quantity, with a description) and RECOMPUTE
35
+ * (picks again the earnings its period covers) while it is OPEN or
36
+ * PENDING_APPROVAL; CLOSE moves an OPEN statement to approval; REOPEN takes
37
+ * it back; APPROVE releases its earnings and makes it payable — a negative
38
+ * total, or one under the payee's minimum payout, is carried to the next
39
+ * statement; VOID cancels an unapproved statement and frees its earnings.
40
+ * MARK_PAID records that an approved statement was paid outside Nicer (a
41
+ * check, a wire, another system) in one step: the day, optionally how and a
42
+ * reference; it becomes PAID with its payout and journal (409
43
+ * COMMISSION_STATEMENT_ALREADY_PAID once a payout run holds it).
44
+ * ADD_ATTACHMENT (any status but VOID) answers a presigned upload for a
45
+ * document such as the payment's receipt. ADD_NOTE (Markdown, as on an item)
46
+ * at any time. An approved statement accepts no other change (409
47
+ * COMMISSION_STATEMENT_FINAL). The payee may add notes; agency admins and
48
+ * finance staff run the rest. Returns the statement and, for ADD_ATTACHMENT,
49
+ * its upload link.
50
+ */
51
+ runAction(request: RunActionRequest, options?: RequestOptions): Promise<RunActionResponse>;
52
+ }
53
+ export declare function createClient(options: ClientOptions): Client;
54
+ export declare function bind(transport: Transport): Client;
55
+ export interface GetRequest {
56
+ statementId: string;
57
+ cursor?: string;
58
+ limit?: number;
59
+ }
60
+ export type GetResponse = StatementDetail;
61
+ export interface ListRequest {
62
+ currency?: CurrencyCode;
63
+ cursor?: string;
64
+ from?: string;
65
+ limit?: number;
66
+ payeeId?: string;
67
+ payeeKind?: "ADVISOR" | "COMPANY";
68
+ status?: string;
69
+ to?: string;
70
+ }
71
+ export type ListResponse = StatementsListResponse;
72
+ export type RunActionRequest = {
73
+ statementId: string;
74
+ } & StatementActionRunBody;
75
+ export type RunActionResponse = StatementActionRunResponse;
@@ -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
+ get: (request, options) => transport.send(GetOperation, request, options),
10
+ list: (request, options) => transport.send(ListOperation, request, options),
11
+ runAction: (request, options) => transport.send(RunActionOperation, request, options),
12
+ };
13
+ }
14
+ const GetOperation = {
15
+ method: "GET",
16
+ route: "/commerce/statements/{statementId}",
17
+ query: { cursor: "cursor", limit: "limit" },
18
+ response: null,
19
+ errors: { "400": true, "401": true, "403": true },
20
+ };
21
+ const ListOperation = {
22
+ method: "GET",
23
+ route: "/commerce/statements",
24
+ query: { currency: "currency", cursor: "cursor", from: "from", limit: "limit", payeeId: "payeeId", payeeKind: "payeeKind", status: "status", to: "to" },
25
+ response: null,
26
+ errors: { "400": true, "401": true, "403": true },
27
+ };
28
+ const RunActionOperation = {
29
+ method: "POST",
30
+ route: "/commerce/statements/{statementId}/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, GetRequest, GetResponse, ListRequest, ListResponse, RunActionRequest, RunActionResponse, } from "./client.js";
5
+ export type { Payout, PayoutStatus, StatementActionRunBody, StatementActionRunResponse, StatementAdjustment, StatementDetail, StatementLine, StatementStatus, StatementSummary, StatementsListResponse, } 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,147 @@
1
+ import type { AttachmentContentType, CommissionAttachment, CommissionNote, CurrencyCode, PayoutMethod, UploadLink } from "../models.js";
2
+ export interface Payout {
3
+ amountMinor: number;
4
+ attempts: number;
5
+ companyName: string;
6
+ createdAt: string;
7
+ currency: CurrencyCode;
8
+ failureReason: string | null;
9
+ method: PayoutMethod;
10
+ paidAt: string | null;
11
+ payeeId: string;
12
+ payeeKind: "ADVISOR" | "COMPANY";
13
+ payoutId: string;
14
+ payoutRunId: string;
15
+ processorReference: string | null;
16
+ statementId: string;
17
+ statementNumber: string;
18
+ status: PayoutStatus;
19
+ updatedAt: string;
20
+ }
21
+ export type PayoutStatus = "PENDING" | "PAID" | "FAILED" | "CANCELLED";
22
+ export type StatementActionRunBody = {
23
+ description: string;
24
+ kind: "CREDIT" | "DEBIT";
25
+ quantity: number;
26
+ type: "ADD_ADJUSTMENT";
27
+ unitAmountMinor: number;
28
+ } | {
29
+ adjustmentId: string;
30
+ type: "REMOVE_ADJUSTMENT";
31
+ } | {
32
+ bodyMarkdown: string;
33
+ type: "ADD_NOTE";
34
+ } | {
35
+ type: "CLOSE";
36
+ } | {
37
+ type: "APPROVE";
38
+ } | {
39
+ type: "REOPEN";
40
+ } | {
41
+ reason: string;
42
+ type: "VOID";
43
+ } | {
44
+ type: "RECOMPUTE";
45
+ } | {
46
+ method?: "CHECK" | "MANUAL";
47
+ paidOn: string;
48
+ reference?: string;
49
+ type: "MARK_PAID";
50
+ } | {
51
+ contentType: AttachmentContentType;
52
+ fileName: string;
53
+ label?: string;
54
+ sha256: string;
55
+ sizeBytes: number;
56
+ type: "ADD_ATTACHMENT";
57
+ };
58
+ export interface StatementActionRunResponse {
59
+ statement: StatementDetail;
60
+ upload: UploadLink | null;
61
+ }
62
+ export interface StatementAdjustment {
63
+ adjustmentId: string;
64
+ amountMinor: number;
65
+ carriedFromStatementId: string | null;
66
+ createdAt: string;
67
+ createdByUserId: string | null;
68
+ description: string;
69
+ kind: "CREDIT" | "DEBIT";
70
+ quantity: number;
71
+ unitAmountMinor: number;
72
+ }
73
+ export interface StatementDetail {
74
+ adjustments: StatementAdjustment[];
75
+ adjustmentsMinor: number;
76
+ allowedActions: ("ADD_ADJUSTMENT" | "REMOVE_ADJUSTMENT" | "ADD_NOTE" | "CLOSE" | "APPROVE" | "REOPEN" | "VOID" | "RECOMPUTE" | "MARK_PAID" | "ADD_ATTACHMENT")[];
77
+ approvedAt: string | null;
78
+ approvedByUserId: string | null;
79
+ attachments: CommissionAttachment[];
80
+ closedAt: string | null;
81
+ companyName: string;
82
+ createdAt: string;
83
+ currency: CurrencyCode;
84
+ cycleOn: string;
85
+ earningsMinor: number;
86
+ lineCount: number;
87
+ lines: StatementLine[];
88
+ nextCursor: string | null;
89
+ notes: CommissionNote[];
90
+ number: string;
91
+ paidAt: string | null;
92
+ payeeId: string;
93
+ payeeKind: "ADVISOR" | "COMPANY";
94
+ payout: Payout | null;
95
+ pdfUrl: string | null;
96
+ periodEnd: string;
97
+ periodStart: string;
98
+ statementId: string;
99
+ status: StatementStatus;
100
+ totalMinor: number;
101
+ updatedAt: string;
102
+ version: number;
103
+ voidReason: string | null;
104
+ }
105
+ export interface StatementLine {
106
+ amountMinor: number;
107
+ bucket: "PENDING" | "AVAILABLE";
108
+ clientName: string | null;
109
+ commissionItemId: string | null;
110
+ confirmationNumber: string | null;
111
+ earningId: string;
112
+ earningKind: string;
113
+ entryType: "EARNING" | "REVERSAL" | "CLAWBACK";
114
+ orderId: string | null;
115
+ payableOn: string;
116
+ supplierName: string | null;
117
+ travelEnd: string | null;
118
+ }
119
+ export type StatementStatus = "OPEN" | "PENDING_APPROVAL" | "APPROVED" | "PAID" | "VOID";
120
+ export interface StatementSummary {
121
+ adjustmentsMinor: number;
122
+ approvedAt: string | null;
123
+ approvedByUserId: string | null;
124
+ closedAt: string | null;
125
+ companyName: string;
126
+ createdAt: string;
127
+ currency: CurrencyCode;
128
+ cycleOn: string;
129
+ earningsMinor: number;
130
+ lineCount: number;
131
+ number: string;
132
+ paidAt: string | null;
133
+ payeeId: string;
134
+ payeeKind: "ADVISOR" | "COMPANY";
135
+ periodEnd: string;
136
+ periodStart: string;
137
+ statementId: string;
138
+ status: StatementStatus;
139
+ totalMinor: number;
140
+ updatedAt: string;
141
+ version: number;
142
+ voidReason: string | null;
143
+ }
144
+ export interface StatementsListResponse {
145
+ items: StatementSummary[];
146
+ nextCursor: string | null;
147
+ }
@@ -0,0 +1,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};
@@ -0,0 +1,71 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
2
+ import type { SupplierKind } from "../models.js";
3
+ import type { SupplierActionRunBody, SupplierCreateBody, SupplierDetail, SuppliersSearchResponse } 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
+ * Create a supplier
13
+ *
14
+ * Creates a supplier private to the company (or, for Nicer staff, one in the
15
+ * verified directory). With a Google place id it first answers the supplier
16
+ * that place already names, so a type-ahead miss never creates a duplicate.
17
+ * Returns the supplier as the company sees it.
18
+ */
19
+ create(request: CreateRequest, options?: RequestOptions): Promise<CreateResponse>;
20
+ /**
21
+ * Get a supplier
22
+ *
23
+ * One supplier as the company sees it: the shared profile, the company's own
24
+ * terms and contacts, preferred programs, other systems' ids, and what the
25
+ * company booked, received and is owed with it per currency. An advisor gets
26
+ * the production of the bookings attributed to them only. Another company's
27
+ * supplier answers 404.
28
+ */
29
+ get(request: GetRequest, options?: RequestOptions): Promise<GetResponse>;
30
+ /**
31
+ * Run an action on a supplier
32
+ *
33
+ * One action on a supplier: UPDATE its profile (agency admins, the company's
34
+ * own; global ones by staff), ADD_CONTACT / REMOVE_CONTACT, SET_PROGRAMS
35
+ * (staff), MERGE into another supplier (admins for their own, staff for
36
+ * global ones). Every action is audited and returns the supplier as the
37
+ * company sees it.
38
+ */
39
+ runAction(request: RunActionRequest, options?: RequestOptions): Promise<RunActionResponse>;
40
+ /**
41
+ * Search suppliers
42
+ *
43
+ * Type-ahead over Nicer's global supplier directory and the company's own
44
+ * suppliers, best match first, with Sabre Global Property IDs where
45
+ * available. When fewer than three fit a query of three characters or more
46
+ * and there is no strong Sabre match, it also suggests up to five Google
47
+ * places (lodging for PROPERTY, car rental for CAR_RENTAL). Creating a
48
+ * supplier with a suggestion's `googlePlaceId` reuses the supplier that place
49
+ * already names. Google failing or slow (1.5 s) answers no suggestions, never
50
+ * an error.
51
+ */
52
+ search(request: SearchRequest, options?: RequestOptions): Promise<SearchResponse>;
53
+ }
54
+ export declare function createClient(options: ClientOptions): Client;
55
+ export declare function bind(transport: Transport): Client;
56
+ export type CreateRequest = SupplierCreateBody;
57
+ export type CreateResponse = SupplierDetail;
58
+ export interface GetRequest {
59
+ supplierId: string;
60
+ }
61
+ export type GetResponse = SupplierDetail;
62
+ export type RunActionRequest = {
63
+ supplierId: string;
64
+ } & SupplierActionRunBody;
65
+ export type RunActionResponse = SupplierDetail;
66
+ export interface SearchRequest {
67
+ kind?: SupplierKind;
68
+ limit?: number;
69
+ q: string;
70
+ }
71
+ export type SearchResponse = SuppliersSearchResponse;
@@ -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
+ 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
+ search: (request, options) => transport.send(SearchOperation, request, options),
13
+ };
14
+ }
15
+ const CreateOperation = {
16
+ method: "POST",
17
+ route: "/commerce/suppliers",
18
+ body: "flat",
19
+ response: null,
20
+ errors: { "400": true, "401": true, "403": true },
21
+ };
22
+ const GetOperation = {
23
+ method: "GET",
24
+ route: "/commerce/suppliers/{supplierId}",
25
+ response: null,
26
+ errors: { "400": true, "401": true, "403": true },
27
+ };
28
+ const RunActionOperation = {
29
+ method: "POST",
30
+ route: "/commerce/suppliers/{supplierId}/actions",
31
+ body: "flat",
32
+ response: null,
33
+ errors: { "400": true, "401": true, "403": true },
34
+ };
35
+ const SearchOperation = {
36
+ method: "GET",
37
+ route: "/commerce/suppliers",
38
+ query: { kind: "kind", limit: "limit", q: "q" },
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, CreateRequest, CreateResponse, GetRequest, GetResponse, RunActionRequest, RunActionResponse, SearchRequest, SearchResponse, } from "./client.js";
5
+ export type { SupplierActionRunBody, SupplierContact, SupplierContactRole, SupplierCreateBody, SupplierDetail, SupplierProduction, SupplierProfile, SupplierSuggestion, SupplierSummary, SuppliersSearchResponse, } 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,130 @@
1
+ import type { CommissionChannel, CurrencyCode, SupplierAddress, SupplierKind } from "../models.js";
2
+ export type SupplierActionRunBody = {
3
+ expectedUpdatedAt: string;
4
+ profile: SupplierProfile;
5
+ type: "UPDATE";
6
+ } | {
7
+ email?: string | null;
8
+ name?: string | null;
9
+ notes?: string | null;
10
+ phone?: string | null;
11
+ role: SupplierContactRole;
12
+ shared?: boolean;
13
+ type: "ADD_CONTACT";
14
+ } | {
15
+ supplierContactId: string;
16
+ type: "REMOVE_CONTACT";
17
+ } | {
18
+ programs: {
19
+ programId: string;
20
+ validFrom?: string | null;
21
+ validTo?: string | null;
22
+ }[];
23
+ type: "SET_PROGRAMS";
24
+ } | {
25
+ intoSupplierId: string;
26
+ type: "MERGE";
27
+ };
28
+ export interface SupplierContact {
29
+ email: string | null;
30
+ name: string | null;
31
+ notes: string | null;
32
+ phone: string | null;
33
+ role: SupplierContactRole;
34
+ shared: boolean;
35
+ supplierContactId: string;
36
+ }
37
+ export type SupplierContactRole = "COMMISSIONS" | "ACCOUNTING" | "RESERVATIONS" | "SALES" | "OTHER";
38
+ export interface SupplierCreateBody {
39
+ address?: SupplierAddress | null;
40
+ commissionChannel?: CommissionChannel | null;
41
+ defaultCommissionBps?: number | null;
42
+ defaultPaymentTermDays?: number | null;
43
+ googlePlaceId?: string | null;
44
+ kind: SupplierKind;
45
+ latitude?: number | null;
46
+ longitude?: number | null;
47
+ name: string;
48
+ phone?: string | null;
49
+ scope?: "GLOBAL" | "COMPANY";
50
+ website?: string | null;
51
+ }
52
+ export interface SupplierDetail {
53
+ address: SupplierAddress | null;
54
+ contacts: SupplierContact[];
55
+ defaults: {
56
+ commissionBps: number | null;
57
+ commissionChannel: CommissionChannel | null;
58
+ paymentTermDays: number | null;
59
+ };
60
+ identities: {
61
+ externalId: string;
62
+ source: string;
63
+ }[];
64
+ kind: SupplierKind;
65
+ latitude: number | null;
66
+ longitude: number | null;
67
+ mergedIntoSupplierId: string | null;
68
+ name: string;
69
+ phone: string | null;
70
+ production: SupplierProduction[];
71
+ programs: {
72
+ name: string;
73
+ programId: string;
74
+ validFrom: string | null;
75
+ validTo: string | null;
76
+ }[];
77
+ sabreRating?: number;
78
+ scope: "GLOBAL" | "COMPANY";
79
+ source: string;
80
+ status: "ACTIVE" | "MERGED" | "ARCHIVED";
81
+ supplierId: string;
82
+ updatedAt: string;
83
+ verifiedAt: string | null;
84
+ website: string | null;
85
+ }
86
+ export interface SupplierProduction {
87
+ balanceMinor: number;
88
+ bookings: number;
89
+ currency: CurrencyCode;
90
+ expectedMinor: number;
91
+ overdueMinor: number;
92
+ receivedMinor: number;
93
+ }
94
+ export interface SupplierProfile {
95
+ address?: SupplierAddress | null;
96
+ commissionChannel?: CommissionChannel | null;
97
+ defaultCommissionBps?: number | null;
98
+ defaultPaymentTermDays?: number | null;
99
+ kind: SupplierKind;
100
+ latitude?: number | null;
101
+ longitude?: number | null;
102
+ name: string;
103
+ phone?: string | null;
104
+ website?: string | null;
105
+ }
106
+ export interface SupplierSuggestion {
107
+ address: string | null;
108
+ countryCode: string | null;
109
+ googlePlaceId: string;
110
+ latitude: number | null;
111
+ longitude: number | null;
112
+ name: string;
113
+ }
114
+ export interface SupplierSummary {
115
+ city: string | null;
116
+ commissionBps: number | null;
117
+ countryCode: string | null;
118
+ kind: SupplierKind;
119
+ name: string;
120
+ paymentTermDays: number | null;
121
+ sabreGlobalId?: string | null;
122
+ scope: "GLOBAL" | "COMPANY";
123
+ similarity: number;
124
+ supplierId: string;
125
+ verified: boolean;
126
+ }
127
+ export interface SuppliersSearchResponse {
128
+ items: SupplierSummary[];
129
+ suggestions: SupplierSuggestion[];
130
+ }
@@ -0,0 +1,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};
@@ -0,0 +1,36 @@
1
+ import { type BaseClientOptions, type RequestOptions, Transport } from "../_/index.js";
2
+ import type { TaskList } from "../models.js";
3
+ import type { TaskTemplateApply } 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
+ * Apply a task template to a trip
13
+ *
14
+ * Applies one of the agency's task templates (templateId from GET
15
+ * /crm/settings, taskTemplates) to a trip: each step of the template becomes
16
+ * a task of the trip, dated its offsetDays from the trip's start, end or
17
+ * creation (undated when the trip lacks that date), with origin TEMPLATE, all
18
+ * written at once. Every task is assigned to the caller, to assignedUserId,
19
+ * or with assignedUserId null to the trip's advisor. Publishes
20
+ * crm.task-changed.v1 with action CREATED for each task, and answers them
21
+ * all, in the template's order, with nextToken null. The caller must be the
22
+ * trip's advisor of record or an agency admin. Requires an Idempotency-Key
23
+ * header: a retry with the same key and body answers the same tasks. Errors:
24
+ * 400 ERROR_BODY_VALIDATION, 400 CRM_TASK_TEMPLATE_NOT_FOUND for a template
25
+ * the agency does not have, 404 ERROR_ITEM_NOT_FOUND for a trip the caller
26
+ * may not write about, 409 CRM_IDEMPOTENCY_CONFLICT for a key used with
27
+ * another body, and for a template already applied to the trip.
28
+ */
29
+ apply(request: ApplyRequest, options?: RequestOptions): Promise<ApplyResponse>;
30
+ }
31
+ export declare function createClient(options: ClientOptions): Client;
32
+ export declare function bind(transport: Transport): Client;
33
+ export type ApplyRequest = {
34
+ templateId: string;
35
+ } & TaskTemplateApply;
36
+ export type ApplyResponse = TaskList;
@@ -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
+ apply: (request, options) => transport.send(ApplyOperation, request, options),
10
+ };
11
+ }
12
+ const ApplyOperation = {
13
+ method: "POST",
14
+ route: "/crm/task-templates/{templateId}/apply",
15
+ body: "flat",
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, ApplyRequest, ApplyResponse, } from "./client.js";
5
+ export type { TaskTemplateApply } 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,15 @@
1
+ /**
2
+ * The trip a task template's tasks are for, and who they are assigned to.
3
+ */
4
+ export interface TaskTemplateApply {
5
+ /**
6
+ * The user id of the advisor or admin every task goes to. Left out, the
7
+ * caller; null, the trip's advisor, or nobody when the trip has none.
8
+ */
9
+ assignedUserId?: string | null;
10
+ /**
11
+ * The trip (TT…) the tasks are for. Each task is dated from the trip's start,
12
+ * end or creation, as its step says.
13
+ */
14
+ travelersTripId: string;
15
+ }
@@ -0,0 +1,3 @@
1
+ // Code generated by forge. DO NOT EDIT.
2
+ /* eslint-disable */
3
+ export {};