Types
Types for the options and results of client operations.
All models of the API (Issue, Project, User, …) and enums (IssueQueryInclude, …) are exported from redmine-api-client:
import type { Issue, Project } from "redmine-api-client";Operation types
The options, page responses and page settings of each operation are exported as types as well, e.g. GetIssuesOptions, GetIssuesPageResponse and GetIssuesPageSettings:
import type { GetIssuesOptions } from "redmine-api-client";
const openIssuesOf = (projectId: number): GetIssuesOptions => ({ projectId, statusId: "open" });RedmineQueryOptions
The options of an operation, given by the index of its options parameter. It leaves out operationOptions, so the options are serializable, e.g. for a query key:
import type { RedmineClient, RedmineQueryOptions } from "redmine-api-client";
type GetIssueOptions = RedmineQueryOptions<RedmineClient["issuesClient"]["getIssue"], 1>;
// { include?: IssueQueryInclude[] }RedmineListQueryOptions
The options of a list operation, without offset and limit, which are set per page:
import type { RedmineClient, RedmineListQueryOptions } from "redmine-api-client";
type GetIssuesOptions = RedmineListQueryOptions<RedmineClient["issuesClient"]["getIssues"], 0>;Dates
Timestamps like createdOn are Dates, but calendar dates like dueDate, spentOn or the from/to filters are YYYY-MM-DD strings, since a Date is a point in time and would shift the day between timezones. toPlainDate and fromPlainDate convert between both using the local timezone:
import { fromPlainDate, toPlainDate } from "redmine-api-client";
const { timeEntries } = await client.timeEntriesClient.getTimeEntries({ from: toPlainDate(new Date()) });
const dueDate = issue.dueDate ? fromPlainDate(issue.dueDate) : undefined;fromPlainDate returns local midnight, unlike new Date("2024-01-15"), which is UTC midnight.