bexio 3.8.1 → 4.0.1

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 (286) hide show
  1. package/lib/index.d.mts +2983 -0
  2. package/lib/index.d.ts +2954 -55
  3. package/lib/index.js +2213 -100
  4. package/lib/index.js.map +1 -1
  5. package/lib/index.mjs +2158 -0
  6. package/lib/index.mjs.map +1 -0
  7. package/package.json +25 -6
  8. package/coverage/base.css +0 -224
  9. package/coverage/block-navigation.js +0 -87
  10. package/coverage/favicon.png +0 -0
  11. package/coverage/index.html +0 -146
  12. package/coverage/prettify.css +0 -1
  13. package/coverage/prettify.js +0 -2
  14. package/coverage/sort-arrow-sprite.png +0 -0
  15. package/coverage/sorter.js +0 -210
  16. package/jest-html-reporters-attach/jest_html_reporters/index.js +0 -3
  17. package/jest-html-reporters-attach/jest_html_reporters/result.js +0 -1
  18. package/jest_html_reporters.html +0 -1
  19. package/junit.xml +0 -339
  20. package/lib/interfaces/AccountsStatic.d.ts +0 -14
  21. package/lib/interfaces/AccountsStatic.js +0 -3
  22. package/lib/interfaces/AccountsStatic.js.map +0 -1
  23. package/lib/interfaces/BankAccountsStatic.d.ts +0 -25
  24. package/lib/interfaces/BankAccountsStatic.js +0 -3
  25. package/lib/interfaces/BankAccountsStatic.js.map +0 -1
  26. package/lib/interfaces/BaseStatic.d.ts +0 -20
  27. package/lib/interfaces/BaseStatic.js +0 -3
  28. package/lib/interfaces/BaseStatic.js.map +0 -1
  29. package/lib/interfaces/BillsStatic.d.ts +0 -167
  30. package/lib/interfaces/BillsStatic.js +0 -25
  31. package/lib/interfaces/BillsStatic.js.map +0 -1
  32. package/lib/interfaces/BillsV4Static.d.ts +0 -204
  33. package/lib/interfaces/BillsV4Static.js +0 -60
  34. package/lib/interfaces/BillsV4Static.js.map +0 -1
  35. package/lib/interfaces/BusinessActivitiesStatic.d.ts +0 -24
  36. package/lib/interfaces/BusinessActivitiesStatic.js +0 -11
  37. package/lib/interfaces/BusinessActivitiesStatic.js.map +0 -1
  38. package/lib/interfaces/CalendarStatic.d.ts +0 -30
  39. package/lib/interfaces/CalendarStatic.js +0 -18
  40. package/lib/interfaces/CalendarStatic.js.map +0 -1
  41. package/lib/interfaces/ContactGroupsStatic.d.ts +0 -12
  42. package/lib/interfaces/ContactGroupsStatic.js +0 -11
  43. package/lib/interfaces/ContactGroupsStatic.js.map +0 -1
  44. package/lib/interfaces/ContactRelationsStatic.d.ts +0 -24
  45. package/lib/interfaces/ContactRelationsStatic.js +0 -13
  46. package/lib/interfaces/ContactRelationsStatic.js.map +0 -1
  47. package/lib/interfaces/ContactSectorsStatic.d.ts +0 -9
  48. package/lib/interfaces/ContactSectorsStatic.js +0 -11
  49. package/lib/interfaces/ContactSectorsStatic.js.map +0 -1
  50. package/lib/interfaces/ContactTypesStatic.d.ts +0 -9
  51. package/lib/interfaces/ContactTypesStatic.js +0 -11
  52. package/lib/interfaces/ContactTypesStatic.js.map +0 -1
  53. package/lib/interfaces/ContactsStatic.d.ts +0 -118
  54. package/lib/interfaces/ContactsStatic.js +0 -27
  55. package/lib/interfaces/ContactsStatic.js.map +0 -1
  56. package/lib/interfaces/CurrenciesStatic.d.ts +0 -20
  57. package/lib/interfaces/CurrenciesStatic.js +0 -3
  58. package/lib/interfaces/CurrenciesStatic.js.map +0 -1
  59. package/lib/interfaces/ExpensesStatic.d.ts +0 -83
  60. package/lib/interfaces/ExpensesStatic.js +0 -25
  61. package/lib/interfaces/ExpensesStatic.js.map +0 -1
  62. package/lib/interfaces/InvoicesStatic.d.ts +0 -162
  63. package/lib/interfaces/InvoicesStatic.js +0 -46
  64. package/lib/interfaces/InvoicesStatic.js.map +0 -1
  65. package/lib/interfaces/ItemsStatic.d.ts +0 -120
  66. package/lib/interfaces/ItemsStatic.js +0 -47
  67. package/lib/interfaces/ItemsStatic.js.map +0 -1
  68. package/lib/interfaces/ManualEntriesStatic.d.ts +0 -42
  69. package/lib/interfaces/ManualEntriesStatic.js +0 -3
  70. package/lib/interfaces/ManualEntriesStatic.js.map +0 -1
  71. package/lib/interfaces/NotesStatic.d.ts +0 -23
  72. package/lib/interfaces/NotesStatic.js +0 -16
  73. package/lib/interfaces/NotesStatic.js.map +0 -1
  74. package/lib/interfaces/OrdersStatic.d.ts +0 -117
  75. package/lib/interfaces/OrdersStatic.js +0 -25
  76. package/lib/interfaces/OrdersStatic.js.map +0 -1
  77. package/lib/interfaces/OutgoingPaymentsStatic.d.ts +0 -142
  78. package/lib/interfaces/OutgoingPaymentsStatic.js +0 -39
  79. package/lib/interfaces/OutgoingPaymentsStatic.js.map +0 -1
  80. package/lib/interfaces/PaymentsStatic.d.ts +0 -22
  81. package/lib/interfaces/PaymentsStatic.js +0 -3
  82. package/lib/interfaces/PaymentsStatic.js.map +0 -1
  83. package/lib/interfaces/PositionStatic.d.ts +0 -35
  84. package/lib/interfaces/PositionStatic.js +0 -3
  85. package/lib/interfaces/PositionStatic.js.map +0 -1
  86. package/lib/interfaces/PositionsStatic.d.ts +0 -46
  87. package/lib/interfaces/PositionsStatic.js +0 -3
  88. package/lib/interfaces/PositionsStatic.js.map +0 -1
  89. package/lib/interfaces/ProjectStatusesStatic.d.ts +0 -9
  90. package/lib/interfaces/ProjectStatusesStatic.js +0 -11
  91. package/lib/interfaces/ProjectStatusesStatic.js.map +0 -1
  92. package/lib/interfaces/ProjectTypesStatic.d.ts +0 -9
  93. package/lib/interfaces/ProjectTypesStatic.js +0 -11
  94. package/lib/interfaces/ProjectTypesStatic.js.map +0 -1
  95. package/lib/interfaces/ProjectsStatic.d.ts +0 -55
  96. package/lib/interfaces/ProjectsStatic.js +0 -13
  97. package/lib/interfaces/ProjectsStatic.js.map +0 -1
  98. package/lib/interfaces/SalesOrderManagementStatic.d.ts +0 -289
  99. package/lib/interfaces/SalesOrderManagementStatic.js +0 -69
  100. package/lib/interfaces/SalesOrderManagementStatic.js.map +0 -1
  101. package/lib/interfaces/TaxesStatic.d.ts +0 -31
  102. package/lib/interfaces/TaxesStatic.js +0 -3
  103. package/lib/interfaces/TaxesStatic.js.map +0 -1
  104. package/lib/interfaces/TimetrackingStatusesStatic.d.ts +0 -9
  105. package/lib/interfaces/TimetrackingStatusesStatic.js +0 -11
  106. package/lib/interfaces/TimetrackingStatusesStatic.js.map +0 -1
  107. package/lib/interfaces/TimetrackingsStatic.d.ts +0 -69
  108. package/lib/interfaces/TimetrackingsStatic.js +0 -16
  109. package/lib/interfaces/TimetrackingsStatic.js.map +0 -1
  110. package/lib/interfaces/UsersStatic.d.ts +0 -23
  111. package/lib/interfaces/UsersStatic.js +0 -15
  112. package/lib/interfaces/UsersStatic.js.map +0 -1
  113. package/lib/resources/Accounts.d.ts +0 -49
  114. package/lib/resources/Accounts.js +0 -85
  115. package/lib/resources/Accounts.js.map +0 -1
  116. package/lib/resources/BankAccounts.d.ts +0 -49
  117. package/lib/resources/BankAccounts.js +0 -85
  118. package/lib/resources/BankAccounts.js.map +0 -1
  119. package/lib/resources/BaseCrud.d.ts +0 -89
  120. package/lib/resources/BaseCrud.js +0 -181
  121. package/lib/resources/BaseCrud.js.map +0 -1
  122. package/lib/resources/Bills.d.ts +0 -67
  123. package/lib/resources/Bills.js +0 -107
  124. package/lib/resources/Bills.js.map +0 -1
  125. package/lib/resources/BillsV4.d.ts +0 -52
  126. package/lib/resources/BillsV4.js +0 -86
  127. package/lib/resources/BillsV4.js.map +0 -1
  128. package/lib/resources/BusinessActivities.d.ts +0 -5
  129. package/lib/resources/BusinessActivities.js +0 -13
  130. package/lib/resources/BusinessActivities.js.map +0 -1
  131. package/lib/resources/ContactGroups.d.ts +0 -13
  132. package/lib/resources/ContactGroups.js +0 -34
  133. package/lib/resources/ContactGroups.js.map +0 -1
  134. package/lib/resources/ContactRelations.d.ts +0 -5
  135. package/lib/resources/ContactRelations.js +0 -13
  136. package/lib/resources/ContactRelations.js.map +0 -1
  137. package/lib/resources/ContactSectors.d.ts +0 -39
  138. package/lib/resources/ContactSectors.js +0 -72
  139. package/lib/resources/ContactSectors.js.map +0 -1
  140. package/lib/resources/ContactTypes.d.ts +0 -39
  141. package/lib/resources/ContactTypes.js +0 -72
  142. package/lib/resources/ContactTypes.js.map +0 -1
  143. package/lib/resources/Contacts.d.ts +0 -5
  144. package/lib/resources/Contacts.js +0 -13
  145. package/lib/resources/Contacts.js.map +0 -1
  146. package/lib/resources/Currencies.d.ts +0 -33
  147. package/lib/resources/Currencies.js +0 -61
  148. package/lib/resources/Currencies.js.map +0 -1
  149. package/lib/resources/DefaultPositions.d.ts +0 -33
  150. package/lib/resources/DefaultPositions.js +0 -61
  151. package/lib/resources/DefaultPositions.js.map +0 -1
  152. package/lib/resources/Expenses.d.ts +0 -5
  153. package/lib/resources/Expenses.js +0 -13
  154. package/lib/resources/Expenses.js.map +0 -1
  155. package/lib/resources/Invoices.d.ts +0 -113
  156. package/lib/resources/Invoices.js +0 -189
  157. package/lib/resources/Invoices.js.map +0 -1
  158. package/lib/resources/ItemPositions.d.ts +0 -33
  159. package/lib/resources/ItemPositions.js +0 -61
  160. package/lib/resources/ItemPositions.js.map +0 -1
  161. package/lib/resources/Items.d.ts +0 -5
  162. package/lib/resources/Items.js +0 -13
  163. package/lib/resources/Items.js.map +0 -1
  164. package/lib/resources/ManualEntries.d.ts +0 -50
  165. package/lib/resources/ManualEntries.js +0 -84
  166. package/lib/resources/ManualEntries.js.map +0 -1
  167. package/lib/resources/Orders.d.ts +0 -33
  168. package/lib/resources/Orders.js +0 -64
  169. package/lib/resources/Orders.js.map +0 -1
  170. package/lib/resources/OutgoingPayments.d.ts +0 -63
  171. package/lib/resources/OutgoingPayments.js +0 -117
  172. package/lib/resources/OutgoingPayments.js.map +0 -1
  173. package/lib/resources/Payments.d.ts +0 -36
  174. package/lib/resources/Payments.js +0 -64
  175. package/lib/resources/Payments.js.map +0 -1
  176. package/lib/resources/ProjectStatuses.d.ts +0 -39
  177. package/lib/resources/ProjectStatuses.js +0 -72
  178. package/lib/resources/ProjectStatuses.js.map +0 -1
  179. package/lib/resources/ProjectTypes.d.ts +0 -39
  180. package/lib/resources/ProjectTypes.js +0 -72
  181. package/lib/resources/ProjectTypes.js.map +0 -1
  182. package/lib/resources/Projects.d.ts +0 -5
  183. package/lib/resources/Projects.js +0 -13
  184. package/lib/resources/Projects.js.map +0 -1
  185. package/lib/resources/Taxes.d.ts +0 -30
  186. package/lib/resources/Taxes.js +0 -70
  187. package/lib/resources/Taxes.js.map +0 -1
  188. package/lib/resources/TextPositions.d.ts +0 -33
  189. package/lib/resources/TextPositions.js +0 -61
  190. package/lib/resources/TextPositions.js.map +0 -1
  191. package/lib/resources/TimetrackingStatuses.d.ts +0 -39
  192. package/lib/resources/TimetrackingStatuses.js +0 -72
  193. package/lib/resources/TimetrackingStatuses.js.map +0 -1
  194. package/lib/resources/Timetrackings.d.ts +0 -14
  195. package/lib/resources/Timetrackings.js +0 -35
  196. package/lib/resources/Timetrackings.js.map +0 -1
  197. package/lib/resources/Users.d.ts +0 -39
  198. package/lib/resources/Users.js +0 -72
  199. package/lib/resources/Users.js.map +0 -1
  200. package/lib/tests/Accounts.test.d.ts +0 -1
  201. package/lib/tests/Accounts.test.js +0 -86
  202. package/lib/tests/Accounts.test.js.map +0 -1
  203. package/lib/tests/BankAccounts.test.d.ts +0 -1
  204. package/lib/tests/BankAccounts.test.js +0 -86
  205. package/lib/tests/BankAccounts.test.js.map +0 -1
  206. package/lib/tests/BaseCrud.test.d.ts +0 -1
  207. package/lib/tests/BaseCrud.test.js +0 -302
  208. package/lib/tests/BaseCrud.test.js.map +0 -1
  209. package/lib/tests/Bills.test.d.ts +0 -1
  210. package/lib/tests/Bills.test.js +0 -110
  211. package/lib/tests/Bills.test.js.map +0 -1
  212. package/lib/tests/BillsV4.test.d.ts +0 -1
  213. package/lib/tests/BillsV4.test.js +0 -134
  214. package/lib/tests/BillsV4.test.js.map +0 -1
  215. package/lib/tests/BusinessActivities.test.d.ts +0 -1
  216. package/lib/tests/BusinessActivities.test.js +0 -21
  217. package/lib/tests/BusinessActivities.test.js.map +0 -1
  218. package/lib/tests/ContactGroups.test.d.ts +0 -1
  219. package/lib/tests/ContactGroups.test.js +0 -21
  220. package/lib/tests/ContactGroups.test.js.map +0 -1
  221. package/lib/tests/ContactRelations.test.d.ts +0 -1
  222. package/lib/tests/ContactRelations.test.js +0 -21
  223. package/lib/tests/ContactRelations.test.js.map +0 -1
  224. package/lib/tests/ContactSectors.test.d.ts +0 -1
  225. package/lib/tests/ContactSectors.test.js +0 -21
  226. package/lib/tests/ContactSectors.test.js.map +0 -1
  227. package/lib/tests/ContactTypes.test.d.ts +0 -1
  228. package/lib/tests/ContactTypes.test.js +0 -21
  229. package/lib/tests/ContactTypes.test.js.map +0 -1
  230. package/lib/tests/Contacts.test.d.ts +0 -1
  231. package/lib/tests/Contacts.test.js +0 -21
  232. package/lib/tests/Contacts.test.js.map +0 -1
  233. package/lib/tests/Currencies.test.d.ts +0 -1
  234. package/lib/tests/Currencies.test.js +0 -21
  235. package/lib/tests/Currencies.test.js.map +0 -1
  236. package/lib/tests/DefaultPositions.test.d.ts +0 -1
  237. package/lib/tests/DefaultPositions.test.js +0 -22
  238. package/lib/tests/DefaultPositions.test.js.map +0 -1
  239. package/lib/tests/Expenses.test.d.ts +0 -1
  240. package/lib/tests/Expenses.test.js +0 -21
  241. package/lib/tests/Expenses.test.js.map +0 -1
  242. package/lib/tests/Invoices.test.d.ts +0 -1
  243. package/lib/tests/Invoices.test.js +0 -207
  244. package/lib/tests/Invoices.test.js.map +0 -1
  245. package/lib/tests/ItemPositions.test.d.ts +0 -1
  246. package/lib/tests/ItemPositions.test.js +0 -22
  247. package/lib/tests/ItemPositions.test.js.map +0 -1
  248. package/lib/tests/Items.test.d.ts +0 -1
  249. package/lib/tests/Items.test.js +0 -21
  250. package/lib/tests/Items.test.js.map +0 -1
  251. package/lib/tests/ManualEntries.test.d.ts +0 -1
  252. package/lib/tests/ManualEntries.test.js +0 -116
  253. package/lib/tests/ManualEntries.test.js.map +0 -1
  254. package/lib/tests/Orders.test.d.ts +0 -1
  255. package/lib/tests/Orders.test.js +0 -137
  256. package/lib/tests/Orders.test.js.map +0 -1
  257. package/lib/tests/OutgoingPayments.test.d.ts +0 -1
  258. package/lib/tests/OutgoingPayments.test.js +0 -125
  259. package/lib/tests/OutgoingPayments.test.js.map +0 -1
  260. package/lib/tests/Payments.test.d.ts +0 -1
  261. package/lib/tests/Payments.test.js +0 -22
  262. package/lib/tests/Payments.test.js.map +0 -1
  263. package/lib/tests/ProjectStatuses.test.d.ts +0 -1
  264. package/lib/tests/ProjectStatuses.test.js +0 -21
  265. package/lib/tests/ProjectStatuses.test.js.map +0 -1
  266. package/lib/tests/ProjectTypes.test.d.ts +0 -1
  267. package/lib/tests/ProjectTypes.test.js +0 -21
  268. package/lib/tests/ProjectTypes.test.js.map +0 -1
  269. package/lib/tests/Projects.test.d.ts +0 -1
  270. package/lib/tests/Projects.test.js +0 -21
  271. package/lib/tests/Projects.test.js.map +0 -1
  272. package/lib/tests/Taxes.test.d.ts +0 -1
  273. package/lib/tests/Taxes.test.js +0 -107
  274. package/lib/tests/Taxes.test.js.map +0 -1
  275. package/lib/tests/TextPositions.test.d.ts +0 -1
  276. package/lib/tests/TextPositions.test.js +0 -22
  277. package/lib/tests/TextPositions.test.js.map +0 -1
  278. package/lib/tests/TimetrackingStatuses.test.d.ts +0 -1
  279. package/lib/tests/TimetrackingStatuses.test.js +0 -21
  280. package/lib/tests/TimetrackingStatuses.test.js.map +0 -1
  281. package/lib/tests/Timetrackings.test.d.ts +0 -1
  282. package/lib/tests/Timetrackings.test.js +0 -21
  283. package/lib/tests/Timetrackings.test.js.map +0 -1
  284. package/lib/tests/Users.test.d.ts +0 -1
  285. package/lib/tests/Users.test.js +0 -21
  286. package/lib/tests/Users.test.js.map +0 -1
package/lib/index.js CHANGED
@@ -1,104 +1,2217 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Bexio: () => Bexio,
34
+ BillsStatic: () => BillsStatic,
35
+ BillsV4Static: () => BillsV4Static,
36
+ BusinessActivitiesStatic: () => BusinessActivitiesStatic,
37
+ CalendarStatic: () => CalendarStatic,
38
+ ContactGroupsStatic: () => ContactGroupsStatic,
39
+ ContactRelationsStatic: () => ContactRelationsStatic,
40
+ ContactSectorsStatic: () => ContactSectorsStatic,
41
+ ContactTypesStatic: () => ContactTypesStatic,
42
+ ContactsStatic: () => ContactsStatic,
43
+ ExpensesStatic: () => ExpensesStatic,
44
+ InvoicesStatic: () => InvoicesStatic,
45
+ ItemsStatic: () => ItemsStatic,
46
+ NotesStatic: () => NotesStatic,
47
+ OrdersStatic: () => OrdersStatic,
48
+ OutgoingPaymentsStatic: () => OutgoingPaymentsStatic,
49
+ ProjectStatusesStatic: () => ProjectStatusesStatic,
50
+ ProjectTypesStatic: () => ProjectTypesStatic,
51
+ ProjectsStatic: () => ProjectsStatic,
52
+ SalesOrderManagementStatic: () => SalesOrderManagementStatic,
53
+ TimetrackingStatusesStatic: () => TimetrackingStatusesStatic,
54
+ TimetrackingsStatic: () => TimetrackingsStatic,
55
+ UsersStatic: () => UsersStatic,
56
+ default: () => index_default
57
+ });
58
+ module.exports = __toCommonJS(index_exports);
59
+
60
+ // src/resources/BaseCrud.ts
61
+ var import_axios = __toESM(require("axios"));
62
+ var BaseCrud = class {
63
+ constructor(apiToken, apiEndpoint) {
64
+ this.baseApiUrl = "https://api.bexio.com";
65
+ this.apiToken = apiToken;
66
+ this.apiEndpoint = apiEndpoint;
67
+ }
68
+ /**
69
+ * Lists the ressource
70
+ *
71
+ * @param {BaseStatic.BaseOptions} [options]
72
+ * @returns {Promise<Array<T>>}
73
+ * @memberof BaseCrud
74
+ */
75
+ async list(options) {
76
+ return this.request("GET", this.apiEndpoint, options);
77
+ }
78
+ /**
79
+ * search for resources
80
+ *
81
+ * @param {Array<BaseStatic.SearchParameter<SearchType>>} searchOptions
82
+ * @param {BaseStatic.BaseOptions} [options]
83
+ * @returns {Promise<Array<Search>>}
84
+ * @memberof BaseCrud
85
+ */
86
+ async search(searchOptions, options) {
87
+ return this.request(
88
+ "POST",
89
+ this.apiEndpoint + "/search",
90
+ options,
91
+ searchOptions
92
+ );
93
+ }
94
+ /**
95
+ * show a specific ressource
96
+ *
97
+ * @param {string | number} id
98
+ * @param {BaseStatic.BaseOptions} [options]
99
+ * @returns {Promise<Full>}
100
+ * @memberof BaseCrud
101
+ */
102
+ async show(id, options) {
103
+ return this.request("GET", this.apiEndpoint + "/" + id, options);
104
+ }
105
+ /**
106
+ * create a new ressource
107
+ *
108
+ * @param {Full} ressource
109
+ * @returns {Promise<Full>}
110
+ * @memberof BaseCrud
111
+ */
112
+ async create(ressource) {
113
+ return this.request("POST", this.apiEndpoint, void 0, ressource);
114
+ }
115
+ /**
116
+ * overwrite an existing ressource
117
+ *
118
+ * @param {number} id
119
+ * @param {Overwrite} ressource
120
+ * @returns {Promise<Full>}
121
+ * @memberof BaseCrud
122
+ */
123
+ async overwrite(id, ressource) {
124
+ return this.request(
125
+ "PUT",
126
+ this.apiEndpoint + "/" + id,
127
+ void 0,
128
+ ressource
129
+ );
130
+ }
131
+ /**
132
+ * edit an existing ressource
133
+ *
134
+ * @param {number} id
135
+ * @param {Partial<Overwrite>} ressource
136
+ * @returns {Promise<Full>}
137
+ * @memberof BaseCrud
138
+ */
139
+ async edit(id, ressource) {
140
+ return this.request(
141
+ "POST",
142
+ this.apiEndpoint + "/" + id,
143
+ void 0,
144
+ ressource
145
+ );
146
+ }
147
+ /**
148
+ * delete an ressource
149
+ *
150
+ * @param {string | number} id
151
+ * @returns {Promise<boolean>}
152
+ * @memberof BaseCrud
153
+ */
154
+ async delete(id) {
155
+ return (await this.request(
156
+ "DELETE",
157
+ this.apiEndpoint + "/" + id
158
+ )).success;
159
+ }
160
+ /**
161
+ * Base request to the api
162
+ *
163
+ * @protected
164
+ * @template T
165
+ * @param {string} method
166
+ * @param {string} path
167
+ * @param {BaseStatic.BaseOptions} [options]
168
+ * @param {*} [data]
169
+ * @returns {Promise<T>}
170
+ * @memberof Bexio
171
+ */
172
+ async request(method, path, options, data) {
173
+ let requestOptions = {
174
+ method,
175
+ url: this.baseApiUrl + path + this.optionsToQuery(options),
176
+ headers: {
177
+ Authorization: `Bearer ${this.apiToken}`,
178
+ "Content-Type": "application/json",
179
+ Accept: "application/json"
180
+ }
181
+ };
182
+ if (data) {
183
+ requestOptions.data = data;
184
+ }
185
+ try {
186
+ const reponse = await import_axios.default.request(requestOptions);
187
+ return reponse.data;
188
+ } catch (e) {
189
+ const error = e;
190
+ return Promise.reject({
191
+ code: error.response?.status,
192
+ message: error.response?.data
193
+ });
7
194
  }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- const BusinessActivities_1 = __importDefault(require("./resources/BusinessActivities"));
21
- const Contacts_1 = __importDefault(require("./resources/Contacts"));
22
- const ContactTypes_1 = __importDefault(require("./resources/ContactTypes"));
23
- const ContactSectors_1 = __importDefault(require("./resources/ContactSectors"));
24
- const ContactGroups_1 = __importDefault(require("./resources/ContactGroups"));
25
- const ContactRelations_1 = __importDefault(require("./resources/ContactRelations"));
26
- const Expenses_1 = __importDefault(require("./resources/Expenses"));
27
- const Bills_1 = __importDefault(require("./resources/Bills"));
28
- const Orders_1 = __importDefault(require("./resources/Orders"));
29
- const Projects_1 = __importDefault(require("./resources/Projects"));
30
- const ProjectStatuses_1 = __importDefault(require("./resources/ProjectStatuses"));
31
- const ProjectTypes_1 = __importDefault(require("./resources/ProjectTypes"));
32
- const Timetrackings_1 = __importDefault(require("./resources/Timetrackings"));
33
- const TimetrackingStatuses_1 = __importDefault(require("./resources/TimetrackingStatuses"));
34
- const Users_1 = __importDefault(require("./resources/Users"));
35
- const Items_1 = __importDefault(require("./resources/Items"));
36
- const Invoices_1 = __importDefault(require("./resources/Invoices"));
37
- const Currencies_1 = __importDefault(require("./resources/Currencies"));
38
- const BillsV4_1 = __importDefault(require("./resources/BillsV4"));
39
- const OutgoingPayments_1 = __importDefault(require("./resources/OutgoingPayments"));
40
- const BankAccounts_1 = __importDefault(require("./resources/BankAccounts"));
41
- const Accounts_1 = __importDefault(require("./resources/Accounts"));
42
- const ManualEntries_1 = __importDefault(require("./resources/ManualEntries"));
43
- const Taxes_1 = __importDefault(require("./resources/Taxes"));
44
- __exportStar(require("./interfaces/BillsStatic"), exports);
45
- __exportStar(require("./interfaces/BusinessActivitiesStatic"), exports);
46
- __exportStar(require("./interfaces/CalendarStatic"), exports);
47
- __exportStar(require("./interfaces/ContactGroupsStatic"), exports);
48
- __exportStar(require("./interfaces/ContactRelationsStatic"), exports);
49
- __exportStar(require("./interfaces/ContactSectorsStatic"), exports);
50
- __exportStar(require("./interfaces/ContactTypesStatic"), exports);
51
- __exportStar(require("./interfaces/ContactsStatic"), exports);
52
- __exportStar(require("./interfaces/ExpensesStatic"), exports);
53
- __exportStar(require("./interfaces/NotesStatic"), exports);
54
- __exportStar(require("./interfaces/OrdersStatic"), exports);
55
- __exportStar(require("./interfaces/ProjectsStatic"), exports);
56
- __exportStar(require("./interfaces/ProjectStatusesStatic"), exports);
57
- __exportStar(require("./interfaces/ProjectTypesStatic"), exports);
58
- __exportStar(require("./interfaces/SalesOrderManagementStatic"), exports);
59
- __exportStar(require("./interfaces/TimetrackingsStatic"), exports);
60
- __exportStar(require("./interfaces/TimetrackingStatusesStatic"), exports);
61
- __exportStar(require("./interfaces/UsersStatic"), exports);
62
- __exportStar(require("./interfaces/ItemsStatic"), exports);
63
- __exportStar(require("./interfaces/InvoicesStatic"), exports);
64
- __exportStar(require("./interfaces/PositionStatic"), exports);
65
- __exportStar(require("./interfaces/PositionsStatic"), exports);
66
- __exportStar(require("./interfaces/CurrenciesStatic"), exports);
67
- __exportStar(require("./interfaces/BillsV4Static"), exports);
68
- __exportStar(require("./interfaces/OutgoingPaymentsStatic"), exports);
69
- __exportStar(require("./interfaces/BankAccountsStatic"), exports);
70
- __exportStar(require("./interfaces/AccountsStatic"), exports);
71
- __exportStar(require("./interfaces/ManualEntriesStatic"), exports);
72
- __exportStar(require("./interfaces/TaxesStatic"), exports);
73
- class Bexio {
74
- constructor(token) {
75
- this.token = token;
76
- // Init resources
77
- this.businessActivities = new BusinessActivities_1.default(this.token);
78
- this.contacts = new Contacts_1.default(this.token);
79
- this.contactTypes = new ContactTypes_1.default(this.token);
80
- this.contactSectors = new ContactSectors_1.default(this.token);
81
- this.contactGroups = new ContactGroups_1.default(this.token);
82
- this.contactRelations = new ContactRelations_1.default(this.token);
83
- this.orders = new Orders_1.default(this.token);
84
- this.projects = new Projects_1.default(this.token);
85
- this.projectStatuses = new ProjectStatuses_1.default(this.token);
86
- this.projectTypes = new ProjectTypes_1.default(this.token);
87
- this.expenses = new Expenses_1.default(this.token);
88
- this.billsV4 = new BillsV4_1.default(this.token);
89
- this.outgoingPayments = new OutgoingPayments_1.default(this.token);
90
- this.bills = new Bills_1.default(this.token);
91
- this.timetrackings = new Timetrackings_1.default(this.token);
92
- this.timetrackingStatuses = new TimetrackingStatuses_1.default(this.token);
93
- this.users = new Users_1.default(this.token);
94
- this.items = new Items_1.default(this.token);
95
- this.invoices = new Invoices_1.default(this.token);
96
- this.currencies = new Currencies_1.default(this.token);
97
- this.bankAccounts = new BankAccounts_1.default(this.token);
98
- this.accounts = new Accounts_1.default(this.token);
99
- this.manualEntries = new ManualEntries_1.default(this.token);
100
- this.taxes = new Taxes_1.default(this.token);
195
+ }
196
+ /**
197
+ * Generates the querystring out of the options
198
+ *
199
+ * @protected
200
+ * @param {BaseStatic.BaseOptions} [options]
201
+ * @returns {string}
202
+ * @memberof Bexio
203
+ */
204
+ optionsToQuery(options) {
205
+ let str = [];
206
+ if (!options) {
207
+ return "";
101
208
  }
102
- }
103
- exports.default = Bexio;
209
+ for (let i in options) {
210
+ if (options.hasOwnProperty(i)) {
211
+ const value = options[i];
212
+ if (Array.isArray(value)) {
213
+ value.forEach((v) => {
214
+ str.push(encodeURIComponent(i) + "=" + encodeURIComponent(v));
215
+ });
216
+ } else {
217
+ str.push(encodeURIComponent(i) + "=" + encodeURIComponent(value));
218
+ }
219
+ }
220
+ }
221
+ return `?${str.join("&")}`;
222
+ }
223
+ };
224
+
225
+ // src/resources/BusinessActivities.ts
226
+ var ClientServices = class extends BaseCrud {
227
+ constructor(apiToken) {
228
+ super(apiToken, "/2.0/client_service");
229
+ }
230
+ };
231
+
232
+ // src/resources/Contacts.ts
233
+ var Contacts = class extends BaseCrud {
234
+ constructor(apiToken) {
235
+ super(apiToken, "/2.0/contact");
236
+ }
237
+ };
238
+
239
+ // src/resources/ContactTypes.ts
240
+ var ContactTypes = class extends BaseCrud {
241
+ constructor(apiToken) {
242
+ super(apiToken, "/2.0/contact_type");
243
+ }
244
+ /**
245
+ * Not implemented by Bexio yet
246
+ *
247
+ * @param {{}} ressource
248
+ * @returns {Promise<ContactTypesStatic.ContactSector>}
249
+ * @memberof ContactTypes
250
+ */
251
+ async create(ressource) {
252
+ throw new Error("not implemented by Bexio yet");
253
+ }
254
+ /**
255
+ * Not implemented by Bexio yet
256
+ *
257
+ * @param {number} id
258
+ * @param {{}} ressource
259
+ * @returns {Promise<ContactTypesStatic.ContactSector>}
260
+ * @memberof ContactTypes
261
+ */
262
+ async edit(id, ressource) {
263
+ throw new Error("not implemented by Bexio yet");
264
+ }
265
+ /**
266
+ * Not implemented by Bexio yet
267
+ *
268
+ * @param {number} id
269
+ * @param {{}} ressource
270
+ * @returns {Promise<ContactTypesStatic.ContactSector>}
271
+ * @memberof ContactTypes
272
+ */
273
+ async overwrite(id, ressource) {
274
+ throw new Error("not implemented by Bexio yet");
275
+ }
276
+ /**
277
+ * Not implemented by Bexio yet
278
+ *
279
+ * @param {number} id
280
+ * @returns {Promise<boolean>}
281
+ * @memberof ContactTypes
282
+ */
283
+ async delete(id) {
284
+ throw new Error("not implemented by Bexio yet");
285
+ }
286
+ };
287
+
288
+ // src/resources/ContactSectors.ts
289
+ var ContactSectors = class extends BaseCrud {
290
+ constructor(apiToken) {
291
+ super(apiToken, "/2.0/contact_branch");
292
+ }
293
+ /**
294
+ * Not implemented by Bexio yet
295
+ *
296
+ * @param {{}} ressource
297
+ * @returns {Promise<ContactSectorsStatic.ContactSector>}
298
+ * @memberof ContactSectors
299
+ */
300
+ async create(ressource) {
301
+ throw new Error("not implemented by Bexio yet");
302
+ }
303
+ /**
304
+ * Not implemented by Bexio yet
305
+ *
306
+ * @param {number} id
307
+ * @param {{}} ressource
308
+ * @returns {Promise<ContactSectorsStatic.ContactSector>}
309
+ * @memberof ContactSectors
310
+ */
311
+ async edit(id, ressource) {
312
+ throw new Error("not implemented by Bexio yet");
313
+ }
314
+ /**
315
+ * Not implemented by Bexio yet
316
+ *
317
+ * @param {number} id
318
+ * @param {{}} ressource
319
+ * @returns {Promise<ContactSectorsStatic.ContactSector>}
320
+ * @memberof ContactSectors
321
+ */
322
+ async overwrite(id, ressource) {
323
+ throw new Error("not implemented by Bexio yet");
324
+ }
325
+ /**
326
+ * Not implemented by Bexio yet
327
+ *
328
+ * @param {number} id
329
+ * @returns {Promise<boolean>}
330
+ * @memberof ContactSectors
331
+ */
332
+ async delete(id) {
333
+ throw new Error("not implemented by Bexio yet");
334
+ }
335
+ };
336
+
337
+ // src/resources/ContactGroups.ts
338
+ var ContactGroups = class extends BaseCrud {
339
+ constructor(apiToken) {
340
+ super(apiToken, "/2.0/contact_group");
341
+ }
342
+ /**
343
+ * Not implemented by Bexio yet
344
+ *
345
+ * @param {number} id
346
+ * @returns {Promise<boolean>}
347
+ * @memberof ContactGroups
348
+ */
349
+ async delete(id) {
350
+ throw new Error("not implemented by Bexio yet");
351
+ }
352
+ };
353
+
354
+ // src/resources/ContactRelations.ts
355
+ var ContactRelations = class extends BaseCrud {
356
+ constructor(apiToken) {
357
+ super(apiToken, "/2.0/contact_relation");
358
+ }
359
+ };
360
+
361
+ // src/resources/Expenses.ts
362
+ var Expenses = class extends BaseCrud {
363
+ constructor(apiToken) {
364
+ super(apiToken, "/2.0/kb_expense");
365
+ }
366
+ };
367
+
368
+ // src/resources/Payments.ts
369
+ var Payments = class extends BaseCrud {
370
+ constructor(apiToken, billId) {
371
+ super(apiToken, `/2.0/kb_bill/${billId}/payment`);
372
+ }
373
+ /**
374
+ * Not implemented by Bexio yet
375
+ *
376
+ * @param {BaseStatic.BaseOptions} options
377
+ * @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
378
+ * @returns {Promise<Array<{}>>}
379
+ * @memberof Payments
380
+ */
381
+ async search(options, searchOptions) {
382
+ throw new Error("not implemented by Bexio yet");
383
+ }
384
+ /**
385
+ * Not implemented by Bexio yet
386
+ *
387
+ * @param {number} id
388
+ * @param {{}} ressource
389
+ * @returns {Promise<PaymentsStatic.Payment>}
390
+ * @memberof Payments
391
+ */
392
+ async overwrite(id, ressource) {
393
+ throw new Error("not implemented by Bexio yet");
394
+ }
395
+ /**
396
+ * Not implemented by Bexio yet
397
+ *
398
+ * @param {number} id
399
+ * @param {Partial<{}>} ressource
400
+ * @returns {Promise<PaymentsStatic.Payment>}
401
+ * @memberof Payments
402
+ */
403
+ async edit(id, ressource) {
404
+ throw new Error("not implemented by Bexio yet");
405
+ }
406
+ };
407
+
408
+ // src/resources/Bills.ts
409
+ var Bills = class extends BaseCrud {
410
+ constructor(apiToken) {
411
+ super(apiToken, "/2.0/kb_bill");
412
+ }
413
+ /**
414
+ * issue a bill
415
+ *
416
+ * @param {number} id
417
+ * @returns {Promise<{ success: boolean }>}
418
+ * @memberof Bills
419
+ */
420
+ async issue(id) {
421
+ return this.request(
422
+ "POST",
423
+ `${this.apiEndpoint}/${id.toString()}/issue`
424
+ );
425
+ }
426
+ /**
427
+ * revert a bill issue
428
+ *
429
+ * @param {number} id
430
+ * @returns {Promise<{ success: boolean }>}
431
+ * @memberof Bills
432
+ */
433
+ async revertIssue(id) {
434
+ return this.request(
435
+ "POST",
436
+ `${this.apiEndpoint}/${id.toString()}/revert_issue`
437
+ );
438
+ }
439
+ /**
440
+ * List all payments for this bill
441
+ *
442
+ * @param {number} billId
443
+ * @param {BaseStatic.BaseOptions} [options]
444
+ * @returns {Promise<PaymentsStatic.Payment[]>}
445
+ * @memberof Bills
446
+ */
447
+ async listPayments(billId, options) {
448
+ const paymentCrud = new Payments(this.apiToken, billId);
449
+ return paymentCrud.list(options);
450
+ }
451
+ /**
452
+ * Show a specific payment for this bill
453
+ *
454
+ * @param {number} billId
455
+ * @param {number} paymentId
456
+ * @param {BaseStatic.BaseOptions} [options]
457
+ * @returns {Promise<PaymentsStatic.Payment>}
458
+ * @memberof Bills
459
+ */
460
+ async showPayment(billId, paymentId, options) {
461
+ const paymentCrud = new Payments(this.apiToken, billId);
462
+ return paymentCrud.show(paymentId, options);
463
+ }
464
+ /**
465
+ * Create a new payment for this bill
466
+ *
467
+ * @param {number} billId
468
+ * @param {PaymentsStatic.PaymentCreate} payment
469
+ * @returns {Promise<PaymentsStatic.Payment>}
470
+ * @memberof Bills
471
+ */
472
+ async createPayment(billId, payment) {
473
+ const paymentCrud = new Payments(this.apiToken, billId);
474
+ return paymentCrud.create(payment);
475
+ }
476
+ /**
477
+ * delete a specific payment for this bill
478
+ *
479
+ * @param {number} billId
480
+ * @param {number} paymentId
481
+ * @returns {Promise<boolean>}
482
+ * @memberof Bills
483
+ */
484
+ async deletePayment(billId, paymentId) {
485
+ const paymentCrud = new Payments(this.apiToken, billId);
486
+ return paymentCrud.delete(paymentId);
487
+ }
488
+ };
489
+
490
+ // src/resources/DefaultPositions.ts
491
+ var DefaultPositions = class extends BaseCrud {
492
+ constructor(apiToken, documentType, documentId) {
493
+ super(
494
+ apiToken,
495
+ `/2.0/${documentType}/${documentId}/kb_position_custom`
496
+ );
497
+ }
498
+ /**
499
+ * Not implemented by Bexio yet
500
+ *
501
+ * @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
502
+ * @param {BaseStatic.BaseOptions} [options]
503
+ * @returns {Promise<Array<{}>>}
504
+ * @memberof DefaultPositions
505
+ */
506
+ async search(searchOptions, options) {
507
+ throw new Error("not implemented by Bexio yet");
508
+ }
509
+ /**
510
+ * Not implemented by Bexio yet
511
+ *
512
+ * @param {number} id
513
+ * @param {{}} ressource
514
+ * @returns {Promise<PositionsStatic.DefaultPosition>}
515
+ * @memberof DefaultPositions
516
+ */
517
+ async overwrite(id, ressource) {
518
+ throw new Error("not implemented by Bexio yet");
519
+ }
520
+ /**
521
+ * Not implemented by Bexio yet
522
+ *
523
+ * @param {number} id
524
+ * @param {Partial<{}>} ressource
525
+ * @returns {Promise<PositionsStatic.DefaultPosition>}
526
+ * @memberof DefaultPositions
527
+ */
528
+ async edit(id, ressource) {
529
+ throw new Error("not implemented by Bexio yet");
530
+ }
531
+ };
532
+
533
+ // src/resources/ItemPositions.ts
534
+ var ItemPositions = class extends BaseCrud {
535
+ constructor(apiToken, documentType, documentId) {
536
+ super(
537
+ apiToken,
538
+ `/2.0/${documentType}/${documentId}/kb_position_article`
539
+ );
540
+ }
541
+ /**
542
+ * Not implemented by Bexio yet
543
+ *
544
+ * @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
545
+ * @param {BaseStatic.BaseOptions} [options]
546
+ * @returns {Promise<Array<{}>>}
547
+ * @memberof ItemPositions
548
+ */
549
+ async search(searchOptions, options) {
550
+ throw new Error("not implemented by Bexio yet");
551
+ }
552
+ /**
553
+ * Not implemented by Bexio yet
554
+ *
555
+ * @param {number} id
556
+ * @param {{}} ressource
557
+ * @returns {Promise<PositionsStatic.ItemPosition>}
558
+ * @memberof ItemPositions
559
+ */
560
+ async overwrite(id, ressource) {
561
+ throw new Error("not implemented by Bexio yet");
562
+ }
563
+ /**
564
+ * Not implemented by Bexio yet
565
+ *
566
+ * @param {number} id
567
+ * @param {Partial<{}>} ressource
568
+ * @returns {Promise<PositionsStatic.ItemPosition>}
569
+ * @memberof ItemPositions
570
+ */
571
+ async edit(id, ressource) {
572
+ throw new Error("not implemented by Bexio yet");
573
+ }
574
+ };
575
+
576
+ // src/resources/TextPositions.ts
577
+ var TextPositions = class extends BaseCrud {
578
+ constructor(apiToken, documentType, documentId) {
579
+ super(
580
+ apiToken,
581
+ `/2.0/${documentType}/${documentId}/kb_position_text`
582
+ );
583
+ }
584
+ /**
585
+ * Not implemented by Bexio yet
586
+ *
587
+ * @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
588
+ * @param {BaseStatic.BaseOptions} [options]
589
+ * @returns {Promise<Array<{}>>}
590
+ * @memberof TextPositions
591
+ */
592
+ async search(searchOptions, options) {
593
+ throw new Error("not implemented by Bexio yet");
594
+ }
595
+ /**
596
+ * Not implemented by Bexio yet
597
+ *
598
+ * @param {number} id
599
+ * @param {{}} ressource
600
+ * @returns {Promise<PositionsStatic.TextPosition>}
601
+ * @memberof TextPositions
602
+ */
603
+ async overwrite(id, ressource) {
604
+ throw new Error("not implemented by Bexio yet");
605
+ }
606
+ /**
607
+ * Not implemented by Bexio yet
608
+ *
609
+ * @param {number} id
610
+ * @param {Partial<{}>} ressource
611
+ * @returns {Promise<PositionsStatic.TextPosition>}
612
+ * @memberof TextPositions
613
+ */
614
+ async edit(id, ressource) {
615
+ throw new Error("not implemented by Bexio yet");
616
+ }
617
+ };
618
+
619
+ // src/resources/Positions.ts
620
+ var Positions = class _Positions extends BaseCrud {
621
+ static {
622
+ this.endpoints = {
623
+ KbPositionCustom: "kb_position_custom",
624
+ KbPositionArticle: "kb_position_article",
625
+ KbPositionText: "kb_position_text",
626
+ KbPositionSubtotal: "kb_position_subtotal",
627
+ KbPositionPagebreak: "kb_position_pagebreak",
628
+ KbPositionDiscount: "kb_position_discount",
629
+ KbPositionSubposition: "kb_position_subposition"
630
+ };
631
+ }
632
+ constructor(apiToken, documentType, documentId, positionType) {
633
+ super(
634
+ apiToken,
635
+ `/2.0/${documentType}/${documentId}/${_Positions.endpoint(positionType)}`
636
+ );
637
+ }
638
+ /**
639
+ * Endpoint segment of a position type
640
+ *
641
+ * @private
642
+ * @static
643
+ * @param {PositionsStatic.PositionType} positionType
644
+ * @returns {string}
645
+ * @memberof Positions
646
+ */
647
+ static endpoint(positionType) {
648
+ if (!Object.prototype.hasOwnProperty.call(_Positions.endpoints, positionType)) {
649
+ throw new Error(`Unknown position type "${positionType}"`);
650
+ }
651
+ return _Positions.endpoints[positionType];
652
+ }
653
+ /**
654
+ * Not implemented by Bexio yet
655
+ *
656
+ * @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
657
+ * @param {BaseStatic.BaseOptions} [options]
658
+ * @returns {Promise<Array<{}>>}
659
+ * @memberof Positions
660
+ */
661
+ async search(searchOptions, options) {
662
+ throw new Error("not implemented by Bexio yet");
663
+ }
664
+ /**
665
+ * Not implemented by Bexio yet
666
+ *
667
+ * @param {number} id
668
+ * @param {{}} ressource
669
+ * @returns {Promise<PositionStatic.Position>}
670
+ * @memberof Positions
671
+ */
672
+ async overwrite(id, ressource) {
673
+ throw new Error("not implemented by Bexio yet");
674
+ }
675
+ };
676
+
677
+ // src/resources/Orders.ts
678
+ var Orders = class extends BaseCrud {
679
+ constructor(apiToken) {
680
+ super(apiToken, "/2.0/kb_order");
681
+ }
682
+ /**
683
+ * Create a default position for an order
684
+ *
685
+ * @param {number} orderId
686
+ * @param {PositionsStatic.DefaultPositionCreate} position
687
+ * @returns {Promise<PositionsStatic.DefaultPosition>}
688
+ * @memberof Orders
689
+ */
690
+ async createDefaultPosition(orderId, position) {
691
+ return new DefaultPositions(this.apiToken, "kb_order", orderId).create(
692
+ position
693
+ );
694
+ }
695
+ /**
696
+ * Create an item position for an order
697
+ *
698
+ * @param {number} orderId
699
+ * @param {PositionsStatic.ItemPositionCreate} position
700
+ * @returns {Promise<PositionsStatic.ItemPosition>}
701
+ * @memberof Orders
702
+ */
703
+ async createItemPosition(orderId, position) {
704
+ return new ItemPositions(this.apiToken, "kb_order", orderId).create(
705
+ position
706
+ );
707
+ }
708
+ /**
709
+ * Create a text position for an order
710
+ *
711
+ * @param {number} orderId
712
+ * @param {PositionsStatic.TextPositionCreate} position
713
+ * @returns {Promise<PositionsStatic.TextPosition>}
714
+ * @memberof Orders
715
+ */
716
+ async createTextPosition(orderId, position) {
717
+ return new TextPositions(this.apiToken, "kb_order", orderId).create(
718
+ position
719
+ );
720
+ }
721
+ /**
722
+ * Delete a default position for an order
723
+ *
724
+ * @param {number} orderId
725
+ * @param {number} positionId
726
+ * @returns {Promise<boolean>}
727
+ * @memberof Orders
728
+ */
729
+ async deleteDefaultPosition(orderId, positionId) {
730
+ return new DefaultPositions(this.apiToken, "kb_order", orderId).delete(
731
+ positionId
732
+ );
733
+ }
734
+ /**
735
+ * Delete an item position for an order
736
+ *
737
+ * @param {number} orderId
738
+ * @param {number} positionId
739
+ * @returns {Promise<boolean>}
740
+ * @memberof Orders
741
+ */
742
+ async deleteItemPosition(orderId, positionId) {
743
+ return new ItemPositions(this.apiToken, "kb_order", orderId).delete(
744
+ positionId
745
+ );
746
+ }
747
+ /**
748
+ * Delete a text position for an order
749
+ *
750
+ * @param {number} orderId
751
+ * @param {number} positionId
752
+ * @returns {Promise<boolean>}
753
+ * @memberof Orders
754
+ */
755
+ async deleteTextPosition(orderId, positionId) {
756
+ return new TextPositions(this.apiToken, "kb_order", orderId).delete(
757
+ positionId
758
+ );
759
+ }
760
+ /**
761
+ * Delete a position for an order, whatever its type
762
+ *
763
+ * @param {number} orderId
764
+ * @param {Pick<PositionStatic.Position, "id" | "type">} position
765
+ * @returns {Promise<boolean>}
766
+ * @memberof Orders
767
+ */
768
+ async deletePosition(orderId, position) {
769
+ return new Positions(
770
+ this.apiToken,
771
+ "kb_order",
772
+ orderId,
773
+ position.type
774
+ ).delete(position.id);
775
+ }
776
+ };
777
+
778
+ // src/resources/Projects.ts
779
+ var Projects = class extends BaseCrud {
780
+ constructor(apiToken) {
781
+ super(apiToken, "/2.0/pr_project");
782
+ }
783
+ };
784
+
785
+ // src/resources/ProjectStatuses.ts
786
+ var ProjectStatuses = class extends BaseCrud {
787
+ constructor(apiToken) {
788
+ super(apiToken, "/2.0/pr_project_state");
789
+ }
790
+ /**
791
+ * Not implemented by Bexio yet
792
+ *
793
+ * @param {number} id
794
+ * @param {{}} ressource
795
+ * @returns {Promise<ProjectStatusesStatic.ProjectStatus>}
796
+ * @memberof ProjectStatuses
797
+ */
798
+ async overwrite(id, ressource) {
799
+ throw new Error("not implemented by Bexio yet");
800
+ }
801
+ /**
802
+ * Not implemented by Bexio yet
803
+ *
804
+ * @param {number} id
805
+ * @param {{}} ressource
806
+ * @returns {Promise<ProjectStatusesStatic.ProjectStatus>}
807
+ * @memberof ProjectStatuses
808
+ */
809
+ async edit(id, ressource) {
810
+ throw new Error("not implemented by Bexio yet");
811
+ }
812
+ /**
813
+ * Not implemented by Bexio yet
814
+ *
815
+ * @param {{}} ressource
816
+ * @returns {Promise<ProjectStatusesStatic.ProjectStatus>}
817
+ * @memberof ProjectStatuses
818
+ */
819
+ async create(ressource) {
820
+ throw new Error("not implemented by Bexio yet");
821
+ }
822
+ /**
823
+ * Not implemented by Bexio yet
824
+ *
825
+ * @param {number} id
826
+ * @returns {Promise<boolean>}
827
+ * @memberof ProjectStatuses
828
+ */
829
+ async delete(id) {
830
+ throw new Error("not implemented by Bexio yet");
831
+ }
832
+ };
833
+
834
+ // src/resources/ProjectTypes.ts
835
+ var ProjectTypes = class extends BaseCrud {
836
+ constructor(apiToken) {
837
+ super(apiToken, "/2.0/pr_project_type");
838
+ }
839
+ /**
840
+ * Not implemented by Bexio yet
841
+ *
842
+ * @param {{}} ressource
843
+ * @returns {Promise<ProjectTypesStatic.ProjectType>}
844
+ * @memberof ProjectTypes
845
+ */
846
+ async create(ressource) {
847
+ throw new Error("not implemented by Bexio yet");
848
+ }
849
+ /**
850
+ * Not implemented by Bexio yet
851
+ *
852
+ * @param {number} id
853
+ * @param {{}} ressource
854
+ * @returns {Promise<ProjectTypesStatic.ProjectType>}
855
+ * @memberof ProjectTypes
856
+ */
857
+ async edit(id, ressource) {
858
+ throw new Error("not implemented by Bexio yet");
859
+ }
860
+ /**
861
+ * Not implemented by Bexio yet
862
+ *
863
+ * @param {number} id
864
+ * @param {{}} ressource
865
+ * @returns {Promise<ProjectTypesStatic.ProjectType>}
866
+ * @memberof ProjectTypes
867
+ */
868
+ async overwrite(id, ressource) {
869
+ throw new Error("not implemented by Bexio yet");
870
+ }
871
+ /**
872
+ * Not implemented by Bexio yet
873
+ *
874
+ * @param {number} id
875
+ * @returns {Promise<boolean>}
876
+ * @memberof ProjectTypes
877
+ */
878
+ async delete(id) {
879
+ throw new Error("not implemented by Bexio yet");
880
+ }
881
+ };
882
+
883
+ // src/resources/Timetrackings.ts
884
+ var Timetrackings = class extends BaseCrud {
885
+ constructor(apiToken) {
886
+ super(apiToken, "/2.0/timesheet");
887
+ }
888
+ /**
889
+ * Not implemented by Bexio yet
890
+ *
891
+ * @param {number} id
892
+ * @param {{}} ressource
893
+ * @returns {Promise<TimetrackingsStatic.TimetrackingsFull>}
894
+ * @memberof Timetracking
895
+ */
896
+ async overwrite(id, ressource) {
897
+ throw new Error("not implemented by Bexio yet");
898
+ }
899
+ };
900
+
901
+ // src/resources/TimetrackingStatuses.ts
902
+ var TimetrackingStatuses = class extends BaseCrud {
903
+ constructor(apiToken) {
904
+ super(apiToken, "/2.0/timesheet_status");
905
+ }
906
+ /**
907
+ * Not implemented by Bexio yet
908
+ *
909
+ * @param {number} id
910
+ * @param {{}} ressource
911
+ * @returns {Promise<TimetrackingStatusesStatic.TimetrackingStatus>}
912
+ * @memberof TimetrackingStatuses
913
+ */
914
+ async overwrite(id, ressource) {
915
+ throw new Error("not implemented by Bexio yet");
916
+ }
917
+ /**
918
+ * Not implemented by Bexio yet
919
+ *
920
+ * @param {number} id
921
+ * @param {{}} ressource
922
+ * @returns {Promise<TimetrackingStatusesStatic.TimetrackingStatus>}
923
+ * @memberof TimetrackingStatuses
924
+ */
925
+ async edit(id, ressource) {
926
+ throw new Error("not implemented by Bexio yet");
927
+ }
928
+ /**
929
+ * Not implemented by Bexio yet
930
+ *
931
+ * @param {{}} ressource
932
+ * @returns {Promise<TimetrackingStatusesStatic.TimetrackingStatus>}
933
+ * @memberof TimetrackingStatuses
934
+ */
935
+ async create(ressource) {
936
+ throw new Error("not implemented by Bexio yet");
937
+ }
938
+ /**
939
+ * Not implemented by Bexio yet
940
+ *
941
+ * @param {number} id
942
+ * @returns {Promise<boolean>}
943
+ * @memberof TimetrackingStatuses
944
+ */
945
+ async delete(id) {
946
+ throw new Error("not implemented by Bexio yet");
947
+ }
948
+ };
949
+
950
+ // src/resources/Users.ts
951
+ var Users = class extends BaseCrud {
952
+ constructor(apiToken) {
953
+ super(apiToken, "/2.0/user");
954
+ }
955
+ /**
956
+ * Not implemented by Bexio yet
957
+ *
958
+ * @param {number} id
959
+ * @param {{}} ressource
960
+ * @returns {Promise<UsersStatic.UserFull>}
961
+ * @memberof Users
962
+ */
963
+ async overwrite(id, ressource) {
964
+ throw new Error("not implemented by Bexio yet");
965
+ }
966
+ /**
967
+ * Not implemented by Bexio yet
968
+ *
969
+ * @param {number} id
970
+ * @param {{}} ressource
971
+ * @returns {Promise<UsersStatic.UserFull>}
972
+ * @memberof Users
973
+ */
974
+ async edit(id, ressource) {
975
+ throw new Error("not implemented by Bexio yet");
976
+ }
977
+ /**
978
+ * Not implemented by Bexio yet
979
+ *
980
+ * @param {{}} ressource
981
+ * @returns {Promise<UsersStatic.UserFull>}
982
+ * @memberof Users
983
+ */
984
+ async create(ressource) {
985
+ throw new Error("not implemented by Bexio yet");
986
+ }
987
+ /**
988
+ * Not implemented by Bexio yet
989
+ *
990
+ * @param {number} id
991
+ * @returns {Promise<boolean>}
992
+ * @memberof Users
993
+ */
994
+ async delete(id) {
995
+ throw new Error("not implemented by Bexio yet");
996
+ }
997
+ };
998
+
999
+ // src/resources/Items.ts
1000
+ var Items = class extends BaseCrud {
1001
+ constructor(apiToken) {
1002
+ super(apiToken, "/2.0/article");
1003
+ }
1004
+ };
1005
+
1006
+ // src/resources/Invoices.ts
1007
+ var Invoices = class extends BaseCrud {
1008
+ constructor(apiToken) {
1009
+ super(apiToken, "/2.0/kb_invoice");
1010
+ }
1011
+ /**
1012
+ * Send an invoice by email.
1013
+ *
1014
+ * @param {number} id
1015
+ * @param {Partial<InvoicesStatic.InvoiceSend>} ressource
1016
+ * @returns {Promise<InvoicesStatic.InvoiceSentAnswer>}
1017
+ * @memberof Invoices
1018
+ */
1019
+ async send(id, ressource) {
1020
+ return this.request(
1021
+ "POST",
1022
+ `${this.apiEndpoint}/${id}/send`,
1023
+ void 0,
1024
+ ressource
1025
+ );
1026
+ }
1027
+ /**
1028
+ * @deprecated Use `send` instead.
1029
+ */
1030
+ async sent(id, ressource) {
1031
+ return this.send(id, ressource);
1032
+ }
1033
+ async cancel(id) {
1034
+ return this.request(
1035
+ "POST",
1036
+ `${this.apiEndpoint}/${id}/cancel`
1037
+ );
1038
+ }
1039
+ /**
1040
+ * This action returns a pdf document of the invoice.
1041
+ *
1042
+ * @param {number} id
1043
+ * @param {0 | 1} [logopaper] Whether the PDF should be generated using the letterhead, or not.
1044
+ * @returns {Promise<BaseStatic.PdfResponse>}
1045
+ * @memberof Invoices
1046
+ */
1047
+ async showPdf(id, logopaper) {
1048
+ const response = await this.request(
1049
+ "GET",
1050
+ `${this.apiEndpoint}/${id}/pdf`,
1051
+ logopaper !== void 0 ? { logopaper } : void 0
1052
+ );
1053
+ return {
1054
+ ...response,
1055
+ content: Buffer.from(response.content, "base64")
1056
+ };
1057
+ }
1058
+ /**
1059
+ * Issue an invoice. The invoice must be in the draft status.
1060
+ *
1061
+ * @param {number} id
1062
+ * @returns {Promise<InvoicesStatic.InvoiceIssued>}
1063
+ * @memberof Invoices
1064
+ */
1065
+ async issue(id) {
1066
+ return this.request(
1067
+ "POST",
1068
+ `${this.apiEndpoint}/${id}/issue`
1069
+ );
1070
+ }
1071
+ /**
1072
+ * Mark an invoice as sent.
1073
+ *
1074
+ * @param {number} id
1075
+ * @returns {Promise<InvoicesStatic.InvoiceSentAnswer>}
1076
+ * @memberof Invoices
1077
+ */
1078
+ async markAsSent(id) {
1079
+ return this.request(
1080
+ "POST",
1081
+ `${this.apiEndpoint}/${id}/mark_as_sent`
1082
+ );
1083
+ }
1084
+ /**
1085
+ * revert a Invoice issue
1086
+ *
1087
+ * @param {number} id
1088
+ * @returns {Promise<{ success: boolean }>}
1089
+ * @memberof Invoices
1090
+ */
1091
+ async revertIssue(id) {
1092
+ return this.request(
1093
+ "POST",
1094
+ `${this.apiEndpoint}/${id.toString()}/revert_issue`
1095
+ );
1096
+ }
1097
+ /**
1098
+ * Create a payment for an invoice
1099
+ *
1100
+ * @param {number} invoiceId
1101
+ * @param {Date} date
1102
+ * @param {string} value
1103
+ * @param {number} [bank_account_id]
1104
+ * @param {number} [payment_service_id]
1105
+ * @return {*} {Promise<InvoicesStatic.Payment>}
1106
+ * @memberof Invoices
1107
+ */
1108
+ async createPayment(invoiceId, date, value, bank_account_id, payment_service_id) {
1109
+ return this.request(
1110
+ "POST",
1111
+ `${this.apiEndpoint}/${invoiceId.toString()}/payment`,
1112
+ void 0,
1113
+ {
1114
+ date: `${date.getFullYear()}-${(date.getMonth() + 1).toString().padStart(2, "0")}-${date.getDate().toString().padStart(2, "0")}`,
1115
+ value,
1116
+ bank_account_id,
1117
+ payment_service_id
1118
+ }
1119
+ );
1120
+ }
1121
+ /**
1122
+ * Get a payment for an invoice
1123
+ *
1124
+ * @param {number} invoiceId
1125
+ * @param {number} paymentId
1126
+ * @return {*} {Promise<InvoicesStatic.Payment>}
1127
+ * @memberof Invoices
1128
+ */
1129
+ async getPayment(invoiceId, paymentId) {
1130
+ return this.request(
1131
+ "GET",
1132
+ `${this.apiEndpoint}/${invoiceId.toString()}/payment/${paymentId.toString()}`
1133
+ );
1134
+ }
1135
+ /**
1136
+ * Delete a payment for an invoice
1137
+ *
1138
+ * @param {number} invoiceId
1139
+ * @param {number} paymentId
1140
+ * @return {*} {Promise<void>}
1141
+ * @memberof Invoices
1142
+ */
1143
+ async deletePayment(invoiceId, paymentId) {
1144
+ return this.request(
1145
+ "DELETE",
1146
+ `${this.apiEndpoint}/${invoiceId.toString()}/payment/${paymentId.toString()}`
1147
+ );
1148
+ }
1149
+ /**
1150
+ * Create a default position for an invoice
1151
+ *
1152
+ * @param {number} invoiceId
1153
+ * @param {PositionsStatic.DefaultPositionCreate} position
1154
+ * @returns {Promise<PositionsStatic.DefaultPosition>}
1155
+ * @memberof Invoices
1156
+ */
1157
+ async createDefaultPosition(invoiceId, position) {
1158
+ return new DefaultPositions(this.apiToken, "kb_invoice", invoiceId).create(
1159
+ position
1160
+ );
1161
+ }
1162
+ /**
1163
+ * Create an item position for an invoice
1164
+ *
1165
+ * @param {number} invoiceId
1166
+ * @param {PositionsStatic.ItemPositionCreate} position
1167
+ * @returns {Promise<PositionsStatic.ItemPosition>}
1168
+ * @memberof Invoices
1169
+ */
1170
+ async createItemPosition(invoiceId, position) {
1171
+ return new ItemPositions(this.apiToken, "kb_invoice", invoiceId).create(
1172
+ position
1173
+ );
1174
+ }
1175
+ /**
1176
+ * Create a text position for an invoice
1177
+ *
1178
+ * @param {number} invoiceId
1179
+ * @param {PositionsStatic.TextPositionCreate} position
1180
+ * @returns {Promise<PositionsStatic.TextPosition>}
1181
+ * @memberof Invoices
1182
+ */
1183
+ async createTextPosition(invoiceId, position) {
1184
+ return new TextPositions(this.apiToken, "kb_invoice", invoiceId).create(
1185
+ position
1186
+ );
1187
+ }
1188
+ /**
1189
+ * Delete a default position for an invoice
1190
+ *
1191
+ * @param {number} invoiceId
1192
+ * @param {number} positionId
1193
+ * @returns {Promise<boolean>}
1194
+ * @memberof Invoices
1195
+ */
1196
+ async deleteDefaultPosition(invoiceId, positionId) {
1197
+ return new DefaultPositions(this.apiToken, "kb_invoice", invoiceId).delete(
1198
+ positionId
1199
+ );
1200
+ }
1201
+ /**
1202
+ * Delete an item position for an invoice
1203
+ *
1204
+ * @param {number} invoiceId
1205
+ * @param {number} positionId
1206
+ * @returns {Promise<boolean>}
1207
+ * @memberof Invoices
1208
+ */
1209
+ async deleteItemPosition(invoiceId, positionId) {
1210
+ return new ItemPositions(this.apiToken, "kb_invoice", invoiceId).delete(
1211
+ positionId
1212
+ );
1213
+ }
1214
+ /**
1215
+ * Delete a text position for an invoice
1216
+ *
1217
+ * @param {number} invoiceId
1218
+ * @param {number} positionId
1219
+ * @returns {Promise<boolean>}
1220
+ * @memberof Invoices
1221
+ */
1222
+ async deleteTextPosition(invoiceId, positionId) {
1223
+ return new TextPositions(this.apiToken, "kb_invoice", invoiceId).delete(
1224
+ positionId
1225
+ );
1226
+ }
1227
+ /**
1228
+ * Delete a position for an invoice, whatever its type
1229
+ *
1230
+ * @param {number} invoiceId
1231
+ * @param {Pick<PositionStatic.Position, "id" | "type">} position
1232
+ * @returns {Promise<boolean>}
1233
+ * @memberof Invoices
1234
+ */
1235
+ async deletePosition(invoiceId, position) {
1236
+ return new Positions(
1237
+ this.apiToken,
1238
+ "kb_invoice",
1239
+ invoiceId,
1240
+ position.type
1241
+ ).delete(position.id);
1242
+ }
1243
+ };
1244
+
1245
+ // src/resources/Currencies.ts
1246
+ var Currencies = class extends BaseCrud {
1247
+ constructor(apiToken) {
1248
+ super(apiToken, `/3.0/currencies`);
1249
+ }
1250
+ /**
1251
+ * NOT IMPLEMENTED BY BEXIO YET
1252
+ *
1253
+ * @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
1254
+ * @param {BaseStatic.BaseOptions} [options]
1255
+ * @returns {Promise<Array<{}>>}
1256
+ * @memberof Currencies
1257
+ */
1258
+ async search(searchOptions, options) {
1259
+ throw new Error("not implemented by Bexio yet");
1260
+ }
1261
+ /**
1262
+ * NOT IMPLEMENTED BY BEXIO YET
1263
+ *
1264
+ * @param {number} id
1265
+ * @param {Overwrite} ressource
1266
+ * @returns {Promise<{}>}
1267
+ * @memberof Currencies
1268
+ */
1269
+ async overwrite(id, ressource) {
1270
+ throw new Error("not implemented by Bexio yet");
1271
+ }
1272
+ /**
1273
+ * NOT IMPLEMENTED BY BEXIO YET
1274
+ *
1275
+ * @param {number} id
1276
+ * @param {Partial<{}>} ressource
1277
+ * @returns {Promise<CurrenciesStatic.Currency>}
1278
+ * @memberof BaseCrud
1279
+ */
1280
+ async edit(id, ressource) {
1281
+ throw new Error("not implemented by Bexio yet");
1282
+ }
1283
+ };
1284
+
1285
+ // src/resources/BillsV4.ts
1286
+ var BillsV4 = class extends BaseCrud {
1287
+ constructor(apiToken) {
1288
+ super(apiToken, "/4.0/purchase/bills");
1289
+ }
1290
+ /**
1291
+ * Lists the ressource
1292
+ *
1293
+ * @param {BillsV4Static.ListOptions} [options]
1294
+ * @returns {Promise<Array<BillsV4Static.Bill>>}
1295
+ * @memberof BillsV4
1296
+ */
1297
+ async list(options) {
1298
+ const resp = await this.request("GET", this.apiEndpoint, options);
1299
+ return resp.data;
1300
+ }
1301
+ /**
1302
+ * Not implemented by Bexio yet
1303
+ *
1304
+ * @param {Array<BaseStatic.SearchParameter<BillsV4Static.SearchParameters>>} searchOptions
1305
+ * @param {BaseStatic.BaseOptions} [options]
1306
+ * @returns {Promise<BillsV4Static.Bill[]>}
1307
+ * @memberof BillsV4
1308
+ */
1309
+ async search(searchOptions, options) {
1310
+ throw new Error("not implemented by Bexio yet");
1311
+ }
1312
+ /**
1313
+ * Update bill status
1314
+ *
1315
+ * @param {string} id
1316
+ * @param {BillsV4Static.BillStatusUpdate} status
1317
+ * @returns {Promise<BillsV4Static.BillFull>}
1318
+ * @memberof BillsV4
1319
+ */
1320
+ async updateStatus(id, status) {
1321
+ return this.request(
1322
+ "PUT",
1323
+ `${this.apiEndpoint}/${id}/bookings/${status}`
1324
+ );
1325
+ }
1326
+ /**
1327
+ * Execute bill action
1328
+ *
1329
+ * @param {string} id
1330
+ * @param {BillsV4Static.BillAction} action
1331
+ * @returns {Promise<BillsV4Static.BillFull>}
1332
+ * @memberof BillsV4
1333
+ */
1334
+ async executeAction(id, action) {
1335
+ return this.request(
1336
+ "POST",
1337
+ `${this.apiEndpoint}/${id}/actions`,
1338
+ void 0,
1339
+ { action }
1340
+ );
1341
+ }
1342
+ /**
1343
+ * Validate whether document number is available or not
1344
+ *
1345
+ * @param {string} documentNo
1346
+ * @returns {Promise<{ valid: boolean; next_available_no: string }>}
1347
+ * @memberof BillsV4
1348
+ */
1349
+ async validateDocumentNumber(documentNo) {
1350
+ return this.request(
1351
+ "GET",
1352
+ "/4.0/purchase/documentnumbers/bills",
1353
+ { document_no: documentNo }
1354
+ );
1355
+ }
1356
+ };
1357
+
1358
+ // src/resources/OutgoingPayments.ts
1359
+ var OutgoingPayments = class extends BaseCrud {
1360
+ constructor(apiToken) {
1361
+ super(apiToken, "/4.0/purchase/outgoing-payments");
1362
+ }
1363
+ /**
1364
+ * search for resources - Not implemented for OutgoingPayments V4
1365
+ *
1366
+ * @memberof OutgoingPayments
1367
+ */
1368
+ async search() {
1369
+ throw new Error("Method not implemented.");
1370
+ }
1371
+ /**
1372
+ * overwrite an existing outgoing payment - Not implemented for OutgoingPayments V4
1373
+ *
1374
+ * @memberof OutgoingPayments
1375
+ */
1376
+ async overwrite(id, ressource) {
1377
+ throw new Error("Method not implemented. Use update() instead.");
1378
+ }
1379
+ /**
1380
+ * edit an existing outgoing payment - Not implemented for OutgoingPayments V4
1381
+ *
1382
+ * @memberof OutgoingPayments
1383
+ */
1384
+ async edit(id, ressource) {
1385
+ throw new Error("Method not implemented. Use update() instead.");
1386
+ }
1387
+ /**
1388
+ * delete an existing outgoing payment
1389
+ *
1390
+ * @param {T} id
1391
+ * @returns {Promise<any>}
1392
+ * @memberof OutgoingPayments
1393
+ */
1394
+ async delete(id) {
1395
+ const resp = await this.request("DELETE", `${this.apiEndpoint}/${id}`);
1396
+ if (!resp || resp && Object.keys(resp).length === 0) {
1397
+ return true;
1398
+ }
1399
+ throw new Error(`Failed to delete outgoing payment with id ${id}`);
1400
+ }
1401
+ /**
1402
+ * cancel an existing outgoing payment
1403
+ *
1404
+ * @param {string} id
1405
+ * @returns {Promise<void>}
1406
+ * @memberof OutgoingPayments
1407
+ */
1408
+ async cancel(id) {
1409
+ return this.request("POST", `${this.apiEndpoint}/${id}/cancel`);
1410
+ }
1411
+ /**
1412
+ * edit an existing outgoing payment
1413
+ *
1414
+ * @param {OutgoingPaymentsStatic.OutgoingPaymentUpdate} data
1415
+ * @returns {Promise<OutgoingPaymentsStatic.OutgoingPayment>}
1416
+ * @memberof OutgoingPayments
1417
+ */
1418
+ async update(data) {
1419
+ return this.request(
1420
+ "PUT",
1421
+ this.apiEndpoint,
1422
+ void 0,
1423
+ data
1424
+ );
1425
+ }
1426
+ /**
1427
+ * Lists the outgoing payments
1428
+ *
1429
+ * @param {OutgoingPaymentsStatic.ListOptions} options
1430
+ * @returns {Promise<OutgoingPaymentsStatic.OutgoingPayment[]>}
1431
+ * @memberof OutgoingPayments
1432
+ */
1433
+ async list(options) {
1434
+ const response = await this.request("GET", this.apiEndpoint, options);
1435
+ return response.data;
1436
+ }
1437
+ /**
1438
+ * create a new outgoing payment
1439
+ *
1440
+ * @param {OutgoingPaymentsStatic.OutgoingPaymentCreate} data
1441
+ * @returns {Promise<OutgoingPaymentsStatic.OutgoingPayment>}
1442
+ * @memberof OutgoingPayments
1443
+ */
1444
+ async create(data) {
1445
+ return this.request(
1446
+ "POST",
1447
+ this.apiEndpoint,
1448
+ void 0,
1449
+ data
1450
+ );
1451
+ }
1452
+ };
1453
+
1454
+ // src/resources/BankAccounts.ts
1455
+ var BankAccounts = class extends BaseCrud {
1456
+ constructor(apiToken) {
1457
+ super(apiToken, "/3.0/banking/accounts");
1458
+ }
1459
+ /**
1460
+ * NOT IMPLEMENTED BY BEXIO YET
1461
+ *
1462
+ * @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
1463
+ * @param {BaseStatic.BaseOptions} [options]
1464
+ * @returns {Promise<Array<{}>>}
1465
+ * @memberof BankAccounts
1466
+ */
1467
+ async search(searchOptions, options) {
1468
+ throw new Error("not implemented by Bexio yet");
1469
+ }
1470
+ /**
1471
+ * NOT IMPLEMENTED BY BEXIO YET
1472
+ *
1473
+ * @param {number} id
1474
+ * @param {{}} ressource
1475
+ * @returns {Promise<BankAccountsStatic.BankAccountFull>}
1476
+ * @memberof BankAccounts
1477
+ */
1478
+ async overwrite(id, ressource) {
1479
+ throw new Error("not implemented by Bexio yet");
1480
+ }
1481
+ /**
1482
+ * NOT IMPLEMENTED BY BEXIO YET
1483
+ *
1484
+ * @param {number} id
1485
+ * @param {Partial<{}>} ressource
1486
+ * @returns {Promise<BankAccountsStatic.BankAccountFull>}
1487
+ * @memberof BankAccounts
1488
+ */
1489
+ async edit(id, ressource) {
1490
+ throw new Error("not implemented by Bexio yet");
1491
+ }
1492
+ /**
1493
+ * NOT IMPLEMENTED BY BEXIO YET
1494
+ *
1495
+ * @param {{}} ressource
1496
+ * @returns {Promise<BankAccountsStatic.BankAccountFull>}
1497
+ * @memberof BankAccounts
1498
+ */
1499
+ async create(ressource) {
1500
+ throw new Error("not implemented by Bexio yet");
1501
+ }
1502
+ /**
1503
+ * NOT IMPLEMENTED BY BEXIO YET
1504
+ *
1505
+ * @param {number} id
1506
+ * @returns {Promise<boolean>}
1507
+ * @memberof BankAccounts
1508
+ */
1509
+ async delete(id) {
1510
+ throw new Error("not implemented by Bexio yet");
1511
+ }
1512
+ };
1513
+
1514
+ // src/resources/Accounts.ts
1515
+ var Accounts = class extends BaseCrud {
1516
+ constructor(apiToken) {
1517
+ super(apiToken, "/2.0/accounts");
1518
+ }
1519
+ /**
1520
+ * show a specific ressource
1521
+ *
1522
+ * @param {string | number} id
1523
+ * @param {BaseStatic.BaseOptions} [options]
1524
+ * @returns {Promise<AccountsStatic.Account>}
1525
+ * @memberof Accounts
1526
+ */
1527
+ async show(id, options) {
1528
+ throw new Error("not implemented by Bexio yet");
1529
+ }
1530
+ /**
1531
+ * create a new ressource
1532
+ *
1533
+ * @param {AccountsStatic.Account} ressource
1534
+ * @returns {Promise<AccountsStatic.Account>}
1535
+ * @memberof Accounts
1536
+ */
1537
+ async create(ressource) {
1538
+ throw new Error("not implemented by Bexio yet");
1539
+ }
1540
+ /**
1541
+ * overwrite an existing ressource
1542
+ *
1543
+ * @param {number} id
1544
+ * @param {AccountsStatic.Account} ressource
1545
+ * @returns {Promise<AccountsStatic.Account>}
1546
+ * @memberof Accounts
1547
+ */
1548
+ async overwrite(id, ressource) {
1549
+ throw new Error("not implemented by Bexio yet");
1550
+ }
1551
+ /**
1552
+ * edit an existing ressource
1553
+ *
1554
+ * @param {number} id
1555
+ * @param {Partial<AccountsStatic.Account>} ressource
1556
+ * @returns {Promise<AccountsStatic.Account>}
1557
+ * @memberof Accounts
1558
+ */
1559
+ async edit(id, ressource) {
1560
+ throw new Error("not implemented by Bexio yet");
1561
+ }
1562
+ /**
1563
+ * delete a ressource
1564
+ *
1565
+ * @param {number} id
1566
+ * @returns {Promise<boolean>}
1567
+ * @memberof Accounts
1568
+ */
1569
+ async delete(id) {
1570
+ throw new Error("not implemented by Bexio yet");
1571
+ }
1572
+ };
1573
+
1574
+ // src/resources/ManualEntries.ts
1575
+ var ManualEntries = class extends BaseCrud {
1576
+ constructor(apiToken) {
1577
+ super(apiToken, "/3.0/accounting/manual_entries");
1578
+ }
1579
+ /**
1580
+ * Lists the manual entries
1581
+ *
1582
+ * @param {ManualEntriesStatic.ListOptions} [options]
1583
+ * @returns {Promise<Array<ManualEntriesStatic.ManualEntry>>}
1584
+ * @memberof ManualEntries
1585
+ */
1586
+ async list(options) {
1587
+ return this.request(
1588
+ "GET",
1589
+ this.apiEndpoint,
1590
+ options
1591
+ );
1592
+ }
1593
+ /**
1594
+ * Not implemented by Bexio yet
1595
+ *
1596
+ * @param {string | number} id
1597
+ * @param {BaseStatic.BaseOptions} [options]
1598
+ * @returns {Promise<ManualEntriesStatic.ManualEntry>}
1599
+ * @memberof ManualEntries
1600
+ */
1601
+ async show(id, options) {
1602
+ throw new Error("not implemented by Bexio yet");
1603
+ }
1604
+ /**
1605
+ * Not implemented by Bexio yet
1606
+ *
1607
+ * @param {Array<BaseStatic.SearchParameter<ManualEntriesStatic.SearchParameters>>} searchOptions
1608
+ * @param {BaseStatic.BaseOptions} [options]
1609
+ * @returns {Promise<ManualEntriesStatic.ManualEntry[]>}
1610
+ * @memberof ManualEntries
1611
+ */
1612
+ async search(searchOptions, options) {
1613
+ throw new Error("not implemented by Bexio yet");
1614
+ }
1615
+ /**
1616
+ * Not implemented by Bexio yet
1617
+ *
1618
+ * @param {number} id
1619
+ * @param {Partial<ManualEntriesStatic.ManualEntryUpdate>} ressource
1620
+ * @returns {Promise<ManualEntriesStatic.ManualEntry>}
1621
+ * @memberof ManualEntries
1622
+ */
1623
+ async edit(id, ressource) {
1624
+ throw new Error("not implemented by Bexio yet");
1625
+ }
1626
+ /**
1627
+ * Get the next reference number for a manual entry
1628
+ *
1629
+ * @returns {Promise<{ next_ref_nr: string }>}
1630
+ * @memberof ManualEntries
1631
+ */
1632
+ async getNextReferenceNumber() {
1633
+ return this.request(
1634
+ "GET",
1635
+ `${this.apiEndpoint}/next_ref_nr`
1636
+ );
1637
+ }
1638
+ };
1639
+
1640
+ // src/resources/Taxes.ts
1641
+ var Taxes = class extends BaseCrud {
1642
+ constructor(accessToken) {
1643
+ super(accessToken, "/3.0/taxes");
1644
+ }
1645
+ /**
1646
+ * Lists the taxes
1647
+ *
1648
+ * @param {TaxesStatic.TaxOptions} [options]
1649
+ * @returns {Promise<TaxesStatic.Tax[]>}
1650
+ * @memberof Taxes
1651
+ */
1652
+ async list(options) {
1653
+ return super.list(options);
1654
+ }
1655
+ /**
1656
+ * Search for taxes is not implemented in the API.
1657
+ * Use list() with parameters instead.
1658
+ */
1659
+ async search() {
1660
+ throw new Error("Method not implemented.");
1661
+ }
1662
+ /**
1663
+ * Create a tax is not implemented in the API.
1664
+ */
1665
+ async create() {
1666
+ throw new Error("Method not implemented.");
1667
+ }
1668
+ /**
1669
+ * Overwrite a tax is not implemented in the API.
1670
+ */
1671
+ async overwrite() {
1672
+ throw new Error("Method not implemented.");
1673
+ }
1674
+ /**
1675
+ * Edit a tax is not implemented in the API.
1676
+ */
1677
+ async edit() {
1678
+ throw new Error("Method not implemented.");
1679
+ }
1680
+ };
1681
+
1682
+ // src/interfaces/BillsStatic.ts
1683
+ var BillsStatic;
1684
+ ((BillsStatic2) => {
1685
+ let SearchParameters;
1686
+ ((SearchParameters2) => {
1687
+ SearchParameters2["id"] = "id";
1688
+ SearchParameters2["kb_item_status_id"] = "kb_item_status_id";
1689
+ SearchParameters2["document_nr"] = "document_nr";
1690
+ SearchParameters2["title"] = "title";
1691
+ SearchParameters2["contact_id"] = "contact_id";
1692
+ SearchParameters2["contact_sub_id"] = "contact_sub_id";
1693
+ SearchParameters2["user_id"] = "user_id";
1694
+ SearchParameters2["currency_id"] = "currency_id";
1695
+ SearchParameters2["total_gross"] = "total_gross";
1696
+ SearchParameters2["total_net"] = "total_net";
1697
+ SearchParameters2["total"] = "total";
1698
+ SearchParameters2["is_valid_from"] = "is_valid_from";
1699
+ SearchParameters2["is_valid_to"] = "is_valid_to";
1700
+ SearchParameters2["is_valid_until"] = "is_valid_until";
1701
+ SearchParameters2["updated_at"] = "updated_at";
1702
+ })(SearchParameters = BillsStatic2.SearchParameters || (BillsStatic2.SearchParameters = {}));
1703
+ })(BillsStatic || (BillsStatic = {}));
1704
+
1705
+ // src/interfaces/BusinessActivitiesStatic.ts
1706
+ var BusinessActivitiesStatic;
1707
+ ((BusinessActivitiesStatic2) => {
1708
+ let BusinessActivitySearchParameters;
1709
+ ((BusinessActivitySearchParameters2) => {
1710
+ BusinessActivitySearchParameters2["name"] = "name";
1711
+ })(BusinessActivitySearchParameters = BusinessActivitiesStatic2.BusinessActivitySearchParameters || (BusinessActivitiesStatic2.BusinessActivitySearchParameters = {}));
1712
+ })(BusinessActivitiesStatic || (BusinessActivitiesStatic = {}));
1713
+
1714
+ // src/interfaces/CalendarStatic.ts
1715
+ var CalendarStatic;
1716
+ ((CalendarStatic2) => {
1717
+ let SearchParameters;
1718
+ ((SearchParameters2) => {
1719
+ SearchParameters2["event_start"] = "event_start";
1720
+ SearchParameters2["event_end"] = "event_end";
1721
+ SearchParameters2["contact_id"] = "contact_id";
1722
+ SearchParameters2["user_id"] = "user_id";
1723
+ SearchParameters2["subject"] = "subject";
1724
+ SearchParameters2["place"] = "place";
1725
+ SearchParameters2["module_id"] = "module_id";
1726
+ SearchParameters2["entry_id"] = "entry_id";
1727
+ })(SearchParameters = CalendarStatic2.SearchParameters || (CalendarStatic2.SearchParameters = {}));
1728
+ })(CalendarStatic || (CalendarStatic = {}));
1729
+
1730
+ // src/interfaces/ContactGroupsStatic.ts
1731
+ var ContactGroupsStatic;
1732
+ ((ContactGroupsStatic2) => {
1733
+ let ContactGroupSearchParameters;
1734
+ ((ContactGroupSearchParameters2) => {
1735
+ ContactGroupSearchParameters2["name"] = "name";
1736
+ })(ContactGroupSearchParameters = ContactGroupsStatic2.ContactGroupSearchParameters || (ContactGroupsStatic2.ContactGroupSearchParameters = {}));
1737
+ })(ContactGroupsStatic || (ContactGroupsStatic = {}));
1738
+
1739
+ // src/interfaces/ContactRelationsStatic.ts
1740
+ var ContactRelationsStatic;
1741
+ ((ContactRelationsStatic2) => {
1742
+ let ContactRelationSearchParameters;
1743
+ ((ContactRelationSearchParameters2) => {
1744
+ ContactRelationSearchParameters2["contact_id"] = "contact_id";
1745
+ ContactRelationSearchParameters2["contact_sub_id"] = "contact_sub_id";
1746
+ ContactRelationSearchParameters2["updated_at"] = "updated_at";
1747
+ })(ContactRelationSearchParameters = ContactRelationsStatic2.ContactRelationSearchParameters || (ContactRelationsStatic2.ContactRelationSearchParameters = {}));
1748
+ })(ContactRelationsStatic || (ContactRelationsStatic = {}));
1749
+
1750
+ // src/interfaces/ContactSectorsStatic.ts
1751
+ var ContactSectorsStatic;
1752
+ ((ContactSectorsStatic2) => {
1753
+ let ContactSectorSearchParameters;
1754
+ ((ContactSectorSearchParameters2) => {
1755
+ ContactSectorSearchParameters2["name"] = "name";
1756
+ })(ContactSectorSearchParameters = ContactSectorsStatic2.ContactSectorSearchParameters || (ContactSectorsStatic2.ContactSectorSearchParameters = {}));
1757
+ })(ContactSectorsStatic || (ContactSectorsStatic = {}));
1758
+
1759
+ // src/interfaces/ContactTypesStatic.ts
1760
+ var ContactTypesStatic;
1761
+ ((ContactTypesStatic2) => {
1762
+ let ContactTypeSearchParameters;
1763
+ ((ContactTypeSearchParameters2) => {
1764
+ ContactTypeSearchParameters2["name"] = "name";
1765
+ })(ContactTypeSearchParameters = ContactTypesStatic2.ContactTypeSearchParameters || (ContactTypesStatic2.ContactTypeSearchParameters = {}));
1766
+ })(ContactTypesStatic || (ContactTypesStatic = {}));
1767
+
1768
+ // src/interfaces/ContactsStatic.ts
1769
+ var ContactsStatic;
1770
+ ((ContactsStatic2) => {
1771
+ let ContactSearchParameters;
1772
+ ((ContactSearchParameters2) => {
1773
+ ContactSearchParameters2["id"] = "id";
1774
+ ContactSearchParameters2["name_1"] = "name_1";
1775
+ ContactSearchParameters2["name_2"] = "name_2";
1776
+ ContactSearchParameters2["nr"] = "nr";
1777
+ ContactSearchParameters2["address"] = "address";
1778
+ ContactSearchParameters2["mail"] = "mail";
1779
+ ContactSearchParameters2["mail_second"] = "mail_second";
1780
+ ContactSearchParameters2["postcode"] = "postcode";
1781
+ ContactSearchParameters2["city"] = "city";
1782
+ ContactSearchParameters2["country_id"] = "country_id";
1783
+ ContactSearchParameters2["contact_group_ids"] = "contact_group_ids";
1784
+ ContactSearchParameters2["contact_type_id"] = "contact_type_id";
1785
+ ContactSearchParameters2["updated_at"] = "updated_at";
1786
+ ContactSearchParameters2["user_id"] = "user_id";
1787
+ ContactSearchParameters2["phone_fixed"] = "phone_fixed";
1788
+ ContactSearchParameters2["phone_mobile"] = "phone_mobile";
1789
+ ContactSearchParameters2["fax"] = "fax";
1790
+ })(ContactSearchParameters = ContactsStatic2.ContactSearchParameters || (ContactsStatic2.ContactSearchParameters = {}));
1791
+ })(ContactsStatic || (ContactsStatic = {}));
1792
+
1793
+ // src/interfaces/ExpensesStatic.ts
1794
+ var ExpensesStatic;
1795
+ ((ExpensesStatic2) => {
1796
+ let SearchParameters;
1797
+ ((SearchParameters2) => {
1798
+ SearchParameters2["id"] = "id";
1799
+ SearchParameters2["kb_item_status_id"] = "kb_item_status_id";
1800
+ SearchParameters2["document_nr"] = "document_nr";
1801
+ SearchParameters2["title"] = "title";
1802
+ SearchParameters2["contact_id"] = "contact_id";
1803
+ SearchParameters2["contact_sub_id"] = "contact_sub_id";
1804
+ SearchParameters2["user_id"] = "user_id";
1805
+ SearchParameters2["currency_id"] = "currency_id";
1806
+ SearchParameters2["total_gross"] = "total_gross";
1807
+ SearchParameters2["total_net"] = "total_net";
1808
+ SearchParameters2["total"] = "total";
1809
+ SearchParameters2["is_valid_from"] = "is_valid_from";
1810
+ SearchParameters2["is_valid_to"] = "is_valid_to";
1811
+ SearchParameters2["is_valid_until"] = "is_valid_until";
1812
+ SearchParameters2["updated_at"] = "updated_at";
1813
+ })(SearchParameters = ExpensesStatic2.SearchParameters || (ExpensesStatic2.SearchParameters = {}));
1814
+ })(ExpensesStatic || (ExpensesStatic = {}));
1815
+
1816
+ // src/interfaces/NotesStatic.ts
1817
+ var NotesStatic;
1818
+ ((NotesStatic2) => {
1819
+ let SearchParameters;
1820
+ ((SearchParameters2) => {
1821
+ SearchParameters2["event_start"] = "event_start";
1822
+ SearchParameters2["contact_id"] = "contact_id";
1823
+ SearchParameters2["user_id"] = "user_id";
1824
+ SearchParameters2["subject"] = "subject";
1825
+ SearchParameters2["module_id"] = "module_id";
1826
+ SearchParameters2["entry_id"] = "entry_id";
1827
+ })(SearchParameters = NotesStatic2.SearchParameters || (NotesStatic2.SearchParameters = {}));
1828
+ })(NotesStatic || (NotesStatic = {}));
1829
+
1830
+ // src/interfaces/OrdersStatic.ts
1831
+ var OrdersStatic;
1832
+ ((OrdersStatic2) => {
1833
+ let OrderSearchParameters;
1834
+ ((OrderSearchParameters2) => {
1835
+ OrderSearchParameters2["id"] = "id";
1836
+ OrderSearchParameters2["kb_item_status_id"] = "kb_item_status_id";
1837
+ OrderSearchParameters2["document_nr"] = "document_nr";
1838
+ OrderSearchParameters2["title"] = "title";
1839
+ OrderSearchParameters2["contact_id"] = "contact_id";
1840
+ OrderSearchParameters2["contact_sub_id"] = "contact_sub_id";
1841
+ OrderSearchParameters2["user_id"] = "user_id";
1842
+ OrderSearchParameters2["currency_id"] = "currency_id";
1843
+ OrderSearchParameters2["total_gross"] = "total_gross";
1844
+ OrderSearchParameters2["total_net"] = "total_net";
1845
+ OrderSearchParameters2["total"] = "total";
1846
+ OrderSearchParameters2["is_valid_from"] = "is_valid_from";
1847
+ OrderSearchParameters2["is_valid_to"] = "is_valid_to";
1848
+ OrderSearchParameters2["is_valid_until"] = "is_valid_until";
1849
+ OrderSearchParameters2["updated_at"] = "updated_at";
1850
+ })(OrderSearchParameters = OrdersStatic2.OrderSearchParameters || (OrdersStatic2.OrderSearchParameters = {}));
1851
+ })(OrdersStatic || (OrdersStatic = {}));
1852
+
1853
+ // src/interfaces/ProjectsStatic.ts
1854
+ var ProjectsStatic;
1855
+ ((ProjectsStatic2) => {
1856
+ let ProjectSearchParameters;
1857
+ ((ProjectSearchParameters2) => {
1858
+ ProjectSearchParameters2["name"] = "name";
1859
+ ProjectSearchParameters2["contact_id"] = "contact_id";
1860
+ ProjectSearchParameters2["pr_state_id"] = "pr_state_id";
1861
+ })(ProjectSearchParameters = ProjectsStatic2.ProjectSearchParameters || (ProjectsStatic2.ProjectSearchParameters = {}));
1862
+ })(ProjectsStatic || (ProjectsStatic = {}));
1863
+
1864
+ // src/interfaces/ProjectStatusesStatic.ts
1865
+ var ProjectStatusesStatic;
1866
+ ((ProjectStatusesStatic2) => {
1867
+ let ProjectStatusSearchParameters;
1868
+ ((ProjectStatusSearchParameters2) => {
1869
+ ProjectStatusSearchParameters2["text"] = "text";
1870
+ })(ProjectStatusSearchParameters = ProjectStatusesStatic2.ProjectStatusSearchParameters || (ProjectStatusesStatic2.ProjectStatusSearchParameters = {}));
1871
+ })(ProjectStatusesStatic || (ProjectStatusesStatic = {}));
1872
+
1873
+ // src/interfaces/ProjectTypesStatic.ts
1874
+ var ProjectTypesStatic;
1875
+ ((ProjectTypesStatic2) => {
1876
+ let ProjectTypeSearchParameters;
1877
+ ((ProjectTypeSearchParameters2) => {
1878
+ ProjectTypeSearchParameters2["project_type"] = "project_type";
1879
+ })(ProjectTypeSearchParameters = ProjectTypesStatic2.ProjectTypeSearchParameters || (ProjectTypesStatic2.ProjectTypeSearchParameters = {}));
1880
+ })(ProjectTypesStatic || (ProjectTypesStatic = {}));
1881
+
1882
+ // src/interfaces/SalesOrderManagementStatic.ts
1883
+ var SalesOrderManagementStatic;
1884
+ ((SalesOrderManagementStatic2) => {
1885
+ let EstimateSearchParameters;
1886
+ ((EstimateSearchParameters2) => {
1887
+ EstimateSearchParameters2["id"] = "id";
1888
+ EstimateSearchParameters2["kb_item_status_id"] = "kb_item_status_id";
1889
+ EstimateSearchParameters2["document_nr"] = "document_nr";
1890
+ EstimateSearchParameters2["title"] = "title";
1891
+ EstimateSearchParameters2["contact_id"] = "contact_id";
1892
+ EstimateSearchParameters2["contact_sub_id"] = "contact_sub_id";
1893
+ EstimateSearchParameters2["user_id"] = "user_id";
1894
+ EstimateSearchParameters2["currency_id"] = "currency_id";
1895
+ EstimateSearchParameters2["total_gross"] = "total_gross";
1896
+ EstimateSearchParameters2["total_net"] = "total_net";
1897
+ EstimateSearchParameters2["total"] = "total";
1898
+ EstimateSearchParameters2["is_valid_from"] = "is_valid_from";
1899
+ EstimateSearchParameters2["is_valid_to"] = "is_valid_to";
1900
+ EstimateSearchParameters2["is_valid_until"] = "is_valid_until";
1901
+ EstimateSearchParameters2["updated_at"] = "updated_at";
1902
+ })(EstimateSearchParameters = SalesOrderManagementStatic2.EstimateSearchParameters || (SalesOrderManagementStatic2.EstimateSearchParameters = {}));
1903
+ let CommentSearchParameters;
1904
+ ((CommentSearchParameters2) => {
1905
+ CommentSearchParameters2["id"] = "id";
1906
+ CommentSearchParameters2["user_id"] = "user_id";
1907
+ CommentSearchParameters2["text"] = "text";
1908
+ CommentSearchParameters2["date"] = "date";
1909
+ CommentSearchParameters2["is_public"] = "is_public";
1910
+ })(CommentSearchParameters = SalesOrderManagementStatic2.CommentSearchParameters || (SalesOrderManagementStatic2.CommentSearchParameters = {}));
1911
+ let OrderSearchParameters;
1912
+ ((OrderSearchParameters2) => {
1913
+ OrderSearchParameters2["id"] = "id";
1914
+ OrderSearchParameters2["kb_item_status_id"] = "kb_item_status_id";
1915
+ OrderSearchParameters2["document_nr"] = "document_nr";
1916
+ OrderSearchParameters2["title"] = "title";
1917
+ OrderSearchParameters2["contact_id"] = "contact_id";
1918
+ OrderSearchParameters2["contact_sub_id"] = "contact_sub_id";
1919
+ OrderSearchParameters2["user_id"] = "user_id";
1920
+ OrderSearchParameters2["currency_id"] = "currency_id";
1921
+ OrderSearchParameters2["total_gross"] = "total_gross";
1922
+ OrderSearchParameters2["total_net"] = "total_net";
1923
+ OrderSearchParameters2["total"] = "total";
1924
+ OrderSearchParameters2["is_valid_from"] = "is_valid_from";
1925
+ OrderSearchParameters2["is_valid_to"] = "is_valid_to";
1926
+ OrderSearchParameters2["is_valid_until"] = "is_valid_until";
1927
+ OrderSearchParameters2["updated_at"] = "updated_at";
1928
+ })(OrderSearchParameters = SalesOrderManagementStatic2.OrderSearchParameters || (SalesOrderManagementStatic2.OrderSearchParameters = {}));
1929
+ let InvoiceSearchParameters;
1930
+ ((InvoiceSearchParameters2) => {
1931
+ InvoiceSearchParameters2["id"] = "id";
1932
+ InvoiceSearchParameters2["kb_item_status_id"] = "kb_item_status_id";
1933
+ InvoiceSearchParameters2["document_nr"] = "document_nr";
1934
+ InvoiceSearchParameters2["title"] = "title";
1935
+ InvoiceSearchParameters2["contact_id"] = "contact_id";
1936
+ InvoiceSearchParameters2["contact_sub_id"] = "contact_sub_id";
1937
+ InvoiceSearchParameters2["user_id"] = "user_id";
1938
+ InvoiceSearchParameters2["currency_id"] = "currency_id";
1939
+ InvoiceSearchParameters2["total_gross"] = "total_gross";
1940
+ InvoiceSearchParameters2["total_net"] = "total_net";
1941
+ InvoiceSearchParameters2["total"] = "total";
1942
+ InvoiceSearchParameters2["is_valid_from"] = "is_valid_from";
1943
+ InvoiceSearchParameters2["is_valid_to"] = "is_valid_to";
1944
+ InvoiceSearchParameters2["is_valid_until"] = "is_valid_until";
1945
+ InvoiceSearchParameters2["updated_at"] = "updated_at";
1946
+ })(InvoiceSearchParameters = SalesOrderManagementStatic2.InvoiceSearchParameters || (SalesOrderManagementStatic2.InvoiceSearchParameters = {}));
1947
+ })(SalesOrderManagementStatic || (SalesOrderManagementStatic = {}));
1948
+
1949
+ // src/interfaces/TimetrackingsStatic.ts
1950
+ var TimetrackingsStatic;
1951
+ ((TimetrackingsStatic2) => {
1952
+ let TimetrackingsSearchParameters;
1953
+ ((TimetrackingsSearchParameters2) => {
1954
+ TimetrackingsSearchParameters2["id"] = "id";
1955
+ TimetrackingsSearchParameters2["client_service_id"] = "client_service_id";
1956
+ TimetrackingsSearchParameters2["contact_id"] = "contact_id";
1957
+ TimetrackingsSearchParameters2["user_id"] = "user_id";
1958
+ TimetrackingsSearchParameters2["pr_project_id"] = "pr_project_id";
1959
+ TimetrackingsSearchParameters2["status_id"] = "status_id";
1960
+ })(TimetrackingsSearchParameters = TimetrackingsStatic2.TimetrackingsSearchParameters || (TimetrackingsStatic2.TimetrackingsSearchParameters = {}));
1961
+ })(TimetrackingsStatic || (TimetrackingsStatic = {}));
1962
+
1963
+ // src/interfaces/TimetrackingStatusesStatic.ts
1964
+ var TimetrackingStatusesStatic;
1965
+ ((TimetrackingStatusesStatic2) => {
1966
+ let TimetrackingStatusesSearchparameters;
1967
+ ((TimetrackingStatusesSearchparameters2) => {
1968
+ TimetrackingStatusesSearchparameters2["name"] = "name";
1969
+ })(TimetrackingStatusesSearchparameters = TimetrackingStatusesStatic2.TimetrackingStatusesSearchparameters || (TimetrackingStatusesStatic2.TimetrackingStatusesSearchparameters = {}));
1970
+ })(TimetrackingStatusesStatic || (TimetrackingStatusesStatic = {}));
1971
+
1972
+ // src/interfaces/UsersStatic.ts
1973
+ var UsersStatic;
1974
+ ((UsersStatic2) => {
1975
+ let UsersSearchparameters;
1976
+ ((UsersSearchparameters2) => {
1977
+ UsersSearchparameters2["id"] = "id";
1978
+ UsersSearchparameters2["nickname"] = "nickname";
1979
+ UsersSearchparameters2["firstname"] = "firstname";
1980
+ UsersSearchparameters2["lastname"] = "lastname";
1981
+ UsersSearchparameters2["color"] = "color";
1982
+ })(UsersSearchparameters = UsersStatic2.UsersSearchparameters || (UsersStatic2.UsersSearchparameters = {}));
1983
+ })(UsersStatic || (UsersStatic = {}));
1984
+
1985
+ // src/interfaces/ItemsStatic.ts
1986
+ var ItemsStatic;
1987
+ ((ItemsStatic2) => {
1988
+ let ItemSearchParameters;
1989
+ ((ItemSearchParameters2) => {
1990
+ ItemSearchParameters2["id"] = "id";
1991
+ ItemSearchParameters2["user_id"] = "user_id";
1992
+ ItemSearchParameters2["article_type_id"] = "article_type_id";
1993
+ ItemSearchParameters2["contact_id"] = "contact_id";
1994
+ ItemSearchParameters2["deliverer_code"] = "deliverer_code";
1995
+ ItemSearchParameters2["deliverer_name"] = "deliverer_name";
1996
+ ItemSearchParameters2["deliverer_description"] = "deliverer_description";
1997
+ ItemSearchParameters2["intern_code"] = "intern_code";
1998
+ ItemSearchParameters2["intern_name"] = "intern_name";
1999
+ ItemSearchParameters2["intern_description"] = "intern_description";
2000
+ ItemSearchParameters2["purchase_price"] = "purchase_price";
2001
+ ItemSearchParameters2["sale_price"] = "sale_price";
2002
+ ItemSearchParameters2["purchase_total"] = "purchase_total";
2003
+ ItemSearchParameters2["sale_total"] = "sale_total";
2004
+ ItemSearchParameters2["currency_id"] = "currency_id";
2005
+ ItemSearchParameters2["tax_income_id"] = "tax_income_id";
2006
+ ItemSearchParameters2["tax_id"] = "tax_id";
2007
+ ItemSearchParameters2["tax_expense_id"] = "tax_expense_id";
2008
+ ItemSearchParameters2["unit_id"] = "unit_id";
2009
+ ItemSearchParameters2["is_stock"] = "is_stock";
2010
+ ItemSearchParameters2["stock_id"] = "stock_id";
2011
+ ItemSearchParameters2["stock_place_id"] = "stock_place_id";
2012
+ ItemSearchParameters2["stock_nr"] = "stock_nr";
2013
+ ItemSearchParameters2["stock_min_nr"] = "stock_min_nr";
2014
+ ItemSearchParameters2["stock_reserved_nr"] = "stock_reserved_nr";
2015
+ ItemSearchParameters2["stock_available_nr"] = "stock_available_nr";
2016
+ ItemSearchParameters2["stock_picked_nr"] = "stock_picked_nr";
2017
+ ItemSearchParameters2["stock_disposed_nr"] = "stock_disposed_nr";
2018
+ ItemSearchParameters2["stock_ordered_nr"] = "stock_ordered_nr";
2019
+ ItemSearchParameters2["width"] = "width";
2020
+ ItemSearchParameters2["height"] = "height";
2021
+ ItemSearchParameters2["weight"] = "weight";
2022
+ ItemSearchParameters2["volume"] = "volume";
2023
+ ItemSearchParameters2["html_text"] = "html_text";
2024
+ ItemSearchParameters2["remarks"] = "remarks";
2025
+ ItemSearchParameters2["delivery_price"] = "delivery_price";
2026
+ ItemSearchParameters2["article_group_id"] = "article_group_id";
2027
+ })(ItemSearchParameters = ItemsStatic2.ItemSearchParameters || (ItemsStatic2.ItemSearchParameters = {}));
2028
+ })(ItemsStatic || (ItemsStatic = {}));
2029
+
2030
+ // src/interfaces/InvoicesStatic.ts
2031
+ var InvoicesStatic;
2032
+ ((InvoicesStatic2) => {
2033
+ let InvoiceSearchParameters;
2034
+ ((InvoiceSearchParameters2) => {
2035
+ InvoiceSearchParameters2["id"] = "id";
2036
+ InvoiceSearchParameters2["kb_item_status_id"] = "kb_item_status_id";
2037
+ InvoiceSearchParameters2["document_nr"] = "document_nr";
2038
+ InvoiceSearchParameters2["title"] = "title";
2039
+ InvoiceSearchParameters2["api_reference"] = "api_reference";
2040
+ InvoiceSearchParameters2["contact_id"] = "contact_id";
2041
+ InvoiceSearchParameters2["contact_sub_id"] = "contact_sub_id";
2042
+ InvoiceSearchParameters2["user_id"] = "user_id";
2043
+ InvoiceSearchParameters2["currency_id"] = "currency_id";
2044
+ InvoiceSearchParameters2["total_gross"] = "total_gross";
2045
+ InvoiceSearchParameters2["total_net"] = "total_net";
2046
+ InvoiceSearchParameters2["total"] = "total";
2047
+ InvoiceSearchParameters2["is_valid_from"] = "is_valid_from";
2048
+ InvoiceSearchParameters2["is_valid_to"] = "is_valid_to";
2049
+ InvoiceSearchParameters2["updated_at"] = "updated_at";
2050
+ })(InvoiceSearchParameters = InvoicesStatic2.InvoiceSearchParameters || (InvoicesStatic2.InvoiceSearchParameters = {}));
2051
+ let KB_ITEM_STATUS;
2052
+ ((KB_ITEM_STATUS2) => {
2053
+ KB_ITEM_STATUS2[KB_ITEM_STATUS2["Draft"] = 7] = "Draft";
2054
+ KB_ITEM_STATUS2[KB_ITEM_STATUS2["Pending"] = 8] = "Pending";
2055
+ KB_ITEM_STATUS2[KB_ITEM_STATUS2["Paid"] = 9] = "Paid";
2056
+ KB_ITEM_STATUS2[KB_ITEM_STATUS2["Partial"] = 16] = "Partial";
2057
+ KB_ITEM_STATUS2[KB_ITEM_STATUS2["Canceled"] = 19] = "Canceled";
2058
+ KB_ITEM_STATUS2[KB_ITEM_STATUS2["Unpaid"] = 31] = "Unpaid";
2059
+ })(KB_ITEM_STATUS = InvoicesStatic2.KB_ITEM_STATUS || (InvoicesStatic2.KB_ITEM_STATUS = {}));
2060
+ let MWST_TYPE;
2061
+ ((MWST_TYPE2) => {
2062
+ MWST_TYPE2[MWST_TYPE2["INCLUDING_TAXES"] = 0] = "INCLUDING_TAXES";
2063
+ MWST_TYPE2[MWST_TYPE2["EXCLUDING_TAXES"] = 1] = "EXCLUDING_TAXES";
2064
+ MWST_TYPE2[MWST_TYPE2["EXEMPT_FROM_TAXES"] = 2] = "EXEMPT_FROM_TAXES";
2065
+ })(MWST_TYPE = InvoicesStatic2.MWST_TYPE || (InvoicesStatic2.MWST_TYPE = {}));
2066
+ let PAYMENT_SERVICE;
2067
+ ((PAYMENT_SERVICE2) => {
2068
+ PAYMENT_SERVICE2[PAYMENT_SERVICE2["PAYPAL"] = 1] = "PAYPAL";
2069
+ PAYMENT_SERVICE2[PAYMENT_SERVICE2["STRIPE"] = 2] = "STRIPE";
2070
+ PAYMENT_SERVICE2[PAYMENT_SERVICE2["SIX_PAYMENTS"] = 3] = "SIX_PAYMENTS";
2071
+ })(PAYMENT_SERVICE = InvoicesStatic2.PAYMENT_SERVICE || (InvoicesStatic2.PAYMENT_SERVICE = {}));
2072
+ })(InvoicesStatic || (InvoicesStatic = {}));
2073
+
2074
+ // src/interfaces/BillsV4Static.ts
2075
+ var BillsV4Static;
2076
+ ((BillsV4Static2) => {
2077
+ let SearchParameters;
2078
+ ((SearchParameters2) => {
2079
+ SearchParameters2["document_no"] = "document_no";
2080
+ SearchParameters2["title"] = "title";
2081
+ SearchParameters2["vendor_ref"] = "vendor_ref";
2082
+ SearchParameters2["currency_code"] = "currency_code";
2083
+ SearchParameters2["lastname_company"] = "lastname_company";
2084
+ SearchParameters2["firstname_suffix"] = "firstname_suffix";
2085
+ })(SearchParameters = BillsV4Static2.SearchParameters || (BillsV4Static2.SearchParameters = {}));
2086
+ let BillStatusUpdate;
2087
+ ((BillStatusUpdate2) => {
2088
+ BillStatusUpdate2["DRAFT"] = "DRAFT";
2089
+ BillStatusUpdate2["BOOKED"] = "BOOKED";
2090
+ })(BillStatusUpdate = BillsV4Static2.BillStatusUpdate || (BillsV4Static2.BillStatusUpdate = {}));
2091
+ let BillAction;
2092
+ ((BillAction2) => {
2093
+ BillAction2["DUPLICATE"] = "DUPLICATE";
2094
+ })(BillAction = BillsV4Static2.BillAction || (BillsV4Static2.BillAction = {}));
2095
+ let BillStatusFilter;
2096
+ ((BillStatusFilter2) => {
2097
+ BillStatusFilter2["DRAFTS"] = "DRAFTS";
2098
+ BillStatusFilter2["TODO"] = "TODO";
2099
+ BillStatusFilter2["PAID"] = "PAID";
2100
+ BillStatusFilter2["OVERDUE"] = "OVERDUE";
2101
+ })(BillStatusFilter = BillsV4Static2.BillStatusFilter || (BillsV4Static2.BillStatusFilter = {}));
2102
+ let PaymentType;
2103
+ ((PaymentType2) => {
2104
+ PaymentType2["IBAN"] = "IBAN";
2105
+ PaymentType2["MANUAL"] = "MANUAL";
2106
+ PaymentType2["QR"] = "QR";
2107
+ })(PaymentType = BillsV4Static2.PaymentType || (BillsV4Static2.PaymentType = {}));
2108
+ let PaymentFee;
2109
+ ((PaymentFee2) => {
2110
+ PaymentFee2["BY_SENDER"] = "BY_SENDER";
2111
+ PaymentFee2["BY_RECEIVER"] = "BY_RECEIVER";
2112
+ PaymentFee2["BREAKDOWN"] = "BREAKDOWN";
2113
+ PaymentFee2["NO_FEE"] = "NO_FEE";
2114
+ })(PaymentFee = BillsV4Static2.PaymentFee || (BillsV4Static2.PaymentFee = {}));
2115
+ let BillStatus;
2116
+ ((BillStatus2) => {
2117
+ BillStatus2["DRAFT"] = "DRAFT";
2118
+ BillStatus2["BOOKED"] = "BOOKED";
2119
+ BillStatus2["PARTIALLY_CREATED"] = "PARTIALLY_CREATED";
2120
+ BillStatus2["CREATED"] = "CREATED";
2121
+ BillStatus2["PARTIALLY_SENT"] = "PARTIALLY_SENT";
2122
+ BillStatus2["SENT"] = "SENT";
2123
+ BillStatus2["PARTIALLY_DOWNLOADED"] = "PARTIALLY_DOWNLOADED";
2124
+ BillStatus2["DOWNLOADED"] = "DOWNLOADED";
2125
+ BillStatus2["PARTIALLY_PAID"] = "PARTIALLY_PAID";
2126
+ BillStatus2["PAID"] = "PAID";
2127
+ BillStatus2["PARTIALLY_FAILED"] = "PARTIALLY_FAILED";
2128
+ BillStatus2["FAILED"] = "FAILED";
2129
+ })(BillStatus = BillsV4Static2.BillStatus || (BillsV4Static2.BillStatus = {}));
2130
+ })(BillsV4Static || (BillsV4Static = {}));
2131
+
2132
+ // src/interfaces/OutgoingPaymentsStatic.ts
2133
+ var OutgoingPaymentsStatic;
2134
+ ((OutgoingPaymentsStatic2) => {
2135
+ let OutgoingPaymentStatus;
2136
+ ((OutgoingPaymentStatus2) => {
2137
+ OutgoingPaymentStatus2["DOWNLOADED"] = "DOWNLOADED";
2138
+ OutgoingPaymentStatus2["OPEN"] = "OPEN";
2139
+ OutgoingPaymentStatus2["RECONCILED"] = "RECONCILED";
2140
+ OutgoingPaymentStatus2["CANCELLED"] = "CANCELLED";
2141
+ OutgoingPaymentStatus2["UPLOADED"] = "UPLOADED";
2142
+ OutgoingPaymentStatus2["REJECTED"] = "REJECTED";
2143
+ })(OutgoingPaymentStatus = OutgoingPaymentsStatic2.OutgoingPaymentStatus || (OutgoingPaymentsStatic2.OutgoingPaymentStatus = {}));
2144
+ let OutgoingPaymentType;
2145
+ ((OutgoingPaymentType2) => {
2146
+ OutgoingPaymentType2["IBAN"] = "IBAN";
2147
+ OutgoingPaymentType2["MANUAL"] = "MANUAL";
2148
+ OutgoingPaymentType2["CASH_DISCOUNT"] = "CASH_DISCOUNT";
2149
+ OutgoingPaymentType2["QR"] = "QR";
2150
+ })(OutgoingPaymentType = OutgoingPaymentsStatic2.OutgoingPaymentType || (OutgoingPaymentsStatic2.OutgoingPaymentType = {}));
2151
+ let FeeType;
2152
+ ((FeeType2) => {
2153
+ FeeType2["BY_SENDER"] = "BY_SENDER";
2154
+ FeeType2["BY_RECEIVER"] = "BY_RECEIVER";
2155
+ FeeType2["BREAKDOWN"] = "BREAKDOWN";
2156
+ FeeType2["NO_FEE"] = "NO_FEE";
2157
+ })(FeeType = OutgoingPaymentsStatic2.FeeType || (OutgoingPaymentsStatic2.FeeType = {}));
2158
+ })(OutgoingPaymentsStatic || (OutgoingPaymentsStatic = {}));
2159
+
2160
+ // src/index.ts
2161
+ var Bexio = class {
2162
+ constructor(token) {
2163
+ this.token = token;
2164
+ this.businessActivities = new ClientServices(this.token);
2165
+ this.contacts = new Contacts(this.token);
2166
+ this.contactTypes = new ContactTypes(this.token);
2167
+ this.contactSectors = new ContactSectors(this.token);
2168
+ this.contactGroups = new ContactGroups(this.token);
2169
+ this.contactRelations = new ContactRelations(this.token);
2170
+ this.orders = new Orders(this.token);
2171
+ this.projects = new Projects(this.token);
2172
+ this.projectStatuses = new ProjectStatuses(this.token);
2173
+ this.projectTypes = new ProjectTypes(this.token);
2174
+ this.expenses = new Expenses(this.token);
2175
+ this.billsV4 = new BillsV4(this.token);
2176
+ this.outgoingPayments = new OutgoingPayments(this.token);
2177
+ this.bills = new Bills(this.token);
2178
+ this.timetrackings = new Timetrackings(this.token);
2179
+ this.timetrackingStatuses = new TimetrackingStatuses(this.token);
2180
+ this.users = new Users(this.token);
2181
+ this.items = new Items(this.token);
2182
+ this.invoices = new Invoices(this.token);
2183
+ this.currencies = new Currencies(this.token);
2184
+ this.bankAccounts = new BankAccounts(this.token);
2185
+ this.accounts = new Accounts(this.token);
2186
+ this.manualEntries = new ManualEntries(this.token);
2187
+ this.taxes = new Taxes(this.token);
2188
+ }
2189
+ };
2190
+ var index_default = Bexio;
2191
+ // Annotate the CommonJS export names for ESM import in node:
2192
+ 0 && (module.exports = {
2193
+ Bexio,
2194
+ BillsStatic,
2195
+ BillsV4Static,
2196
+ BusinessActivitiesStatic,
2197
+ CalendarStatic,
2198
+ ContactGroupsStatic,
2199
+ ContactRelationsStatic,
2200
+ ContactSectorsStatic,
2201
+ ContactTypesStatic,
2202
+ ContactsStatic,
2203
+ ExpensesStatic,
2204
+ InvoicesStatic,
2205
+ ItemsStatic,
2206
+ NotesStatic,
2207
+ OrdersStatic,
2208
+ OutgoingPaymentsStatic,
2209
+ ProjectStatusesStatic,
2210
+ ProjectTypesStatic,
2211
+ ProjectsStatic,
2212
+ SalesOrderManagementStatic,
2213
+ TimetrackingStatusesStatic,
2214
+ TimetrackingsStatic,
2215
+ UsersStatic
2216
+ });
104
2217
  //# sourceMappingURL=index.js.map