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