gpt4 book ai didi

node.js - 使用 Rally API 根据功能选择用户故事

转载 作者:太空宇宙 更新时间:2023-11-04 01:05:21 25 4
gpt4 key购买 nike

我正在尝试获取属于特定功能但有子项的所有用户故事。

以下是我如何使用集结 Node 创建查询。

async.map(features, function(feature, cb) {
self.restApi.query({
type: 'hierarchicalrequirement',
limit: Infinity,
order: 'Rank',
fetch: ['FormattedID', 'Name', 'Children'],
parent: feature.ObjectID,
query: queryUtils.where('DirectChildrenCount', '>', 0)
}, cb);
}, function(err, results) {
//user stories
});

这是我的功能的样子:

 { _rallyAPIMajor: '2',
_rallyAPIMinor: '0',
_ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/18846103932',
_refObjectUUID: 'c01d7f828-a6d6-4efc-8160-c0c19ad0fabc',
_objectVersion: '7',
_refObjectName: 'Dashboard Widgets',
ObjectID: 18836103932,
FormattedID: 'F1',
DirectChildrenCount: 2,
Name: 'Dashboard Widgets',
UserStories:
{ _rallyAPIMajor: '2',
_rallyAPIMinor: '0',
_ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/PortfolioItem/Feature/18846103932/UserStories',
_type: 'HierarchicalRequirement',
Count: 2 },
_type: 'PortfolioItem/Feature' },

我是集会新手,因此非常感谢有关文档等的任何进一步帮助。

最佳答案

这是一个完整的示例,其中查询功能并获取其 UserStories 集合,然后进行水合。

出于性能原因,v2.0 删除了在同一响应中返回子集合的功能。现在获取集合将返回一个对象,其中包含计数和从中获取集合数据的 url。需要单独的请求来水合集合。

此更改已记录在案 here

我在您的帖子中没有看到问题,我不确定您遇到什么问题,但他的代码根据功能获取用户故事,并按 ('DirectChildrenCount', '>', 0) 进行过滤

var rally = require('rally'),
queryUtils = rally.util.query;
mySettings = {
apiKey: '_secret',
server: 'https://rally1.rallydev.com', //this is the default and may be omitted
requestOptions: {
headers: {
'X-RallyIntegrationName': 'My cool node.js program',
'X-RallyIntegrationVendor': 'My company',
'X-RallyIntegrationVersion': '1.0'
},
}
},
restApi = rally(mySettings);

function queryFeature() {
return restApi.query({
type: 'portfolioitem/feature',
fetch: ['FormattedID', 'Name', 'UserStories'],
query: queryUtils.where('FormattedID', '=', 'F7')
});
}

function queryChildren(result) {
return restApi.query({
ref: result.Results[0].UserStories,
limit: Infinity,
order: 'Rank',
fetch: ['FormattedID', 'Name'],
query: queryUtils.where('DirectChildrenCount', '>', 0)
});
}

function onSuccess(result) {
console.log('Success!', result);
}

function onError(errors) {
console.log('Failure!', errors);
}

queryFeature()
.then(queryChildren)
.then(onSuccess)
.fail(onError);

关于node.js - 使用 Rally API 根据功能选择用户故事,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23611977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com