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 { WorkflowsListConfig, WorkflowsTypeCreate, WorkflowsTypeResponse, WorkflowsTypeUpdate } from "./types"
4
+
5
+ export interface WorkflowsHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<WorkflowsTypeResponse | null>
7
+ list: (config?: WorkflowsListConfig) => Promise<WorkflowsTypeResponse[]>
8
+ create: (d: WorkflowsTypeCreate) => Promise<WorkflowsTypeResponse | null>
9
+ update: (id: number, data: WorkflowsTypeUpdate) => Promise<WorkflowsTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class Workflows extends AbstractResource implements WorkflowsHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'workflows')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as WorkflowsTypeResponse | null
20
+ }
21
+
22
+ list = async (config: WorkflowsListConfig = {}) => {
23
+ return (await this.baseList(config)) as WorkflowsTypeResponse[]
24
+ }
25
+
26
+ create = async (data: WorkflowsTypeCreate) => {
27
+ return (await this.baseCreate(data)) as WorkflowsTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: WorkflowsTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as WorkflowsTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,43 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /workflows /workflows/####
4
+ // =================================================================================================
5
+
6
+ export interface WorkflowsTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ }
11
+
12
+ export interface WorkflowsTypeUpdate {
13
+ name?:string
14
+ is_default?:boolean
15
+ }
16
+
17
+ export type WorkflowsTypeResponse = Merge<WorkflowsTypeUpdate, Merge<WorkflowsTypeRead, {
18
+
19
+ }>>
20
+
21
+ export interface WorkflowsTypeCreate extends WorkflowsTypeUpdate {
22
+ name:string
23
+ }
24
+
25
+ export interface WorkflowsTypeFilter {
26
+ id?:number
27
+ name?:string
28
+ is_default?:boolean
29
+ }
30
+
31
+ export interface WorkflowsFilterCondition extends WorkflowsTypeFilter {
32
+ _custom?: {
33
+ [k: string]: {
34
+ key?: Extract<keyof WorkflowsTypeFilter, string>
35
+ operator?:FilterOperator
36
+ value: string | number | boolean | null | number[]
37
+ }
38
+ }
39
+ }
40
+
41
+ export interface WorkflowsListConfig extends GenericListConfig {
42
+ filter?:WorkflowsFilterCondition
43
+ }
@@ -0,0 +1,38 @@
1
+ import { AbstractResource, AbstractResourceInterface } from '../../abstract'
2
+ import { AuthInterface } from "../../types"
3
+ import { WorkflowStatusesListConfig, WorkflowStatusesTypeCreate, WorkflowStatusesTypeResponse, WorkflowStatusesTypeUpdate } from "./types"
4
+
5
+ export interface WorkflowStatusesHandler extends AbstractResourceInterface {
6
+ get: (id: number) => Promise<WorkflowStatusesTypeResponse | null>
7
+ list: (config?: WorkflowStatusesListConfig) => Promise<WorkflowStatusesTypeResponse[]>
8
+ create: (d: WorkflowStatusesTypeCreate) => Promise<WorkflowStatusesTypeResponse | null>
9
+ update: (id: number, data: WorkflowStatusesTypeUpdate) => Promise<WorkflowStatusesTypeResponse | null>
10
+ delete: (id: number) => Promise<boolean>
11
+ }
12
+
13
+ export class WorkflowStatuses extends AbstractResource implements WorkflowStatusesHandler {
14
+ constructor(auth: AuthInterface) {
15
+ super(auth, 'workflowstatuses')
16
+ }
17
+
18
+ get = async (id: number) => {
19
+ return (await this.baseGet(id)) as WorkflowStatusesTypeResponse | null
20
+ }
21
+
22
+ list = async (config: WorkflowStatusesListConfig = {}) => {
23
+ return (await this.baseList(config)) as WorkflowStatusesTypeResponse[]
24
+ }
25
+
26
+ create = async (data: WorkflowStatusesTypeCreate) => {
27
+ return (await this.baseCreate(data)) as WorkflowStatusesTypeResponse | null
28
+ }
29
+
30
+ update = async (id: number, data: WorkflowStatusesTypeUpdate) => {
31
+ return (await this.baseUpdate(id, data)) as WorkflowStatusesTypeResponse | null
32
+ }
33
+
34
+ delete = async (id: number) => {
35
+ return await this.baseDelete(id)
36
+ }
37
+
38
+ }
@@ -0,0 +1,47 @@
1
+ import { FilterOperator, GenericListConfig, Merge } from "../../types"
2
+
3
+ // PAYMO API DOCS - 2019-12-11 /workflowstatuses /workflowstatuses/####
4
+ // =================================================================================================
5
+
6
+ export interface WorkflowStatusesTypeRead {
7
+ readonly id: number
8
+ readonly created_on: string
9
+ readonly updated_on: string
10
+ readonly seq: number
11
+ readonly action: '' | 'complete' |'backlog'
12
+ }
13
+
14
+ export interface WorkflowStatusesTypeUpdate {
15
+ name?:string
16
+ workflow_id?:number
17
+ color?:string
18
+ }
19
+
20
+ export type WorkflowStatusesTypeResponse = Merge<WorkflowStatusesTypeUpdate, Merge<WorkflowStatusesTypeRead, {
21
+
22
+ }>>
23
+
24
+ export interface WorkflowStatusesTypeCreate extends WorkflowStatusesTypeUpdate {
25
+ name:string
26
+ color:string
27
+ workflow_id:number
28
+ }
29
+
30
+ export interface WorkflowStatusesTypeFilter {
31
+ name?:string
32
+ workflow_id?:number
33
+ }
34
+
35
+ export interface WorkflowStatusesFilterCondition extends WorkflowStatusesTypeFilter {
36
+ _custom?: {
37
+ [k: string]: {
38
+ key?: Extract<keyof WorkflowStatusesTypeFilter, string>
39
+ operator?:FilterOperator
40
+ value: string | number | boolean | null | number[]
41
+ }
42
+ }
43
+ }
44
+
45
+ export interface WorkflowStatusesListConfig extends GenericListConfig {
46
+ filter?:WorkflowStatusesFilterCondition
47
+ }
package/src/types.ts ADDED
@@ -0,0 +1,40 @@
1
+ export interface AuthInterface {
2
+ userApi: string
3
+ password: string
4
+ }
5
+
6
+ export type FilterOperator =
7
+ | '='
8
+ | '<='
9
+ | '>='
10
+ | '>'
11
+ | '<'
12
+ | '!='
13
+ | 'like'
14
+ | 'not like'
15
+ | 'in'
16
+ | 'not in'
17
+
18
+ export type GenericCustomFilterType = {
19
+ [k: string]: {
20
+ key?: string
21
+ operator?: FilterOperator
22
+ value: string | number | boolean | null | number[]
23
+ }
24
+ }
25
+
26
+ export type GenericFilterType = {
27
+ [key: string]: any
28
+ } & {
29
+ _custom?: GenericCustomFilterType
30
+ }
31
+
32
+ export interface GenericListConfig {
33
+ filter?: GenericFilterType
34
+ include?: string[]
35
+ }
36
+
37
+ type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
38
+ export type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
39
+
40
+ 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'
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "outDir": "dist",
4
+ "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
5
+ "module": "commonjs",
6
+ "strict": true,
7
+ "strictNullChecks": true,
8
+ "esModuleInterop": true,
9
+ "declaration": true,
10
+ "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
11
+ }
12
+ }
package/lib/index.ts DELETED
@@ -1,6 +0,0 @@
1
-
2
- const paymoApp = {
3
- x: 1
4
- }
5
-
6
- export default paymoApp