    import BaseRepository from 'pvbid-sdk/src/repositories/BaseRepository.js'

public class | source

# BaseRepository

#### Direct Subclass:

AssemblyRepository, BidRepository, CacheRepository, DocumentRepository, FieldRepository, LineItemRepository, MetricRepository, PredictionModelRepository, ProjectRepository, SnapshotRepository, UserRepository

#### Indirect Subclass:

ProjectStatusRepository, TagRepository

## Constructor Summary

Public Constructor
public | constructor(endpoint: string, singleMap: string, multiMap: string) Creates an instance of BaseRepository. |

## Member Summary

Public Members
public | endpoint: * |
public | http: * |
public | httpConfig: * |
public | map: {"single": *, "multi": *} |
public | metaData: * |
public | params: {} |

## Method Summary

Public Methods
public | async create(entity: BidEntity): Promise<BidEntity> Persists a new entity |
public | async delete(id: number): Promise<Object> Deletes a single entity by its id |
public | async findById(id: number): Promise<BidEntity> Retrieves a single domain object by its id. |
public | async get(params: Object): Promise<BidEntity[]> Retrieves an array of results for the endpoint |
public | async save(entity: BidEntity): Promise<BidEntity> Persists an update to the entity |

## Public Constructors

### public constructor(endpoint: string, singleMap: string, multiMap: string) source

Creates an instance of BaseRepository.

#### Params:

Name | Type | Attribute | Description
endpoint | string |  | The API endpoint for the entity
singleMap | string |  | The singular noun for the entity (ie. 'bid' or 'assembly')
multiMap | string |  | The plural noun for the entity (ie. 'bids' or 'assemblies')

## Public Members

### public endpoint: * source

### public http: * source

### public httpConfig: * source

### public map: {"single": *, "multi": *} source

### public metaData: * source

### public params: {} source

## Public Methods

### public async create(entity: BidEntity): Promise<BidEntity> source

Persists a new entity

#### Params:

Name | Type | Attribute | Description
entity | BidEntity |  | An entity object to persist

#### Return:

Promise<BidEntity> | The newly persisted entity

### public async delete(id: number): Promise<Object> source

Deletes a single entity by its id

#### Params:

Name | Type | Attribute | Description
id | number |  | The id of the entity to delete

#### Return:

Promise<Object> | Response status message

### public async findById(id: number): Promise<BidEntity> source

Retrieves a single domain object by its id.

#### Params:

Name | Type | Attribute | Description
id | number |  | The id of the entity to retrieve.

#### Return:

Promise<BidEntity>

### public async get(params: Object): Promise<BidEntity[]> source

Retrieves an array of results for the endpoint

#### Params:

Name | Type | Attribute | Description

params

Object

- optional

A set of parameters to include for the endpoint.

#### Return:

Promise<BidEntity[]> | Array of results filtered by the given params

### public async save(entity: BidEntity): Promise<BidEntity> source

Persists an update to the entity

#### Params:

Name | Type | Attribute | Description
entity | BidEntity |  |

#### Return:

Promise<BidEntity> | The updated entity