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,100 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-11-23 | /clients /clients/####
4
+ // =================================================================================================
5
+ // id integer (read-only) Unique client identifier
6
+ // name text Client name
7
+ // address text Street address
8
+ // city text City name
9
+ // postal_code text Postal code
10
+ // country text Country name
11
+ // state text State or Region name
12
+ // phone text Phone number
13
+ // fax text Fax number
14
+ // email email Email address
15
+ // website url Website address
16
+ // active boolean (read-only) If true the client is active, otherwise the client is archived.
17
+ // fiscal_information text Fiscal information. It is used in invoice headers to display client details.
18
+ // created_on datetime (read-only) Date and time when the client was created
19
+ // updated_on datetime (read-only) Date and time when the client was last updated
20
+ // image url Client logo image URL
21
+ // image_thumb_large url (read-only) Client logo image large size thumbnail URL
22
+ // image_thumb_medium url (read-only) Client logo image medium size thumbnail URL
23
+ // image_thumb_small url (read-only) Client logo image small size thumbnail URL
24
+
25
+ export interface ClientTypeRead {
26
+ readonly id: number
27
+ readonly active: boolean
28
+ readonly created_on: string
29
+ readonly updated_on: string
30
+ readonly image_thumb_large?: string
31
+ readonly image_thumb_medium?: string
32
+ readonly image_thumb_small?: string
33
+ }
34
+
35
+ export interface ClientTypeUpdate {
36
+ name?: string
37
+ address?: string
38
+ city?: string
39
+ postal_code?: string
40
+ country?: string
41
+ state?: string
42
+ phone?: string
43
+ fax?: string
44
+ email?: string
45
+ website?: string
46
+ fiscal_information?: string
47
+ image?: string
48
+ }
49
+
50
+ export type ClientTypeResponse = Merge<ClientTypeRead, Merge<ClientTypeUpdate, {
51
+ additional_privileges: any[]
52
+ address?: string | null
53
+ city?: string | null
54
+ country?: string | null
55
+ email?: string | null
56
+ fax?: string | null
57
+ fiscal_information?: string | null
58
+ image?: string | null
59
+ phone?: string | null
60
+ postal_code?: string | null
61
+ state?: string | null
62
+ website?: string | null
63
+ }>>
64
+
65
+ export interface ClientTypeCreate extends ClientTypeUpdate {
66
+ name: string
67
+ }
68
+
69
+ export interface ClientTypeFilter {
70
+ id?: number
71
+ active?: boolean
72
+ created_on?: string
73
+ updated_on?: string
74
+ name?: string
75
+ address?: string | null
76
+ city?: string | null
77
+ country?: string | null
78
+ email?: string | null
79
+ fax?: string | null
80
+ fiscal_information?: string | null
81
+ image?: string | null
82
+ phone?: string | null
83
+ postal_code?: string | null
84
+ state?: string | null
85
+ website?: string | null
86
+ }
87
+
88
+ export interface ClientFilterCondition extends ClientTypeFilter {
89
+ _custom?: {
90
+ [k: string]: {
91
+ key?: Extract<keyof ClientTypeFilter, string>
92
+ operator?: FilterOperator
93
+ value: string | number | boolean | null | number[]
94
+ }
95
+ }
96
+ }
97
+
98
+ export interface ClientsListConfig extends GenericListConfig {
99
+ filter?: ClientFilterCondition
100
+ }
@@ -0,0 +1,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { CommentsListConfig, CommentsTypeCreate, CommentsTypeResponse, CommentsTypeUpdate } from "./types"
4
+
5
+ export interface CommentsHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<CommentsTypeResponse | null>
7
+ list: (config?: CommentsListConfig) => Promise<CommentsTypeResponse[]>
8
+ create: (d: CommentsTypeCreate) => Promise<CommentsTypeResponse | null>
9
+ update: (id: number, data: CommentsTypeUpdate) => Promise<CommentsTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class Comments extends AbstractResource implements CommentsHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'comments')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as CommentsTypeResponse | null
20
+ }
21
+
22
+ list = async (config: CommentsListConfig = {}) => {
23
+ return (await this.baseList(config)) as CommentsTypeResponse[]
24
+ }
25
+
26
+ create = async (data: CommentsTypeCreate) => {
27
+ return (await this.baseCreate(data)) as CommentsTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: CommentsTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as CommentsTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,28 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { ThreadsListConfig, ThreadsTypeResponse } from "./types"
4
+
5
+ export interface ThreadsHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<ThreadsTypeResponse | null>
7
+ list: (config?: ThreadsListConfig) => Promise<ThreadsTypeResponse[]>
8
+ //delete: (id: number) => Promise<boolean>
9
+ }
10
+
11
+ export class Threads extends AbstractResource implements ThreadsHandler {
12
+ constructor(auth: AuthInterface) {
13
+ super(auth, 'threads')
14
+ }
15
+
16
+ get = async (id: number) => {
17
+ return (await this.baseGet(id)) as ThreadsTypeResponse | null
18
+ }
19
+
20
+ list = async (config: ThreadsListConfig = {}) => {
21
+ return (await this.baseList(config)) as ThreadsTypeResponse[]
22
+ }
23
+
24
+ // delete = async (id: number) => {
25
+ // return await this.baseDelete(id)
26
+ // }
27
+
28
+ }
@@ -0,0 +1,2 @@
1
+ export { Comments, CommentsHandler } from './Comments';
2
+ export { Threads, ThreadsHandler } from './Threads';
@@ -0,0 +1,105 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from '../../types'
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /comments /comments/####
4
+ // =================================================================================================
5
+
6
+ export interface CommentsTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ readonly thread_id: number
11
+ readonly user_id: number
12
+ }
13
+
14
+ export interface CommentsTypeUpdate {
15
+ content: string
16
+ }
17
+
18
+ export type CommentsTypeResponse = Merge<
19
+ CommentsTypeUpdate,
20
+ Merge<CommentsTypeRead, {}>
21
+ >
22
+
23
+ interface CommentsTypeCreateWithThread extends CommentsTypeUpdate {
24
+ thread_id: number
25
+ }
26
+
27
+ interface CommentsTypeCreateWithTask extends CommentsTypeUpdate {
28
+ task_id: number
29
+ }
30
+
31
+ interface CommentsTypeCreateWithDiscussion extends CommentsTypeUpdate {
32
+ discussion_id: number
33
+ }
34
+
35
+ interface CommentsTypeCreateWithFile extends CommentsTypeUpdate {
36
+ file_id: number
37
+ }
38
+
39
+ export type CommentsTypeCreate =
40
+ | CommentsTypeCreateWithThread
41
+ | CommentsTypeCreateWithTask
42
+ | CommentsTypeCreateWithDiscussion
43
+ | CommentsTypeCreateWithFile
44
+
45
+ export interface CommentsTypeFilter {
46
+ id?: number
47
+ thread_id?: number
48
+ user_id?: number
49
+ created_on?: string
50
+ updated_on?: string
51
+ content?: string
52
+ }
53
+
54
+ export interface CommentsFilterCondition extends CommentsTypeFilter {
55
+ _custom?: {
56
+ [k: string]: {
57
+ key?: Extract<keyof CommentsTypeFilter, string>
58
+ operator?: FilterOperator
59
+ value: string | number | boolean | null | number[]
60
+ }
61
+ }
62
+ }
63
+
64
+ export interface CommentsListConfig extends GenericListConfig {
65
+ filter?: CommentsFilterCondition
66
+ }
67
+
68
+ // PAYMO API DOCS - 2019-12-11 /threads /threads/####
69
+ // =================================================================================================
70
+
71
+ export interface ThreadsTypeRead {
72
+ readonly id: number
73
+ readonly created_on: string
74
+ readonly updated_on: string
75
+ readonly project_id: number
76
+ readonly discussion_id: number | null
77
+ readonly task_id: number | null
78
+ readonly file_id: number | null
79
+ }
80
+
81
+ export type ThreadsTypeResponse = Merge<ThreadsTypeRead, {}>
82
+
83
+ export interface ThreadsTypeFilter {
84
+ id?: number
85
+ created_on?: string
86
+ updated_on?: string
87
+ project_id?: number
88
+ discussion_id?: number
89
+ task_id?: number
90
+ file_id?: number
91
+ }
92
+
93
+ export interface ThreadsFilterCondition extends ThreadsTypeFilter {
94
+ _custom?: {
95
+ [k: string]: {
96
+ key?: Extract<keyof ThreadsTypeFilter, string>
97
+ operator?: FilterOperator
98
+ value: string | number | boolean | null | number[]
99
+ }
100
+ }
101
+ }
102
+
103
+ export interface ThreadsListConfig extends GenericListConfig {
104
+ filter?: ThreadsFilterCondition
105
+ }
@@ -0,0 +1,23 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { CompanyTypeResponse, CompanyTypeUpdate } from "./types"
4
+
5
+ export interface CompanyHandler extends AbstractResourceInterface {
6
+ get: () => Promise<CompanyTypeResponse | null>
7
+ update: (data: CompanyTypeUpdate) => Promise<CompanyTypeResponse | null>
8
+ }
9
+
10
+ export class Company extends AbstractResource implements CompanyHandler {
11
+ constructor(auth: AuthInterface) {
12
+ super(auth, 'company')
13
+ }
14
+
15
+ get = async () => {
16
+ return (await this.baseGet(null)) as CompanyTypeResponse | null
17
+ }
18
+
19
+ update = async (data: CompanyTypeUpdate) => {
20
+ return (await this.baseUpdate(null, data)) as CompanyTypeResponse | null
21
+ }
22
+
23
+ }
@@ -0,0 +1,52 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /company
4
+ // =================================================================================================
5
+
6
+ export interface CompanyTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ readonly image_thumb_large?: string
11
+ readonly image_thumb_medium?: string
12
+ readonly image_thumb_small?: string
13
+ readonly account_type: string
14
+ readonly max_users: number
15
+ readonly current_users: number
16
+ readonly max_projects:number|null
17
+ readonly current_projects:number
18
+ readonly max_invoices: number
19
+ readonly current_invoices: number
20
+ }
21
+
22
+ export interface CompanyTypeUpdate {
23
+ name?:string
24
+ address?:string
25
+ phone?:string
26
+ email?:string
27
+ url?:string
28
+ fiscal_information?:string
29
+ country?:string
30
+ image?:string
31
+ timezone?:string
32
+ default_currency?:string
33
+ default_price_per_hour?:string
34
+ apply_tax_to_expenses?:string
35
+ tax_on_tax?:string
36
+ currency_position?:"left"|"right"
37
+ next_invoice_number?:number
38
+ next_estimate_number?:number
39
+ online_payments?:number
40
+ date_format?:"Y-m-d"|"d/m/Y"|"m/d/Y"|"d.m.Y"
41
+ time_format?:"H:i"|"h:i"
42
+ decimal_sep?:string
43
+ thousands_sep?:string
44
+ week_start?:"0"|"1"|"2"|"3"|"4"|"5"|"6"
45
+ workday_start?:string // HH:SS 24 hour format
46
+ workday_end?:string // HH:SS 24 hour format
47
+ working_days?:string // Comma separated list of 0,1,2,3,4,5,6
48
+ }
49
+
50
+ export type CompanyTypeResponse = Merge<CompanyTypeUpdate, Merge<CompanyTypeRead, {
51
+
52
+ }>>
@@ -0,0 +1,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { DiscussionsListConfig, DiscussionsTypeCreate, DiscussionsTypeResponse, DiscussionsTypeUpdate } from "./types"
4
+
5
+ export interface DiscussionsHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<DiscussionsTypeResponse | null>
7
+ list: (config?: DiscussionsListConfig) => Promise<DiscussionsTypeResponse[]>
8
+ create: (d: DiscussionsTypeCreate) => Promise<DiscussionsTypeResponse | null>
9
+ update: (id: number, data: DiscussionsTypeUpdate) => Promise<DiscussionsTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class Discussions extends AbstractResource implements DiscussionsHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'discussions')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as DiscussionsTypeResponse | null
20
+ }
21
+
22
+ list = async (config: DiscussionsListConfig = {}) => {
23
+ return (await this.baseList(config)) as DiscussionsTypeResponse[]
24
+ }
25
+
26
+ create = async (data: DiscussionsTypeCreate) => {
27
+ return (await this.baseCreate(data)) as DiscussionsTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: DiscussionsTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as DiscussionsTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,53 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /discussions /discussions/####
4
+ // =================================================================================================
5
+
6
+ export interface DiscussionsTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ }
11
+
12
+ export interface DiscussionsTypeUpdate {
13
+ name?: string
14
+ description?: string
15
+ project_id?:number
16
+ user_id?:number
17
+ }
18
+
19
+ export type DiscussionsTypeResponse = Merge<DiscussionsTypeUpdate, Merge<DiscussionsTypeRead, {
20
+ name:string
21
+ project_id:number
22
+ description: string | null
23
+ user_id: number
24
+ comments_count: number
25
+ }>>
26
+
27
+ export interface DiscussionsTypeCreate extends DiscussionsTypeUpdate {
28
+ name:string
29
+ project_id: number
30
+ }
31
+
32
+ export interface DiscussionsTypeFilter {
33
+ id?: number
34
+ created_on?:string
35
+ updated_on?:string
36
+ name?:string
37
+ description?:string
38
+ user_id?:number
39
+ }
40
+
41
+ export interface DiscussionsFilterCondition extends DiscussionsTypeFilter {
42
+ _custom?: {
43
+ [k: string]: {
44
+ key?: Extract<keyof DiscussionsTypeFilter, string>
45
+ operator?:FilterOperator
46
+ value: string | number | boolean | null | number[]
47
+ }
48
+ }
49
+ }
50
+
51
+ export interface DiscussionsListConfig extends GenericListConfig {
52
+ filter?:DiscussionsFilterCondition
53
+ }
@@ -0,0 +1,52 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { TimeEntriesListConfig, TimeEntriesTypeCreate, TimeEntriesTypeResponse, TimeEntriesTypeUpdate } from "./types"
4
+
5
+ export interface TimeEntriesHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<TimeEntriesTypeResponse | null>
7
+ list: (config?: TimeEntriesListConfig) => Promise<TimeEntriesTypeResponse[]>
8
+ create: (d: TimeEntriesTypeCreate) => Promise<TimeEntriesTypeResponse | null>
9
+ update: (id: number, data: TimeEntriesTypeUpdate) => Promise<TimeEntriesTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class TimeEntries extends AbstractResource implements TimeEntriesHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'entries')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as TimeEntriesTypeResponse | null
20
+ }
21
+
22
+ list = async (config: TimeEntriesListConfig = {}) => {
23
+ const validConfig =
24
+ !!config &&
25
+ config.filter &&
26
+ (config.filter.project_id ||
27
+ config.filter.client_id ||
28
+ config.filter.task_id ||
29
+ config.filter.user_id ||
30
+ (config.filter.time_interval &&
31
+ Array.isArray(config.filter.time_interval) &&
32
+ config.filter.time_interval.length === 2))
33
+ if (!validConfig) {
34
+ console.log('Entry list requires at least one valid filter condition')
35
+ return []
36
+ }
37
+ return (await this.baseList(config)) as TimeEntriesTypeResponse[]
38
+ }
39
+
40
+ create = async (data: TimeEntriesTypeCreate) => {
41
+ return (await this.baseCreate(data)) as TimeEntriesTypeResponse | null
42
+ }
43
+
44
+ update = async (id: number, data: TimeEntriesTypeUpdate) => {
45
+ return (await this.baseUpdate(id, data)) as TimeEntriesTypeResponse | null
46
+ }
47
+
48
+ delete = async (id: number) => {
49
+ return await this.baseDelete(id)
50
+ }
51
+
52
+ }
@@ -0,0 +1,67 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /entries /entries/####
4
+ // =================================================================================================
5
+
6
+ export interface TimeEntriesTypeRead {
7
+ readonly id: number
8
+ readonly project_id:number
9
+ readonly created_on: string
10
+ readonly updated_on: string
11
+ }
12
+
13
+ export interface TimeEntriesTypeUpdate {
14
+ task_id?:number
15
+ user_id?:number
16
+ is_bulk?: boolean
17
+ start_time?:string
18
+ end_time?:string
19
+ date?:string
20
+ duration?:number // in seconds
21
+ description?:string
22
+ added_manually?:boolean // false means the timer app was used
23
+ billed?:boolean // time is on an invoice
24
+ }
25
+
26
+ export type TimeEntriesTypeResponse = Merge<TimeEntriesTypeUpdate, Merge<TimeEntriesTypeRead, {
27
+
28
+ }>>
29
+
30
+ interface TimeEntriesTypeCreateCommon extends TimeEntriesTypeUpdate {
31
+ task_id:number
32
+ }
33
+
34
+ interface TimeEntriesTypeCreateRange extends TimeEntriesTypeCreateCommon {
35
+ start_time:string
36
+ end_time:string
37
+ }
38
+
39
+ interface TimeEntriesTypeCreateDuration extends TimeEntriesTypeCreateCommon {
40
+ date:string
41
+ duration:number
42
+ }
43
+
44
+ export type TimeEntriesTypeCreate = TimeEntriesTypeCreateRange | TimeEntriesTypeCreateDuration
45
+
46
+ export interface TimeEntriesTypeFilter {
47
+ project_id?:number
48
+ task_id?:number
49
+ user_id?:number
50
+ client_id?:number
51
+ time_interval?:string[]
52
+ end_time?:string | null
53
+ }
54
+
55
+ export interface TimeEntriesFilterCondition extends TimeEntriesTypeFilter {
56
+ _custom?: {
57
+ [k: string]: {
58
+ key?: Extract<keyof TimeEntriesTypeFilter, string>
59
+ operator?:FilterOperator
60
+ value: string | number | boolean | null | number[]
61
+ }
62
+ }
63
+ }
64
+
65
+ export interface TimeEntriesListConfig extends GenericListConfig {
66
+ filter?:TimeEntriesFilterCondition
67
+ }
@@ -0,0 +1,6 @@
1
+
2
+ export const EstimateItem = {
3
+
4
+ }
5
+
6
+ export default null
@@ -0,0 +1,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { EstimatesListConfig, EstimatesTypeCreate, EstimatesTypeResponse, EstimatesTypeUpdate } from "./types"
4
+
5
+ export interface EstimatesHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<EstimatesTypeResponse | null>
7
+ list: (config?: EstimatesListConfig) => Promise<EstimatesTypeResponse[]>
8
+ create: (d: EstimatesTypeCreate) => Promise<EstimatesTypeResponse | null>
9
+ update: (id: number, data: EstimatesTypeUpdate) => Promise<EstimatesTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class Estimates extends AbstractResource implements EstimatesHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'estimates')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as EstimatesTypeResponse | null
20
+ }
21
+
22
+ list = async (config: EstimatesListConfig = {}) => {
23
+ return (await this.baseList(config)) as EstimatesTypeResponse[]
24
+ }
25
+
26
+ create = async (data: EstimatesTypeCreate) => {
27
+ return (await this.baseCreate(data)) as EstimatesTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: EstimatesTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as EstimatesTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,2 @@
1
+ export { Estimates, EstimatesHandler } from './Estimates';
2
+ export { EstimateItem } from './EstimateItem';