1.0.3 • Published 5 months ago
proggio-api-client v1.0.3
Proggio API Client
Official Node.js client for the Proggio API that provides a comprehensive interface for interacting with Proggio's services.
Installation
To install the client, run:
npm install proggio-api-client
Basic Usage
Initialize the client with your API key and optional base URL:
const ProggioClient = require('proggio-api-client');
const client = new ProggioClient({
baseUrl: 'https://server-co.proggio.com/api/v1', // Optional - defaults to Proggio's production API
apiKey: 'your-api-key'
});
Available Services
The client provides access to several Proggio services:
Users
// List all users
const users = await client.users.list();
// Add a new user
const newUser = await client.users.add({
email: 'user@example.com',
name: 'Test User',
username: 'testuser',
access: 'editor',
role: 'task-editor',
sendInvite: false
});
// Update an existing user
const updatedUser = await client.users.update(userId, {
name: 'Updated Test User',
access: 'editor',
role: 'task-editor',
username: 'updatedusername'
});
// Create user groups
const group = await client.users.createGroup({
label: 'Test Group'
});
Projects
// Create a new project
const project = await client.projects.create({
label: 'Test Project',
type: 'project',
icon: 'random',
color: '#FF0000'
});
// Update a project
const updatedProject = await client.projects.update(projectId, {
label: 'Updated Project',
icon: 'star',
color: '#00FF00',
tags: ['test', 'updated'],
fields: [{
id: 1234,
value: 'Test Value'
}],
assignees: [userId]
});
// List all projects
const projects = await client.projects.list();
// Get a specific project
const project = await client.projects.get(projectId);
// Delete a project
await client.projects.delete(projectId);
Categories
// Create a category in a project
const category = await client.categories.create(projectId, {
label: 'Test Category',
ownerUserId: userId,
color: '#FF0000'
});
// Update a category
const updatedCategory = await client.categories.update(projectId, categoryId, {
label: 'Updated Category',
color: '#00FF00'
});
// Delete a category
await client.categories.delete(projectId, categoryId);
Activities
// Create an activity
const activity = await client.activities.create(projectId, {
label: 'Test Activity',
type: 'task',
category: categoryId,
assignees: [userId],
date: {
start: '2024-01-01',
end: '2024-01-02'
}
});
// Update an activity
const updatedActivity = await client.activities.update(projectId, activityId, {
label: 'Updated Activity',
description: 'Updated description'
});
// List all activities in a project
const activities = await client.activities.list(projectId);
// Log time for an activity
const timeLog = await client.activities.logTime(projectId, activityId, {
minutes: 60,
userId: userId,
description: 'Work description'
});
// Delete an activity
await client.activities.delete(projectId, activityId);
Teams
// Get team settings
const teamSettings = await client.teams.getSettings();
// Set team day metadata
const dayMeta = await client.teams.setDayMeta({
date: {
start: '2024-01-01',
end: '2024-01-01'
},
type: 'WORKING', // Options: 'WORKING', 'HALF-OFF', 'OFF', 'SPECIAL'
description: 'Regular working day',
scope: 'team'
});
Budget
// Get team budget items
const teamItems = await client.budget.getTeamItems();
// Get budget for specific activity
const budget = await client.budget.get(projectId, activityId);
// Create budget entry
const newBudget = await client.budget.create(projectId, activityId, {
itemId: 1234,
comments: 'Initial budget allocation',
actualUnits: 100,
plannedUnits: 150
});
// Update budget entry
const updatedBudget = await client.budget.update(projectId, activityId, budgetId, {
comments: 'Updated allocation',
actualUnits: 120,
plannedUnits: 150
});
// Delete budget entry
await client.budget.delete(projectId, activityId, budgetId);
Error Handling
The client includes built-in error handling:
try {
const users = await client.users.list();
} catch (error) {
console.error('Operation failed:', error.message);
if (error.response) {
console.error('Status:', error.response.status);
console.error('Response:', error.response.data);
}
}
Documentation
For more detailed information about the API endpoints and response formats, please refer to the Proggio API documentation.
Additional Available Methods
Projects
// List all projects with optional parameters
const projects = await client.projects.list({
// Optional parameters can be added here
});
// Get a specific project
const project = await client.projects.get(projectId);
Activities
// List all activities in a project
const activities = await client.activities.list(projectId, {
// Optional parameters can be added here
});
Categories
// Delete a category
await client.categories.delete(projectId, categoryId);
Teams
// Set team day metadata
const dayMeta = await client.teams.setDayMeta({
date: {
start: '2024-01-01',
end: '2024-01-01'
},
type: 'WORKING', // Options: 'WORKING', 'HALF-OFF', 'OFF', 'SPECIAL'
description: 'Regular working day',
scope: 'team'
});
Budget
// Get budget for specific activity
const budget = await client.budget.get(projectId, activityId);
// Create budget entry
const newBudget = await client.budget.create(projectId, activityId, {
itemId: 1234,
comments: 'Initial budget allocation',
actualUnits: 100,
plannedUnits: 150
});
// Update budget entry
const updatedBudget = await client.budget.update(projectId, activityId, budgetId, {
comments: 'Updated allocation',
actualUnits: 120,
plannedUnits: 150
});
// Delete budget entry
await client.budget.delete(projectId, activityId, budgetId);
Users
// Delete a user
await client.users.delete(userId);