redmine-ts
Version:
Redmine REST API client written using TypeScript
872 lines (869 loc) • 31.1 kB
TypeScript
/**
* Redmine REST API client written in TypeScript
*
* MIT License 2021 Jakub Gawryl
*
*/
/// <reference types="node" />
export declare class Redmine {
private baseURL;
private options;
private conn;
/**
* Constructor
* @param host
* @param options
*/
constructor(baseUrl: string, options: RedmineTS.Config);
/**
* Deeply iterate through given object and replace all found arrays into comma separated strings.
*
* @param obj
*/
private static _deepJoinArrays;
/**
* Creates connection (if there's not any) and sends request to redmine API
* @param method HTTP methos (GET, POST, PUT, DELETE, etc)
* @param path Redmine API path (without initial "/" and format eg. "issues/1")
* @param params Parameters that are sent with request
*/
private request;
/**
* Get list of projects
* http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Listing-projects
*
* @param params
*/
listProjects(params?: RedmineTS.Projects.ListParams): Promise<any>;
/**
* Create project
* http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Creating-a-project
*
* @param project
*/
createProject(project: RedmineTS.Projects.CreateParams): Promise<any>;
/**
* Get project
* http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Showing-a-project
*
* @param projectId
* @param params
*/
getProject(projectId: RedmineTS.Projects.ID, params?: RedmineTS.Projects.GetParams): Promise<any>;
/**
* Update project
* http://www.redmine.org/projects/redmine/wiki/Rest_Projects#Updating-a-project
*
* @param projectId
* @param project
*/
updateProject(projectId: RedmineTS.Projects.ID, project: RedmineTS.Projects.UpdateParams): Promise<any>;
/**
* Delete project
* https://www.redmine.org/projects/redmine/wiki/Rest_Projects#Deleting-a-project
*
* @param projectId
*/
deleteProject(projectId: RedmineTS.Projects.ID): Promise<any>;
/**
* Get list of issues
* http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Listing-issues
*
* @param params
*/
listIssues(params?: RedmineTS.Issues.ListParams): Promise<any>;
/**
* Create issue
* http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Creating-an-issue
*
* @param issue
*/
createIssue(issue: RedmineTS.Issues.CreateParams): Promise<any>;
/**
* Get issue
* http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Showing-an-issue
*
* @param issueId
* @param params
*/
getIssue(issueId: number, params?: RedmineTS.Issues.GetParams): Promise<any>;
/**
* Update issue
* http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Updating-an-issue
*
* @param issueId
* @param issue
*/
updateIssue(issueId: number, issue: RedmineTS.Issues.UpdateParams): Promise<any>;
/**
* Delete issue
* http://www.redmine.org/projects/redmine/wiki/Rest_Issues#Deleting-an-issue
*
* @param issueId
*/
deleteIssue(issueId: number): Promise<any>;
/**
* Adds watcher to issue
* https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Adding-a-watcher
*
* @param issueId
* @param watcherId
*/
addWatcher(issueId: number, watcherId: number): Promise<any>;
/**
* Remove watcher from issue
* https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Removing-a-watcher
*
* @param issueId
* @param watcherId
*/
removeWatcher(issueId: number, watcherId: number): Promise<any>;
/**
* Returns a paginated list of the project memberships.
* https://www.redmine.org/projects/redmine/wiki/Rest_Memberships#GET
*
* @param projectId can be either the project numerical id or the project identifier.
*/
listProjectMembers(projectId: RedmineTS.Projects.ID, params?: RedmineTS.Memberships.ListProjectMembersParams): Promise<any>;
/**
* Adds a project member.
* https://www.redmine.org/projects/redmine/wiki/Rest_Memberships#POST
*
* @param projectId can be either the project numerical id or the project identifier.
* @param membership
*/
addProjectMember(projectId: RedmineTS.Projects.ID, membership: RedmineTS.Memberships.AddParams): Promise<any>;
/**
* Returns the membership of given id
* https://www.redmine.org/projects/redmine/wiki/Rest_Memberships#GET-2
*
* @param membershipId
*/
getMembership(membershipId: number): Promise<any>;
/**
* Updates the membership of given id. Only the roles can be updated, the project and the user of a membership are read-only.
* https://www.redmine.org/projects/redmine/wiki/Rest_Memberships#PUT
*
* @param membershipId
* @param membership
*/
updateMembership(membershipId: number, membership: RedmineTS.Memberships.UpdateParams): Promise<any>;
/**
* Deletes a memberships. Memberships inherited from a group membership can not be deleted. You must delete the group membership.
* https://www.redmine.org/projects/redmine/wiki/Rest_Memberships#DELETE
*
* @param membershipId
*/
deleteMembership(membershipId: number): Promise<any>;
/**
* Returns a list of users. This endpoint requires admin privileges.
* https://www.redmine.org/projects/redmine/wiki/Rest_Users#GET
*
* @param params
*/
listUsers(params?: RedmineTS.Users.ListParams): Promise<any>;
/**
* Creates a user. This endpoint requires admin privileges.
* https://www.redmine.org/projects/redmine/wiki/Rest_Users#POST
*
* @param user
* @param sendToUser
*/
createUser(user: RedmineTS.Users.CreateParams, sendToUser?: boolean): Promise<any>;
/**
* Returns the user details. This endpoint can be used by admin or non admin but the returned fields will
* depend on the privileges of the requesting user. Details available in documentation:
* https://www.redmine.org/projects/redmine/wiki/Rest_Users#GET-2
*
* @param userId Id of the user or 'current' for retrieving the user whose credentials are used to access the API.
* @param params
*/
getUser(userId: number | 'current', params?: RedmineTS.Users.GetParams): Promise<any>;
/**
* Updates a user. This endpoint requires admin privileges.
* https://www.redmine.org/projects/redmine/wiki/Rest_Users#PUT
*
* @param userId
* @param user
*/
updateUser(userId: number | 'current', user: RedmineTS.Users.UpdateParams): Promise<any>;
/**
* Deletes a user. This endpoint requires admin privileges.
* https://www.redmine.org/projects/redmine/wiki/Rest_Users#DELETE
*
* @param userId
*/
deleteUser(userId: number | 'current'): Promise<any>;
/**
* Return time entries.
* https://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Listing-time-entries
*
* @param params
*/
listTimeEntries(params?: RedmineTS.TimeEntries.ListParams): Promise<any>;
/**
* Returns the time entry of given id.
* https://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Showing-a-time-entry
*
* @param teId
*/
getTimeEntry(teId: number): Promise<any>;
/**
* Creates a time entry. It's apply to the issue or project but only one is required!
* (so only issue_id OR project_id can be passed here!)
* https://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Creating-a-time-entry
*
* @param timeEntry
*/
createTimeEntry(timeEntry: RedmineTS.TimeEntries.CreateParams): Promise<any>;
/**
* Updates the time entry of given id.
* IMPORTANT NOTE: If time entry is transferred from one project to another (by changing project_id),
* the issue_id parameter must be set to null (or issue id which belongs to a new project)
* Otherwise, the method may return the error 'Issue is invalid'
* https://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Updating-a-time-entry
*
* @param teId
* @param timeEntry
*/
updateTimeEntry(teId: number, timeEntry: RedmineTS.TimeEntries.UpdateParams): Promise<any>;
/**
* Deletes the time entry of given id.
* https://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Deleting-a-time-entry
*
* @param teId
*/
deleteTimeEntry(teId: number): Promise<any>;
/**
* Returns all news across all projects with pagination.
* https://www.redmine.org/projects/redmine/wiki/Rest_News#GET
*
* @param params
*/
listAllNews(params?: RedmineTS.News.ListParams): Promise<any>;
/**
* Returns all news from project with given id or identifier with pagination.
* https://www.redmine.org/projects/redmine/wiki/Rest_News#GET-2
*
* @param projectId
* @param params
*/
listProjectNews(projectId: RedmineTS.Projects.ID, params?: RedmineTS.News.ListParams): Promise<any>;
/**
* Get single news (Released in Redmine 4.1.0 but not yet documented)
* https://www.redmine.org/projects/redmine/repository/revisions/18441
*
* @param newsId
*/
getNews(newsId: number, params?: RedmineTS.News.GetParams): Promise<any>;
/**
* Create news (Released in Redmine 4.1.0 but not yet documented)
* https://www.redmine.org/projects/redmine/repository/revisions/18440
*
* @param news
*/
createNews(projectId: RedmineTS.Projects.ID, news: RedmineTS.News.CreateParams): Promise<any>;
/**
* Update news (Released in Redmine 4.1.0 but not yet documented)
* https://www.redmine.org/projects/redmine/repository/revisions/18443
*
* @param newsId
* @param news
*/
updateNews(newsId: number, news: RedmineTS.News.UpdateParams): Promise<any>;
/**
* Delete news (Released in Redmine 4.1.0 but not yet documented)
* https://www.redmine.org/projects/redmine/repository/revisions/18442
*
* @param newsId
*/
deleteNews(newsId: number): Promise<any>;
/**
* Returns the relations for the issue of given id (not relation id!)
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueRelations#GET
*
* @param issueId
*/
listIssueRelations(issueId: number): Promise<any>;
/**
* Creates a relation for the issue of given id (not relation id!)
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueRelations#POST
*
* @param issueId
* @param relation
*/
createIssueRelation(issueId: number, relation: RedmineTS.IssueRelations.CreateParams): Promise<any>;
/**
* Returns the relation of given id (not issue id!)
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueRelations#GET-2
*
* @param relationId
*/
getIssueRelation(relationId: number): Promise<any>;
/**
* Deletes the relation of given id (not issue id!)
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueRelations#DELETE
*
* @param relationId
*/
deleteIssueRelation(relationId: number): Promise<any>;
/**
* Returns the versions available for the project of given id or identifier.
* The response may include shared versions from other projects.
* https://www.redmine.org/projects/redmine/wiki/Rest_Versions#GET
*
* @param projectId
*/
listProjectVersions(projectId: RedmineTS.Projects.ID): Promise<any>;
/**
* Creates a version for the project of given id or identifier
* https://www.redmine.org/projects/redmine/wiki/Rest_Versions#POST
*
* @param projectId
* @param version
*/
createProjectVersion(projectId: RedmineTS.Projects.ID, version: RedmineTS.Versions.CreateParams): Promise<any>;
/**
* Returns the version of given id.
* https://www.redmine.org/projects/redmine/wiki/Rest_Versions#GET-2
*
* @param versionId
*/
getProjectVersion(versionId: number): Promise<any>;
/**
* Updates the version of given id
* https://www.redmine.org/projects/redmine/wiki/Rest_Versions#PUT
*
* @param versionId
* @param version
*/
updateProjectVersion(versionId: number, version: RedmineTS.Versions.UpdateParams): Promise<any>;
/**
* Deletes the version of given id.
* https://www.redmine.org/projects/redmine/wiki/Rest_Versions#DELETE
*
* @param versionId
*/
deleteProjectVersion(versionId: number): Promise<any>;
/**
* Returns the list of all pages in a project wiki.
* https://www.redmine.org/projects/redmine/wiki/Rest_WikiPages#Getting-the-pages-list-of-a-wiki
*
* @param projectId
*/
listWikiPages(projectId: RedmineTS.Projects.ID): Promise<any>;
/**
* Returns the details of a wiki page.
* If version param is passed, returns the details of an old version of a wiki page.
* https://www.redmine.org/projects/redmine/wiki/Rest_WikiPages#Getting-a-wiki-page
*
* @param projectId
* @param pageTitle
* @param params
* @param version
*/
getWikiPage(projectId: RedmineTS.Projects.ID, pageTitle: string, params?: RedmineTS.WikiPages.GetParams, version?: number): Promise<any>;
/**
* Creates or updates a wiki page.
*
* When creating or updating wiki pages, the text field must be provided.
* If you do not wish to change the text, you can keep it by first getting
* the wiki page, and provide the current text in the update.
*
* When updating an existing page, you can include a version attribute to
* make sure that the page is a specific version when you try to update it.
* (eg. you don't want to overwrite an update that would have been done after you retrieved the page).
* https://www.redmine.org/projects/redmine/wiki/Rest_WikiPages#Creating-or-updating-a-wiki-page
* @param projectId
* @param pageTitle
* @param wikiPages
*/
createUpdateWikiPage(projectId: RedmineTS.Projects.ID, pageTitle: string, wikiPages: RedmineTS.WikiPages.CreateUpdateParams): Promise<any>;
/**
* Deletes a wiki page, its attachments and its history. If the deleted page is a
* parent page,its child pages are not deleted but changed as root pages.
* https://www.redmine.org/projects/redmine/wiki/Rest_WikiPages#Deleting-a-wiki-page
*
* @param projectId
* @param pageTitle
*/
deleteWikiPage(projectId: RedmineTS.Projects.ID, pageTitle: string): Promise<any>;
/**
* Returns the list of all custom queries visible by the user (public and private queries) for all projects.
* https://www.redmine.org/projects/redmine/wiki/Rest_Queries
*/
listQueries(): Promise<any>;
/**
* Upload file to Redmine's server If the upload succeeds, you get
* a 201 response that contains a token for your uploaded file.
* https://www.redmine.org/projects/redmine/wiki/Rest_api#Attaching-files
*
* @param fileContent File content
*/
uploadFile(fileContent: Buffer): Promise<any>;
/**
* Returns the description of the attachment of given id. The file can actually
* be downloaded at the URL given by the content_url attribute in the response.
* Then you can use this token to attach your uploaded file to a new or an
* existing issue or other resource (eg. news, wiki pages etc.)
* https://www.redmine.org/projects/redmine/wiki/Rest_Attachments#attachmentsidformat
*
* @param attachmentId
*/
getAttachment(attachmentId: number): Promise<any>;
/**
* Update attachment info (only filename and description can be changed)
*
* IMPORTANT NOTE: Changing filename may cause the image file to
* no longer appear on news pages, wikis, etc., when an image
* token ("!filename.png!") is used in the content.
*
* @param attachmentId
* @param attachment
*/
updateAttachmentInfo(attachmentId: number, attachment: RedmineTS.Attachments.UpdateParams): Promise<any>;
/**
* Delete an attachement
*
* IMPORTANT NOTE: Deleting attachement may cause the image file to
* no longer appear on news pages, wikis, etc., when an image
* token ("!filename.png!") is used in the content.
*
* https://www.redmine.org/projects/redmine/wiki/Rest_Attachments#DELETE
*
* @param attachmentId
*/
deleteAttachment(attachmentId: number): Promise<any>;
/**
* Returns the list of all issue statuses.
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueStatuses
*/
listIssueStatuses(): Promise<any>;
/**
* Returns the list of all trackers.
* https://www.redmine.org/projects/redmine/wiki/Rest_Trackers
*/
listTrackers(): Promise<any>;
/**
* Returns the list of issue priorities.
* https://www.redmine.org/projects/redmine/wiki/Rest_Enumerations#enumerationsissue_prioritiesformat
*/
listIssuePrioritiesEnum(): Promise<any>;
/**
* Returns the list of time entry activities.
* https://www.redmine.org/projects/redmine/wiki/Rest_Enumerations#enumerationstime_entry_activitiesformat
*/
listTimeEntryActivitiesEnum(): Promise<any>;
/**
* Returns the list of document categories.
* https://www.redmine.org/projects/redmine/wiki/Rest_Enumerations#enumerationsdocument_categoriesformat
*/
listDocumentCategoriesEnum(): Promise<any>;
/**
* Returns the issue categories available for the project of given id or identifier.
* @param projectId
*/
listIssueCategories(projectId: RedmineTS.Projects.ID): Promise<any>;
/**
* Creates an issue category for the project of given id or identifier
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#POST
*
* @param projectId
* @param issueCategory
*/
createIssueCategory(projectId: RedmineTS.Projects.ID, issueCategory: RedmineTS.IssueCategories.CreateParams): Promise<any>;
/**
* Returns the issue category of given id
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#GET-2
*
* @param issueCategoryId
*/
getIssueCategory(issueCategoryId: number): Promise<any>;
/**
* Updates the issue category of given id
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#PUT
*
* @param issueCategoryId
* @param issueCategory
*/
updateIssueCategory(issueCategoryId: number, issueCategory: RedmineTS.IssueCategories.UpdateParams): Promise<any>;
/**
* Deletes the issue category of given id
* https://www.redmine.org/projects/redmine/wiki/Rest_IssueCategories#DELETE
*
* @param issueCategoryId
*/
deleteIssueCategory(issueCategoryId: number): Promise<any>;
/**
* Returns the list of roles
* https://www.redmine.org/projects/redmine/wiki/Rest_Roles#rolesformat
*/
listRoles(): Promise<any>;
/**
* Returns the list of permissions for a given role
* https://www.redmine.org/projects/redmine/wiki/Rest_Roles#GET-2
*
* @param roleId
*/
listRolePermissions(roleId: number): Promise<any>;
/**
* Returns the list of groups. This endpoint requires admin privileges
* https://www.redmine.org/projects/redmine/wiki/Rest_Groups#GET
*/
listGroups(): Promise<any>;
/**
* Creates a group. This endpoint requires admin privileges
* https://www.redmine.org/projects/redmine/wiki/Rest_Groups#POST
*
* @param group
*/
createGroup(group: RedmineTS.Groups.CreateParams): Promise<any>;
/**
* Returns details of a group. This endpoint requires admin privileges
* https://www.redmine.org/projects/redmine/wiki/Rest_Groups#GET-2
*
* @param groupId
* @param params
*/
getGroup(groupId: number, params?: RedmineTS.Groups.GetParams): Promise<any>;
/**
* Updates an existing group. This endpoint requires admin privileges
* https://www.redmine.org/projects/redmine/wiki/Rest_Groups#PUT
*
* @param groupId
* @param group
*/
updateGroup(groupId: number, group: RedmineTS.Groups.UpdateParams): Promise<any>;
/**
* Deletes an existing group. This endpoint requires admin privileges
* https://www.redmine.org/projects/redmine/wiki/Rest_Groups#DELETE
*
* @param groupId
*/
deleteGroup(groupId: number): Promise<any>;
/**
* Adds an existing user to a group. This endpoint requires admin privileges
* https://www.redmine.org/projects/redmine/wiki/Rest_Groups#POST-2
*
* @param userId
* @param groupId
*/
addUserToGroup(userId: number, groupId: number): Promise<any>;
/**
* Removes a user from a group. This endpoint requires admin privileges
* https://www.redmine.org/projects/redmine/wiki/Rest_Groups#DELETE-2
*
* @param userId
* @param groupId
*/
removeUserFromGroup(userId: number, groupId: number): Promise<any>;
/**
* Returns all the custom fields definitions
* https://www.redmine.org/projects/redmine/wiki/Rest_CustomFields#custom_fieldsformat
*/
listCustomFields(): Promise<any>;
/**
* Search in Redmine (Not documented yet - details in https://www.redmine.org/issues/6277)
* https://www.redmine.org/projects/redmine/wiki/Rest_Search
*
* @param q
* @param additionalParams
*/
search(q: string, additionalParams?: RedmineTS.Search.Params): Promise<any>;
/**
* Returns the files available for the project of given id or identifier
* https://www.redmine.org/projects/redmine/wiki/Rest_Files#GET
*
* @param projectId
*/
listProjectFiles(projectId: RedmineTS.Projects.ID): Promise<any>;
/**
* Upload a file for the project of given id or identifier
* https://www.redmine.org/projects/redmine/wiki/Rest_Files#POST
*
* @param projectId
* @param file
*/
addProjectFile(projectId: RedmineTS.Projects.ID, file: RedmineTS.Files.AddProjectarams): Promise<any>;
/**
* Returns the details of your account.
* https://www.redmine.org/projects/redmine/wiki/Rest_MyAccount#GET
*/
getMyAccount(): Promise<any>;
updateMyAccount(user: RedmineTS.MyAccount.UpdateParams): Promise<any>;
}
export declare namespace RedmineTS {
type Config = {
apiKey?: string;
username?: string;
password?: string;
impersonateUser?: string;
maxUploadSize?: number;
};
namespace Common {
type EnabledModuleNames = 'boards' | 'calendar' | 'documents' | 'files' | 'gantt' | 'issue_tracking' | 'news' | 'repository' | 'time_tracking' | 'wiki';
type CustomField = {
id: number;
value: string;
};
type Upload = {
token: string;
filename: string;
content_type: string;
description?: string;
};
type PaginationParams = {
limit?: number;
offset?: number;
};
}
namespace Projects {
type ID = number | string;
type OptionalParams = {
description?: string;
homepage?: string;
is_public?: boolean;
parent_id?: number;
inherit_members?: boolean;
tracker_ids?: number[];
enabled_module_names?: Common.EnabledModuleNames[];
issue_custom_field_ids?: number[];
};
type CreateParams = OptionalParams & {
name: string;
identifier: string;
};
type UpdateParams = OptionalParams & {
name?: string;
};
type ListParamsInclude = 'trackers' | 'issue_categories' | 'enabled_modules';
type ListParams = Common.PaginationParams & {
include?: ListParamsInclude[];
};
type GetParamsInclude = ListParamsInclude | 'time_entry_activities';
type GetParams = {
include?: GetParamsInclude[];
};
}
namespace Issues {
type OptionalParams = {
tracker_id?: number;
status_id?: number;
priority_id?: number;
description?: string;
category_id?: number;
fixed_version_id?: number;
assigned_to_id?: number;
parent_issue_id?: number;
custom_fields?: Common.CustomField[];
watcher_user_ids?: number[];
is_private?: boolean;
estimated_hours?: number;
uploads?: Common.Upload[];
done_ratio?: number;
start_date?: string;
due_date?: string;
};
type CreateParams = OptionalParams & {
subject: string;
project_id: number;
};
type UpdateParams = OptionalParams & {
subject?: string;
project_id?: number;
notes?: string;
private_notes?: boolean;
};
type ListParamsInclude = 'attachments' | 'relations';
type ListParams = Common.PaginationParams & {
sort?: string;
include?: ListParamsInclude[];
issue_id?: number[] | string;
project_id?: number;
subproject_id?: number | string;
tracker_id?: number;
status_id?: number | 'open' | 'closed' | '*';
assigned_to_id?: number | 'me';
parent_id?: number;
query_id?: number;
};
type GetParamsInclude = ListParamsInclude | 'children' | 'changesets' | 'journals' | 'watchers';
type GetParams = {
include?: GetParamsInclude[];
};
}
namespace Memberships {
type AddParams = {
user_id: number;
role_ids: number[];
};
type UpdateParams = {
role_ids: number[];
};
type ListProjectMembersParams = Common.PaginationParams;
}
namespace Users {
type MailNotificationOptions = 'all' | 'selected' | 'only_my_events' | 'only_assigned' | 'only_owner' | 'none';
type OptionalParams = {
auth_source_id?: number;
mail_notification?: MailNotificationOptions;
must_change_passwd?: boolean;
generate_password?: boolean;
admin?: boolean;
status?: number;
};
type ListParams = Common.PaginationParams & {
status?: 0 | 1 | 2 | 3;
name?: string;
group_id?: number;
};
type CreateParams = OptionalParams & {
login: string;
password: string;
firstname: string;
lastname: string;
mail: string;
};
type GetParamsInclude = 'memberships' | 'groups';
type GetParams = {
include?: GetParamsInclude[];
};
type UpdateParams = OptionalParams & {
login?: string;
firstname?: string;
lastname?: string;
mail?: string;
};
}
namespace TimeEntries {
type ListParams = Common.PaginationParams & {
user_id?: number;
project_id?: number;
spent_on?: string;
from?: string;
to?: string;
};
type OptionalParams = {
spent_on?: string;
activity_id?: number;
comments?: string;
user_id?: number;
};
type CreateParams = OptionalParams & {
issue_id: number;
project_id?: never;
} | {
issue_id?: never;
project_id: number;
} & {
hours: number;
};
type UpdateParams = OptionalParams & {
project_id?: number;
issue_id?: number;
hours?: number;
};
}
namespace News {
type ListParams = Common.PaginationParams;
type GetParamsInclude = 'attachments';
type GetParams = {
include?: GetParamsInclude[];
};
type OptionalCreateParams = {
summary?: string;
uploads?: Common.Upload[];
};
type CreateParams = OptionalCreateParams & {
title: string;
description: string;
};
type UpdateParams = OptionalCreateParams & {
title?: string;
description?: string;
};
}
namespace IssueRelations {
type RelationType = 'relates' | 'duplicates' | 'duplicated' | 'blocks' | 'blocked' | 'precedes' | 'follows' | 'copied_to' | 'copied_from';
type CreateParams = {
issue_to_id: number;
relation_type?: RelationType;
delay?: number;
};
}
namespace Versions {
type OptionalVersionParams = {
status?: 'open' | 'locked' | 'closed';
sharing?: 'none' | 'descendants' | 'hierarchy' | 'tree' | 'system';
due_date?: string;
description?: string;
wiki_page_title?: string;
};
type CreateParams = OptionalVersionParams & {
name: string;
};
type UpdateParams = OptionalVersionParams & {
name?: string;
};
}
namespace WikiPages {
type GetParams = {
include?: 'attachments';
};
type CreateUpdateParams = {
text: string;
comments?: string;
version?: number;
parent_id?: number;
uploads?: Common.Upload[];
};
}
namespace Attachments {
type UpdateParams = {
filename?: string;
description?: string;
};
}
namespace IssueCategories {
type OptionalCreateParams = {
assigned_to_id?: number;
};
type CreateParams = OptionalCreateParams & {
name: string;
};
type UpdateParams = OptionalCreateParams & {
name?: string;
};
}
namespace Groups {
type CreateParams = {
name: string;
user_ids?: number[];
};
type UpdateParams = {
name?: string;
};
type GetParamsInclude = 'users' | 'memberships';
type GetParams = {
include?: GetParamsInclude[];
};
}
namespace Search {
type Params = Common.PaginationParams;
}
namespace Files {
type AddProjectarams = {
token: string;
version_id?: number;
filename?: string;
description?: string;
};
}
namespace MyAccount {
type UpdateParams = {
firstame?: string;
lastname?: string;
mail?: string;
};
}
}