node-paymo-api 0.0.3 → 0.0.5

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 (194) hide show
  1. package/.prettierrc +6 -0
  2. package/README.md +24 -1
  3. package/dist/abstract.d.ts +23 -0
  4. package/dist/abstract.js +210 -0
  5. package/dist/index.d.ts +6 -0
  6. package/dist/index.js +18 -0
  7. package/dist/remote.d.ts +9 -0
  8. package/dist/remote.js +80 -0
  9. package/dist/resources/_template_/index.d.ts +18 -0
  10. package/dist/resources/_template_/index.js +34 -0
  11. package/dist/resources/_template_/types.d.ts +25 -0
  12. package/dist/resources/_template_/types.js +2 -0
  13. package/dist/resources/bookings/index.d.ts +18 -0
  14. package/dist/resources/bookings/index.js +49 -0
  15. package/dist/resources/bookings/types.d.ts +49 -0
  16. package/dist/resources/bookings/types.js +2 -0
  17. package/dist/resources/clientcontacts/index.d.ts +18 -0
  18. package/dist/resources/clientcontacts/index.js +34 -0
  19. package/dist/resources/clientcontacts/types.d.ts +59 -0
  20. package/dist/resources/clientcontacts/types.js +2 -0
  21. package/dist/resources/clients/index.d.ts +18 -0
  22. package/dist/resources/clients/index.js +34 -0
  23. package/dist/resources/clients/types.d.ts +71 -0
  24. package/dist/resources/clients/types.js +2 -0
  25. package/dist/resources/comments/Comments.d.ts +18 -0
  26. package/dist/resources/comments/Comments.js +34 -0
  27. package/dist/resources/comments/Threads.d.ts +28 -0
  28. package/dist/resources/comments/Threads.js +25 -0
  29. package/dist/resources/comments/index.d.ts +2 -0
  30. package/dist/resources/comments/index.js +7 -0
  31. package/dist/resources/comments/types.d.ts +77 -0
  32. package/dist/resources/comments/types.js +2 -0
  33. package/dist/resources/company/index.d.ts +12 -0
  34. package/dist/resources/company/index.js +25 -0
  35. package/dist/resources/company/types.d.ts +44 -0
  36. package/dist/resources/company/types.js +2 -0
  37. package/dist/resources/discussions/index.d.ts +18 -0
  38. package/dist/resources/discussions/index.js +34 -0
  39. package/dist/resources/discussions/types.d.ts +43 -0
  40. package/dist/resources/discussions/types.js +2 -0
  41. package/dist/resources/entries/index.d.ts +18 -0
  42. package/dist/resources/entries/index.js +47 -0
  43. package/dist/resources/entries/types.d.ts +53 -0
  44. package/dist/resources/entries/types.js +2 -0
  45. package/dist/resources/estimates/EstimateItem.d.ts +3 -0
  46. package/dist/resources/estimates/EstimateItem.js +5 -0
  47. package/dist/resources/estimates/Estimates.d.ts +18 -0
  48. package/dist/resources/estimates/Estimates.js +34 -0
  49. package/dist/resources/estimates/index.d.ts +2 -0
  50. package/dist/resources/estimates/index.js +7 -0
  51. package/dist/resources/estimates/types.d.ts +76 -0
  52. package/dist/resources/estimates/types.js +2 -0
  53. package/dist/resources/estimatetemplates/index.d.ts +18 -0
  54. package/dist/resources/estimatetemplates/index.js +34 -0
  55. package/dist/resources/estimatetemplates/types.d.ts +34 -0
  56. package/dist/resources/estimatetemplates/types.js +2 -0
  57. package/dist/resources/expenses/index.d.ts +18 -0
  58. package/dist/resources/expenses/index.js +34 -0
  59. package/dist/resources/expenses/types.d.ts +46 -0
  60. package/dist/resources/expenses/types.js +2 -0
  61. package/dist/resources/files/index.d.ts +18 -0
  62. package/dist/resources/files/index.js +45 -0
  63. package/dist/resources/files/types.d.ts +44 -0
  64. package/dist/resources/files/types.js +2 -0
  65. package/dist/resources/index.d.ts +117 -0
  66. package/dist/resources/index.js +200 -0
  67. package/dist/resources/invoices/InvoiceItem.d.ts +3 -0
  68. package/dist/resources/invoices/InvoiceItem.js +5 -0
  69. package/dist/resources/invoices/Invoices.d.ts +18 -0
  70. package/dist/resources/invoices/Invoices.js +34 -0
  71. package/dist/resources/invoices/index.d.ts +2 -0
  72. package/dist/resources/invoices/index.js +7 -0
  73. package/dist/resources/invoices/types.d.ts +87 -0
  74. package/dist/resources/invoices/types.js +2 -0
  75. package/dist/resources/invoicetemplates/index.d.ts +18 -0
  76. package/dist/resources/invoicetemplates/index.js +34 -0
  77. package/dist/resources/invoicetemplates/types.d.ts +34 -0
  78. package/dist/resources/invoicetemplates/types.js +2 -0
  79. package/dist/resources/milestones/index.d.ts +18 -0
  80. package/dist/resources/milestones/index.js +34 -0
  81. package/dist/resources/milestones/types.d.ts +40 -0
  82. package/dist/resources/milestones/types.js +2 -0
  83. package/dist/resources/projects/index.d.ts +20 -0
  84. package/dist/resources/projects/index.js +39 -0
  85. package/dist/resources/projects/types.d.ts +86 -0
  86. package/dist/resources/projects/types.js +14 -0
  87. package/dist/resources/projectstatuses/index.d.ts +18 -0
  88. package/dist/resources/projectstatuses/index.js +34 -0
  89. package/dist/resources/projectstatuses/types.d.ts +32 -0
  90. package/dist/resources/projectstatuses/types.js +2 -0
  91. package/dist/resources/projecttemplates/index.d.ts +18 -0
  92. package/dist/resources/projecttemplates/index.js +34 -0
  93. package/dist/resources/projecttemplates/types.d.ts +29 -0
  94. package/dist/resources/projecttemplates/types.js +2 -0
  95. package/dist/resources/reports/index.d.ts +18 -0
  96. package/dist/resources/reports/index.js +34 -0
  97. package/dist/resources/reports/types.d.ts +90 -0
  98. package/dist/resources/reports/types.js +2 -0
  99. package/dist/resources/sessions/index.d.ts +18 -0
  100. package/dist/resources/sessions/index.js +35 -0
  101. package/dist/resources/sessions/types.d.ts +28 -0
  102. package/dist/resources/sessions/types.js +2 -0
  103. package/dist/resources/tasklists/index.d.ts +18 -0
  104. package/dist/resources/tasklists/index.js +34 -0
  105. package/dist/resources/tasklists/types.d.ts +35 -0
  106. package/dist/resources/tasklists/types.js +2 -0
  107. package/dist/resources/tasks/index.d.ts +18 -0
  108. package/dist/resources/tasks/index.js +34 -0
  109. package/dist/resources/tasks/types.d.ts +64 -0
  110. package/dist/resources/tasks/types.js +2 -0
  111. package/dist/resources/users/index.d.ts +22 -0
  112. package/dist/resources/users/index.js +40 -0
  113. package/dist/resources/users/types.d.ts +86 -0
  114. package/dist/resources/users/types.js +2 -0
  115. package/dist/resources/usertasks/index.d.ts +18 -0
  116. package/dist/resources/usertasks/index.js +41 -0
  117. package/dist/resources/usertasks/types.d.ts +31 -0
  118. package/dist/resources/usertasks/types.js +2 -0
  119. package/dist/resources/workflows/index.d.ts +18 -0
  120. package/dist/resources/workflows/index.js +34 -0
  121. package/dist/resources/workflows/types.d.ts +31 -0
  122. package/dist/resources/workflows/types.js +2 -0
  123. package/dist/resources/workflowstatuses/index.d.ts +18 -0
  124. package/dist/resources/workflowstatuses/index.js +34 -0
  125. package/dist/resources/workflowstatuses/types.d.ts +35 -0
  126. package/dist/resources/workflowstatuses/types.js +2 -0
  127. package/dist/types.d.ts +25 -0
  128. package/dist/types.js +2 -0
  129. package/package.json +13 -3
  130. package/src/abstract.ts +220 -0
  131. package/src/index.ts +23 -0
  132. package/src/remote.ts +77 -0
  133. package/src/resources/_template_/index.ts +38 -0
  134. package/src/resources/_template_/types.ts +40 -0
  135. package/src/resources/bookings/index.ts +61 -0
  136. package/src/resources/bookings/types.ts +60 -0
  137. package/src/resources/clientcontacts/index.ts +38 -0
  138. package/src/resources/clientcontacts/types.ts +69 -0
  139. package/src/resources/clients/index.ts +38 -0
  140. package/src/resources/clients/types.ts +100 -0
  141. package/src/resources/comments/Comments.ts +38 -0
  142. package/src/resources/comments/Threads.ts +28 -0
  143. package/src/resources/comments/index.ts +2 -0
  144. package/src/resources/comments/types.ts +105 -0
  145. package/src/resources/company/index.ts +23 -0
  146. package/src/resources/company/types.ts +52 -0
  147. package/src/resources/discussions/index.ts +38 -0
  148. package/src/resources/discussions/types.ts +53 -0
  149. package/src/resources/entries/index.ts +52 -0
  150. package/src/resources/entries/types.ts +67 -0
  151. package/src/resources/estimates/EstimateItem.ts +6 -0
  152. package/src/resources/estimates/Estimates.ts +38 -0
  153. package/src/resources/estimates/index.ts +2 -0
  154. package/src/resources/estimates/types.ts +89 -0
  155. package/src/resources/estimatetemplates/index.ts +38 -0
  156. package/src/resources/estimatetemplates/types.ts +46 -0
  157. package/src/resources/expenses/index.ts +38 -0
  158. package/src/resources/expenses/types.ts +58 -0
  159. package/src/resources/files/index.ts +50 -0
  160. package/src/resources/files/types.ts +58 -0
  161. package/src/resources/index.ts +289 -0
  162. package/src/resources/invoices/InvoiceItem.ts +6 -0
  163. package/src/resources/invoices/Invoices.ts +38 -0
  164. package/src/resources/invoices/index.ts +2 -0
  165. package/src/resources/invoices/types.ts +102 -0
  166. package/src/resources/invoicetemplates/index.ts +38 -0
  167. package/src/resources/invoicetemplates/types.ts +46 -0
  168. package/src/resources/milestones/index.ts +38 -0
  169. package/src/resources/milestones/types.ts +52 -0
  170. package/src/resources/projects/index.ts +47 -0
  171. package/src/resources/projects/types.ts +134 -0
  172. package/src/resources/projectstatuses/index.ts +38 -0
  173. package/src/resources/projectstatuses/types.ts +44 -0
  174. package/src/resources/projecttemplates/index.ts +40 -0
  175. package/src/resources/projecttemplates/types.ts +43 -0
  176. package/src/resources/reports/index.ts +38 -0
  177. package/src/resources/reports/types.ts +104 -0
  178. package/src/resources/sessions/index.ts +39 -0
  179. package/src/resources/sessions/types.ts +43 -0
  180. package/src/resources/tasklists/index.ts +38 -0
  181. package/src/resources/tasklists/types.ts +48 -0
  182. package/src/resources/tasks/index.ts +38 -0
  183. package/src/resources/tasks/types.ts +76 -0
  184. package/src/resources/users/index.ts +48 -0
  185. package/src/resources/users/types.ts +124 -0
  186. package/src/resources/usertasks/index.ts +46 -0
  187. package/src/resources/usertasks/types.ts +43 -0
  188. package/src/resources/workflows/index.ts +38 -0
  189. package/src/resources/workflows/types.ts +43 -0
  190. package/src/resources/workflowstatuses/index.ts +38 -0
  191. package/src/resources/workflowstatuses/types.ts +47 -0
  192. package/src/types.ts +40 -0
  193. package/tsconfig.json +12 -0
  194. package/lib/index.ts +0 -6
@@ -0,0 +1,53 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface TimeEntriesTypeRead {
3
+ readonly id: number;
4
+ readonly project_id: number;
5
+ readonly created_on: string;
6
+ readonly updated_on: string;
7
+ }
8
+ export interface TimeEntriesTypeUpdate {
9
+ task_id?: number;
10
+ user_id?: number;
11
+ is_bulk?: boolean;
12
+ start_time?: string;
13
+ end_time?: string;
14
+ date?: string;
15
+ duration?: number;
16
+ description?: string;
17
+ added_manually?: boolean;
18
+ billed?: boolean;
19
+ }
20
+ export type TimeEntriesTypeResponse = Merge<TimeEntriesTypeUpdate, Merge<TimeEntriesTypeRead, {}>>;
21
+ interface TimeEntriesTypeCreateCommon extends TimeEntriesTypeUpdate {
22
+ task_id: number;
23
+ }
24
+ interface TimeEntriesTypeCreateRange extends TimeEntriesTypeCreateCommon {
25
+ start_time: string;
26
+ end_time: string;
27
+ }
28
+ interface TimeEntriesTypeCreateDuration extends TimeEntriesTypeCreateCommon {
29
+ date: string;
30
+ duration: number;
31
+ }
32
+ export type TimeEntriesTypeCreate = TimeEntriesTypeCreateRange | TimeEntriesTypeCreateDuration;
33
+ export interface TimeEntriesTypeFilter {
34
+ project_id?: number;
35
+ task_id?: number;
36
+ user_id?: number;
37
+ client_id?: number;
38
+ time_interval?: string[];
39
+ end_time?: string | null;
40
+ }
41
+ export interface TimeEntriesFilterCondition extends TimeEntriesTypeFilter {
42
+ _custom?: {
43
+ [k: string]: {
44
+ key?: Extract<keyof TimeEntriesTypeFilter, string>;
45
+ operator?: FilterOperator;
46
+ value: string | number | boolean | null | number[];
47
+ };
48
+ };
49
+ }
50
+ export interface TimeEntriesListConfig extends GenericListConfig {
51
+ filter?: TimeEntriesFilterCondition;
52
+ }
53
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export declare const EstimateItem: {};
2
+ declare const _default: null;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EstimateItem = void 0;
4
+ exports.EstimateItem = {};
5
+ exports.default = null;
@@ -0,0 +1,18 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract';
2
+ import { AuthInterface } from "../../types";
3
+ import { EstimatesListConfig, EstimatesTypeCreate, EstimatesTypeResponse, EstimatesTypeUpdate } from "./types";
4
+ export interface EstimatesHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<EstimatesTypeResponse | null>;
6
+ list: (config?: EstimatesListConfig) => Promise<EstimatesTypeResponse[]>;
7
+ create: (d: EstimatesTypeCreate) => Promise<EstimatesTypeResponse | null>;
8
+ update: (id: number, data: EstimatesTypeUpdate) => Promise<EstimatesTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ }
11
+ export declare class Estimates extends AbstractResource implements EstimatesHandler {
12
+ constructor(auth: AuthInterface);
13
+ get: (id: number) => Promise<EstimatesTypeResponse | null>;
14
+ list: (config?: EstimatesListConfig) => Promise<EstimatesTypeResponse[]>;
15
+ create: (data: EstimatesTypeCreate) => Promise<EstimatesTypeResponse | null>;
16
+ update: (id: number, data: EstimatesTypeUpdate) => Promise<EstimatesTypeResponse | null>;
17
+ delete: (id: number) => Promise<boolean>;
18
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Estimates = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class Estimates extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'estimates');
17
+ this.get = (id) => __awaiter(this, void 0, void 0, function* () {
18
+ return (yield this.baseGet(id));
19
+ });
20
+ this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
21
+ return (yield this.baseList(config));
22
+ });
23
+ this.create = (data) => __awaiter(this, void 0, void 0, function* () {
24
+ return (yield this.baseCreate(data));
25
+ });
26
+ this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
27
+ return (yield this.baseUpdate(id, data));
28
+ });
29
+ this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
30
+ return yield this.baseDelete(id);
31
+ });
32
+ }
33
+ }
34
+ exports.Estimates = Estimates;
@@ -0,0 +1,2 @@
1
+ export { Estimates, EstimatesHandler } from './Estimates';
2
+ export { EstimateItem } from './EstimateItem';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EstimateItem = exports.Estimates = void 0;
4
+ var Estimates_1 = require("./Estimates");
5
+ Object.defineProperty(exports, "Estimates", { enumerable: true, get: function () { return Estimates_1.Estimates; } });
6
+ var EstimateItem_1 = require("./EstimateItem");
7
+ Object.defineProperty(exports, "EstimateItem", { enumerable: true, get: function () { return EstimateItem_1.EstimateItem; } });
@@ -0,0 +1,76 @@
1
+ import { FilterOperator, GenericListConfig, Merge, PaymoCurrency } from "../../types";
2
+ export interface EstimatesTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ readonly subtotal: number;
7
+ readonly total: number;
8
+ readonly tax_amount: number;
9
+ readonly tax2_amount: number;
10
+ readonly permalink: string;
11
+ readonly pdf_link: string;
12
+ }
13
+ export interface EstimatesTypeUpdate {
14
+ number?: string;
15
+ client_id?: number;
16
+ template_id?: number;
17
+ status?: 'draft' | 'sent' | 'viewed' | 'accepted' | 'invoiced' | 'void';
18
+ currency?: PaymoCurrency;
19
+ date?: string;
20
+ tax?: number;
21
+ tax2?: number;
22
+ tax_on_tax?: boolean;
23
+ bill_to?: string;
24
+ company_info?: string;
25
+ footer?: string;
26
+ notes?: string;
27
+ tax_text?: string;
28
+ tax2_text?: string;
29
+ title?: string;
30
+ invoice_id?: number;
31
+ estimateitems?: EstimateItemTypeCreate[];
32
+ }
33
+ export type EstimatesTypeResponse = Merge<EstimatesTypeUpdate, Merge<EstimatesTypeRead, {
34
+ estimateitems?: EstimateItemTypeRead[];
35
+ }>>;
36
+ export interface EstimatesTypeCreate extends EstimatesTypeUpdate {
37
+ client_id: number;
38
+ currency: PaymoCurrency;
39
+ items?: EstimateItemTypeCreate[];
40
+ }
41
+ export interface EstimatesTypeFilter extends EstimatesTypeUpdate {
42
+ created_on?: string;
43
+ updated_on?: string;
44
+ subtotal?: number;
45
+ total?: number;
46
+ tax_amount?: number;
47
+ tax2_amount?: number;
48
+ }
49
+ export interface EstimatesFilterCondition extends EstimatesTypeFilter {
50
+ _custom?: {
51
+ [k: string]: {
52
+ key?: Extract<keyof EstimatesTypeFilter, string>;
53
+ operator?: FilterOperator;
54
+ value: string | number | boolean | null | number[];
55
+ };
56
+ };
57
+ }
58
+ export interface EstimatesListConfig extends GenericListConfig {
59
+ filter?: EstimatesFilterCondition;
60
+ }
61
+ export interface EstimateItemTypeCreate {
62
+ item: string;
63
+ description: string;
64
+ price_unit: number;
65
+ quantity: number;
66
+ apply_tax?: boolean;
67
+ seq?: number | null;
68
+ }
69
+ export interface EstimateItemTypeRead extends EstimateItemTypeCreate {
70
+ readonly id: number;
71
+ readonly estimate_id: number;
72
+ apply_tax: boolean;
73
+ seq: number | null;
74
+ readonly created_on: string;
75
+ readonly updated_on: string;
76
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract';
2
+ import { AuthInterface } from "../../types";
3
+ import { EstimateTemplatesListConfig, EstimateTemplatesTypeCreate, EstimateTemplatesTypeResponse, EstimateTemplatesTypeUpdate } from "./types";
4
+ export interface EstimateTemplatesHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<EstimateTemplatesTypeResponse | null>;
6
+ list: (config?: EstimateTemplatesListConfig) => Promise<EstimateTemplatesTypeResponse[]>;
7
+ create: (d: EstimateTemplatesTypeCreate) => Promise<EstimateTemplatesTypeResponse | null>;
8
+ update: (id: number, data: EstimateTemplatesTypeUpdate) => Promise<EstimateTemplatesTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ }
11
+ export declare class EstimateTemplates extends AbstractResource implements EstimateTemplatesHandler {
12
+ constructor(auth: AuthInterface);
13
+ get: (id: number) => Promise<EstimateTemplatesTypeResponse | null>;
14
+ list: (config?: EstimateTemplatesListConfig) => Promise<EstimateTemplatesTypeResponse[]>;
15
+ create: (data: EstimateTemplatesTypeCreate) => Promise<EstimateTemplatesTypeResponse | null>;
16
+ update: (id: number, data: EstimateTemplatesTypeUpdate) => Promise<EstimateTemplatesTypeResponse | null>;
17
+ delete: (id: number) => Promise<boolean>;
18
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EstimateTemplates = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class EstimateTemplates extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'estimatetemplates');
17
+ this.get = (id) => __awaiter(this, void 0, void 0, function* () {
18
+ return (yield this.baseGet(id));
19
+ });
20
+ this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
21
+ return (yield this.baseList(config));
22
+ });
23
+ this.create = (data) => __awaiter(this, void 0, void 0, function* () {
24
+ return (yield this.baseCreate(data));
25
+ });
26
+ this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
27
+ return (yield this.baseUpdate(id, data));
28
+ });
29
+ this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
30
+ return yield this.baseDelete(id);
31
+ });
32
+ }
33
+ }
34
+ exports.EstimateTemplates = EstimateTemplates;
@@ -0,0 +1,34 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface EstimateTemplatesTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ }
7
+ export interface EstimateTemplatesTypeUpdate {
8
+ name?: string;
9
+ title?: string;
10
+ html?: string;
11
+ css?: string;
12
+ is_default?: boolean;
13
+ }
14
+ export type EstimateTemplatesTypeResponse = Merge<EstimateTemplatesTypeUpdate, Merge<EstimateTemplatesTypeRead, {}>>;
15
+ export interface EstimateTemplatesTypeCreate extends EstimateTemplatesTypeUpdate {
16
+ name: string;
17
+ }
18
+ export interface EstimateTemplatesTypeFilter {
19
+ id?: number;
20
+ name?: string;
21
+ is_default?: boolean;
22
+ }
23
+ export interface EstimateTemplatesFilterCondition extends EstimateTemplatesTypeFilter {
24
+ _custom?: {
25
+ [k: string]: {
26
+ key?: Extract<keyof EstimateTemplatesTypeFilter, string>;
27
+ operator?: FilterOperator;
28
+ value: string | number | boolean | null | number[];
29
+ };
30
+ };
31
+ }
32
+ export interface EstimateTemplatesListConfig extends GenericListConfig {
33
+ filter?: EstimateTemplatesFilterCondition;
34
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract';
2
+ import { AuthInterface } from "../../types";
3
+ import { ExpensesListConfig, ExpensesTypeCreate, ExpensesTypeResponse, ExpensesTypeUpdate } from "./types";
4
+ export interface ExpensesHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<ExpensesTypeResponse | null>;
6
+ list: (config?: ExpensesListConfig) => Promise<ExpensesTypeResponse[]>;
7
+ create: (d: ExpensesTypeCreate) => Promise<ExpensesTypeResponse | null>;
8
+ update: (id: number, data: ExpensesTypeUpdate) => Promise<ExpensesTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ }
11
+ export declare class Expenses extends AbstractResource implements ExpensesHandler {
12
+ constructor(auth: AuthInterface);
13
+ get: (id: number) => Promise<ExpensesTypeResponse | null>;
14
+ list: (config?: ExpensesListConfig) => Promise<ExpensesTypeResponse[]>;
15
+ create: (data: ExpensesTypeCreate) => Promise<ExpensesTypeResponse | null>;
16
+ update: (id: number, data: ExpensesTypeUpdate) => Promise<ExpensesTypeResponse | null>;
17
+ delete: (id: number) => Promise<boolean>;
18
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Expenses = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class Expenses extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'expenses');
17
+ this.get = (id) => __awaiter(this, void 0, void 0, function* () {
18
+ return (yield this.baseGet(id));
19
+ });
20
+ this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
21
+ return (yield this.baseList(config));
22
+ });
23
+ this.create = (data) => __awaiter(this, void 0, void 0, function* () {
24
+ return (yield this.baseCreate(data));
25
+ });
26
+ this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
27
+ return (yield this.baseUpdate(id, data));
28
+ });
29
+ this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
30
+ return yield this.baseDelete(id);
31
+ });
32
+ }
33
+ }
34
+ exports.Expenses = Expenses;
@@ -0,0 +1,46 @@
1
+ import { FilterOperator, GenericListConfig, Merge, PaymoCurrency } from "../../types";
2
+ export interface ExpensesTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ readonly image_thumb_large?: string;
7
+ readonly image_thumb_medium?: string;
8
+ readonly image_thumb_small?: string;
9
+ }
10
+ export interface ExpensesTypeUpdate {
11
+ client_id?: number;
12
+ project_id?: number;
13
+ user_id?: number;
14
+ amount?: number;
15
+ currency?: PaymoCurrency;
16
+ date?: string;
17
+ notes?: string;
18
+ invoiced?: boolean;
19
+ invoice_item_id?: number;
20
+ tags?: string[];
21
+ file?: string;
22
+ }
23
+ export type ExpensesTypeResponse = Merge<ExpensesTypeUpdate, Merge<ExpensesTypeRead, {}>>;
24
+ export interface ExpensesTypeCreate extends ExpensesTypeUpdate {
25
+ client_id: number;
26
+ currency: PaymoCurrency;
27
+ amount: number;
28
+ }
29
+ export interface ExpensesTypeFilter {
30
+ client_id?: number;
31
+ project_id?: number;
32
+ user_id?: number;
33
+ invoice_item_id?: number;
34
+ }
35
+ export interface ExpensesFilterCondition extends ExpensesTypeFilter {
36
+ _custom?: {
37
+ [k: string]: {
38
+ key?: Extract<keyof ExpensesTypeFilter, string>;
39
+ operator?: FilterOperator;
40
+ value: string | number | boolean | null | number[];
41
+ };
42
+ };
43
+ }
44
+ export interface ExpensesListConfig extends GenericListConfig {
45
+ filter?: ExpensesFilterCondition;
46
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract';
2
+ import { AuthInterface } from "../../types";
3
+ import { FilesListConfig, FilesTypeCreate, FilesTypeResponse, FilesTypeUpdate } from "./types";
4
+ export interface FilesHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<FilesTypeResponse | null>;
6
+ list: (config?: FilesListConfig) => Promise<FilesTypeResponse[]>;
7
+ create: (d: FilesTypeCreate) => Promise<FilesTypeResponse | null>;
8
+ update: (id: number, data: FilesTypeUpdate) => Promise<FilesTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ }
11
+ export declare class Files extends AbstractResource implements FilesHandler {
12
+ constructor(auth: AuthInterface);
13
+ get: (id: number) => Promise<FilesTypeResponse | null>;
14
+ list: (config?: FilesListConfig) => Promise<FilesTypeResponse[]>;
15
+ create: (data: FilesTypeCreate) => Promise<FilesTypeResponse | null>;
16
+ update: (id: number, data: FilesTypeUpdate) => Promise<FilesTypeResponse | null>;
17
+ delete: (id: number) => Promise<boolean>;
18
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Files = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class Files extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'files');
17
+ this.get = (id) => __awaiter(this, void 0, void 0, function* () {
18
+ return (yield this.baseGet(id));
19
+ });
20
+ this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
21
+ const validConfig = !!config &&
22
+ config.filter &&
23
+ (config.filter.project_id ||
24
+ config.filter.task_id ||
25
+ config.filter.discussion_id ||
26
+ config.filter.comment_id);
27
+ if (!validConfig) {
28
+ console.log('File list requires at least one valid filter condition');
29
+ return [];
30
+ }
31
+ return (yield this.baseList(config));
32
+ });
33
+ // Does not work yet, needs multipart upload system
34
+ this.create = (data) => __awaiter(this, void 0, void 0, function* () {
35
+ return (yield this.baseCreate(data));
36
+ });
37
+ this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
38
+ return (yield this.baseUpdate(id, data));
39
+ });
40
+ this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
41
+ return yield this.baseDelete(id);
42
+ });
43
+ }
44
+ }
45
+ exports.Files = Files;
@@ -0,0 +1,44 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface FilesTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ readonly user_id: number | null;
7
+ readonly project_id: number | null;
8
+ readonly discussion_id: number | null;
9
+ readonly task_id: number | null;
10
+ readonly comment_id: number | null;
11
+ readonly token: string;
12
+ readonly size: number;
13
+ readonly mime: string;
14
+ readonly file: string;
15
+ readonly image_thumb_large?: string;
16
+ readonly image_thumb_medium?: string;
17
+ readonly image_thumb_small?: string;
18
+ }
19
+ export interface FilesTypeUpdate {
20
+ original_filename?: string;
21
+ description?: string;
22
+ }
23
+ export type FilesTypeResponse = Merge<FilesTypeUpdate, Merge<FilesTypeRead, {}>>;
24
+ export interface FilesTypeCreate extends FilesTypeUpdate {
25
+ }
26
+ export interface FilesTypeFilter {
27
+ original_filename?: string;
28
+ project_id?: number;
29
+ discussion_id?: number;
30
+ task_id?: number;
31
+ comment_id?: number;
32
+ }
33
+ export interface FilesFilterCondition extends FilesTypeFilter {
34
+ _custom?: {
35
+ [k: string]: {
36
+ key?: Extract<keyof FilesTypeFilter, string>;
37
+ operator?: FilterOperator;
38
+ value: string | number | boolean | null | number[];
39
+ };
40
+ };
41
+ }
42
+ export interface FilesListConfig extends GenericListConfig {
43
+ filter?: FilesFilterCondition;
44
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,117 @@
1
+ import { AuthInterface } from '../types';
2
+ import { ProjectsHandler } from './projects';
3
+ import { ClientsHandler } from './clients';
4
+ import { UsersHandler } from "./users";
5
+ import { BookingsHandler } from "./bookings";
6
+ import { ClientContacts, ClientContactsHandler } from "./clientcontacts";
7
+ import { Comments, CommentsHandler, Threads, ThreadsHandler } from "./comments";
8
+ import { Company, CompanyHandler } from "./company";
9
+ import { Discussions, DiscussionsHandler } from "./discussions";
10
+ import { EstimateTemplates, EstimateTemplatesHandler } from "./estimatetemplates";
11
+ import { Estimates, EstimatesHandler } from "./estimates";
12
+ import { Expenses, ExpensesHandler } from "./expenses";
13
+ import { Files, FilesHandler } from "./files";
14
+ import { InvoiceTemplates, InvoiceTemplatesHandler } from "./invoicetemplates";
15
+ import { Invoices, InvoicesHandler } from "./invoices";
16
+ import { Milestones, MilestonesHandler } from "./milestones";
17
+ import { ProjectTemplates, ProjectTemplatesHandler } from "./projecttemplates";
18
+ import { ProjectStatuses, ProjectStatusesHandler } from "./projectstatuses";
19
+ import { Reports, ReportsHandler } from "./reports";
20
+ import { Sessions, SessionsHandler } from "./sessions";
21
+ import { TaskLists, TaskListsHandler } from "./tasklists";
22
+ import { Tasks, TasksHandler } from "./tasks";
23
+ import { TimeEntries, TimeEntriesHandler } from "./entries";
24
+ import { UserTasks, UserTasksHandler } from "./usertasks";
25
+ import { Workflows, WorkflowsHandler } from "./workflows";
26
+ import { WorkflowStatuses, WorkflowStatusesHandler } from "./workflowstatuses";
27
+ export interface PaymoHandlersContainerInterface {
28
+ projects?: ProjectsHandler;
29
+ clients?: ClientsHandler;
30
+ users?: UsersHandler;
31
+ bookings?: BookingsHandler;
32
+ clientcontacts?: ClientContacts;
33
+ comments?: Comments;
34
+ threads?: Threads;
35
+ company?: Company;
36
+ discussions?: Discussions;
37
+ estimatetemplates?: EstimateTemplates;
38
+ estimates?: Estimates;
39
+ expenses?: Expenses;
40
+ files?: Files;
41
+ invoicetemplates?: InvoiceTemplates;
42
+ invoices?: Invoices;
43
+ milestones?: Milestones;
44
+ projecttemplates?: ProjectTemplates;
45
+ projectstatuses?: ProjectStatuses;
46
+ reports?: Reports;
47
+ sessions?: Sessions;
48
+ tasklists?: TaskLists;
49
+ tasks?: Tasks;
50
+ entries?: TimeEntries;
51
+ usertasks?: UserTasks;
52
+ workflows?: Workflows;
53
+ workflowstatuses?: WorkflowStatuses;
54
+ }
55
+ export interface PaymoResourceHandlerInterface {
56
+ isApiUser: (a: string) => boolean;
57
+ projects: () => ProjectsHandler;
58
+ clients: () => ClientsHandler;
59
+ users: () => UsersHandler;
60
+ bookings: () => BookingsHandler;
61
+ clientcontacts: () => ClientContactsHandler;
62
+ comments: () => CommentsHandler;
63
+ threads: () => ThreadsHandler;
64
+ company: () => CompanyHandler;
65
+ discussions: () => DiscussionsHandler;
66
+ estimatetemplates: () => EstimateTemplatesHandler;
67
+ estimates: () => EstimatesHandler;
68
+ expenses: () => ExpensesHandler;
69
+ files: () => FilesHandler;
70
+ invoicetemplates: () => InvoiceTemplatesHandler;
71
+ invoices: () => InvoicesHandler;
72
+ milestones: () => MilestonesHandler;
73
+ projecttemplates: () => ProjectTemplatesHandler;
74
+ projectstatuses: () => ProjectStatusesHandler;
75
+ reports: () => ReportsHandler;
76
+ sessions: () => SessionsHandler;
77
+ tasklists: () => TaskListsHandler;
78
+ tasks: () => TasksHandler;
79
+ entries: () => TimeEntriesHandler;
80
+ usertasks: () => UserTasksHandler;
81
+ workflows: () => WorkflowsHandler;
82
+ workflowstatuses: () => WorkflowStatusesHandler;
83
+ }
84
+ declare const PaymoResourceHandler: {
85
+ new (u: string, p: string | null): {
86
+ auth: AuthInterface;
87
+ handlers: PaymoHandlersContainerInterface;
88
+ isApiUser: (apiUser: string) => boolean;
89
+ projects: () => ProjectsHandler;
90
+ clients: () => ClientsHandler;
91
+ users: () => UsersHandler;
92
+ bookings: () => BookingsHandler;
93
+ clientcontacts: () => ClientContactsHandler;
94
+ comments: () => CommentsHandler;
95
+ threads: () => ThreadsHandler;
96
+ company: () => CompanyHandler;
97
+ discussions: () => DiscussionsHandler;
98
+ estimatetemplates: () => EstimateTemplatesHandler;
99
+ estimates: () => EstimatesHandler;
100
+ expenses: () => ExpensesHandler;
101
+ files: () => FilesHandler;
102
+ invoicetemplates: () => InvoiceTemplatesHandler;
103
+ invoices: () => InvoicesHandler;
104
+ milestones: () => MilestonesHandler;
105
+ projecttemplates: () => ProjectTemplatesHandler;
106
+ projectstatuses: () => ProjectStatusesHandler;
107
+ reports: () => ReportsHandler;
108
+ sessions: () => SessionsHandler;
109
+ tasklists: () => TaskListsHandler;
110
+ tasks: () => TasksHandler;
111
+ entries: () => TimeEntriesHandler;
112
+ usertasks: () => UserTasksHandler;
113
+ workflows: () => WorkflowsHandler;
114
+ workflowstatuses: () => WorkflowStatusesHandler;
115
+ };
116
+ };
117
+ export default PaymoResourceHandler;