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.
- package/.prettierrc +6 -0
- package/README.md +24 -1
- package/dist/abstract.d.ts +23 -0
- package/dist/abstract.js +210 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +18 -0
- package/dist/remote.d.ts +9 -0
- package/dist/remote.js +80 -0
- package/dist/resources/_template_/index.d.ts +18 -0
- package/dist/resources/_template_/index.js +34 -0
- package/dist/resources/_template_/types.d.ts +25 -0
- package/dist/resources/_template_/types.js +2 -0
- package/dist/resources/bookings/index.d.ts +18 -0
- package/dist/resources/bookings/index.js +49 -0
- package/dist/resources/bookings/types.d.ts +49 -0
- package/dist/resources/bookings/types.js +2 -0
- package/dist/resources/clientcontacts/index.d.ts +18 -0
- package/dist/resources/clientcontacts/index.js +34 -0
- package/dist/resources/clientcontacts/types.d.ts +59 -0
- package/dist/resources/clientcontacts/types.js +2 -0
- package/dist/resources/clients/index.d.ts +18 -0
- package/dist/resources/clients/index.js +34 -0
- package/dist/resources/clients/types.d.ts +71 -0
- package/dist/resources/clients/types.js +2 -0
- package/dist/resources/comments/Comments.d.ts +18 -0
- package/dist/resources/comments/Comments.js +34 -0
- package/dist/resources/comments/Threads.d.ts +28 -0
- package/dist/resources/comments/Threads.js +25 -0
- package/dist/resources/comments/index.d.ts +2 -0
- package/dist/resources/comments/index.js +7 -0
- package/dist/resources/comments/types.d.ts +77 -0
- package/dist/resources/comments/types.js +2 -0
- package/dist/resources/company/index.d.ts +12 -0
- package/dist/resources/company/index.js +25 -0
- package/dist/resources/company/types.d.ts +44 -0
- package/dist/resources/company/types.js +2 -0
- package/dist/resources/discussions/index.d.ts +18 -0
- package/dist/resources/discussions/index.js +34 -0
- package/dist/resources/discussions/types.d.ts +43 -0
- package/dist/resources/discussions/types.js +2 -0
- package/dist/resources/entries/index.d.ts +18 -0
- package/dist/resources/entries/index.js +47 -0
- package/dist/resources/entries/types.d.ts +53 -0
- package/dist/resources/entries/types.js +2 -0
- package/dist/resources/estimates/EstimateItem.d.ts +3 -0
- package/dist/resources/estimates/EstimateItem.js +5 -0
- package/dist/resources/estimates/Estimates.d.ts +18 -0
- package/dist/resources/estimates/Estimates.js +34 -0
- package/dist/resources/estimates/index.d.ts +2 -0
- package/dist/resources/estimates/index.js +7 -0
- package/dist/resources/estimates/types.d.ts +76 -0
- package/dist/resources/estimates/types.js +2 -0
- package/dist/resources/estimatetemplates/index.d.ts +18 -0
- package/dist/resources/estimatetemplates/index.js +34 -0
- package/dist/resources/estimatetemplates/types.d.ts +34 -0
- package/dist/resources/estimatetemplates/types.js +2 -0
- package/dist/resources/expenses/index.d.ts +18 -0
- package/dist/resources/expenses/index.js +34 -0
- package/dist/resources/expenses/types.d.ts +46 -0
- package/dist/resources/expenses/types.js +2 -0
- package/dist/resources/files/index.d.ts +18 -0
- package/dist/resources/files/index.js +45 -0
- package/dist/resources/files/types.d.ts +44 -0
- package/dist/resources/files/types.js +2 -0
- package/dist/resources/index.d.ts +117 -0
- package/dist/resources/index.js +200 -0
- package/dist/resources/invoices/InvoiceItem.d.ts +3 -0
- package/dist/resources/invoices/InvoiceItem.js +5 -0
- package/dist/resources/invoices/Invoices.d.ts +18 -0
- package/dist/resources/invoices/Invoices.js +34 -0
- package/dist/resources/invoices/index.d.ts +2 -0
- package/dist/resources/invoices/index.js +7 -0
- package/dist/resources/invoices/types.d.ts +87 -0
- package/dist/resources/invoices/types.js +2 -0
- package/dist/resources/invoicetemplates/index.d.ts +18 -0
- package/dist/resources/invoicetemplates/index.js +34 -0
- package/dist/resources/invoicetemplates/types.d.ts +34 -0
- package/dist/resources/invoicetemplates/types.js +2 -0
- package/dist/resources/milestones/index.d.ts +18 -0
- package/dist/resources/milestones/index.js +34 -0
- package/dist/resources/milestones/types.d.ts +40 -0
- package/dist/resources/milestones/types.js +2 -0
- package/dist/resources/projects/index.d.ts +20 -0
- package/dist/resources/projects/index.js +39 -0
- package/dist/resources/projects/types.d.ts +86 -0
- package/dist/resources/projects/types.js +14 -0
- package/dist/resources/projectstatuses/index.d.ts +18 -0
- package/dist/resources/projectstatuses/index.js +34 -0
- package/dist/resources/projectstatuses/types.d.ts +32 -0
- package/dist/resources/projectstatuses/types.js +2 -0
- package/dist/resources/projecttemplates/index.d.ts +18 -0
- package/dist/resources/projecttemplates/index.js +34 -0
- package/dist/resources/projecttemplates/types.d.ts +29 -0
- package/dist/resources/projecttemplates/types.js +2 -0
- package/dist/resources/reports/index.d.ts +18 -0
- package/dist/resources/reports/index.js +34 -0
- package/dist/resources/reports/types.d.ts +90 -0
- package/dist/resources/reports/types.js +2 -0
- package/dist/resources/sessions/index.d.ts +18 -0
- package/dist/resources/sessions/index.js +35 -0
- package/dist/resources/sessions/types.d.ts +28 -0
- package/dist/resources/sessions/types.js +2 -0
- package/dist/resources/tasklists/index.d.ts +18 -0
- package/dist/resources/tasklists/index.js +34 -0
- package/dist/resources/tasklists/types.d.ts +35 -0
- package/dist/resources/tasklists/types.js +2 -0
- package/dist/resources/tasks/index.d.ts +18 -0
- package/dist/resources/tasks/index.js +34 -0
- package/dist/resources/tasks/types.d.ts +64 -0
- package/dist/resources/tasks/types.js +2 -0
- package/dist/resources/users/index.d.ts +22 -0
- package/dist/resources/users/index.js +40 -0
- package/dist/resources/users/types.d.ts +86 -0
- package/dist/resources/users/types.js +2 -0
- package/dist/resources/usertasks/index.d.ts +18 -0
- package/dist/resources/usertasks/index.js +41 -0
- package/dist/resources/usertasks/types.d.ts +31 -0
- package/dist/resources/usertasks/types.js +2 -0
- package/dist/resources/workflows/index.d.ts +18 -0
- package/dist/resources/workflows/index.js +34 -0
- package/dist/resources/workflows/types.d.ts +31 -0
- package/dist/resources/workflows/types.js +2 -0
- package/dist/resources/workflowstatuses/index.d.ts +18 -0
- package/dist/resources/workflowstatuses/index.js +34 -0
- package/dist/resources/workflowstatuses/types.d.ts +35 -0
- package/dist/resources/workflowstatuses/types.js +2 -0
- package/dist/types.d.ts +25 -0
- package/dist/types.js +2 -0
- package/package.json +13 -3
- package/src/abstract.ts +220 -0
- package/src/index.ts +23 -0
- package/src/remote.ts +77 -0
- package/src/resources/_template_/index.ts +38 -0
- package/src/resources/_template_/types.ts +40 -0
- package/src/resources/bookings/index.ts +61 -0
- package/src/resources/bookings/types.ts +60 -0
- package/src/resources/clientcontacts/index.ts +38 -0
- package/src/resources/clientcontacts/types.ts +69 -0
- package/src/resources/clients/index.ts +38 -0
- package/src/resources/clients/types.ts +100 -0
- package/src/resources/comments/Comments.ts +38 -0
- package/src/resources/comments/Threads.ts +28 -0
- package/src/resources/comments/index.ts +2 -0
- package/src/resources/comments/types.ts +105 -0
- package/src/resources/company/index.ts +23 -0
- package/src/resources/company/types.ts +52 -0
- package/src/resources/discussions/index.ts +38 -0
- package/src/resources/discussions/types.ts +53 -0
- package/src/resources/entries/index.ts +52 -0
- package/src/resources/entries/types.ts +67 -0
- package/src/resources/estimates/EstimateItem.ts +6 -0
- package/src/resources/estimates/Estimates.ts +38 -0
- package/src/resources/estimates/index.ts +2 -0
- package/src/resources/estimates/types.ts +89 -0
- package/src/resources/estimatetemplates/index.ts +38 -0
- package/src/resources/estimatetemplates/types.ts +46 -0
- package/src/resources/expenses/index.ts +38 -0
- package/src/resources/expenses/types.ts +58 -0
- package/src/resources/files/index.ts +50 -0
- package/src/resources/files/types.ts +58 -0
- package/src/resources/index.ts +289 -0
- package/src/resources/invoices/InvoiceItem.ts +6 -0
- package/src/resources/invoices/Invoices.ts +38 -0
- package/src/resources/invoices/index.ts +2 -0
- package/src/resources/invoices/types.ts +102 -0
- package/src/resources/invoicetemplates/index.ts +38 -0
- package/src/resources/invoicetemplates/types.ts +46 -0
- package/src/resources/milestones/index.ts +38 -0
- package/src/resources/milestones/types.ts +52 -0
- package/src/resources/projects/index.ts +47 -0
- package/src/resources/projects/types.ts +134 -0
- package/src/resources/projectstatuses/index.ts +38 -0
- package/src/resources/projectstatuses/types.ts +44 -0
- package/src/resources/projecttemplates/index.ts +40 -0
- package/src/resources/projecttemplates/types.ts +43 -0
- package/src/resources/reports/index.ts +38 -0
- package/src/resources/reports/types.ts +104 -0
- package/src/resources/sessions/index.ts +39 -0
- package/src/resources/sessions/types.ts +43 -0
- package/src/resources/tasklists/index.ts +38 -0
- package/src/resources/tasklists/types.ts +48 -0
- package/src/resources/tasks/index.ts +38 -0
- package/src/resources/tasks/types.ts +76 -0
- package/src/resources/users/index.ts +48 -0
- package/src/resources/users/types.ts +124 -0
- package/src/resources/usertasks/index.ts +46 -0
- package/src/resources/usertasks/types.ts +43 -0
- package/src/resources/workflows/index.ts +38 -0
- package/src/resources/workflows/types.ts +43 -0
- package/src/resources/workflowstatuses/index.ts +38 -0
- package/src/resources/workflowstatuses/types.ts +47 -0
- package/src/types.ts +40 -0
- package/tsconfig.json +12 -0
- 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,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
|
+
}
|