buildUpdateProjectItem constructs UpdateProjectItemOptions from the input map.
(input map[string]any)
| 1452 | |
| 1453 | // buildUpdateProjectItem constructs UpdateProjectItemOptions from the input map. |
| 1454 | func buildUpdateProjectItem(input map[string]any) (*github.UpdateProjectItemOptions, error) { |
| 1455 | if input == nil { |
| 1456 | return nil, fmt.Errorf("updated_field must be an object") |
| 1457 | } |
| 1458 | |
| 1459 | idField, ok := input["id"] |
| 1460 | if !ok { |
| 1461 | return nil, fmt.Errorf("updated_field.id is required") |
| 1462 | } |
| 1463 | |
| 1464 | fieldID, err := validateAndConvertToInt64(idField) |
| 1465 | if err != nil { |
| 1466 | return nil, fmt.Errorf("updated_field.id: %w", err) |
| 1467 | } |
| 1468 | |
| 1469 | valueField, ok := input["value"] |
| 1470 | if !ok { |
| 1471 | return nil, fmt.Errorf("updated_field.value is required") |
| 1472 | } |
| 1473 | |
| 1474 | payload := &github.UpdateProjectItemOptions{ |
| 1475 | Fields: []*github.UpdateProjectV2Field{{ |
| 1476 | ID: fieldID, |
| 1477 | Value: valueField, |
| 1478 | }}, |
| 1479 | } |
| 1480 | |
| 1481 | return payload, nil |
| 1482 | } |
| 1483 | |
| 1484 | func extractPaginationOptionsFromArgs(args map[string]any) (github.ListProjectsPaginationOptions, error) { |
| 1485 | perPage, err := OptionalIntParamWithDefault(args, "per_page", MaxProjectsPerPage) |
no test coverage detected