| 281 | |
| 282 | |
| 283 | def add_to_project(project_id: str, content_id: str) -> str | None: |
| 284 | mutation = ( |
| 285 | "mutation($project: ID!, $content: ID!) { " |
| 286 | "addProjectV2ItemById(input: {projectId: $project, contentId: $content}) { " |
| 287 | "item { id } } }" |
| 288 | ) |
| 289 | try: |
| 290 | d = graphql(mutation, project=project_id, content=content_id) |
| 291 | except SystemExit: |
| 292 | return None |
| 293 | item = (d.get("data") or {}).get("addProjectV2ItemById", {}).get("item") or {} |
| 294 | node_id = item.get("id") |
| 295 | return str(node_id) if node_id else None |
| 296 | |
| 297 | |
| 298 | def main() -> int: |