projectmanager-sdk
Version:
Software development kit for the ProjectManager.com API. for TypeScript
109 lines • 3.62 kB
JavaScript
/**
* ProjectManager API for TypeScript
*
* (c) ProjectManager.com, Inc.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author ProjectManager.com <support@projectmanager.com>
* @copyright ProjectManager.com, Inc.
* @link https://github.com/projectmgr/projectmanager-sdk-typescript
*/
export class TimesheetClient {
client;
/**
* Internal constructor for this client library
*/
constructor(client) {
this.client = client;
}
/**
* Creates new time entry for given resource on given day.
*
* @param body Payload
*/
createtimeentry(body) {
const url = `/api/data/timesheets`;
return this.client.request("post", url, null, body);
}
/**
* Retrieve a list of TimeSheets that match an [OData formatted query](https://www.odata.org/).
*
* Time Sheets is a list of times per task
*
* @param top The number of records to return
* @param skip Skips the given number of records and then returns $top records
* @param filter Filter the expression according to oData queries
* @param orderby Order collection by this field.
* @param expand Include related data in the response
*/
queryTimeSheets(top, skip, filter, orderby, expand) {
const url = `/api/data/timesheets`;
const options = {
params: {
'$top': top,
'$skip': skip,
'$filter': filter,
'$orderby': orderby,
'$expand': expand,
},
};
return this.client.request("get", url, options, null);
}
/**
* Delete time entry by id.
*
* @param timesheetId time entry id
*/
deletetimeentry(timesheetId) {
const url = `/api/data/timesheets/${timesheetId}`;
return this.client.request("delete", url, null, null);
}
/**
* Updates a time entry by its unique identifier.
*
* @param timesheetId time entry id
* @param body payload
*/
updatetimeentry(timesheetId, body) {
const url = `/api/data/timesheets/${timesheetId}`;
return this.client.request("put", url, null, body);
}
/**
* Returns active admin tasks that are used to report time not related to work on projects. I.e. annual/sick leave etc
*
*/
returnsactiveadmintasksthatareusedtoreporttime() {
const url = `/api/data/timesheets/admin-tasks`;
return this.client.request("get", url, null, null);
}
/**
* Submit a timesheet for approval for a specific resource.
*
* @param body The timesheet to be submitted for approval
*/
submitResourceTimeSheetForApproval(body) {
const url = `/api/data/timesheets/approvals`;
return this.client.request("post", url, null, body);
}
/**
* Approve a timesheet approval request
*
* @param body The timesheet to approve
*/
approveResourceTimeSheetApprovalRequest(body) {
const url = `/api/data/timesheets/approvals/approve`;
return this.client.request("post", url, null, body);
}
/**
* Rejects a specific resource's timesheet approval request for a specific week.
*
* @param body The data for rejecting the approval request
*/
rejectResourceTimeSheetApprovalRequest(body) {
const url = `/api/data/timesheets/approvals/reject`;
return this.client.request("post", url, null, body);
}
}
//# sourceMappingURL=TimesheetClient.js.map