Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 60 additions & 25 deletions src/CrowdinApiClient/Api/TaskApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
class TaskApi extends AbstractApi
{
/**
* List Tasks
* List Project Tasks
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.getMany API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.getMany API Documentation Enterprise
*
* @param int $projectId
* @param array $params
* integer $params[limit] [ 1 .. 500 ] Default: 25<br>
* integer $params[offset] >= 0 Default: 0<br>
* string $params[status] Enum: "todo" "in_progress" "done" "closed" Example: status=done<br>
* string $params[orderBy]<br>
* integer $params[limit] [1 .. 500] Default: 25<br>
* integer $params[offset] >= 0 Default: 0<br>
* string $params[status] Enum: "todo" "in_progress" "done" "closed"<br>
* integer $params[assigneeId]
*
* @return ModelCollection
Expand All @@ -39,7 +40,7 @@ public function list(int $projectId, array $params = []): ModelCollection
}

/**
* Get Task
* Get Project Task
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.get API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.get API Documentation Enterprise
*
Expand All @@ -54,7 +55,7 @@ public function get(int $projectId, int $taskId): ?Task
}

/**
* Add Task
* Add Project Task
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.post API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.post API Documentation Enterprise
*
Expand All @@ -69,7 +70,7 @@ public function create(int $projectId, array $data): ?Task
}

/**
* Edit Task
* Edit Project Task
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.patch API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.patch API Documentation Enterprise
*
Expand All @@ -83,7 +84,7 @@ public function update($task): ?Task
}

/**
* Delete Task
* Delete Project Task
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.delete API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.delete API Documentation Enterprise
*
Expand All @@ -98,7 +99,7 @@ public function delete(int $projectId, int $taskId)
}

/**
* Export Task Strings
* Export Project Task Strings
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.export.get API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.export.get API Documentation Enterprise
*
Expand All @@ -112,21 +113,53 @@ public function exportStrings(int $projectId, int $taskId): ?DownloadFile
return $this->_post($path, DownloadFile::class, []);
}

/**
* List Tasks
* @link https://developer.crowdin.com/api/v2/#operation/api.users.tasks.getMany API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.users.tasks.getMany API Documentation Enterprise
*
* @param int $userId
* @param array $params
* string $params[orderBy]<br>
* integer $params[limit] [1 .. 500] Default: 25<br>
* integer $params[offset] >= 0 Default: 0<br>
* string $params[status] Enum: "todo" "in_progress" "done" "closed"<br>
* string $params[type] Enum: 0 1 2 3<br>
* string $params[projectIds]<br>
* string $params[assigneeIds]<br>
* string $params[creatorIds]<br>
* string $params[targetLanguageIds]<br>
* string $params[sourceLanguageIds]<br>
* string $params[createdAtFrom]<br>
* string $params[createdAtTo]<br>
* string $params[deadlineFrom]<br>
* string $params[deadlineTo]
*
* @return ModelCollection|null
*/
public function listTasks(int $userId, array $params = []): ?ModelCollection
{
$path = sprintf('users/%d/tasks', $userId);
return $this->_list($path, Task::class, $params);
}

/**
* List User Tasks
* @link https://developer.crowdin.com/api/v2/#operation/api.user.tasks.getMany API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.user.tasks.getMany API Documentation Enterprise
*
* @param array $params
* integer $params[limit] [ 1 .. 500 ] Default: 25<br>
* integer $params[offset] >= 0 Default: 25<br>
* string $params[status] Enum: "todo" "in_progress" "done" "closed" Example: status=done<br>
* string $params[isArchived] Default: 0 Default: 0 Example: isArchived=1
* string $params[orderBy]<br>
* integer $params[limit] [1 .. 500] Default: 25<br>
* integer $params[offset] >= 0 Default: 0<br>
* string $params[status] Enum: "todo" "in_progress" "done" "closed"<br>
* string $params[isArchived] Enum: "0" "1"
*
* @return ModelCollection
* @return ModelCollection|null
*/
public function listUserTasks(array $params = []): ?ModelCollection
{
return $this->_list('user/tasks', Task::class, $params);
return $this->_list('user/tasks', Task::class, $params);
}

/**
Expand All @@ -148,21 +181,21 @@ public function userTaskArchivedStatus(int $taskId, int $projectId, bool $isArch
'op' => 'replace',
'path' => '/isArchived',
'value' => $isArchived,
]
],
];

return $this->_patch($path, Task::class, $body, ['projectId' => $projectId]);
}

/**
* List Task Settings template
* List Project Task Settings Templates
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.settings-templates.getMany API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.settings-templates.getMany API Documentation Enterprise
*
* @param int $projectId
* @param array $params
* integer $params[limit] [ 1 .. 500 ] Default: 25<br>
* integer $params[offset] >= 0 Default: 0<br>
* integer $params[limit] [1 .. 500] Default: 25<br>
* integer $params[offset] >= 0 Default: 0<br>
*
* @return ModelCollection
*/
Expand All @@ -173,7 +206,7 @@ public function listSettingsTemplates(int $projectId, array $params = []): Model
}

/**
* Get Task Settings template
* Get Task Settings Template
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.settings-templates.get API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.settings-templates.get API Documentation Enterprise
*
Expand All @@ -188,7 +221,7 @@ public function getSettingsTemplate(int $projectId, int $taskSettingsTemplateId)
}

/**
* Add Task Settings Template
* Add Project Task Settings Template
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.settings-templates.post API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.settings-templates.post API Documentation Enterprise
*
Expand All @@ -205,7 +238,7 @@ public function addSettingsTemplate(int $projectId, array $data): ?TaskSettingsT
}

/**
* Delete Task Settings Template
* Delete Project Task Settings Template
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.settings-templates.delete API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.settings-templates.delete API Documentation Enterprise
*
Expand All @@ -220,7 +253,7 @@ public function deleteSettingsTemplate(int $projectId, int $taskSettingsTemplate
}

/**
* Update Task Settings Template
* Update Project Task Settings Template
*
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.settings-templates.patch API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.settings-templates.patch API Documentation Enterprise
Expand All @@ -229,8 +262,10 @@ public function deleteSettingsTemplate(int $projectId, int $taskSettingsTemplate
* @param TaskSettingsTemplate $taskSettingsTemplate
* @return TaskSettingsTemplate|null
*/
public function updateSettingsTemplate(int $projectId, TaskSettingsTemplate $taskSettingsTemplate): ?TaskSettingsTemplate
{
public function updateSettingsTemplate(
int $projectId,
TaskSettingsTemplate $taskSettingsTemplate
): ?TaskSettingsTemplate {
$path = sprintf('projects/%d/tasks/settings-templates/%d', $projectId, $taskSettingsTemplate->getId());
return $this->_update($path, $taskSettingsTemplate);
}
Expand Down
10 changes: 5 additions & 5 deletions src/CrowdinApiClient/Api/TaskCommentApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class TaskCommentApi extends AbstractApi
{
/**
* List Task Comments
* List Project Task Comments
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.getMany API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.getMany API Documentation Enterprise
*
Expand All @@ -32,7 +32,7 @@ public function list(int $projectId, int $taskId, array $params = []): ModelColl
}

/**
* Get Task Comment
* Get Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.get API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.get API Documentation Enterprise
*
Expand All @@ -48,7 +48,7 @@ public function get(int $projectId, int $taskId, int $commentId): ?TaskComment
}

/**
* Add Task Comment
* Add Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.post API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.post API Documentation Enterprise
*
Expand All @@ -67,7 +67,7 @@ public function create(int $projectId, int $taskId, array $data): ?TaskComment
}

/**
* Edit Task Comment
* Edit Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.patch API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.patch API Documentation Enterprise
*
Expand All @@ -83,7 +83,7 @@ public function update(int $projectId, int $taskId, TaskComment $taskComment): ?
}

/**
* Delete Task Comment
* Delete Project Task Comment
* @link https://developer.crowdin.com/api/v2/#operation/api.projects.tasks.comments.delete API Documentation
* @link https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.tasks.comments.delete API Documentation Enterprise
*
Expand Down
Loading
Loading