JS API Reference

Class: DemandBodyBuilder

market/demand/demand-body-builder.DemandBodyBuilder

A helper class assisting in building the Golem Demand object

Various directors should use the builder to add properties and constraints before the final product is received from the builder and sent to yagna to subscribe for matched offers (proposals).

The main purpose of the builder is to accept different requirements (properties and constraints) from different directors who know what kind of properties and constraints are needed. Then it helps to merge these requirements.

Demand -> DemandSpecification -> DemandPrototype -> DemandDTO

Table of contents

Constructors

Methods

Constructors

constructor

new DemandBodyBuilder(): DemandBodyBuilder

Returns

DemandBodyBuilder

Methods

addProperty

addProperty(key, value): DemandBodyBuilder

Parameters

NameType
keystring
valueDemandPropertyValue

Returns

DemandBodyBuilder

Defined in

src/market/demand/demand-body-builder.ts:60


addConstraint

addConstraint(key, value, comparisonOperator?): DemandBodyBuilder

Parameters

NameTypeDefault value
keystringundefined
valuestring | numberundefined
comparisonOperatorComparisonOperatorComparisonOperator.Eq

Returns

DemandBodyBuilder

Defined in

src/market/demand/demand-body-builder.ts:70


getProduct

getProduct(): DemandBodyPrototype

Returns

DemandBodyPrototype

Defined in

src/market/demand/demand-body-builder.ts:75


mergePrototype

mergePrototype(prototype): DemandBodyBuilder

Parameters

NameType
prototypeDemandBodyPrototype

Returns

DemandBodyBuilder

Defined in

src/market/demand/demand-body-builder.ts:82