Home Manual Reference Source
import PVBidContext from 'pvbid-sdk/src/PVBidContext.js'
public class | source

PVBidContext

Constructor Summary

Public Constructor
public

constructor(config: object)

Creates an instance of PVBidContext.

Member Summary

Public Members
public

repositories(projects: ProjectRepository, bids: BidRepository, projectStatuses: ProjectStatusRepository, snapshots: SnapshotRepository, assemblies: AssemblyRepository, tags: TagRepository, users: UserRepository, lineItems: LineItemRepository, metrics: MetricRepository, fields: FieldRepository, predictionModels: PredictionModelRepository, industryWidePredictionModels: IndustryWidePredictionModelRepository, datatables: DatatableRepository, assemblyDefs: AssemblyDefRepository, fieldDefs: FieldDefRepository, metricDefs: MetricDefRepository, lineItemDefs: LineItemDefRepository, datatableDefs: DatatableDefRepository, componentDefs: ComponentDefRepository, componentGroupDefs: ComponentGroupDefRepository, fieldGroupDefs: FieldGroupDefRepository, dynamicGroups: DynamicGroupRepository): object

A property that provides quick access to initialized repositories.

public

The current authorized user.

Method Summary

Public Methods
public

async getProject(projectId: number, options: object): Promise<Project>

Gets an initiated Project instance with included bids.

public

Create a virtual clone of a project.

public

Loads the authorized user for this context.

Public Constructors

public constructor(config: object) source

Creates an instance of PVBidContext.

Params:

NameTypeAttributeDescription
config object
config.token string

The auth token to access account data..

config.base_uri string
  • optional
  • default: https://api.pvbid.com/v2

Public Members

public repositories(projects: ProjectRepository, bids: BidRepository, projectStatuses: ProjectStatusRepository, snapshots: SnapshotRepository, assemblies: AssemblyRepository, tags: TagRepository, users: UserRepository, lineItems: LineItemRepository, metrics: MetricRepository, fields: FieldRepository, predictionModels: PredictionModelRepository, industryWidePredictionModels: IndustryWidePredictionModelRepository, datatables: DatatableRepository, assemblyDefs: AssemblyDefRepository, fieldDefs: FieldDefRepository, metricDefs: MetricDefRepository, lineItemDefs: LineItemDefRepository, datatableDefs: DatatableDefRepository, componentDefs: ComponentDefRepository, componentGroupDefs: ComponentGroupDefRepository, fieldGroupDefs: FieldGroupDefRepository, dynamicGroups: DynamicGroupRepository): object source

A property that provides quick access to initialized repositories.

public user: User source

The current authorized user. PVBidContext.loadAuthorizedUser must get called first.

Public Methods

public async getProject(projectId: number, options: object): Promise<Project> source

Gets an initiated Project instance with included bids.

Params:

NameTypeAttributeDescription
projectId number

The project id in which to retrieve.

options object
options.allowCache boolean
  • optional
  • default: false

Flags system to use cache if available.

options.loadBidEntities boolean
  • optional
  • default: true

Flag to load the bid entities with the bids. If false, the entities may be loaded later with bid.load().

Return:

Promise<Project>

public getVirtualProjectClone(project: Project, bidIds: number[]): Project source

Create a virtual clone of a project. For safety, any methods involving repositories or peristance are absent in the clone.

Params:

NameTypeAttributeDescription
project Project

The project to make a virtual clone of.

bidIds number[]
  • optional

Optionally limit the bids that will be cloned into the virtual project. Helps with performance.

Return:

Project

public async loadAuthorizedUser(): Promise<User> source

Loads the authorized user for this context. Calling PVBidContext.getProject auto loads the authorized user.

Return:

Promise<User>