API Introduction
The plugin exposes some API that can be used by other plugins that provide JavaScript access.
Some of the plugin that are compatible with those API are:
It is possible to access the API using the plugin reference
this.app.plugins.plugins['obsidian-jira-issue'].api
or the global variable:
$ji
API Categories
The API are divided in few categories to help the navigation.
API Category - Base
This category contains all the functions to directly access the Jira API.
The responses are cached in order to reduce the network load.
$ji.base.getIssue(issueKey: string, options: { fields?: string[], account?: IJiraIssueAccountSettings } = {})
$ji.base.getSearchResults(query: string, options: { limit?: number, offset?: number, fields?: string[], account?: IJiraIssueAccountSettings } = {})
$ji.base.getDevStatus(issueId: string, options: { account?: IJiraIssueAccountSettings } = {})
$ji.base.getBoards(projectKeyOrId: string, options: { limit?: number, offset?: number, account?: IJiraIssueAccountSettings } = {})
$ji.base.getSprint(sprintId: number, options: { account?: IJiraIssueAccountSettings } = {})
$ji.base.getSprints(boardId: number, options: { limit?: number, offset?: number, state?: ESprintState[], account?: IJiraIssueAccountSettings } = {})
$ji.base.getLoggedUser(account: IJiraIssueAccountSettings = null)
API Category - Defaulted
This category contains few functions to directly access the Jira API.
The difference with the Base section is the format of the response where all the fields have been set to a default value in case the Jira API call replied with some missing data. This type of API allows you to simplify the data access because you don't need to check if the fields exists.
The responses are cached in order to reduce the network load.
$ji.defaulted.getIssue(issueKey: string, options: { fields?: string[], account?: IJiraIssueAccountSettings } = {})
$ji.defaulted.getSearchResults(query: string, options: { limit?: number, offset?: number, fields?: string[], account?: IJiraIssueAccountSettings } = {})
API Category - Macro
This category contains functions that perform few Jira API call to get some advanced information. This category is designed to help the user access some data with few steps.
Please open an Issue on GitHub to request more of this functions.
The responses are cached in order to reduce the network load.
$ji.macro.getActiveSprint(projectKeyOrId: string)
$ji.macro.getActiveSprintName(projectKeyOrId: string)
$ji.macro.getWorkLogBySprint(projectKeyOrId: string, sprint: IJiraSprint)
$ji.macro.getWorkLogBySprintId(projectKeyOrId: string, sprintId: number)
$ji.macro.getWorkLogByDates(projectKeyOrId: string, startDate: string, endDate: string = 'now()')
$ji.macro.getWorkLogSeriesByUser(projectKeyOrId: string, startDate: string, endDate: string = 'now()')
$ji.macro.getVelocity(projectKeyOrId: string, sprintId: number, storyPointFieldName: string = 'aggregatetimeoriginalestimate')
API Category - Chart
This category contains functions to generate charts using the community plugin Obsidian-Charts.
$ji.chart.getWorklogPerDay(projectKeyOrId: string, startDate: string, endDate: string = 'now()')
$ji.chart.getWorklogPerUser(projectKeyOrId: string, startDate: string, endDate: string = 'now()', options: { format?: EChartFormat, capacity?: ISeries } = {})
API Category - Account
This category contains functions to access the accounts data stored in the Obsidian settings of this plugin.
API Category - Util
This category contains generic functions.