Skip to content

Commit c6cde8f

Browse files
committed
Fix: Drop task content type
The task content type MUST be always plain text or Markdown formatting. HTML content type is not supported. The payload attribute and the response field are going to be removed from the API soon. Related to: #71
1 parent da32da3 commit c6cde8f

2 files changed

Lines changed: 24 additions & 29 deletions

File tree

projects/task.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ type Task struct {
6262

6363
// DescriptionContentType is the content type of the description. It can be
6464
// "TEXT" or "HTML".
65+
//
66+
// Deprecated: This field will be removed in a future release. The task is
67+
// always plain text or Markdown formatting.
6568
DescriptionContentType *TaskDescriptionContentType `json:"descriptionContentType"`
6669

6770
// Priority is the priority of the task. It can be "none", "low", "medium" or
@@ -203,13 +206,10 @@ type TaskCreateRequest struct {
203206
// Name is the name of the task
204207
Name string `json:"name"`
205208

206-
// Description is an optional description of the task.
209+
// Description is an optional description of the task. It supports plain text
210+
// or Markdown formatting.
207211
Description *string `json:"description,omitempty"`
208212

209-
// DescriptionContentType is the content type of the description. It can be
210-
// "TEXT" or "HTML". If not provided, it defaults to "TEXT".
211-
DescriptionContentType *TaskDescriptionContentType `json:"descriptionContentType,omitempty"`
212-
213213
// Priority is the priority of the task. It can be "none", "low", "medium" or
214214
// "high".
215215
Priority *string `json:"priority,omitempty"`
@@ -348,13 +348,10 @@ type TaskUpdateRequest struct {
348348
// Name is the name of the task
349349
Name *string `json:"name,omitempty"`
350350

351-
// Description is an optional description of the task.
351+
// Description is an optional description of the task. It supports plain text
352+
// or Markdown formatting.
352353
Description *string `json:"description,omitempty"`
353354

354-
// DescriptionContentType is the content type of the description. It can be
355-
// "TEXT" or "HTML". If not provided, it defaults to "TEXT".
356-
DescriptionContentType *TaskDescriptionContentType `json:"descriptionContentType,omitempty"`
357-
358355
// Priority is the priority of the task. It can be "none", "low", "medium" or
359356
// "high".
360357
Priority *string `json:"priority,omitempty"`

projects/task_test.go

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ func TestTaskCreate(t *testing.T) {
4141
Notify: true,
4242
CheckInvalidUsers: true,
4343
},
44-
Name: fmt.Sprintf("test%d%d", time.Now().UnixNano(), rand.Intn(100)),
45-
Description: new("<h1>This is a test task</h1>"),
46-
DescriptionContentType: new(projects.TaskDescriptionContentTypeHTML),
47-
Priority: new("high"),
48-
Progress: new(int64(50)),
49-
StartAt: new(twapi.Date(time.Now().Add(24 * time.Hour))),
50-
DueAt: new(twapi.Date(time.Now().Add(48 * time.Hour))),
51-
EstimatedMinutes: new(int64(120)),
52-
ParentTaskID: &parentTaskID,
44+
Name: fmt.Sprintf("test%d%d", time.Now().UnixNano(), rand.Intn(100)),
45+
Description: new("<h1>This is a test task</h1>"),
46+
Priority: new("high"),
47+
Progress: new(int64(50)),
48+
StartAt: new(twapi.Date(time.Now().Add(24 * time.Hour))),
49+
DueAt: new(twapi.Date(time.Now().Add(48 * time.Hour))),
50+
EstimatedMinutes: new(int64(120)),
51+
ParentTaskID: &parentTaskID,
5352
Assignees: &projects.UserGroups{
5453
UserIDs: []int64{testResources.UserID},
5554
},
@@ -128,16 +127,15 @@ func TestTaskUpdate(t *testing.T) {
128127
Notify: true,
129128
CheckInvalidUsers: true,
130129
},
131-
Name: new(fmt.Sprintf("test%d%d", time.Now().UnixNano(), rand.Intn(100))),
132-
Description: new("<h1>This is a test task</h1>"),
133-
DescriptionContentType: new(projects.TaskDescriptionContentTypeHTML),
134-
Priority: new("high"),
135-
Progress: new(int64(50)),
136-
StartAt: new(twapi.Date(time.Now().Add(24 * time.Hour))),
137-
DueAt: new(twapi.Date(time.Now().Add(48 * time.Hour))),
138-
EstimatedMinutes: new(int64(120)),
139-
TasklistID: &testResources.TasklistID,
140-
ParentTaskID: &parentTaskID,
130+
Name: new(fmt.Sprintf("test%d%d", time.Now().UnixNano(), rand.Intn(100))),
131+
Description: new("<h1>This is a test task</h1>"),
132+
Priority: new("high"),
133+
Progress: new(int64(50)),
134+
StartAt: new(twapi.Date(time.Now().Add(24 * time.Hour))),
135+
DueAt: new(twapi.Date(time.Now().Add(48 * time.Hour))),
136+
EstimatedMinutes: new(int64(120)),
137+
TasklistID: &testResources.TasklistID,
138+
ParentTaskID: &parentTaskID,
141139
Assignees: &projects.UserGroups{
142140
UserIDs: []int64{testResources.UserID},
143141
},

0 commit comments

Comments
 (0)