node-paymo-api 0.0.4 → 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/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 +6 -6
- package/src/abstract.ts +8 -12
- package/src/remote.ts +1 -1
- package/yarn-error.log +0 -126
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Tasks = void 0;
|
|
13
|
+
const abstract_1 = require("../../abstract");
|
|
14
|
+
class Tasks extends abstract_1.AbstractResource {
|
|
15
|
+
constructor(auth) {
|
|
16
|
+
super(auth, 'tasks');
|
|
17
|
+
this.get = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return (yield this.baseGet(id));
|
|
19
|
+
});
|
|
20
|
+
this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
|
|
21
|
+
return (yield this.baseList(config));
|
|
22
|
+
});
|
|
23
|
+
this.create = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return (yield this.baseCreate(data));
|
|
25
|
+
});
|
|
26
|
+
this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return (yield this.baseUpdate(id, data));
|
|
28
|
+
});
|
|
29
|
+
this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield this.baseDelete(id);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.Tasks = Tasks;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types";
|
|
2
|
+
export interface TasksTypeRead {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly created_on: string;
|
|
5
|
+
readonly updated_on: string;
|
|
6
|
+
readonly project_id: number;
|
|
7
|
+
}
|
|
8
|
+
export interface TasksTypeUpdate {
|
|
9
|
+
name?: string;
|
|
10
|
+
code?: string;
|
|
11
|
+
tasklist_id?: number;
|
|
12
|
+
seq?: number | null;
|
|
13
|
+
description?: string;
|
|
14
|
+
complete?: boolean;
|
|
15
|
+
due_date?: string;
|
|
16
|
+
user_id?: number;
|
|
17
|
+
users?: number[] | null;
|
|
18
|
+
billable?: boolean;
|
|
19
|
+
flat_billing?: boolean;
|
|
20
|
+
price_per_hour?: number;
|
|
21
|
+
budget_hours?: number;
|
|
22
|
+
estimated_price?: number;
|
|
23
|
+
invoiced?: boolean;
|
|
24
|
+
invoice_item_id?: number;
|
|
25
|
+
priority?: 25 | 50 | 75 | 100;
|
|
26
|
+
status_id?: number;
|
|
27
|
+
}
|
|
28
|
+
export type TasksTypeResponse = Merge<TasksTypeUpdate, Merge<TasksTypeRead, {
|
|
29
|
+
completed_by?: number;
|
|
30
|
+
cover_file_id?: number;
|
|
31
|
+
start_date?: string;
|
|
32
|
+
recurring_profile_id?: number;
|
|
33
|
+
billing_type?: string;
|
|
34
|
+
}>>;
|
|
35
|
+
interface TasksTypeCreateCommon extends TasksTypeUpdate {
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
interface TasksTypeCreateWithTaskList extends TasksTypeCreateCommon {
|
|
39
|
+
tasklist_id: number;
|
|
40
|
+
}
|
|
41
|
+
interface TasksTypeCreateWithProject extends TasksTypeCreateCommon {
|
|
42
|
+
project_id: number;
|
|
43
|
+
}
|
|
44
|
+
export type TasksTypeCreate = TasksTypeCreateWithProject | TasksTypeCreateWithTaskList;
|
|
45
|
+
export interface TasksTypeFilter {
|
|
46
|
+
project_id?: number;
|
|
47
|
+
tasklist_id?: number;
|
|
48
|
+
complete?: boolean;
|
|
49
|
+
users?: number | (number | string)[] | 'anyone';
|
|
50
|
+
mytasks?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface TasksFilterCondition extends TasksTypeFilter {
|
|
53
|
+
_custom?: {
|
|
54
|
+
[k: string]: {
|
|
55
|
+
key?: Extract<keyof TasksTypeFilter, string>;
|
|
56
|
+
operator?: FilterOperator;
|
|
57
|
+
value: string | number | boolean | null | number[];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface TasksListConfig extends GenericListConfig {
|
|
62
|
+
filter?: TasksFilterCondition;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract';
|
|
2
|
+
import { AuthInterface } from "../../types";
|
|
3
|
+
import { UsersListConfig, UserTypeCreate, UserTypeResponse, UserTypeUpdate } from "./types";
|
|
4
|
+
export interface UsersHandler extends AbstractResourceInterface {
|
|
5
|
+
get: (id: number) => Promise<UserTypeResponse | null>;
|
|
6
|
+
list: (config?: UsersListConfig) => Promise<UserTypeResponse[]>;
|
|
7
|
+
create: (d: UserTypeCreate) => Promise<UserTypeResponse | null>;
|
|
8
|
+
update: (id: number, data: UserTypeUpdate) => Promise<UserTypeResponse | null>;
|
|
9
|
+
delete: (id: number) => Promise<boolean>;
|
|
10
|
+
retire: (id: number) => Promise<UserTypeResponse | null>;
|
|
11
|
+
activate: (id: number) => Promise<UserTypeResponse | null>;
|
|
12
|
+
}
|
|
13
|
+
export declare class Users extends AbstractResource implements UsersHandler {
|
|
14
|
+
constructor(auth: AuthInterface);
|
|
15
|
+
get: (id: number) => Promise<UserTypeResponse | null>;
|
|
16
|
+
list: (config?: UsersListConfig) => Promise<UserTypeResponse[]>;
|
|
17
|
+
create: (data: UserTypeCreate) => Promise<UserTypeResponse | null>;
|
|
18
|
+
update: (id: number, data: UserTypeUpdate) => Promise<UserTypeResponse | null>;
|
|
19
|
+
delete: (id: number) => Promise<boolean>;
|
|
20
|
+
retire: (id: number) => Promise<UserTypeResponse | null>;
|
|
21
|
+
activate: (id: number) => Promise<UserTypeResponse | null>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Users = void 0;
|
|
13
|
+
const abstract_1 = require("../../abstract");
|
|
14
|
+
class Users extends abstract_1.AbstractResource {
|
|
15
|
+
constructor(auth) {
|
|
16
|
+
super(auth, 'users');
|
|
17
|
+
this.get = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return (yield this.baseGet(id));
|
|
19
|
+
});
|
|
20
|
+
this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
|
|
21
|
+
return (yield this.baseList(config));
|
|
22
|
+
});
|
|
23
|
+
this.create = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return (yield this.baseCreate(data));
|
|
25
|
+
});
|
|
26
|
+
this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return (yield this.baseUpdate(id, data));
|
|
28
|
+
});
|
|
29
|
+
this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield this.baseDelete(id);
|
|
31
|
+
});
|
|
32
|
+
this.retire = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return yield this.update(id, { active: false });
|
|
34
|
+
});
|
|
35
|
+
this.activate = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return yield this.update(id, { active: true });
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.Users = Users;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types";
|
|
2
|
+
export interface UserTypeRead {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly created_on: string;
|
|
5
|
+
readonly updated_on: string;
|
|
6
|
+
readonly image_thumb_large?: string;
|
|
7
|
+
readonly image_thumb_medium?: string;
|
|
8
|
+
readonly image_thumb_small?: string;
|
|
9
|
+
readonly is_online?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface UserTypeUpdate {
|
|
12
|
+
name?: string;
|
|
13
|
+
email?: string;
|
|
14
|
+
type?: "Admin" | "Employee";
|
|
15
|
+
active?: boolean;
|
|
16
|
+
timezone?: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
skype?: string;
|
|
19
|
+
position?: string;
|
|
20
|
+
workday_hours?: number;
|
|
21
|
+
price_per_hour?: number;
|
|
22
|
+
image?: string;
|
|
23
|
+
date_format?: "Y-m-d" | "d/m/Y" | "m/d/Y" | "d.m.Y";
|
|
24
|
+
time_format?: "H:i" | "h:i";
|
|
25
|
+
decimal_sep?: string;
|
|
26
|
+
thousands_sep?: string;
|
|
27
|
+
week_start?: "0" | "1" | "2" | "3" | "4" | "5" | "6";
|
|
28
|
+
language?: string;
|
|
29
|
+
theme?: string;
|
|
30
|
+
assigned_projects?: number[];
|
|
31
|
+
managed_projects?: number[];
|
|
32
|
+
password?: string;
|
|
33
|
+
}
|
|
34
|
+
export type UserTypeResponse = Merge<UserTypeUpdate, Merge<UserTypeRead, {
|
|
35
|
+
additional_privileges: any[];
|
|
36
|
+
annual_leave_days_number: number | null;
|
|
37
|
+
image: string | null;
|
|
38
|
+
phone: string | null;
|
|
39
|
+
position: string | null;
|
|
40
|
+
price_per_hour: string | null;
|
|
41
|
+
skype: string | null;
|
|
42
|
+
user_hash: string;
|
|
43
|
+
workflows: number[];
|
|
44
|
+
}>>;
|
|
45
|
+
export interface UserTypeCreate extends UserTypeUpdate {
|
|
46
|
+
email: string;
|
|
47
|
+
}
|
|
48
|
+
export interface UserTypeFilter {
|
|
49
|
+
id?: number;
|
|
50
|
+
created_on?: string;
|
|
51
|
+
updated_on?: string;
|
|
52
|
+
is_online?: boolean;
|
|
53
|
+
name?: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
type?: "Admin" | "Employee";
|
|
56
|
+
active?: boolean;
|
|
57
|
+
timezone?: string;
|
|
58
|
+
phone?: string;
|
|
59
|
+
skype?: string;
|
|
60
|
+
position?: string;
|
|
61
|
+
workday_hours?: number;
|
|
62
|
+
price_per_hour?: number;
|
|
63
|
+
image?: string;
|
|
64
|
+
date_format?: "Y-m-d" | "d/m/Y" | "m/d/Y" | "d.m.Y";
|
|
65
|
+
time_format?: "H:i" | "h:i";
|
|
66
|
+
decimal_sep?: string;
|
|
67
|
+
thousands_sep?: string;
|
|
68
|
+
week_start?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
69
|
+
language?: string;
|
|
70
|
+
theme?: string;
|
|
71
|
+
assigned_projects?: number[];
|
|
72
|
+
managed_projects?: number[];
|
|
73
|
+
password?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface UserFilterCondition extends UserTypeFilter {
|
|
76
|
+
_custom?: {
|
|
77
|
+
[k: string]: {
|
|
78
|
+
key?: Extract<keyof UserTypeFilter, string>;
|
|
79
|
+
operator?: FilterOperator;
|
|
80
|
+
value: string | number | boolean | null | number[];
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export interface UsersListConfig extends GenericListConfig {
|
|
85
|
+
filter?: UserFilterCondition;
|
|
86
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract';
|
|
2
|
+
import { AuthInterface } from "../../types";
|
|
3
|
+
import { UserTasksListConfig, UserTasksTypeCreate, UserTasksTypeResponse, UserTasksTypeUpdate } from "./types";
|
|
4
|
+
export interface UserTasksHandler extends AbstractResourceInterface {
|
|
5
|
+
get: (id: number) => Promise<UserTasksTypeResponse | null>;
|
|
6
|
+
list: (config?: UserTasksListConfig) => Promise<UserTasksTypeResponse[]>;
|
|
7
|
+
create: (d: UserTasksTypeCreate) => Promise<UserTasksTypeResponse | null>;
|
|
8
|
+
update: (id: number, data: UserTasksTypeUpdate) => Promise<UserTasksTypeResponse | null>;
|
|
9
|
+
delete: (id: number) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
export declare class UserTasks extends AbstractResource implements UserTasksHandler {
|
|
12
|
+
constructor(auth: AuthInterface);
|
|
13
|
+
get: (id: number) => Promise<UserTasksTypeResponse | null>;
|
|
14
|
+
list: (config?: UserTasksListConfig) => Promise<UserTasksTypeResponse[]>;
|
|
15
|
+
create: (data: UserTasksTypeCreate) => Promise<UserTasksTypeResponse | null>;
|
|
16
|
+
update: (id: number, data: UserTasksTypeUpdate) => Promise<UserTasksTypeResponse | null>;
|
|
17
|
+
delete: (id: number) => Promise<boolean>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UserTasks = void 0;
|
|
13
|
+
const abstract_1 = require("../../abstract");
|
|
14
|
+
class UserTasks extends abstract_1.AbstractResource {
|
|
15
|
+
constructor(auth) {
|
|
16
|
+
super(auth, 'userstasks');
|
|
17
|
+
this.get = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return (yield this.baseGet(id));
|
|
19
|
+
});
|
|
20
|
+
this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
|
|
21
|
+
const validConfig = !!config &&
|
|
22
|
+
config.filter &&
|
|
23
|
+
(config.filter.user_id || config.filter.task_id);
|
|
24
|
+
if (!validConfig) {
|
|
25
|
+
console.log('User task list requires at least a user_id or task_id filter');
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return (yield this.baseList(config));
|
|
29
|
+
});
|
|
30
|
+
this.create = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
return (yield this.baseCreate(data));
|
|
32
|
+
});
|
|
33
|
+
this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return (yield this.baseUpdate(id, data));
|
|
35
|
+
});
|
|
36
|
+
this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
return yield this.baseDelete(id);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.UserTasks = UserTasks;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types";
|
|
2
|
+
export interface UserTasksTypeRead {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly created_on: string;
|
|
5
|
+
readonly updated_on: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UserTasksTypeUpdate {
|
|
8
|
+
user_id?: number;
|
|
9
|
+
task_id?: number;
|
|
10
|
+
}
|
|
11
|
+
export type UserTasksTypeResponse = Merge<UserTasksTypeUpdate, Merge<UserTasksTypeRead, {}>>;
|
|
12
|
+
export interface UserTasksTypeCreate extends UserTasksTypeUpdate {
|
|
13
|
+
user_id: number;
|
|
14
|
+
task_id: number;
|
|
15
|
+
}
|
|
16
|
+
export interface UserTasksTypeFilter {
|
|
17
|
+
user_id?: number;
|
|
18
|
+
task_id?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface UserTasksFilterCondition extends UserTasksTypeFilter {
|
|
21
|
+
_custom?: {
|
|
22
|
+
[k: string]: {
|
|
23
|
+
key?: Extract<keyof UserTasksTypeFilter, string>;
|
|
24
|
+
operator?: FilterOperator;
|
|
25
|
+
value: string | number | boolean | null | number[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface UserTasksListConfig extends GenericListConfig {
|
|
30
|
+
filter?: UserTasksFilterCondition;
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract';
|
|
2
|
+
import { AuthInterface } from "../../types";
|
|
3
|
+
import { WorkflowsListConfig, WorkflowsTypeCreate, WorkflowsTypeResponse, WorkflowsTypeUpdate } from "./types";
|
|
4
|
+
export interface WorkflowsHandler extends AbstractResourceInterface {
|
|
5
|
+
get: (id: number) => Promise<WorkflowsTypeResponse | null>;
|
|
6
|
+
list: (config?: WorkflowsListConfig) => Promise<WorkflowsTypeResponse[]>;
|
|
7
|
+
create: (d: WorkflowsTypeCreate) => Promise<WorkflowsTypeResponse | null>;
|
|
8
|
+
update: (id: number, data: WorkflowsTypeUpdate) => Promise<WorkflowsTypeResponse | null>;
|
|
9
|
+
delete: (id: number) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
export declare class Workflows extends AbstractResource implements WorkflowsHandler {
|
|
12
|
+
constructor(auth: AuthInterface);
|
|
13
|
+
get: (id: number) => Promise<WorkflowsTypeResponse | null>;
|
|
14
|
+
list: (config?: WorkflowsListConfig) => Promise<WorkflowsTypeResponse[]>;
|
|
15
|
+
create: (data: WorkflowsTypeCreate) => Promise<WorkflowsTypeResponse | null>;
|
|
16
|
+
update: (id: number, data: WorkflowsTypeUpdate) => Promise<WorkflowsTypeResponse | null>;
|
|
17
|
+
delete: (id: number) => Promise<boolean>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Workflows = void 0;
|
|
13
|
+
const abstract_1 = require("../../abstract");
|
|
14
|
+
class Workflows extends abstract_1.AbstractResource {
|
|
15
|
+
constructor(auth) {
|
|
16
|
+
super(auth, 'workflows');
|
|
17
|
+
this.get = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return (yield this.baseGet(id));
|
|
19
|
+
});
|
|
20
|
+
this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
|
|
21
|
+
return (yield this.baseList(config));
|
|
22
|
+
});
|
|
23
|
+
this.create = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return (yield this.baseCreate(data));
|
|
25
|
+
});
|
|
26
|
+
this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return (yield this.baseUpdate(id, data));
|
|
28
|
+
});
|
|
29
|
+
this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield this.baseDelete(id);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.Workflows = Workflows;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types";
|
|
2
|
+
export interface WorkflowsTypeRead {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly created_on: string;
|
|
5
|
+
readonly updated_on: string;
|
|
6
|
+
}
|
|
7
|
+
export interface WorkflowsTypeUpdate {
|
|
8
|
+
name?: string;
|
|
9
|
+
is_default?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export type WorkflowsTypeResponse = Merge<WorkflowsTypeUpdate, Merge<WorkflowsTypeRead, {}>>;
|
|
12
|
+
export interface WorkflowsTypeCreate extends WorkflowsTypeUpdate {
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
export interface WorkflowsTypeFilter {
|
|
16
|
+
id?: number;
|
|
17
|
+
name?: string;
|
|
18
|
+
is_default?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface WorkflowsFilterCondition extends WorkflowsTypeFilter {
|
|
21
|
+
_custom?: {
|
|
22
|
+
[k: string]: {
|
|
23
|
+
key?: Extract<keyof WorkflowsTypeFilter, string>;
|
|
24
|
+
operator?: FilterOperator;
|
|
25
|
+
value: string | number | boolean | null | number[];
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface WorkflowsListConfig extends GenericListConfig {
|
|
30
|
+
filter?: WorkflowsFilterCondition;
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AbstractResource, AbstractResourceInterface } from '../../abstract';
|
|
2
|
+
import { AuthInterface } from "../../types";
|
|
3
|
+
import { WorkflowStatusesListConfig, WorkflowStatusesTypeCreate, WorkflowStatusesTypeResponse, WorkflowStatusesTypeUpdate } from "./types";
|
|
4
|
+
export interface WorkflowStatusesHandler extends AbstractResourceInterface {
|
|
5
|
+
get: (id: number) => Promise<WorkflowStatusesTypeResponse | null>;
|
|
6
|
+
list: (config?: WorkflowStatusesListConfig) => Promise<WorkflowStatusesTypeResponse[]>;
|
|
7
|
+
create: (d: WorkflowStatusesTypeCreate) => Promise<WorkflowStatusesTypeResponse | null>;
|
|
8
|
+
update: (id: number, data: WorkflowStatusesTypeUpdate) => Promise<WorkflowStatusesTypeResponse | null>;
|
|
9
|
+
delete: (id: number) => Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
export declare class WorkflowStatuses extends AbstractResource implements WorkflowStatusesHandler {
|
|
12
|
+
constructor(auth: AuthInterface);
|
|
13
|
+
get: (id: number) => Promise<WorkflowStatusesTypeResponse | null>;
|
|
14
|
+
list: (config?: WorkflowStatusesListConfig) => Promise<WorkflowStatusesTypeResponse[]>;
|
|
15
|
+
create: (data: WorkflowStatusesTypeCreate) => Promise<WorkflowStatusesTypeResponse | null>;
|
|
16
|
+
update: (id: number, data: WorkflowStatusesTypeUpdate) => Promise<WorkflowStatusesTypeResponse | null>;
|
|
17
|
+
delete: (id: number) => Promise<boolean>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.WorkflowStatuses = void 0;
|
|
13
|
+
const abstract_1 = require("../../abstract");
|
|
14
|
+
class WorkflowStatuses extends abstract_1.AbstractResource {
|
|
15
|
+
constructor(auth) {
|
|
16
|
+
super(auth, 'workflowstatuses');
|
|
17
|
+
this.get = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
return (yield this.baseGet(id));
|
|
19
|
+
});
|
|
20
|
+
this.list = (...args_1) => __awaiter(this, [...args_1], void 0, function* (config = {}) {
|
|
21
|
+
return (yield this.baseList(config));
|
|
22
|
+
});
|
|
23
|
+
this.create = (data) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
return (yield this.baseCreate(data));
|
|
25
|
+
});
|
|
26
|
+
this.update = (id, data) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
return (yield this.baseUpdate(id, data));
|
|
28
|
+
});
|
|
29
|
+
this.delete = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
return yield this.baseDelete(id);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.WorkflowStatuses = WorkflowStatuses;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FilterOperator, GenericListConfig, Merge } from "../../types";
|
|
2
|
+
export interface WorkflowStatusesTypeRead {
|
|
3
|
+
readonly id: number;
|
|
4
|
+
readonly created_on: string;
|
|
5
|
+
readonly updated_on: string;
|
|
6
|
+
readonly seq: number;
|
|
7
|
+
readonly action: '' | 'complete' | 'backlog';
|
|
8
|
+
}
|
|
9
|
+
export interface WorkflowStatusesTypeUpdate {
|
|
10
|
+
name?: string;
|
|
11
|
+
workflow_id?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
}
|
|
14
|
+
export type WorkflowStatusesTypeResponse = Merge<WorkflowStatusesTypeUpdate, Merge<WorkflowStatusesTypeRead, {}>>;
|
|
15
|
+
export interface WorkflowStatusesTypeCreate extends WorkflowStatusesTypeUpdate {
|
|
16
|
+
name: string;
|
|
17
|
+
color: string;
|
|
18
|
+
workflow_id: number;
|
|
19
|
+
}
|
|
20
|
+
export interface WorkflowStatusesTypeFilter {
|
|
21
|
+
name?: string;
|
|
22
|
+
workflow_id?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface WorkflowStatusesFilterCondition extends WorkflowStatusesTypeFilter {
|
|
25
|
+
_custom?: {
|
|
26
|
+
[k: string]: {
|
|
27
|
+
key?: Extract<keyof WorkflowStatusesTypeFilter, string>;
|
|
28
|
+
operator?: FilterOperator;
|
|
29
|
+
value: string | number | boolean | null | number[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface WorkflowStatusesListConfig extends GenericListConfig {
|
|
34
|
+
filter?: WorkflowStatusesFilterCondition;
|
|
35
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface AuthInterface {
|
|
2
|
+
userApi: string;
|
|
3
|
+
password: string;
|
|
4
|
+
}
|
|
5
|
+
export type FilterOperator = '=' | '<=' | '>=' | '>' | '<' | '!=' | 'like' | 'not like' | 'in' | 'not in';
|
|
6
|
+
export type GenericCustomFilterType = {
|
|
7
|
+
[k: string]: {
|
|
8
|
+
key?: string;
|
|
9
|
+
operator?: FilterOperator;
|
|
10
|
+
value: string | number | boolean | null | number[];
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export type GenericFilterType = {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
} & {
|
|
16
|
+
_custom?: GenericCustomFilterType;
|
|
17
|
+
};
|
|
18
|
+
export interface GenericListConfig {
|
|
19
|
+
filter?: GenericFilterType;
|
|
20
|
+
include?: string[];
|
|
21
|
+
}
|
|
22
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
23
|
+
export type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
24
|
+
export type PaymoCurrency = 'AED' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'BAM' | 'BDT' | 'BGN' | 'BRL' | 'BWP' | 'CAD' | 'CFP' | 'CHF' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'CRC' | 'CZK' | 'DKK' | 'DOP' | 'DZD' | 'EEK' | 'EGP' | 'EUR' | 'GBP' | 'GTQ' | 'HKD' | 'HRK' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LKR' | 'LTL' | 'LVL' | 'MAD' | 'MDL' | 'MUR' | 'MXN' | 'MYR' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NZD' | 'OMR' | 'PEN' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RMB' | 'RON' | 'RSD' | 'RUB' | 'SAR' | 'SEK' | 'SGD' | 'SKK' | 'TBH' | 'TND' | 'TRY' | 'TTD' | 'TWD' | 'U$S' | 'UAH' | 'US$' | 'USD' | 'UYU' | 'VEF' | 'VND' | 'ZAR';
|
|
25
|
+
export {};
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-paymo-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Complete object based implementation of the paymoapp.com API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"type": "git"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"axios": "^0.
|
|
16
|
+
"axios": "^0.34.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"prettier": "^1.19.1"
|
|
19
|
+
"prettier": "^1.19.1",
|
|
20
|
+
"typescript": "^5"
|
|
22
21
|
},
|
|
23
22
|
"scripts": {
|
|
24
23
|
"build": "tsc",
|
|
25
|
-
"watch": "watch
|
|
24
|
+
"watch": "tsc --watch",
|
|
25
|
+
"prepack": "tsc"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/abstract.ts
CHANGED
|
@@ -55,11 +55,9 @@ export class AbstractResource {
|
|
|
55
55
|
case 'not in':
|
|
56
56
|
const v = Array.isArray(rVal) ? rVal : [rVal]
|
|
57
57
|
return rKey + ' ' + rOp + ' (' + v.join(',') + ')'
|
|
58
|
-
break
|
|
59
58
|
case 'like':
|
|
60
59
|
case 'not like':
|
|
61
60
|
return rKey + ' ' + rOp + ' "' + rVal + '"'
|
|
62
|
-
break
|
|
63
61
|
default:
|
|
64
62
|
return rKey + rOp + rVal
|
|
65
63
|
}
|
|
@@ -110,9 +108,9 @@ export class AbstractResource {
|
|
|
110
108
|
) {
|
|
111
109
|
console.log('RESPONSE KEY', responseKey, response.data)
|
|
112
110
|
const data = response.data[responseKey]
|
|
113
|
-
if (
|
|
111
|
+
if (Array.isArray(data)) {
|
|
114
112
|
console.log('AXIOS RESPONSE', data[0])
|
|
115
|
-
return data[0]
|
|
113
|
+
return data.length > 0 ? data[0] : null
|
|
116
114
|
} else if (data) {
|
|
117
115
|
return data
|
|
118
116
|
}
|
|
@@ -170,9 +168,9 @@ export class AbstractResource {
|
|
|
170
168
|
response.data.hasOwnProperty(responseKey)
|
|
171
169
|
) {
|
|
172
170
|
const data = response.data[responseKey]
|
|
173
|
-
if (
|
|
171
|
+
if (Array.isArray(data)) {
|
|
174
172
|
console.log('AXIOS RESPONSE', data[0])
|
|
175
|
-
return data[0]
|
|
173
|
+
return data.length > 0 ? data[0] : null
|
|
176
174
|
} else if (data) {
|
|
177
175
|
return data
|
|
178
176
|
}
|
|
@@ -198,9 +196,9 @@ export class AbstractResource {
|
|
|
198
196
|
response.data.hasOwnProperty(responseKey)
|
|
199
197
|
) {
|
|
200
198
|
const data = response.data[responseKey]
|
|
201
|
-
if (
|
|
199
|
+
if (Array.isArray(data)) {
|
|
202
200
|
console.log('AXIOS RESPONSE', data[0])
|
|
203
|
-
return data[0]
|
|
201
|
+
return data.length > 0 ? data[0] : null
|
|
204
202
|
} else if (data) {
|
|
205
203
|
return data
|
|
206
204
|
}
|
|
@@ -216,9 +214,7 @@ export class AbstractResource {
|
|
|
216
214
|
headers: this.constructHeaders(),
|
|
217
215
|
},
|
|
218
216
|
})
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
return false
|
|
217
|
+
return !!(response && response.status >= 200 && response.status < 300);
|
|
218
|
+
|
|
223
219
|
}
|
|
224
220
|
}
|