Skip to content

Commit f456667

Browse files
committed
Fix req params
1 parent 58ec448 commit f456667

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pkg/github/projects.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ func AddProjectItem(getClient GetClientFn, t translations.TranslationHelperFunc)
523523
}
524524

525525
newProjectItem := &newProjectItem{
526-
ContentID: int64(itemID),
527-
ContentType: toNewProjectType(itemType),
526+
ID: int64(itemID),
527+
Type: toNewProjectType(itemType),
528528
}
529529
httpRequest, err := client.NewRequest("POST", projectsURL, newProjectItem)
530530
if err != nil {
@@ -754,8 +754,8 @@ type newProjectV2Field struct {
754754
}
755755

756756
type newProjectItem struct {
757-
ContentID int64 `json:"content_id,omitempty"`
758-
ContentType string `json:"content_type,omitempty"`
757+
ID int64 `json:"id,omitempty"` // Issue or Pull Request ID to add to the project.
758+
Type string `json:"type,omitempty"`
759759
}
760760

761761
type projectV2Field struct {

pkg/github/projects_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -985,12 +985,12 @@ func Test_AddProjectItem(t *testing.T) {
985985
body, err := io.ReadAll(r.Body)
986986
assert.NoError(t, err)
987987
var payload struct {
988-
ContentType string `json:"content_type"`
989-
ContentID int `json:"content_id"`
988+
Type string `json:"type"`
989+
ID int `json:"id"`
990990
}
991991
assert.NoError(t, json.Unmarshal(body, &payload))
992-
assert.Equal(t, "Issue", payload.ContentType)
993-
assert.Equal(t, 9876, payload.ContentID)
992+
assert.Equal(t, "Issue", payload.Type)
993+
assert.Equal(t, 9876, payload.ID)
994994
w.WriteHeader(http.StatusCreated)
995995
_, _ = w.Write(mock.MustMarshal(orgItem))
996996
}),
@@ -1016,12 +1016,12 @@ func Test_AddProjectItem(t *testing.T) {
10161016
body, err := io.ReadAll(r.Body)
10171017
assert.NoError(t, err)
10181018
var payload struct {
1019-
ContentType string `json:"content_type"`
1020-
ContentID int `json:"content_id"`
1019+
Type string `json:"type"`
1020+
ID int `json:"id"`
10211021
}
10221022
assert.NoError(t, json.Unmarshal(body, &payload))
1023-
assert.Equal(t, "PullRequest", payload.ContentType)
1024-
assert.Equal(t, 7654, payload.ContentID)
1023+
assert.Equal(t, "PullRequest", payload.Type)
1024+
assert.Equal(t, 7654, payload.ID)
10251025
w.WriteHeader(http.StatusOK)
10261026
_, _ = w.Write(mock.MustMarshal(userItem))
10271027
}),

0 commit comments

Comments
 (0)