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,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { InvoicesListConfig, InvoicesTypeCreate, InvoicesTypeResponse, InvoicesTypeUpdate } from "./types"
4
+
5
+ export interface InvoicesHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<InvoicesTypeResponse | null>
7
+ list: (config?: InvoicesListConfig) => Promise<InvoicesTypeResponse[]>
8
+ create: (d: InvoicesTypeCreate) => Promise<InvoicesTypeResponse | null>
9
+ update: (id: number, data: InvoicesTypeUpdate) => Promise<InvoicesTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class Invoices extends AbstractResource implements InvoicesHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'invoices')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as InvoicesTypeResponse | null
20
+ }
21
+
22
+ list = async (config: InvoicesListConfig = {}) => {
23
+ return (await this.baseList(config)) as InvoicesTypeResponse[]
24
+ }
25
+
26
+ create = async (data: InvoicesTypeCreate) => {
27
+ return (await this.baseCreate(data)) as InvoicesTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: InvoicesTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as InvoicesTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,2 @@
1
+ export { Invoices, InvoicesHandler } from './Invoices';
2
+ export { InvoiceItem } from './InvoiceItem';
@@ -0,0 +1,102 @@
1
+ import { FilterOperator, GenericListConfig, Merge, PaymoCurrency } from "../../types"
2
+
3
+
4
+ // PAYMO API DOCS - 2019-12-11 /invoices /invoices/####
5
+ // =================================================================================================
6
+
7
+ export interface InvoicesTypeRead {
8
+ readonly id: number
9
+ readonly created_on: string
10
+ readonly updated_on: string
11
+ readonly subtotal : number
12
+ readonly total : number
13
+ readonly tax_amount : number
14
+ readonly tax2_amount : number
15
+ readonly discount_amount : number
16
+ readonly reminder_1_sent : boolean
17
+ readonly reminder_2_sent : boolean
18
+ readonly reminder_3_sent : boolean
19
+ readonly permalink : string
20
+ readonly pdf_link : string
21
+ }
22
+
23
+ export interface InvoicesTypeUpdate {
24
+ number?: string
25
+ client_id?: number
26
+ template_id?: number
27
+ status?: 'draft' | 'sent' | 'viewed' |'paid' | 'void'
28
+ currency?: PaymoCurrency
29
+ date?: string
30
+ due_date?: string
31
+ tax?: number
32
+ tax2?: number
33
+ discount?: number
34
+ tax_on_tax?: boolean
35
+ bill_to?: string
36
+ company_info?: string
37
+ footer?: string
38
+ notes?: string
39
+ outstanding?: number
40
+ tax_text?:string
41
+ tax2_text?:string
42
+ discount_text?:string
43
+ title?:string
44
+ pay_online?: boolean
45
+
46
+ invoiceitems?: InvoiceItemTypeCreate[] // Not sure if this is how you update items or not !
47
+ }
48
+
49
+ export type InvoicesTypeResponse = Merge<InvoicesTypeUpdate, Merge<InvoicesTypeRead, {
50
+ invoiceitems?: InvoiceItemTypeRead[]
51
+ }>>
52
+
53
+ export interface InvoicesTypeCreate extends InvoicesTypeUpdate {
54
+ client_id: number
55
+ currency: PaymoCurrency
56
+ items?:InvoiceItemTypeCreate[]
57
+ }
58
+
59
+ export interface InvoicesTypeFilter extends InvoicesTypeUpdate {
60
+ created_on?: string
61
+ updated_on?: string
62
+ subtotal?: number
63
+ total?: number
64
+ tax_amount?: number
65
+ tax2_amount?: number
66
+ }
67
+
68
+ export interface InvoicesFilterCondition extends InvoicesTypeFilter {
69
+ _custom?: {
70
+ [k: string]: {
71
+ key?: Extract<keyof InvoicesTypeFilter, string>
72
+ operator?:FilterOperator
73
+ value: string | number | boolean | null | number[]
74
+ }
75
+ }
76
+ }
77
+
78
+ export interface InvoicesListConfig extends GenericListConfig {
79
+ filter?:InvoicesFilterCondition
80
+ }
81
+
82
+ export interface InvoiceItemTypeCommon {
83
+ item: string
84
+ description: string
85
+ price_unit: number
86
+ quantity: number
87
+ expense_id?: number
88
+ apply_tax?: boolean
89
+ seq?: number | null
90
+ }
91
+
92
+ export interface InvoiceItemTypeCreate extends InvoiceItemTypeCommon {
93
+ entries?: number[] // Array of entries (Time Entries) to be added as line items as billed
94
+ }
95
+
96
+ export interface InvoiceItemTypeRead extends InvoiceItemTypeCommon {
97
+ readonly id: number
98
+ apply_tax: boolean
99
+ seq: number | null
100
+ readonly created_on: string
101
+ readonly updated_on: string
102
+ }
@@ -0,0 +1,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { InvoiceTemplatesListConfig, InvoiceTemplatesTypeCreate, InvoiceTemplatesTypeResponse, InvoiceTemplatesTypeUpdate } from "./types"
4
+
5
+ export interface InvoiceTemplatesHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<InvoiceTemplatesTypeResponse | null>
7
+ list: (config?: InvoiceTemplatesListConfig) => Promise<InvoiceTemplatesTypeResponse[]>
8
+ create: (d: InvoiceTemplatesTypeCreate) => Promise<InvoiceTemplatesTypeResponse | null>
9
+ update: (id: number, data: InvoiceTemplatesTypeUpdate) => Promise<InvoiceTemplatesTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class InvoiceTemplates extends AbstractResource implements InvoiceTemplatesHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'invoicetemplates')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as InvoiceTemplatesTypeResponse | null
20
+ }
21
+
22
+ list = async (config: InvoiceTemplatesListConfig = {}) => {
23
+ return (await this.baseList(config)) as InvoiceTemplatesTypeResponse[]
24
+ }
25
+
26
+ create = async (data: InvoiceTemplatesTypeCreate) => {
27
+ return (await this.baseCreate(data)) as InvoiceTemplatesTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: InvoiceTemplatesTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as InvoiceTemplatesTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,46 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /invoicetemplates /invoicetemplates/####
4
+ // =================================================================================================
5
+
6
+ export interface InvoiceTemplatesTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ }
11
+
12
+ export interface InvoiceTemplatesTypeUpdate {
13
+ name?:string
14
+ title?:string
15
+ html?:string
16
+ css?:string
17
+ is_default?:boolean
18
+ }
19
+
20
+ export type InvoiceTemplatesTypeResponse = Merge<InvoiceTemplatesTypeUpdate, Merge<InvoiceTemplatesTypeRead, {
21
+
22
+ }>>
23
+
24
+ export interface InvoiceTemplatesTypeCreate extends InvoiceTemplatesTypeUpdate {
25
+ name: string
26
+ }
27
+
28
+ export interface InvoiceTemplatesTypeFilter {
29
+ id?:number
30
+ name?: string
31
+ is_default?: boolean
32
+ }
33
+
34
+ export interface InvoiceTemplatesFilterCondition extends InvoiceTemplatesTypeFilter {
35
+ _custom?: {
36
+ [k: string]: {
37
+ key?: Extract<keyof InvoiceTemplatesTypeFilter, string>
38
+ operator?:FilterOperator
39
+ value: string | number | boolean | null | number[]
40
+ }
41
+ }
42
+ }
43
+
44
+ export interface InvoiceTemplatesListConfig extends GenericListConfig {
45
+ filter?:InvoiceTemplatesFilterCondition
46
+ }
@@ -0,0 +1,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { MilestonesListConfig, MilestonesTypeCreate, MilestonesTypeResponse, MilestonesTypeUpdate } from "./types"
4
+
5
+ export interface MilestonesHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<MilestonesTypeResponse | null>
7
+ list: (config?: MilestonesListConfig) => Promise<MilestonesTypeResponse[]>
8
+ create: (d: MilestonesTypeCreate) => Promise<MilestonesTypeResponse | null>
9
+ update: (id: number, data: MilestonesTypeUpdate) => Promise<MilestonesTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class Milestones extends AbstractResource implements MilestonesHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'milestones')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as MilestonesTypeResponse | null
20
+ }
21
+
22
+ list = async (config: MilestonesListConfig = {}) => {
23
+ return (await this.baseList(config)) as MilestonesTypeResponse[]
24
+ }
25
+
26
+ create = async (data: MilestonesTypeCreate) => {
27
+ return (await this.baseCreate(data)) as MilestonesTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: MilestonesTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as MilestonesTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,52 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /milestones /milestones/####
4
+ // =================================================================================================
5
+
6
+ export interface MilestonesTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ readonly reminder_sent: boolean
11
+ }
12
+
13
+ export interface MilestonesTypeUpdate {
14
+ name?: string
15
+ project_id?: number
16
+ user_id?: number
17
+ due_date?: string
18
+ send_reminder?: number
19
+ complete?: boolean
20
+ linked_tasklists?: number[]
21
+ }
22
+
23
+ export type MilestonesTypeResponse = Merge<MilestonesTypeUpdate, Merge<MilestonesTypeRead, {
24
+
25
+ }>>
26
+
27
+ export interface MilestonesTypeCreate extends MilestonesTypeUpdate {
28
+ name: string
29
+ project_id: number
30
+ due_date: string
31
+ }
32
+
33
+ export interface MilestonesTypeFilter {
34
+ project_id?: number
35
+ user_id?: number
36
+ due_date?: string
37
+ complete?: boolean
38
+ }
39
+
40
+ export interface MilestonesFilterCondition extends MilestonesTypeFilter {
41
+ _custom?: {
42
+ [k: string]: {
43
+ key?: Extract<keyof MilestonesTypeFilter, string>
44
+ operator?:FilterOperator
45
+ value: string | number | boolean | null | number[]
46
+ }
47
+ }
48
+ }
49
+
50
+ export interface MilestonesListConfig extends GenericListConfig {
51
+ filter?:MilestonesFilterCondition
52
+ }
@@ -0,0 +1,47 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { ProjectsListConfig, ProjectTypeCreate, ProjectTypeResponse, ProjectTypeUpdate } from "./types"
4
+
5
+ export interface ProjectsHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<ProjectTypeResponse | null>
7
+ list: (config?: ProjectsListConfig) => Promise<ProjectTypeResponse[]>
8
+ create: (d: ProjectTypeCreate) => Promise<ProjectTypeResponse | null>
9
+ update: (id: number, data: ProjectTypeUpdate) => Promise<ProjectTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ reorderTaskLists: (id: number, tli: number[]) => Promise<ProjectTypeResponse | null>
12
+ }
13
+
14
+ export class Projects extends AbstractResource implements ProjectsHandler {
15
+ constructor(auth: AuthInterface) {
16
+ super(auth, 'projects')
17
+ }
18
+
19
+ get = async (id: number) => {
20
+ return (await this.baseGet(id)) as ProjectTypeResponse | null
21
+ }
22
+
23
+ list = async (config: ProjectsListConfig = {}) => {
24
+ return (await this.baseList(config)) as ProjectTypeResponse[]
25
+ }
26
+
27
+ create = async (data: ProjectTypeCreate) => {
28
+ return (await this.baseCreate(data)) as ProjectTypeResponse | null
29
+ }
30
+
31
+ update = async (id: number, data: ProjectTypeUpdate) => {
32
+ return (await this.baseUpdate(id, data)) as ProjectTypeResponse | null
33
+ }
34
+
35
+ delete = async (id: number) => {
36
+ return await this.baseDelete(id)
37
+ }
38
+
39
+ reorderTaskLists = async (
40
+ id: number,
41
+ taskListIds: number[]
42
+ ) => {
43
+ return (await this.baseUpdate(id, {
44
+ tasklists_order: taskListIds,
45
+ })) as ProjectTypeResponse | null
46
+ }
47
+ }
@@ -0,0 +1,134 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-11-23 /projects /projects/####
4
+ // =================================================================================================
5
+ // id integer (read-only) Unique project identifier
6
+ // name text Project name
7
+ // code text Project code can only contain alphanumeric characters (letters A-Z, numbers 0-9). Project code is used as a prefix in task code.
8
+ // task_code_increment integer (read-only) This is the sequence of the last task from this project.
9
+ // description text Project description
10
+ // client_id integer Id of the client for whom the project was created
11
+ // status_id integer Status id
12
+ // active boolean If true the project is being active (you can add time to its tasks), otherwise it is archived (you cannot add time to its tasks)
13
+ // color text An RGB value representing a color for the project when used in charts.
14
+ // users list A list of ids of users assigned to the project. This list contains also the ids of the managers for this project.
15
+ // managers list A list of ids of users that are managers for the project. It is a subset of the users list.
16
+ // billable boolean If true the project is billable. See billing.
17
+ // flat_billing boolean For billable projects, if true the project is flat rate, otherwise the project is time & materials. See billing.
18
+ // price_per_hour decimal For time & materials projects, the project hourly rate. Note: which hourly rate (user, task, project, or company) will be used for billing is defined by the hourly_billing_mode field.
19
+ // price decimal For flat rate project, the project flat rate. See billing.
20
+ // estimated_price decimal For billable projects, the estimated project price consisting of the price of all its billable tasks (including flat rate tasks).
21
+ // hourly_billing_mode text For time & materials projects, defines the hierarchy of rates used when deciding on the hourly rate for billing the time in the project. See billing.
22
+ // budget_hours decimal Project budget in hours. If not set, the project will have unlimited budget hours.
23
+ // adjustable_hours boolean If true the budget_hours will be adjusted automatically based on tasks budget hours.
24
+ // invoiced boolean For flat rate projects, if true, the project was already invoiced.
25
+ // invoice_item_id integer For flat rate projects, if set, the ID of the invoice line (part of the invoice for the project).
26
+ // workflow_id integer Id of the workflow. See workflows
27
+ // created_on datetime (read-only) Date and time when the project was created
28
+ // updated_on datetime (read-only) Date and time when the project was last updated
29
+
30
+ export interface ProjectTypeRead {
31
+ readonly id: number
32
+ readonly task_code_increment: number
33
+ readonly created_on: string
34
+ readonly updated_on: string
35
+ readonly billing_type: string // undocumented
36
+ }
37
+
38
+ export interface ProjectTypeUpdate {
39
+ name?: string
40
+ client_id?: number
41
+ code?: string
42
+ description?: string
43
+ status_id?: number
44
+ active?: boolean
45
+ color?: string
46
+ users?: number[]
47
+ managers?: number[]
48
+ billable?: boolean
49
+ flat_billing?: boolean
50
+ price_per_hour?: number
51
+ price?: number
52
+ estimated_price?: number | string
53
+ hourly_billing_mode?: string
54
+ budget_hours?: number
55
+ adjustable_hours?: boolean
56
+ invoiced?: boolean
57
+ invoice_item_id?: number
58
+ workflow_id?: number
59
+ template_id?: number
60
+ tasklists_order?: number[]
61
+ }
62
+
63
+ export type ProjectTypeResponse = Merge<ProjectTypeRead, Merge<ProjectTypeUpdate, {
64
+ description?: string | null
65
+ color?: string | null
66
+ price_per_hour?: number | null
67
+ price?: number | null
68
+ hourly_billing_mode?: string | null
69
+ budget_hours?: number | null
70
+ adjustable_hours?: boolean | null
71
+ invoice_item_id?: number | null
72
+ }>>
73
+
74
+ export interface ProjectTypeCreate extends ProjectTypeUpdate {
75
+ name: string
76
+ client_id: number
77
+ }
78
+
79
+ export interface ProjectTypeFilter {
80
+ id?: number
81
+ task_code_increment?: number
82
+ created_on?: string
83
+ updated_on?: string
84
+ billing_type?: string
85
+ name?: string
86
+ client_id?: number
87
+ code?: string
88
+ description?: string | null
89
+ status_id?: number
90
+ active?: boolean
91
+ color?: string | null
92
+ users?: number | number[]
93
+ managers?: number | number[]
94
+ billable?: boolean
95
+ flat_billing?: boolean
96
+ price_per_hour?: number | null
97
+ price?: number | null
98
+ estimated_price?: number | string
99
+ hourly_billing_mode?: string | null
100
+ budget_hours?: number | null
101
+ adjustable_hours?: boolean
102
+ invoiced?: boolean
103
+ invoice_item_id?: number | null
104
+ workflow_id?: number
105
+ template_id?: number
106
+ }
107
+
108
+ export interface ProjectFilterCondition extends ProjectTypeFilter {
109
+ _custom?: {
110
+ [k: string]: {
111
+ key?: Extract<keyof ProjectTypeFilter, string>
112
+ operator?:FilterOperator
113
+ value: string | number | boolean | null | number[]
114
+ }
115
+ }
116
+ }
117
+
118
+ export interface ProjectsListConfig extends GenericListConfig {
119
+ filter?:ProjectFilterCondition
120
+ }
121
+
122
+ // export type ProjectInclude =
123
+ // | 'client'
124
+ // | ClientChildrenInclude
125
+ // | 'projectstatus'
126
+ // | 'tasklists'
127
+ // | 'tasks'
128
+ // | 'tasks.entries'
129
+ // | 'milestones'
130
+ // | 'discussions'
131
+ // | 'files'
132
+ // | 'invoiceitem'
133
+ // | 'workflow'
134
+
@@ -0,0 +1,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { ProjectStatusesListConfig, ProjectStatusesTypeCreate, ProjectStatusesTypeResponse, ProjectStatusesTypeUpdate } from "./types"
4
+
5
+ export interface ProjectStatusesHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<ProjectStatusesTypeResponse | null>
7
+ list: (config?: ProjectStatusesListConfig) => Promise<ProjectStatusesTypeResponse[]>
8
+ create: (d: ProjectStatusesTypeCreate) => Promise<ProjectStatusesTypeResponse | null>
9
+ update: (id: number, data: ProjectStatusesTypeUpdate) => Promise<ProjectStatusesTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class ProjectStatuses extends AbstractResource implements ProjectStatusesHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'projectstatuses')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as ProjectStatusesTypeResponse | null
20
+ }
21
+
22
+ list = async (config: ProjectStatusesListConfig = {}) => {
23
+ return (await this.baseList(config)) as ProjectStatusesTypeResponse[]
24
+ }
25
+
26
+ create = async (data: ProjectStatusesTypeCreate) => {
27
+ return (await this.baseCreate(data)) as ProjectStatusesTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: ProjectStatusesTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as ProjectStatusesTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,44 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /projectstatuses /projectstatuses/####
4
+ // =================================================================================================
5
+
6
+ export interface ProjectStatusesTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ readonly readonly: boolean
11
+ }
12
+
13
+ export interface ProjectStatusesTypeUpdate {
14
+ name?: string
15
+ active?: boolean
16
+ seq?: number | null
17
+ }
18
+
19
+ export type ProjectStatusesTypeResponse = Merge<ProjectStatusesTypeUpdate, Merge<ProjectStatusesTypeRead, {
20
+
21
+ }>>
22
+
23
+ export interface ProjectStatusesTypeCreate extends ProjectStatusesTypeUpdate {
24
+ name:string
25
+ }
26
+
27
+ export interface ProjectStatusesTypeFilter {
28
+ name?:string
29
+ active?:boolean
30
+ }
31
+
32
+ export interface ProjectStatusesFilterCondition extends ProjectStatusesTypeFilter {
33
+ _custom?: {
34
+ [k: string]: {
35
+ key?: Extract<keyof ProjectStatusesTypeFilter, string>
36
+ operator?:FilterOperator
37
+ value: string | number | boolean | null | number[]
38
+ }
39
+ }
40
+ }
41
+
42
+ export interface ProjectStatusesListConfig extends GenericListConfig {
43
+ filter?:ProjectStatusesFilterCondition
44
+ }
@@ -0,0 +1,40 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { ProjectTemplatesListConfig, ProjectTemplatesTypeCreate, ProjectTemplatesTypeResponse, ProjectTemplatesTypeUpdate } from "./types"
4
+
5
+ // @todo Add the projecttemplatestasklists and projecttemplatestasks objects
6
+
7
+ export interface ProjectTemplatesHandler extends AbstractResourceInterface {
8
+ get: (id: number) => Promise<ProjectTemplatesTypeResponse | null>
9
+ list: (config?: ProjectTemplatesListConfig) => Promise<ProjectTemplatesTypeResponse[]>
10
+ create: (d: ProjectTemplatesTypeCreate) => Promise<ProjectTemplatesTypeResponse | null>
11
+ update: (id: number, data: ProjectTemplatesTypeUpdate) => Promise<ProjectTemplatesTypeResponse | null>
12
+ delete: (id: number) => Promise<boolean>
13
+ }
14
+
15
+ export class ProjectTemplates extends AbstractResource implements ProjectTemplatesHandler {
16
+ constructor(auth: AuthInterface) {
17
+ super(auth, 'projecttemplates', 'project_templates')
18
+ }
19
+
20
+ get = async (id: number) => {
21
+ return (await this.baseGet(id)) as ProjectTemplatesTypeResponse | null
22
+ }
23
+
24
+ list = async (config: ProjectTemplatesListConfig = {}) => {
25
+ return (await this.baseList(config)) as ProjectTemplatesTypeResponse[]
26
+ }
27
+
28
+ create = async (data: ProjectTemplatesTypeCreate) => {
29
+ return (await this.baseCreate(data)) as ProjectTemplatesTypeResponse | null
30
+ }
31
+
32
+ update = async (id: number, data: ProjectTemplatesTypeUpdate) => {
33
+ return (await this.baseUpdate(id, data)) as ProjectTemplatesTypeResponse | null
34
+ }
35
+
36
+ delete = async (id: number) => {
37
+ return await this.baseDelete(id)
38
+ }
39
+
40
+ }
@@ -0,0 +1,43 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /projecttemplates /projecttemplates/####
4
+ // =================================================================================================
5
+
6
+ // @todo map out types for projecttemplatestasklists and projecttemplatestasks
7
+
8
+ export interface ProjectTemplatesTypeRead {
9
+ readonly id: number
10
+ readonly created_on: string
11
+ readonly updated_on: string
12
+ }
13
+
14
+ export interface ProjectTemplatesTypeUpdate {
15
+ name?: string
16
+ }
17
+
18
+ export type ProjectTemplatesTypeResponse = Merge<ProjectTemplatesTypeUpdate, Merge<ProjectTemplatesTypeRead, {
19
+
20
+ }>>
21
+
22
+ export interface ProjectTemplatesTypeCreate extends ProjectTemplatesTypeUpdate {
23
+ name: string
24
+ project_id?: number // Will create the new template from an existing project
25
+ }
26
+
27
+ export interface ProjectTemplatesTypeFilter {
28
+ name?:string
29
+ }
30
+
31
+ export interface ProjectTemplatesFilterCondition extends ProjectTemplatesTypeFilter {
32
+ _custom?: {
33
+ [k: string]: {
34
+ key?: Extract<keyof ProjectTemplatesTypeFilter, string>
35
+ operator?:FilterOperator
36
+ value: string | number | boolean | null | number[]
37
+ }
38
+ }
39
+ }
40
+
41
+ export interface ProjectTemplatesListConfig extends GenericListConfig {
42
+ filter?:ProjectTemplatesFilterCondition
43
+ }