@@ -74,26 +74,35 @@ type ListProjectsOptions struct {
7474 Query * string `url:"q,omitempty"`
7575}
7676
77+ // ProjectV2TextContent represents text content in a project field option or iteration.
78+ // It includes both HTML and raw text representations.
79+ //
80+ // GitHub API docs: https://docs.github.com/rest/projects/fields
81+ type ProjectV2TextContent struct {
82+ HTML * string `json:"html,omitempty"`
83+ Raw * string `json:"raw,omitempty"`
84+ }
85+
7786// ProjectV2FieldOption represents an option for a project field of type single_select or multi_select.
7887// It defines the available choices that can be selected for dropdown-style fields.
7988//
8089// GitHub API docs: https://docs.github.com/rest/projects/fields
8190type ProjectV2FieldOption struct {
82- ID * string `json:"id,omitempty"` // The unique identifier for this option.
83- Name * string `json:"name ,omitempty"` // The display name of the option.
84- Color * string `json:"color ,omitempty"` // The color associated with this option (e.g., "blue", "red") .
85- Description * string `json:"description ,omitempty"` // An optional description for this option.
91+ ID * string `json:"id,omitempty"` // The unique identifier for this option.
92+ Color * string `json:"color ,omitempty"` // The color associated with this option (e.g., "blue", "red") .
93+ Description * ProjectV2TextContent `json:"description ,omitempty"` // An optional description for this option.
94+ Name * ProjectV2TextContent `json:"name ,omitempty"` // The display name of the option.
8695}
8796
8897// ProjectV2FieldIteration represents an iteration within a project field of type iteration.
8998// It defines a specific time-bound period that can be associated with project items.
9099//
91100// GitHub API docs: https://docs.github.com/rest/projects/fields
92101type ProjectV2FieldIteration struct {
93- ID * string `json:"id,omitempty"` // The unique identifier for the iteration.
94- Title * string `json:"title,omitempty"` // The title of the iteration.
95- StartDate * string `json:"start_date,omitempty"` // The start date of the iteration in ISO 8601 format.
96- Duration * int `json:"duration,omitempty"` // The duration of the iteration in seconds.
102+ ID * string `json:"id,omitempty"` // The unique identifier for the iteration.
103+ Title * ProjectV2TextContent `json:"title,omitempty"` // The title of the iteration.
104+ StartDate * string `json:"start_date,omitempty"` // The start date of the iteration in ISO 8601 format.
105+ Duration * int `json:"duration,omitempty"` // The duration of the iteration in seconds.
97106}
98107
99108// ProjectV2FieldConfiguration represents the configuration for a project field of type iteration.
@@ -325,14 +334,31 @@ type AddProjectItemOptions struct {
325334 ID int64 `json:"id,omitempty"`
326335}
327336
337+ // UpdateProjectV2Field represents a field update for a project item.
338+ //
339+ // GitHub API docs: https://docs.github.com/rest/projects/items#update-project-item-for-organization
340+ type UpdateProjectV2Field struct {
341+ // ID is the field ID to update.
342+ ID int64 `json:"id"`
343+ // Value is the new value to set for the field. The type depends on the field type.
344+ // For text fields: string
345+ // For number fields: float64 or int
346+ // For single_select fields: string (option ID)
347+ // For date fields: string (ISO 8601 date)
348+ // For iteration fields: string (iteration ID)
349+ // Note: Some field types (title, assignees, labels, etc.) are read-only or managed through other API endpoints.
350+ Value any `json:"value"`
351+ }
352+
328353// UpdateProjectItemOptions represents fields that can be modified for a project item.
329- // Currently the REST API allows archiving/unarchiving an item (archived boolean).
330- // This struct can be expanded in the future as the API grows.
354+ // The GitHub API expects either archived status updates or field value updates.
331355type UpdateProjectItemOptions struct {
332356 // Archived indicates whether the item should be archived (true) or unarchived (false).
357+ // This is used for archive/unarchive operations.
333358 Archived * bool `json:"archived,omitempty"`
334- // Fields allows updating field values for the item. Each entry supplies a field ID and a value.
335- Fields []* ProjectV2Field `json:"fields,omitempty"`
359+ // Fields contains field updates to apply to the project item.
360+ // Each entry specifies a field ID and its new value.
361+ Fields []* UpdateProjectV2Field `json:"fields,omitempty"`
336362}
337363
338364// ListOrganizationProjectItems lists items for an organization owned project.
@@ -387,7 +413,11 @@ func (s *ProjectsService) AddOrganizationProjectItem(ctx context.Context, org st
387413//meta:operation GET /orgs/{org}/projectsV2/{project_number}/items/{item_id}
388414func (s * ProjectsService ) GetOrganizationProjectItem (ctx context.Context , org string , projectNumber int , itemID int64 , opts * GetProjectItemOptions ) (* ProjectV2Item , * Response , error ) {
389415 u := fmt .Sprintf ("orgs/%v/projectsV2/%v/items/%v" , org , projectNumber , itemID )
390- req , err := s .client .NewRequest ("GET" , u , opts )
416+ u , err := addOptions (u , opts )
417+ if err != nil {
418+ return nil , nil , err
419+ }
420+ req , err := s .client .NewRequest ("GET" , u , nil )
391421 if err != nil {
392422 return nil , nil , err
393423 }
@@ -481,7 +511,11 @@ func (s *ProjectsService) AddUserProjectItem(ctx context.Context, username strin
481511//meta:operation GET /users/{username}/projectsV2/{project_number}/items/{item_id}
482512func (s * ProjectsService ) GetUserProjectItem (ctx context.Context , username string , projectNumber int , itemID int64 , opts * GetProjectItemOptions ) (* ProjectV2Item , * Response , error ) {
483513 u := fmt .Sprintf ("users/%v/projectsV2/%v/items/%v" , username , projectNumber , itemID )
484- req , err := s .client .NewRequest ("GET" , u , opts )
514+ u , err := addOptions (u , opts )
515+ if err != nil {
516+ return nil , nil , err
517+ }
518+ req , err := s .client .NewRequest ("GET" , u , nil )
485519 if err != nil {
486520 return nil , nil , err
487521 }
0 commit comments