18 from typing
import Optional, Dict
19 from typing_extensions
import Self
21 from .base
import BaseObject
22 from ..utils
import isEntityNameValid
23 from ...codable
import KeyDescriptor
29 Represents the task entity from Coretex.ai\n
30 Contains properties that describe the task
37 def _keyDescriptors(cls) -> Dict[str, KeyDescriptor]:
38 descriptors = super()._keyDescriptors()
44 def createTask(cls, name: str, projectId: int, description: Optional[str]=
None) -> Optional[Self]:
46 Creates a new task with the provided name and description
47 Task is added to the project with provided project id
54 project id the task belongs to
55 description : Optional[str]
60 Optional[Self] -> The created task object
64 >>> from coretex import Task
66 >>> dummyTask = Task.createTask(
69 description = "This is dummy task"
71 >>> if dummyTask is None:
72 print("Failed to create task")
75 if not isEntityNameValid(name):
76 raise ValueError(
">> [Coretex] Task name is invalid. Requirements: alphanumeric characters (\"a-z\", and \"0-9\") and dash (\"-\") with length between 3 to 50")
80 parent_id = projectId,
81 description = description
Optional[Self] createTask(cls, str name, int projectId, Optional[str] description=None)