Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • PurchaseApi

Index

Constructors

constructor

Properties

Private api

Methods

createRateAndCommentOperation

  • Create a rate and comment content operation.

    Parameters

    • uri: string

      a uri of the content

    • consumer: ChainObject

      object id of the account, 1.2.*

    • rating: 1 | 2 | 3 | 4 | 5

      1-5 stars

    • comment: string

      max 100 chars

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<LeaveRatingAndCommentOperation>

    a rate and comment content operation

findAll

  • Search consumer open and history purchases.

    Parameters

    • consumer: ChainObject

      object id of the account, 1.2.*

    • term: string

      search term

    • Default value from: ChainObject = ObjectType.Null.genericId()

      object id of the history object to start from, use {@link ObjectType.Null.genericId} to ignore

    • Default value order: SearchPurchasesOrder = SearchPurchasesOrder.PurchasedDesc

      order defined by SearchPurchasesOrder

    • Default value limit: number = 100

      number of entries, max 100

    Returns Promise<Purchase[]>

    list of purchases

findAllForFeedback

  • findAllForFeedback(uri: string, user?: undefined | string, count?: number, startId?: ChainObject): Promise<Purchase[]>
  • Search for feedback.

    Parameters

    • uri: string

      content URI

    • Optional user: undefined | string

      feedback author account name

    • Default value count: number = 100

      maximum number of feedback objects to fetch

    • Default value startId: ChainObject = ObjectType.Null.genericId()

      the id of purchase object to start searching from

    Returns Promise<Purchase[]>

    a list of purchase objects

get

  • Get consumer purchase by content uri.

    Parameters

    • consumer: ChainObject

      object id of the account, 1.2.*

    • uri: string

      a uri of the content

    Returns Promise<Purchase>

    an account if found, ObjectNotFoundError otherwise

getAllHistory

  • Get a list of history purchases for consumer id.

    Parameters

    • accountId: ChainObject

      consumer account object id, 1.2.*

    Returns Promise<Purchase[]>

    a list of history purchases

getAllOpen

  • Get a list of open purchases.

    Returns Promise<Purchase[]>

    a list of open purchases

getAllOpenByAccount

  • Get a list of open purchases for consumer id.

    Parameters

    • accountId: ChainObject

      consumer account object id, 1.2.*

    Returns Promise<Purchase[]>

    a list of open purchases

getAllOpenByUri

  • getAllOpenByUri(uri: string): Promise<Purchase[]>
  • Get a list of open purchases for content URI.

    Parameters

    • uri: string

      content uri

    Returns Promise<Purchase[]>

    a list of open purchases

rateAndComment

  • Rate and comment content operation.

    Parameters

    • credentials: Credentials

      account credentials

    • uri: string

      a uri of the content

    • rating: 1 | 2 | 3 | 4 | 5

      1-5 stars

    • comment: string

      max 100 chars

    • Optional fee: Fee

      fee for the operation or asset id, if left undefined the fee will be computed in DCT asset. When set, the request might fail if the asset is not convertible to DCT or conversion pool is not large enough

    Returns Promise<TransactionConfirmation>

    a rate and comment content operation

restoreEncryptionKey

  • restoreEncryptionKey(elGamalPrivate: PubKey, purchaseId: ChainObject): Promise<string>
  • Restores encryption key from key parts stored in buying object.

    Parameters

    • elGamalPrivate: PubKey

      the private El Gamal key

    • purchaseId: ChainObject

      the purchase object

    Returns Promise<string>

    AES encryption key

Generated using TypeDoc