ContentApi
public protocol ContentApi : BaseApi
Undocumented
-
get(byId:)Default implementationGet content by id.
Throws
DCoreException.Network.notFoundif account does not exist.Default Implementation
Declaration
Swift
func get(byId id: ObjectIdConvertible) -> Single<Content>Parameters
idContent id, eg. 2.13.*, as
ContentObjectIdorStringformat.Return Value
-
get(byUrl:)Default implementationGet content by url.
Throws
DCoreException.Network.notFoundif content does not exist.Default Implementation
Declaration
Swift
func get(byUrl url: URLConvertible) -> Single<Content>Parameters
urlContent uri, as
URLorStringformat.Return Value
-
get(byReference:)Default implementationGet content by reference (id or URL in String format).
Throws
DCoreException.Network.notFoundif content does not exist.Default Implementation
Parameters
refReference (id or URL in String format).
Return Value
-
exist(byUrl:)Default implementationCheck if content exist by url.
Throws
DCoreException.Network.notFoundif account does not exist.Default Implementation
Declaration
Swift
func exist(byUrl url: URLConvertible) -> Single<Bool>Parameters
urlContent uri, as
URLorStringformat.Return Value
trueif content exist. -
findAll(by:order:author:regionCode:type:startId:limit:)Default implementationUndocumented
Default Implementation
Undocumented
Declaration
Swift
func findAll(by expression: String, order: SearchOrder.Content, author: Account.Reference, regionCode: String, type: String, startId id: ObjectIdConvertible, limit: Int) -> Single<[Content]> -
findAllPublishersRelative(byLower:limit:)Default implementationGet a list of accounts holding publishing manager status.
Default Implementation
Declaration
Swift
func findAllPublishersRelative(byLower bound: String, limit: Int) -> Single<[AccountObjectId]>Parameters
boundName of the first account to return. If the named account does not exist, the list will start at the account that comes after lowerbound.
limitMaximum number of accounts to return, max/default
100.Return Value
Array
[AccountObjectId]of publishing managers. -
generateKeys(forSeeders:)Default implementationGenerate keys for new content submission.
Default Implementation
Declaration
Swift
func generateKeys(forSeeders ids: [AccountObjectIdConvertible]) -> Single<ContentKeys>Parameters
idsList of seeder account ids.
Return Value
Generated key and key parts.
-
restoreKey(byElGamal:purchaseId:)Default implementationRestores encryption key from key parts stored in buying object.
Default Implementation
Declaration
Swift
func restoreKey(byElGamal privateKey: PubKey, purchaseId id: ObjectIdConvertible) -> Single<String>Parameters
privateKeyPrivate El Gamal key.
idId of purchase object
Return Value
AES encryption key.
-
create(on:author:publishingFee:fee:)Default implementationCreate content.
Throws
DCoreException.Network.alreadyFoundif content with given uri already exist.Default Implementation
Declaration
Swift
func create<Input>(on content: SubmitContent<Input>, author: Credentials, publishingFee: AssetAmount, fee: AssetAmount) -> Single<TransactionConfirmation> where Input : SynopsisConvertibleParameters
contentSubmitContent object.
authorCredentials of account which will pay operation fee, will owner of content.
publishingFeeAssetAmountfee, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat content was created. -
update(on:synopsis:price:coAuthors:credentials:fee:)Default implementationUpdate content.
Throws
DCoreException.Network.notFoundif content with given reference does not exist.Default Implementation
Declaration
Swift
func update<Input>(on reference: Content.Reference, synopsis: Input?, price: AssetAmount?, coAuthors: [Pair<AccountObjectId, Int>]?, credentials: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation> where Input : SynopsisConvertibleParameters
referenceContent reference (id or uri) of object to update.
synopsisUpdated synopsis.
priceUpdated price.
coAuthorsUpdated coauthors.
credentialsCredentials of owner account, which will pay operation fee.
feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat content was updated. -
delete(byReference:author:fee:)Default implementationDelete content by reference (id or uri).
Throws
DCoreException.Network.notFoundif content with given reference does not exist.Default Implementation
Declaration
Swift
func delete(byReference ref: Content.Reference, author: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
refContent reference (id or uri).
authorCredentials of account which will pay operation fee, will owner of content.
feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat content was deleted. -
delete(byId:author:fee:)Default implementationDelete content by id.
Throws
DCoreException.Network.notFoundif content with given id does not exist.Default Implementation
Declaration
Swift
func delete(byId id: ObjectIdConvertible, author: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
idContent id, as
ContentObjectIdorStringformat.authorCredentials of account which will pay operation fee, will owner of content.
feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat content was deleted. -
delete(byUrl:author:fee:)Default implementationDelete content by url (URL or String).
Throws
DCoreException.Network.notFoundif content with given uri does not exist.Default Implementation
Declaration
Swift
func delete(byUrl url: URLConvertible, author: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
urlURL or String.
authorCredentials of account which will pay operation fee, will owner of content.
feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
TransactionConfirmationthat content was deleted. -
createPurchase(byId:consumer:)Default implementationCreate a purchase content operation.
Throws
DCoreException.Network.notFoundif content with given id does not exist.Default Implementation
Declaration
Swift
func createPurchase(byId id: ObjectIdConvertible, consumer: Credentials) -> Single<PurchaseContentOperation>Parameters
idContent id, as
ContentObjectIdorStringformat.consumerAccount credentials.
Return Value
-
createPurchase(byUrl:consumer:)Default implementationCreate a purchase content operation.
Throws
DCoreException.Network.notFoundif content with given id does not exist.Default Implementation
Declaration
Swift
func createPurchase(byUrl url: URLConvertible, consumer: Credentials) -> Single<PurchaseContentOperation>Parameters
urlURL or String.
consumerAccount credentials.
Return Value
-
purchase(byId:consumer:)Default implementationMake a content purchase.
Throws
DCoreException.Network.notFoundif content with given id does not exist.Default Implementation
Declaration
Swift
func purchase(byId id: ObjectIdConvertible, consumer: Credentials) -> Single<TransactionConfirmation>Parameters
idContent id, as
ContentObjectIdorStringformat.consumerAccount credentials.
Return Value
TransactionConfirmationof successfull purchase. -
purchase(byUrl:consumer:)Default implementationMake a content purchase.
Throws
DCoreException.Network.notFoundif content with given url does not exist.Default Implementation
Declaration
Swift
func purchase(byUrl url: URLConvertible, consumer: Credentials) -> Single<TransactionConfirmation>Parameters
urlURL or String.
consumerAccount credentials.
Return Value
TransactionConfirmationof successfull purchase. -
createTransfer(toReference:from:amount:message:fee:)Default implementationCreate recurrent transfers operation to transfer 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
fromaccount.Throws
DCoreException.Network.notFoundif content with given reference does not exist.Default Implementation
Declaration
Swift
func createTransfer(toReference ref: Content.Reference, from consumer: Credentials, amount: AssetAmount, message: String?, fee: AssetAmount) -> Single<TransferOperation>Parameters
refReceiver content reference.
consumerSender account credentials.
amountAssetAmountto send with asset type.messageMessage (Optional).
encryptedIf message present, encrypted is visible only for sender and receiver, unencrypted is visible publicly, default
true.feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
-
transfer(toReference:from:amount:message:fee:)Default implementationMake recurrent transfer 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
fromaccount.Throws
DCoreException.Network.notFoundif content with given reference does not exist.Default Implementation
Declaration
Swift
func transfer(toReference ref: Content.Reference, from consumer: Credentials, amount: AssetAmount, message: String?, fee: AssetAmount) -> Single<TransactionConfirmation>Parameters
refReceiver content reference.
consumerSender account credentials.
amountAssetAmountto send with asset type.messageMessage (Optional).
encryptedIf message present, encrypted is visible only for sender and receiver, unencrypted is visible publicly, default
true.feeAssetAmountfee for the operation, if leftAssetAmount.unsetthe fee will be computed in DCT asset, defaultAssetAmount.unset.Return Value
A transaction confirmation.
View on GitHub
Install in Dash
ContentApi Protocol Reference