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 { ReportsListConfig, ReportsTypeCreate, ReportsTypeResponse, ReportsTypeUpdate } from "./types"
|
|
4
|
+
|
|
5
|
+
export interface ReportsHandler extends AbstractResourceInterface {
|
|
6
|
+
get: (id: number) => Promise<ReportsTypeResponse | null>
|
|
7
|
+
list: (config?: ReportsListConfig) => Promise<ReportsTypeResponse[]>
|
|
8
|
+
create: (d: ReportsTypeCreate) => Promise<ReportsTypeResponse | null>
|
|
9
|
+
update: (id: number, data: ReportsTypeUpdate) => Promise<ReportsTypeResponse | null>
|
|
10
|
+
delete: (id: number) => Promise<boolean>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class Reports extends AbstractResource implements ReportsHandler {
|
|
14
|
+
constructor(auth: AuthInterface) {
|
|
15
|
+
super(auth, 'reports')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get = async (id: number) => {
|
|
19
|
+
return (await this.baseGet(id)) as ReportsTypeResponse | null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
list = async (config: ReportsListConfig = {}) => {
|
|
23
|
+
return (await this.baseList(config)) as ReportsTypeResponse[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
create = async (data: ReportsTypeCreate) => {
|
|
27
|
+
return (await this.baseCreate(data)) as ReportsTypeResponse | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update = async (id: number, data: ReportsTypeUpdate) => {
|
|
31
|
+
return (await this.baseUpdate(id, data)) as ReportsTypeResponse | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
delete = async (id: number) => {
|
|
35
|
+
return await this.baseDelete(id)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types"
|
|
2
|
+
|
|
3
|
+
// PAYMO API DOCS - 2019-12-11 /reports /reports/####
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
|
|
6
|
+
type ReportsDateIntervals = 'today' | 'yesterday' | 'this_month' | 'last_month' | 'this_week' | 'last_week' | 'this_year' | 'last_year' | 'all_time'
|
|
7
|
+
|
|
8
|
+
interface ReportsIncludeOptions {
|
|
9
|
+
days?: boolean
|
|
10
|
+
clients?: boolean
|
|
11
|
+
users?: boolean
|
|
12
|
+
projects?: boolean
|
|
13
|
+
tasklists?: boolean
|
|
14
|
+
tasks?: boolean
|
|
15
|
+
billed?: boolean
|
|
16
|
+
entries?: boolean
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ReportsExtraOptions {
|
|
20
|
+
exclude_billed_entries?: boolean
|
|
21
|
+
exclude_unbilled_entries?: boolean
|
|
22
|
+
exclude_billable_tasks?: boolean
|
|
23
|
+
exclude_nonbillable_tasks?: boolean
|
|
24
|
+
exclude_flat_rate_tasks?: boolean
|
|
25
|
+
exclude_flats?: boolean
|
|
26
|
+
enable_time_rounding?: boolean
|
|
27
|
+
rounding_step?: number // In minutes
|
|
28
|
+
display_charts?: boolean
|
|
29
|
+
display_costs?: boolean
|
|
30
|
+
display_entries_descriptions?: boolean
|
|
31
|
+
display_seconds?: boolean
|
|
32
|
+
display_tasks_codes?: boolean
|
|
33
|
+
display_tasks_descriptions?: boolean
|
|
34
|
+
display_tasks_complete_status?: boolean
|
|
35
|
+
display_tasks_remaining_time_budgets?: boolean
|
|
36
|
+
display_tasks_time_budget?: boolean
|
|
37
|
+
display_projects_budgets?: boolean
|
|
38
|
+
display_projects_codes?: boolean
|
|
39
|
+
display_projects_descriptions?: boolean
|
|
40
|
+
display_projects_remaining_budgets?: boolean
|
|
41
|
+
display_users_positions?: boolean
|
|
42
|
+
order?: Array<keyof ReportsIncludeOptions>
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ReportsTypeRead {
|
|
46
|
+
readonly id: number
|
|
47
|
+
readonly created_on: string
|
|
48
|
+
readonly updated_on: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ReportsTypeUpdate {
|
|
52
|
+
name?: string
|
|
53
|
+
user_id?: number
|
|
54
|
+
type?: 'static' | 'live' | 'temp'
|
|
55
|
+
start_date?: string
|
|
56
|
+
end_date?: string
|
|
57
|
+
date_interval?: ReportsDateIntervals
|
|
58
|
+
shared?: boolean
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ReportsTypeResponse = Merge<ReportsTypeUpdate, Merge<ReportsTypeRead, {
|
|
62
|
+
info: any // Parameters used in the creation
|
|
63
|
+
content?: { items: any[] } // Mix of response data types, @todo Can be narrowed down later
|
|
64
|
+
permalink: string
|
|
65
|
+
shared: boolean
|
|
66
|
+
share_client_id?: number
|
|
67
|
+
}>>
|
|
68
|
+
|
|
69
|
+
export type ReportsTypeCreate = ReportsTypeCreateWithInterval | ReportsTypeCreateWithDates
|
|
70
|
+
|
|
71
|
+
interface ReportsTypeCommon extends ReportsTypeUpdate {
|
|
72
|
+
projects?: number[] | 'all' | 'all_active' | 'all_archived' | string // string must be status_id=STATUS_ID
|
|
73
|
+
clients?: number[] | 'all' | 'all_active'
|
|
74
|
+
users?: number[] | 'all' | 'all_active' | 'all_archived'
|
|
75
|
+
include?: ReportsIncludeOptions
|
|
76
|
+
extra?: ReportsExtraOptions
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface ReportsTypeCreateWithInterval extends ReportsTypeCommon {
|
|
80
|
+
date_interval: ReportsDateIntervals
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface ReportsTypeCreateWithDates extends ReportsTypeCommon {
|
|
84
|
+
start_date: string
|
|
85
|
+
end_date: string
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface ReportsTypeFilter {
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface ReportsFilterCondition extends ReportsTypeFilter {
|
|
93
|
+
_custom?: {
|
|
94
|
+
[k: string]: {
|
|
95
|
+
key?: Extract<keyof ReportsTypeFilter, string>
|
|
96
|
+
operator?:FilterOperator
|
|
97
|
+
value: string | number | boolean | null | number[]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ReportsListConfig extends GenericListConfig {
|
|
103
|
+
filter?:ReportsFilterCondition
|
|
104
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract'
|
|
2
|
+
import { AuthInterface } from "../../types"
|
|
3
|
+
import { SessionsListConfig, SessionsTypeCreate, SessionsTypeResponse, SessionsTypeUpdate } from "./types"
|
|
4
|
+
|
|
5
|
+
export interface SessionsHandler extends AbstractResourceInterface {
|
|
6
|
+
get: (id: number) => Promise<SessionsTypeResponse | null>
|
|
7
|
+
list: (config?: SessionsListConfig) => Promise<SessionsTypeResponse[]>
|
|
8
|
+
create: (d: SessionsTypeCreate) => Promise<SessionsTypeResponse | null>
|
|
9
|
+
update: (id: number, data: SessionsTypeUpdate) => Promise<SessionsTypeResponse | null>
|
|
10
|
+
delete: (id: number) => Promise<boolean>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class Sessions extends AbstractResource implements SessionsHandler {
|
|
14
|
+
constructor(auth: AuthInterface) {
|
|
15
|
+
super(auth, 'sessions')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get = async (id: number) => {
|
|
19
|
+
return (await this.baseGet(id)) as SessionsTypeResponse | null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
list = async (config: SessionsListConfig = {}) => {
|
|
23
|
+
return (await this.baseList(config)) as SessionsTypeResponse[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
create = async (data: SessionsTypeCreate) => {
|
|
27
|
+
return (await this.baseCreate(data)) as SessionsTypeResponse | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// There is no update method for sessions. Create, List, Get, or Delete only
|
|
31
|
+
update = async (id: number, data: SessionsTypeUpdate) => {
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
delete = async (id: number) => {
|
|
36
|
+
return await this.baseDelete(id)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types"
|
|
2
|
+
|
|
3
|
+
// PAYMO API DOCS - 2019-12-11 /sessions /sessions/####
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
|
|
6
|
+
export interface SessionsTypeRead {
|
|
7
|
+
readonly id: string
|
|
8
|
+
readonly ip: string
|
|
9
|
+
readonly created_on: string
|
|
10
|
+
readonly updated_on: string
|
|
11
|
+
readonly expires_on: string
|
|
12
|
+
readonly user_id: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SessionsTypeUpdate {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type SessionsTypeResponse = Merge<SessionsTypeUpdate, Merge<SessionsTypeRead, {
|
|
20
|
+
|
|
21
|
+
}>>
|
|
22
|
+
|
|
23
|
+
export interface SessionsTypeCreate {
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface SessionsTypeFilter {
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SessionsFilterCondition extends SessionsTypeFilter {
|
|
32
|
+
_custom?: {
|
|
33
|
+
[k: string]: {
|
|
34
|
+
key?: Extract<keyof SessionsTypeFilter, string>
|
|
35
|
+
operator?:FilterOperator
|
|
36
|
+
value: string | number | boolean | null | number[]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface SessionsListConfig extends GenericListConfig {
|
|
42
|
+
filter?:SessionsFilterCondition
|
|
43
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract'
|
|
2
|
+
import { AuthInterface } from "../../types"
|
|
3
|
+
import { TaskListsListConfig, TaskListsTypeCreate, TaskListsTypeResponse, TaskListsTypeUpdate } from "./types"
|
|
4
|
+
|
|
5
|
+
export interface TaskListsHandler extends AbstractResourceInterface {
|
|
6
|
+
get: (id: number) => Promise<TaskListsTypeResponse | null>
|
|
7
|
+
list: (config?: TaskListsListConfig) => Promise<TaskListsTypeResponse[]>
|
|
8
|
+
create: (d: TaskListsTypeCreate) => Promise<TaskListsTypeResponse | null>
|
|
9
|
+
update: (id: number, data: TaskListsTypeUpdate) => Promise<TaskListsTypeResponse | null>
|
|
10
|
+
delete: (id: number) => Promise<boolean>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class TaskLists extends AbstractResource implements TaskListsHandler {
|
|
14
|
+
constructor(auth: AuthInterface) {
|
|
15
|
+
super(auth, 'tasklists')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get = async (id: number) => {
|
|
19
|
+
return (await this.baseGet(id)) as TaskListsTypeResponse | null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
list = async (config: TaskListsListConfig = {}) => {
|
|
23
|
+
return (await this.baseList(config)) as TaskListsTypeResponse[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
create = async (data: TaskListsTypeCreate) => {
|
|
27
|
+
return (await this.baseCreate(data)) as TaskListsTypeResponse | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update = async (id: number, data: TaskListsTypeUpdate) => {
|
|
31
|
+
return (await this.baseUpdate(id, data)) as TaskListsTypeResponse | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
delete = async (id: number) => {
|
|
35
|
+
return await this.baseDelete(id)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from '../../types'
|
|
2
|
+
|
|
3
|
+
// PAYMO API DOCS - 2019-12-11 /tasklists /tasklists/####
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
|
|
6
|
+
export interface TaskListsTypeRead {
|
|
7
|
+
readonly id: number
|
|
8
|
+
readonly created_on: string
|
|
9
|
+
readonly updated_on: string
|
|
10
|
+
readonly project_id: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TaskListsTypeUpdate {
|
|
14
|
+
name?: string
|
|
15
|
+
seq?: number | null
|
|
16
|
+
milestone_id?: number
|
|
17
|
+
tasks_order?: number[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type TaskListsTypeResponse = Merge<
|
|
21
|
+
TaskListsTypeUpdate,
|
|
22
|
+
Merge<TaskListsTypeRead, {}>
|
|
23
|
+
>
|
|
24
|
+
|
|
25
|
+
export interface TaskListsTypeCreate extends TaskListsTypeUpdate {
|
|
26
|
+
name: string
|
|
27
|
+
project_id: number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface TaskListsTypeFilter {
|
|
31
|
+
name?:string
|
|
32
|
+
project_id?: number
|
|
33
|
+
milestone_id?: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TaskListsFilterCondition extends TaskListsTypeFilter {
|
|
37
|
+
_custom?: {
|
|
38
|
+
[k: string]: {
|
|
39
|
+
key?: Extract<keyof TaskListsTypeFilter, string>
|
|
40
|
+
operator?: FilterOperator
|
|
41
|
+
value: string | number | boolean | null | number[]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface TaskListsListConfig extends GenericListConfig {
|
|
47
|
+
filter?: TaskListsFilterCondition
|
|
48
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract'
|
|
2
|
+
import { AuthInterface } from "../../types"
|
|
3
|
+
import { TasksListConfig, TasksTypeCreate, TasksTypeResponse, TasksTypeUpdate } from "./types"
|
|
4
|
+
|
|
5
|
+
export interface TasksHandler extends AbstractResourceInterface {
|
|
6
|
+
get: (id: number) => Promise<TasksTypeResponse | null>
|
|
7
|
+
list: (config?: TasksListConfig) => Promise<TasksTypeResponse[]>
|
|
8
|
+
create: (d: TasksTypeCreate) => Promise<TasksTypeResponse | null>
|
|
9
|
+
update: (id: number, data: TasksTypeUpdate) => Promise<TasksTypeResponse | null>
|
|
10
|
+
delete: (id: number) => Promise<boolean>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class Tasks extends AbstractResource implements TasksHandler {
|
|
14
|
+
constructor(auth: AuthInterface) {
|
|
15
|
+
super(auth, 'tasks')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get = async (id: number) => {
|
|
19
|
+
return (await this.baseGet(id)) as TasksTypeResponse | null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
list = async (config: TasksListConfig = {}) => {
|
|
23
|
+
return (await this.baseList(config)) as TasksTypeResponse[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
create = async (data: TasksTypeCreate) => {
|
|
27
|
+
return (await this.baseCreate(data)) as TasksTypeResponse | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
update = async (id: number, data: TasksTypeUpdate) => {
|
|
31
|
+
return (await this.baseUpdate(id, data)) as TasksTypeResponse | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
delete = async (id: number) => {
|
|
35
|
+
return await this.baseDelete(id)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types"
|
|
2
|
+
|
|
3
|
+
// PAYMO API DOCS - 2019-12-11 /tasks /tasks/####
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
|
|
6
|
+
export interface TasksTypeRead {
|
|
7
|
+
readonly id: number
|
|
8
|
+
readonly created_on: string
|
|
9
|
+
readonly updated_on: string
|
|
10
|
+
readonly project_id: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface TasksTypeUpdate {
|
|
14
|
+
name?:string
|
|
15
|
+
code?:string
|
|
16
|
+
tasklist_id?: number
|
|
17
|
+
seq?: number | null
|
|
18
|
+
description?: string
|
|
19
|
+
complete?: boolean
|
|
20
|
+
due_date?: string
|
|
21
|
+
user_id?: number
|
|
22
|
+
users?: number[] | null
|
|
23
|
+
billable?: boolean
|
|
24
|
+
flat_billing?: boolean
|
|
25
|
+
price_per_hour?: number
|
|
26
|
+
budget_hours?: number
|
|
27
|
+
estimated_price?: number
|
|
28
|
+
invoiced?: boolean
|
|
29
|
+
invoice_item_id?: number
|
|
30
|
+
priority?: 25 | 50 | 75 | 100
|
|
31
|
+
status_id?: number
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type TasksTypeResponse = Merge<TasksTypeUpdate, Merge<TasksTypeRead, {
|
|
35
|
+
completed_by?:number
|
|
36
|
+
cover_file_id?: number
|
|
37
|
+
start_date?:string
|
|
38
|
+
recurring_profile_id?:number
|
|
39
|
+
billing_type?:string
|
|
40
|
+
}>>
|
|
41
|
+
|
|
42
|
+
interface TasksTypeCreateCommon extends TasksTypeUpdate {
|
|
43
|
+
name: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface TasksTypeCreateWithTaskList extends TasksTypeCreateCommon {
|
|
47
|
+
tasklist_id: number
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface TasksTypeCreateWithProject extends TasksTypeCreateCommon {
|
|
51
|
+
project_id: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type TasksTypeCreate = TasksTypeCreateWithProject | TasksTypeCreateWithTaskList
|
|
55
|
+
|
|
56
|
+
export interface TasksTypeFilter {
|
|
57
|
+
project_id?:number
|
|
58
|
+
tasklist_id?: number
|
|
59
|
+
complete?: boolean
|
|
60
|
+
users?: number | (number|string)[] | 'anyone'
|
|
61
|
+
mytasks?: boolean
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface TasksFilterCondition extends TasksTypeFilter {
|
|
65
|
+
_custom?: {
|
|
66
|
+
[k: string]: {
|
|
67
|
+
key?: Extract<keyof TasksTypeFilter, string>
|
|
68
|
+
operator?:FilterOperator
|
|
69
|
+
value: string | number | boolean | null | number[]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface TasksListConfig extends GenericListConfig {
|
|
75
|
+
filter?:TasksFilterCondition
|
|
76
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract'
|
|
2
|
+
import { AuthInterface } from "../../types"
|
|
3
|
+
import { UsersListConfig, UserTypeCreate, UserTypeResponse, UserTypeUpdate } from "./types"
|
|
4
|
+
|
|
5
|
+
export interface UsersHandler extends AbstractResourceInterface {
|
|
6
|
+
get: (id: number) => Promise<UserTypeResponse | null>
|
|
7
|
+
list: (config?: UsersListConfig) => Promise<UserTypeResponse[]>
|
|
8
|
+
create: (d: UserTypeCreate) => Promise<UserTypeResponse | null>
|
|
9
|
+
update: (id: number, data: UserTypeUpdate) => Promise<UserTypeResponse | null>
|
|
10
|
+
delete: (id: number) => Promise<boolean>
|
|
11
|
+
retire: (id: number) => Promise<UserTypeResponse | null>
|
|
12
|
+
activate: (id: number) => Promise<UserTypeResponse | null>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class Users extends AbstractResource implements UsersHandler {
|
|
16
|
+
constructor(auth: AuthInterface) {
|
|
17
|
+
super(auth, 'users')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get = async (id: number) => {
|
|
21
|
+
return (await this.baseGet(id)) as UserTypeResponse | null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
list = async (config: UsersListConfig = {}) => {
|
|
25
|
+
return (await this.baseList(config)) as UserTypeResponse[]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
create = async (data: UserTypeCreate) => {
|
|
29
|
+
return (await this.baseCreate(data)) as UserTypeResponse | null
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
update = async (id: number, data: UserTypeUpdate) => {
|
|
33
|
+
return (await this.baseUpdate(id, data)) as UserTypeResponse | null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
delete = async (id: number) => {
|
|
37
|
+
return await this.baseDelete(id)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
retire = async (id: number) => {
|
|
41
|
+
return await this.update(id, {active:false})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
activate = async (id: number) => {
|
|
45
|
+
return await this.update(id, {active:true})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types"
|
|
2
|
+
|
|
3
|
+
// PAYMO API DOCS - 2019-11-23 /users /users/####
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
// id integer (read-only) Unique user identifier
|
|
6
|
+
// name text Full name
|
|
7
|
+
// email email Email address. There are no two active users in Paymo with the same email address. Email is used to receive notifications from Paymo as well as to log into Paymo.
|
|
8
|
+
// type text Account type. Available options: Admin, Employee.
|
|
9
|
+
// active boolean If true the user is active and can use Paymo, otherwise it is retired (archived).
|
|
10
|
+
// timezone text User timezone. List of available options
|
|
11
|
+
// phone text Phone number
|
|
12
|
+
// skype text Skype account name
|
|
13
|
+
// position text Job position description
|
|
14
|
+
// workday_hours decimal Number of working hours in a day. It is used to compute user performance.
|
|
15
|
+
// price_per_hour decimal Price per hour. It is used in invoicing to compute the cost of worked time.
|
|
16
|
+
// created_on datetime (read-only) Date and time when the user was created
|
|
17
|
+
// updated_on datetime (read-only) Date and time when the user was last updated
|
|
18
|
+
// image url User profile image URL
|
|
19
|
+
// image_thumb_large url (read-only) User profile image large size thumbnail URL
|
|
20
|
+
// image_thumb_medium url (read-only) User profile image medium size thumbnail URL
|
|
21
|
+
// image_thumb_small url (read-only) User profile image small size thumbnail URL
|
|
22
|
+
// date_format text Format for displaying dates in the application. Available options: Y-m-d, d/m/Y, m/d/Y, d.m.Y.
|
|
23
|
+
// time_format text Format for displaying time values. Available options: H:i for 24-hour format, h:i a for 12-hour format.
|
|
24
|
+
// decimal_sep text Decimal separator for displaying numeric values
|
|
25
|
+
// thousands_sep text Thousands separator for displaying numeric values
|
|
26
|
+
// week_start text Numeric value in the range 0-6 representing the day the week starts, 0 being Sunday, 6 being Saturday.
|
|
27
|
+
// language text Paymo user interface language
|
|
28
|
+
// theme text Paymo user interface theme name
|
|
29
|
+
// assigned_projects list List of projects ids to which the user is assigned
|
|
30
|
+
// managed_projects list List of projects ids that the user manages. This list is a subset of assigned_projects.
|
|
31
|
+
// is_online boolean (read-only) If true the user is logged into Paymo.
|
|
32
|
+
// password text (only for create/update requests) User password when creating or updating a user.
|
|
33
|
+
|
|
34
|
+
export interface UserTypeRead {
|
|
35
|
+
readonly id: number
|
|
36
|
+
readonly created_on: string
|
|
37
|
+
readonly updated_on: string
|
|
38
|
+
readonly image_thumb_large?: string
|
|
39
|
+
readonly image_thumb_medium?: string
|
|
40
|
+
readonly image_thumb_small?: string
|
|
41
|
+
readonly is_online?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface UserTypeUpdate {
|
|
45
|
+
name?: string
|
|
46
|
+
email?: string
|
|
47
|
+
type?: "Admin" | "Employee"
|
|
48
|
+
active?: boolean
|
|
49
|
+
timezone?: string
|
|
50
|
+
phone?: string
|
|
51
|
+
skype?: string
|
|
52
|
+
position?: string
|
|
53
|
+
workday_hours?: number
|
|
54
|
+
price_per_hour?:number
|
|
55
|
+
image?: string
|
|
56
|
+
date_format?:"Y-m-d"|"d/m/Y"|"m/d/Y"|"d.m.Y"
|
|
57
|
+
time_format?:"H:i"|"h:i"
|
|
58
|
+
decimal_sep?:string
|
|
59
|
+
thousands_sep?:string
|
|
60
|
+
week_start?:"0"|"1"|"2"|"3"|"4"|"5"|"6"
|
|
61
|
+
language?:string
|
|
62
|
+
theme?:string
|
|
63
|
+
assigned_projects?:number[]
|
|
64
|
+
managed_projects?:number[]
|
|
65
|
+
password?:string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type UserTypeResponse = Merge<UserTypeUpdate, Merge<UserTypeRead, {
|
|
69
|
+
additional_privileges:any[]
|
|
70
|
+
annual_leave_days_number:number|null
|
|
71
|
+
image:string|null
|
|
72
|
+
phone:string|null
|
|
73
|
+
position:string|null
|
|
74
|
+
price_per_hour:string|null
|
|
75
|
+
skype:string|null
|
|
76
|
+
user_hash:string
|
|
77
|
+
workflows:number[]
|
|
78
|
+
}>>
|
|
79
|
+
|
|
80
|
+
export interface UserTypeCreate extends UserTypeUpdate {
|
|
81
|
+
email: string
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface UserTypeFilter {
|
|
85
|
+
id?: number
|
|
86
|
+
created_on?: string
|
|
87
|
+
updated_on?: string
|
|
88
|
+
is_online?: boolean
|
|
89
|
+
name?: string
|
|
90
|
+
email?: string
|
|
91
|
+
type?: "Admin" | "Employee"
|
|
92
|
+
active?: boolean
|
|
93
|
+
timezone?: string
|
|
94
|
+
phone?: string
|
|
95
|
+
skype?: string
|
|
96
|
+
position?: string
|
|
97
|
+
workday_hours?: number
|
|
98
|
+
price_per_hour?:number
|
|
99
|
+
image?: string
|
|
100
|
+
date_format?:"Y-m-d"|"d/m/Y"|"m/d/Y"|"d.m.Y"
|
|
101
|
+
time_format?:"H:i"|"h:i"
|
|
102
|
+
decimal_sep?:string
|
|
103
|
+
thousands_sep?:string
|
|
104
|
+
week_start?:0|1|2|3|4|5|6
|
|
105
|
+
language?:string
|
|
106
|
+
theme?:string
|
|
107
|
+
assigned_projects?:number[]
|
|
108
|
+
managed_projects?:number[]
|
|
109
|
+
password?:string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface UserFilterCondition extends UserTypeFilter {
|
|
113
|
+
_custom?: {
|
|
114
|
+
[k: string]: {
|
|
115
|
+
key?: Extract<keyof UserTypeFilter, string>
|
|
116
|
+
operator?:FilterOperator
|
|
117
|
+
value: string | number | boolean | null | number[]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface UsersListConfig extends GenericListConfig {
|
|
123
|
+
filter?:UserFilterCondition
|
|
124
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract'
|
|
2
|
+
import { AuthInterface } from "../../types"
|
|
3
|
+
import { UserTasksListConfig, UserTasksTypeCreate, UserTasksTypeResponse, UserTasksTypeUpdate } from "./types"
|
|
4
|
+
|
|
5
|
+
export interface UserTasksHandler extends AbstractResourceInterface {
|
|
6
|
+
get: (id: number) => Promise<UserTasksTypeResponse | null>
|
|
7
|
+
list: (config?: UserTasksListConfig) => Promise<UserTasksTypeResponse[]>
|
|
8
|
+
create: (d: UserTasksTypeCreate) => Promise<UserTasksTypeResponse | null>
|
|
9
|
+
update: (id: number, data: UserTasksTypeUpdate) => Promise<UserTasksTypeResponse | null>
|
|
10
|
+
delete: (id: number) => Promise<boolean>
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export class UserTasks extends AbstractResource implements UserTasksHandler {
|
|
14
|
+
constructor(auth: AuthInterface) {
|
|
15
|
+
super(auth, 'userstasks')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get = async (id: number) => {
|
|
19
|
+
return (await this.baseGet(id)) as UserTasksTypeResponse | null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
list = async (config: UserTasksListConfig = {}) => {
|
|
23
|
+
const validConfig =
|
|
24
|
+
!!config &&
|
|
25
|
+
config.filter &&
|
|
26
|
+
(config.filter.user_id || config.filter.task_id)
|
|
27
|
+
if (!validConfig) {
|
|
28
|
+
console.log('User task list requires at least a user_id or task_id filter')
|
|
29
|
+
return []
|
|
30
|
+
}
|
|
31
|
+
return (await this.baseList(config)) as UserTasksTypeResponse[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
create = async (data: UserTasksTypeCreate) => {
|
|
35
|
+
return (await this.baseCreate(data)) as UserTasksTypeResponse | null
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
update = async (id: number, data: UserTasksTypeUpdate) => {
|
|
39
|
+
return (await this.baseUpdate(id, data)) as UserTasksTypeResponse | null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
delete = async (id: number) => {
|
|
43
|
+
return await this.baseDelete(id)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types"
|
|
2
|
+
|
|
3
|
+
// PAYMO API DOCS - 2019-12-11 /userstasks /userstasks/####
|
|
4
|
+
// =================================================================================================
|
|
5
|
+
|
|
6
|
+
export interface UserTasksTypeRead {
|
|
7
|
+
readonly id: number
|
|
8
|
+
readonly created_on: string
|
|
9
|
+
readonly updated_on: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface UserTasksTypeUpdate {
|
|
13
|
+
user_id?:number
|
|
14
|
+
task_id?:number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type UserTasksTypeResponse = Merge<UserTasksTypeUpdate, Merge<UserTasksTypeRead, {
|
|
18
|
+
|
|
19
|
+
}>>
|
|
20
|
+
|
|
21
|
+
export interface UserTasksTypeCreate extends UserTasksTypeUpdate {
|
|
22
|
+
user_id:number
|
|
23
|
+
task_id:number
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface UserTasksTypeFilter {
|
|
27
|
+
user_id?:number
|
|
28
|
+
task_id?:number
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface UserTasksFilterCondition extends UserTasksTypeFilter {
|
|
32
|
+
_custom?: {
|
|
33
|
+
[k: string]: {
|
|
34
|
+
key?: Extract<keyof UserTasksTypeFilter, string>
|
|
35
|
+
operator?:FilterOperator
|
|
36
|
+
value: string | number | boolean | null | number[]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface UserTasksListConfig extends GenericListConfig {
|
|
42
|
+
filter?:UserTasksFilterCondition
|
|
43
|
+
}
|