Skip to content

Issues

Use client.Issues to manage issues and their notes. The iid is the issue number within a project (for example, 3), not its global Id.

List methods return the server's current page; they do not fetch every page automatically. Create, update, close, and note creation write to the selected project.

Setup

Replace the example token and project ID with your own. Python examples call each API from an async function, then run that function with asyncio.run. In an existing async application, call the API with await inside its running event loop. The repository runs these exact snippets against offline fixtures during documentation checks.

#r "nuget: DataHubClient"

open DataHubClient

let client = DataHubClient("https://git.nfdi4plants.org", Authentication.PersonalAccessToken("your-datahub-pat"))
let projectId = 42
import { DataHubClient } from "@nfdi4plants/datahub-client";
import { Authentication } from "@nfdi4plants/datahub-client/Http/Authentication.js";

const client = new DataHubClient("https://git.nfdi4plants.org", Authentication.PersonalAccessToken("your-datahub-pat"));
const projectId = 42;
import asyncio
from datahub_client import DataHubClient, Authentication

client = DataHubClient("https://git.nfdi4plants.org", Authentication.PersonalAccessToken("your-datahub-pat"))
project_id = 42

ListAsync

List issues, optionally filtered by state. Omit state to use the server default.

let issues = client.Issues.ListAsync(projectId, state = "opened") |> Async.RunSynchronously
for item in issues do printfn $"{item.Iid}: {item.Title}"
const issues = await client.Issues.ListAsync(projectId, "opened");
for (const item of issues) console.log(`${item.Iid}: ${item.Title}`);
async def list_example():
    return await client.Issues.ListAsync(project_id, state="opened")


issues = asyncio.run(list_example())
for item in issues:
    print(f"{item.Iid}: {item.Title}")

GetAsync

Read one issue by its project-local number.

let issue = client.Issues.GetAsync(projectId, 3) |> Async.RunSynchronously
printfn "%s" issue.Title
const issue = await client.Issues.GetAsync(projectId, 3);
console.log(issue.Title);
async def get_example():
    return await client.Issues.GetAsync(project_id, 3)


issue = asyncio.run(get_example())
print(issue.Title)

CreateAsync

Create an issue with a title and optional Markdown description. The returned Iid identifies it for subsequent calls.

let created =
    client.Issues.CreateAsync(projectId, "Add assay metadata", description = "Describe the assay.")
    |> Async.RunSynchronously
printfn "%s" created.WebUrl
const created = await client.Issues.CreateAsync(
  projectId, "Add assay metadata", "Describe the assay."
);
console.log(created.WebUrl);
async def create_example():
    return await client.Issues.CreateAsync(
        project_id, "Add assay metadata", description="Describe the assay."
    )


created = asyncio.run(create_example())
print(created.WebUrl)

UpdateAsync

Change the title or description. Omitted fields remain unchanged. Use stateEvent = "reopen" (Python: state_event="reopen") to reopen a closed issue; JavaScript and TypeScript take this as the fifth argument.

let updated =
    client.Issues.UpdateAsync(projectId, 3, title = "Complete assay metadata", description = "Add protocol details.")
    |> Async.RunSynchronously
printfn "%s" updated.Title
const updated = await client.Issues.UpdateAsync(
  projectId, 3, "Complete assay metadata", "Add protocol details."
);
console.log(updated.Title);
async def update_example():
    return await client.Issues.UpdateAsync(
        project_id, 3, title="Complete assay metadata", description="Add protocol details."
    )


updated = asyncio.run(update_example())
print(updated.Title)

CloseAsync

Close an issue and return its updated state.

let closed = client.Issues.CloseAsync(projectId, 3) |> Async.RunSynchronously
printfn "%s" closed.State
const closed = await client.Issues.CloseAsync(projectId, 3);
console.log(closed.State);
async def close_example():
    return await client.Issues.CloseAsync(project_id, 3)


closed = asyncio.run(close_example())
print(closed.State)

NotesAsync

Read the notes on an issue. System distinguishes automatically generated notes from user comments.

let notes = client.Issues.NotesAsync(projectId, 3) |> Async.RunSynchronously
for note in notes do printfn "%s" note.Body
const notes = await client.Issues.NotesAsync(projectId, 3);
for (const note of notes) console.log(note.Body);
async def notes_example():
    return await client.Issues.NotesAsync(project_id, 3)


notes = asyncio.run(notes_example())
for note in notes:
    print(note.Body)

CreateNoteAsync

Add a Markdown comment and return the created note.

let note = client.Issues.CreateNoteAsync(projectId, 3, "Metadata reviewed.") |> Async.RunSynchronously
printfn "%s" note.Body
const note = await client.Issues.CreateNoteAsync(projectId, 3, "Metadata reviewed.");
console.log(note.Body);
async def create_note_example():
    return await client.Issues.CreateNoteAsync(project_id, 3, "Metadata reviewed.")


note = asyncio.run(create_note_example())
print(note.Body)