Repositories
Included in the SDK are multiple repositories to easily access data from the server. The repositories are initialized within the PVBidContext.
Available Repositories
pvbid.repositories.bidsSee BidRepositorypvbid.repositories.projectsSee ProjectRepositorypvbid.repositories.projectStatusesSee ProjectStatusRepositorypvbid.repositories.tagsSee TagRepositorypvbid.repositories.snapshotsSee SnapshotRepositorypvbid.repositories.assembliesSee AssemblyRepositorypvbid.repositories.usersSee UserRepositorypvbid.repositories.predictionModelsSee PredictionModelRepositorypvbid.repositories.industryWidePredictionModelsSee IndustryWidePredictionModelRepository
These repositories are available as read-only (they should be modified through the pvbid application):
pvbid.repositories.assemblyDefsSee AssemblyDefRepositorypvbid.repositories.lineItemDefsSee LineItemDefRepositorypvbid.repositories.fieldDefsSee FieldDefRepositorypvbid.repositories.fieldGroupDefsSee FieldGroupDefRepositorypvbid.repositories.metricDefsSee MetricDefRepositorypvbid.repositories.componentDefsSee ComponentDefRepositorypvbid.repositories.componentGroupDefsSee ComponentGroupDefRepository
Code Examples
Retrieving an array of projects
let params = {
order_by: "created_at",
sort_order: "asc",
per_page: 50
}
try {
let projects = await pvbid.repositories.projects.get(params);
console.log(projects) //prints an array of project data.
} catch(error) {
//handle error;
}
Retrieving a line item definition
const lineItemDefId = 123;
try {
const lineItemDef = await pvbid.repositories.lineItemDefs.findById(lineItemDefId);
} catch (e) {
// handle error
}