Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • ContentApi

Index

Constructors

constructor

Properties

Private api

Methods

add

  • Add content.

    Parameters

    • credentials: Credentials

      author credentials. If co-authors is not filled, this account will receive full payout

    • coAuthors: Array<[ChainObject, number]>

      if map is not empty, payout will be split - the parameter maps co-authors to basis points split, e.g. author1:9000 (bp), author2:1000 (bp)

    • uri: string

      URI where the content can be found

    • price: RegionalPrice[]

      list of regional prices

    • expiration: Moment

      content expiration time

    • synopsis: Synopsis

      JSON formatted structure containing content information

    • 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>

createAddContentOperation

  • Create request to submit content operation.

    Parameters

    • author: ChainObject

      author of the content. If co-authors is not filled, this account will receive full payout

    • coAuthors: Array<[ChainObject, number]>

      if map is not empty, payout will be split - the parameter maps co-authors to basis points split, e.g. author1:9000 (bp), author2:1000 (bp)

    • uri: string

      URI where the content can be found

    • price: RegionalPrice[]

      list of regional prices

    • expiration: Moment

      content expiration time

    • synopsis: Synopsis

      JSON formatted structure containing content information

    • 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<AddOrUpdateContentOperation>

createPurchaseOperation

  • Create a purchase content operation.

    Parameters

    • credentials: Credentials

      account credentials

    • content: ChainObject | string

      uri of the content or object id of the content, 2.13.*

    • 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<PurchaseContentOperation>

    a purchase content operation

createRemoveContentOperation

  • Create remove content operation. Sets expiration to head block time, so the content cannot be purchased, but remains in database.

    Parameters

    • content: ChainObject | string

      content id or uri

    • 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<RemoveContentOperation>

createTransfer

  • Transfers an amount of one asset to content. Amount is transferred to author and co-authors of the content, if they are specified. Fees are paid by the "from" account.

    Parameters

    • credentials: Credentials

      account credentials

    • id: ChainObject

      content id

    • amount: AssetAmount

      amount to send with asset type

    • Optional memo: undefined | string

      optional unencrypted message

    • 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<TransferOperation>

    a transfer operation

createUpdateContentOperation

  • Create request to update content operation. Update parameters are functions that have current values as arguments.

    Parameters

    • content: ChainObject | string

      content id or uri

    • 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<AddOrUpdateContentOperation>

findAll

  • Search for term in contents (author, title and description).

    Parameters

    • term: string

      search term

    • Default value user: string = ""

      content owner account name

    • Default value regionCode: string = REGION_NAMES[Regions.All]

      two letter region code, defined in [Regions]

    • Default value type: string = contentType(ApplicationType.DecentCore, CategoryType.None)

      the application and content type to be filtered, use contentType method

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

      the id of content object to start searching from

    • Default value order: SearchContentOrder = SearchContentOrder.CreatedDesc

      ordering field. Available options are defined in SearchContentOrder

    • Default value limit: number = 100

      maximum number of contents to fetch (must not exceed 100)

    Returns Promise<ContentSummary[]>

    the contents found

generateKeys

  • Generate keys for new content submission.

    Parameters

    Returns Promise<ContentKeys>

    generated key and key parts

get

  • Get content

    Parameters

    • content: ChainObject | string

      uri of the content or object id of the content, 2.13.*

    Returns Promise<Content>

    a content if found, ObjectNotFoundError otherwise

getAll

  • Get all content by ids

    Parameters

    • contentIds: ChainObject[]

      object id of the content, 2.13.*

    Returns Promise<Content[]>

    the contents

listAllPublishersRelative

  • listAllPublishersRelative(lowerBound: string, limit?: number): Promise<ChainObject[]>
  • Get a list of accounts holding publishing manager status.

    Parameters

    • lowerBound: string

      the name of the first account to return. If the named account does not exist, the list will start at the account that comes after lowerbound

    • Default value limit: number = 100

      the maximum number of accounts to return (max: 100)

    Returns Promise<ChainObject[]>

    a list of publishing managers

purchase

  • Purchase a content.

    Parameters

    • credentials: Credentials

      account credentials

    • content: ChainObject | string

      uri of the content or object id of the content, 2.13.*

    • 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 transaction confirmation

remove

  • Remove content. Sets expiration to head block time, so the content cannot be purchased, but remains in database.

    Parameters

    • credentials: Credentials

      author credentials

    • content: ChainObject | string

      content id or uri

    • 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>

transfer

  • Transfers an amount of one asset to content. Amount is transferred to author and co-authors of the content, if they are specified. Fees are paid by the "from" account.

    Parameters

    • credentials: Credentials

      account credentials

    • id: ChainObject

      content id

    • amount: AssetAmount

      amount to send with asset type

    • Optional memo: undefined | string

      optional unencrypted message

    • 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 transaction confirmation

update

  • Update content. Update parameters are functions that have current values as arguments.

    Parameters

    • credentials: Credentials

      author credentials

    • content: ChainObject | string

      content id or uri

    • Optional synopsis: Synopsis

      JSON formatted structure containing content information

    • Optional price: RegionalPrice[]

      list of regional prices

    • Optional coAuthors: Array<[ChainObject, number]>

      if map is not empty, payout will be split - the parameter maps co-authors to basis points split, e.g. author1:9000 (bp), author2:1000 (bp)

    • 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>

Generated using TypeDoc