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,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.Tasks = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class Tasks extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'tasks');
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.Tasks = Tasks;
@@ -0,0 +1,64 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface TasksTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ readonly project_id: number;
7
+ }
8
+ export interface TasksTypeUpdate {
9
+ name?: string;
10
+ code?: string;
11
+ tasklist_id?: number;
12
+ seq?: number | null;
13
+ description?: string;
14
+ complete?: boolean;
15
+ due_date?: string;
16
+ user_id?: number;
17
+ users?: number[] | null;
18
+ billable?: boolean;
19
+ flat_billing?: boolean;
20
+ price_per_hour?: number;
21
+ budget_hours?: number;
22
+ estimated_price?: number;
23
+ invoiced?: boolean;
24
+ invoice_item_id?: number;
25
+ priority?: 25 | 50 | 75 | 100;
26
+ status_id?: number;
27
+ }
28
+ export type TasksTypeResponse = Merge<TasksTypeUpdate, Merge<TasksTypeRead, {
29
+ completed_by?: number;
30
+ cover_file_id?: number;
31
+ start_date?: string;
32
+ recurring_profile_id?: number;
33
+ billing_type?: string;
34
+ }>>;
35
+ interface TasksTypeCreateCommon extends TasksTypeUpdate {
36
+ name: string;
37
+ }
38
+ interface TasksTypeCreateWithTaskList extends TasksTypeCreateCommon {
39
+ tasklist_id: number;
40
+ }
41
+ interface TasksTypeCreateWithProject extends TasksTypeCreateCommon {
42
+ project_id: number;
43
+ }
44
+ export type TasksTypeCreate = TasksTypeCreateWithProject | TasksTypeCreateWithTaskList;
45
+ export interface TasksTypeFilter {
46
+ project_id?: number;
47
+ tasklist_id?: number;
48
+ complete?: boolean;
49
+ users?: number | (number | string)[] | 'anyone';
50
+ mytasks?: boolean;
51
+ }
52
+ export interface TasksFilterCondition extends TasksTypeFilter {
53
+ _custom?: {
54
+ [k: string]: {
55
+ key?: Extract<keyof TasksTypeFilter, string>;
56
+ operator?: FilterOperator;
57
+ value: string | number | boolean | null | number[];
58
+ };
59
+ };
60
+ }
61
+ export interface TasksListConfig extends GenericListConfig {
62
+ filter?: TasksFilterCondition;
63
+ }
64
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract';
2
+ import { AuthInterface } from "../../types";
3
+ import { UsersListConfig, UserTypeCreate, UserTypeResponse, UserTypeUpdate } from "./types";
4
+ export interface UsersHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<UserTypeResponse | null>;
6
+ list: (config?: UsersListConfig) => Promise<UserTypeResponse[]>;
7
+ create: (d: UserTypeCreate) => Promise<UserTypeResponse | null>;
8
+ update: (id: number, data: UserTypeUpdate) => Promise<UserTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ retire: (id: number) => Promise<UserTypeResponse | null>;
11
+ activate: (id: number) => Promise<UserTypeResponse | null>;
12
+ }
13
+ export declare class Users extends AbstractResource implements UsersHandler {
14
+ constructor(auth: AuthInterface);
15
+ get: (id: number) => Promise<UserTypeResponse | null>;
16
+ list: (config?: UsersListConfig) => Promise<UserTypeResponse[]>;
17
+ create: (data: UserTypeCreate) => Promise<UserTypeResponse | null>;
18
+ update: (id: number, data: UserTypeUpdate) => Promise<UserTypeResponse | null>;
19
+ delete: (id: number) => Promise<boolean>;
20
+ retire: (id: number) => Promise<UserTypeResponse | null>;
21
+ activate: (id: number) => Promise<UserTypeResponse | null>;
22
+ }
@@ -0,0 +1,40 @@
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.Users = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class Users extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'users');
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
+ this.retire = (id) => __awaiter(this, void 0, void 0, function* () {
33
+ return yield this.update(id, { active: false });
34
+ });
35
+ this.activate = (id) => __awaiter(this, void 0, void 0, function* () {
36
+ return yield this.update(id, { active: true });
37
+ });
38
+ }
39
+ }
40
+ exports.Users = Users;
@@ -0,0 +1,86 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface UserTypeRead {
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
+ readonly is_online?: boolean;
10
+ }
11
+ export interface UserTypeUpdate {
12
+ name?: string;
13
+ email?: string;
14
+ type?: "Admin" | "Employee";
15
+ active?: boolean;
16
+ timezone?: string;
17
+ phone?: string;
18
+ skype?: string;
19
+ position?: string;
20
+ workday_hours?: number;
21
+ price_per_hour?: number;
22
+ image?: string;
23
+ date_format?: "Y-m-d" | "d/m/Y" | "m/d/Y" | "d.m.Y";
24
+ time_format?: "H:i" | "h:i";
25
+ decimal_sep?: string;
26
+ thousands_sep?: string;
27
+ week_start?: "0" | "1" | "2" | "3" | "4" | "5" | "6";
28
+ language?: string;
29
+ theme?: string;
30
+ assigned_projects?: number[];
31
+ managed_projects?: number[];
32
+ password?: string;
33
+ }
34
+ export type UserTypeResponse = Merge<UserTypeUpdate, Merge<UserTypeRead, {
35
+ additional_privileges: any[];
36
+ annual_leave_days_number: number | null;
37
+ image: string | null;
38
+ phone: string | null;
39
+ position: string | null;
40
+ price_per_hour: string | null;
41
+ skype: string | null;
42
+ user_hash: string;
43
+ workflows: number[];
44
+ }>>;
45
+ export interface UserTypeCreate extends UserTypeUpdate {
46
+ email: string;
47
+ }
48
+ export interface UserTypeFilter {
49
+ id?: number;
50
+ created_on?: string;
51
+ updated_on?: string;
52
+ is_online?: boolean;
53
+ name?: string;
54
+ email?: string;
55
+ type?: "Admin" | "Employee";
56
+ active?: boolean;
57
+ timezone?: string;
58
+ phone?: string;
59
+ skype?: string;
60
+ position?: string;
61
+ workday_hours?: number;
62
+ price_per_hour?: number;
63
+ image?: string;
64
+ date_format?: "Y-m-d" | "d/m/Y" | "m/d/Y" | "d.m.Y";
65
+ time_format?: "H:i" | "h:i";
66
+ decimal_sep?: string;
67
+ thousands_sep?: string;
68
+ week_start?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
69
+ language?: string;
70
+ theme?: string;
71
+ assigned_projects?: number[];
72
+ managed_projects?: number[];
73
+ password?: string;
74
+ }
75
+ export interface UserFilterCondition extends UserTypeFilter {
76
+ _custom?: {
77
+ [k: string]: {
78
+ key?: Extract<keyof UserTypeFilter, string>;
79
+ operator?: FilterOperator;
80
+ value: string | number | boolean | null | number[];
81
+ };
82
+ };
83
+ }
84
+ export interface UsersListConfig extends GenericListConfig {
85
+ filter?: UserFilterCondition;
86
+ }
@@ -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 { UserTasksListConfig, UserTasksTypeCreate, UserTasksTypeResponse, UserTasksTypeUpdate } from "./types";
4
+ export interface UserTasksHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<UserTasksTypeResponse | null>;
6
+ list: (config?: UserTasksListConfig) => Promise<UserTasksTypeResponse[]>;
7
+ create: (d: UserTasksTypeCreate) => Promise<UserTasksTypeResponse | null>;
8
+ update: (id: number, data: UserTasksTypeUpdate) => Promise<UserTasksTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ }
11
+ export declare class UserTasks extends AbstractResource implements UserTasksHandler {
12
+ constructor(auth: AuthInterface);
13
+ get: (id: number) => Promise<UserTasksTypeResponse | null>;
14
+ list: (config?: UserTasksListConfig) => Promise<UserTasksTypeResponse[]>;
15
+ create: (data: UserTasksTypeCreate) => Promise<UserTasksTypeResponse | null>;
16
+ update: (id: number, data: UserTasksTypeUpdate) => Promise<UserTasksTypeResponse | null>;
17
+ delete: (id: number) => Promise<boolean>;
18
+ }
@@ -0,0 +1,41 @@
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.UserTasks = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class UserTasks extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'userstasks');
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.user_id || config.filter.task_id);
24
+ if (!validConfig) {
25
+ console.log('User task list requires at least a user_id or task_id filter');
26
+ return [];
27
+ }
28
+ return (yield this.baseList(config));
29
+ });
30
+ this.create = (data) => __awaiter(this, void 0, void 0, function* () {
31
+ return (yield this.baseCreate(data));
32
+ });
33
+ this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
34
+ return (yield this.baseUpdate(id, data));
35
+ });
36
+ this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
37
+ return yield this.baseDelete(id);
38
+ });
39
+ }
40
+ }
41
+ exports.UserTasks = UserTasks;
@@ -0,0 +1,31 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface UserTasksTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ }
7
+ export interface UserTasksTypeUpdate {
8
+ user_id?: number;
9
+ task_id?: number;
10
+ }
11
+ export type UserTasksTypeResponse = Merge<UserTasksTypeUpdate, Merge<UserTasksTypeRead, {}>>;
12
+ export interface UserTasksTypeCreate extends UserTasksTypeUpdate {
13
+ user_id: number;
14
+ task_id: number;
15
+ }
16
+ export interface UserTasksTypeFilter {
17
+ user_id?: number;
18
+ task_id?: number;
19
+ }
20
+ export interface UserTasksFilterCondition extends UserTasksTypeFilter {
21
+ _custom?: {
22
+ [k: string]: {
23
+ key?: Extract<keyof UserTasksTypeFilter, string>;
24
+ operator?: FilterOperator;
25
+ value: string | number | boolean | null | number[];
26
+ };
27
+ };
28
+ }
29
+ export interface UserTasksListConfig extends GenericListConfig {
30
+ filter?: UserTasksFilterCondition;
31
+ }
@@ -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 { WorkflowsListConfig, WorkflowsTypeCreate, WorkflowsTypeResponse, WorkflowsTypeUpdate } from "./types";
4
+ export interface WorkflowsHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<WorkflowsTypeResponse | null>;
6
+ list: (config?: WorkflowsListConfig) => Promise<WorkflowsTypeResponse[]>;
7
+ create: (d: WorkflowsTypeCreate) => Promise<WorkflowsTypeResponse | null>;
8
+ update: (id: number, data: WorkflowsTypeUpdate) => Promise<WorkflowsTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ }
11
+ export declare class Workflows extends AbstractResource implements WorkflowsHandler {
12
+ constructor(auth: AuthInterface);
13
+ get: (id: number) => Promise<WorkflowsTypeResponse | null>;
14
+ list: (config?: WorkflowsListConfig) => Promise<WorkflowsTypeResponse[]>;
15
+ create: (data: WorkflowsTypeCreate) => Promise<WorkflowsTypeResponse | null>;
16
+ update: (id: number, data: WorkflowsTypeUpdate) => Promise<WorkflowsTypeResponse | 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.Workflows = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class Workflows extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'workflows');
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.Workflows = Workflows;
@@ -0,0 +1,31 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface WorkflowsTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ }
7
+ export interface WorkflowsTypeUpdate {
8
+ name?: string;
9
+ is_default?: boolean;
10
+ }
11
+ export type WorkflowsTypeResponse = Merge<WorkflowsTypeUpdate, Merge<WorkflowsTypeRead, {}>>;
12
+ export interface WorkflowsTypeCreate extends WorkflowsTypeUpdate {
13
+ name: string;
14
+ }
15
+ export interface WorkflowsTypeFilter {
16
+ id?: number;
17
+ name?: string;
18
+ is_default?: boolean;
19
+ }
20
+ export interface WorkflowsFilterCondition extends WorkflowsTypeFilter {
21
+ _custom?: {
22
+ [k: string]: {
23
+ key?: Extract<keyof WorkflowsTypeFilter, string>;
24
+ operator?: FilterOperator;
25
+ value: string | number | boolean | null | number[];
26
+ };
27
+ };
28
+ }
29
+ export interface WorkflowsListConfig extends GenericListConfig {
30
+ filter?: WorkflowsFilterCondition;
31
+ }
@@ -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 { WorkflowStatusesListConfig, WorkflowStatusesTypeCreate, WorkflowStatusesTypeResponse, WorkflowStatusesTypeUpdate } from "./types";
4
+ export interface WorkflowStatusesHandler extends AbstractResourceInterface {
5
+ get: (id: number) => Promise<WorkflowStatusesTypeResponse | null>;
6
+ list: (config?: WorkflowStatusesListConfig) => Promise<WorkflowStatusesTypeResponse[]>;
7
+ create: (d: WorkflowStatusesTypeCreate) => Promise<WorkflowStatusesTypeResponse | null>;
8
+ update: (id: number, data: WorkflowStatusesTypeUpdate) => Promise<WorkflowStatusesTypeResponse | null>;
9
+ delete: (id: number) => Promise<boolean>;
10
+ }
11
+ export declare class WorkflowStatuses extends AbstractResource implements WorkflowStatusesHandler {
12
+ constructor(auth: AuthInterface);
13
+ get: (id: number) => Promise<WorkflowStatusesTypeResponse | null>;
14
+ list: (config?: WorkflowStatusesListConfig) => Promise<WorkflowStatusesTypeResponse[]>;
15
+ create: (data: WorkflowStatusesTypeCreate) => Promise<WorkflowStatusesTypeResponse | null>;
16
+ update: (id: number, data: WorkflowStatusesTypeUpdate) => Promise<WorkflowStatusesTypeResponse | 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.WorkflowStatuses = void 0;
13
+ const abstract_1 = require("../../abstract");
14
+ class WorkflowStatuses extends abstract_1.AbstractResource {
15
+ constructor(auth) {
16
+ super(auth, 'workflowstatuses');
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.WorkflowStatuses = WorkflowStatuses;
@@ -0,0 +1,35 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types";
2
+ export interface WorkflowStatusesTypeRead {
3
+ readonly id: number;
4
+ readonly created_on: string;
5
+ readonly updated_on: string;
6
+ readonly seq: number;
7
+ readonly action: '' | 'complete' | 'backlog';
8
+ }
9
+ export interface WorkflowStatusesTypeUpdate {
10
+ name?: string;
11
+ workflow_id?: number;
12
+ color?: string;
13
+ }
14
+ export type WorkflowStatusesTypeResponse = Merge<WorkflowStatusesTypeUpdate, Merge<WorkflowStatusesTypeRead, {}>>;
15
+ export interface WorkflowStatusesTypeCreate extends WorkflowStatusesTypeUpdate {
16
+ name: string;
17
+ color: string;
18
+ workflow_id: number;
19
+ }
20
+ export interface WorkflowStatusesTypeFilter {
21
+ name?: string;
22
+ workflow_id?: number;
23
+ }
24
+ export interface WorkflowStatusesFilterCondition extends WorkflowStatusesTypeFilter {
25
+ _custom?: {
26
+ [k: string]: {
27
+ key?: Extract<keyof WorkflowStatusesTypeFilter, string>;
28
+ operator?: FilterOperator;
29
+ value: string | number | boolean | null | number[];
30
+ };
31
+ };
32
+ }
33
+ export interface WorkflowStatusesListConfig extends GenericListConfig {
34
+ filter?: WorkflowStatusesFilterCondition;
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ export interface AuthInterface {
2
+ userApi: string;
3
+ password: string;
4
+ }
5
+ export type FilterOperator = '=' | '<=' | '>=' | '>' | '<' | '!=' | 'like' | 'not like' | 'in' | 'not in';
6
+ export type GenericCustomFilterType = {
7
+ [k: string]: {
8
+ key?: string;
9
+ operator?: FilterOperator;
10
+ value: string | number | boolean | null | number[];
11
+ };
12
+ };
13
+ export type GenericFilterType = {
14
+ [key: string]: any;
15
+ } & {
16
+ _custom?: GenericCustomFilterType;
17
+ };
18
+ export interface GenericListConfig {
19
+ filter?: GenericFilterType;
20
+ include?: string[];
21
+ }
22
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
23
+ export type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
24
+ export type PaymoCurrency = 'AED' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'BAM' | 'BDT' | 'BGN' | 'BRL' | 'BWP' | 'CAD' | 'CFP' | 'CHF' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'CRC' | 'CZK' | 'DKK' | 'DOP' | 'DZD' | 'EEK' | 'EGP' | 'EUR' | 'GBP' | 'GTQ' | 'HKD' | 'HRK' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LKR' | 'LTL' | 'LVL' | 'MAD' | 'MDL' | 'MUR' | 'MXN' | 'MYR' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NZD' | 'OMR' | 'PEN' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RMB' | 'RON' | 'RSD' | 'RUB' | 'SAR' | 'SEK' | 'SGD' | 'SKK' | 'TBH' | 'TND' | 'TRY' | 'TTD' | 'TWD' | 'U$S' | 'UAH' | 'US$' | 'USD' | 'UYU' | 'VEF' | 'VND' | 'ZAR';
25
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "node-paymo-api",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Complete object based implementation of the paymoapp.com API",
5
- "main": "lib/index.ts",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "author": "Joel Colombo <jc-dev@360psg.com>",
7
8
  "license": "MIT",
8
9
  "homepage": "https://github.com/jcolombo/node-paymo-api",
@@ -12,6 +13,15 @@
12
13
  "type": "git"
13
14
  },
14
15
  "dependencies": {
15
- "axios": "^0.19.0"
16
+ "axios": "^0.34.0"
17
+ },
18
+ "devDependencies": {
19
+ "prettier": "^1.19.1",
20
+ "typescript": "^5"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "watch": "tsc --watch",
25
+ "prepack": "tsc"
16
26
  }
17
27
  }