Я создаю надстройку, которая должна автоматически создавать рабочие журналы. Я использую node-js (jira-соединитель).
Мне удалось получить проблемы и создать новый, но я получаю сообщение об ошибке:
UnhandledPromiseRejectionWarning: Ошибка: отсутствует свойство 'worklog'
когда я хочу добавить рабочие журналы в выпуск
function updateIssueInJira()
{
var jira = getoAuth();
try {
return new Promise(() => {
jira.issue.addWorkLog({
opts: {
issueKey: 'NTS-4',
adjustEstimate: 'new',
newEstimade: '2d',
worklog: 'Testing'
}
})
});
} catch (error) {
console.log(error);
}
}
Определение addWorkLog:
/**
* Adds a new worklog entry to an issue.
*
* @method addWorkLog
* @memberOf IssueClient#
* @param {Object} opts The options to pass to the API. Note that this object must contain EITHER an issueId or
* issueKey property; issueId will be used over issueKey if both are present.
* @param {string} [opts.issueId] The id of the issue. EX: 10002
* @param {string} [opts.issueKey] The Key of the issue. EX: JWR-3
* @param {string} [opts.adjustEstimate] Allows you to provide specific instructions to update the remaining time
* estimate of the issue. Valid values are
* * "new" - sets the estimate to a specific value
* * "leave"- leaves the estimate as is
* * "manual" - specify a specific amount to increase remaining estimate by
* * "auto"- Default option. Will automatically adjust the value based on the
* new timeSpent specified on the worklog
* @param {string} [opts.newEstimate] (required when "new" is selected for adjustEstimate) the new value for the
* remaining estimate field. e.g. "2d"
* @param {string} [opts.reduceBy] (required when "manual" is selected for adjustEstimate) the amount to reduce the
* remaining estimate by e.g. "2d"
* @param {Object} opts.worklog See {@link: https://docs.atlassian.com/jira/REST/latest/#d2e1106}
* @param [callback] Called after the worklog is added.
* @return {P
romise} Resolved after the worklog is added.
*/
this.addWorkLog = function (opts, callback) {
if (!opts.worklog) {
throw new Error(errorStrings.NO_WORKLOG_ERROR);
}
var options = this.buildRequestOptions(opts, '/worklog', 'POST', opts.worklog, {
newEstimate: opts.newEstimate,
reduceBy: opts.reduceBy,
adjustEstimate: opts.adjustEstimate
});
return this.jiraClient.makeRequest(options, callback, 'Worklog Added');
};
В getoAuth () я выполняю аутентификацию oAuth и хочу добавить рабочий журнал в выпуск NTS-4.