ContentApi
public protocol ContentApi : BaseApi
Undocumented
-
get(byId:)
Default implementationGet content by id.
Throws
DCoreException.Network.notFound
if account does not exist.Default Implementation
Declaration
Swift
func get(byId id: ObjectIdConvertible) -> Single<Content>
Parameters
id
Content id, eg. 2.13.*, as
ContentObjectId
orString
format.Return Value
-
get(byUrl:)
Default implementationGet content by url.
Throws
DCoreException.Network.notFound
if content does not exist.Default Implementation
Declaration
Swift
func get(byUrl url: URLConvertible) -> Single<Content>
Parameters
url
Content uri, as
URL
orString
format.Return Value
-
get(byReference:)
Default implementationGet content by reference (id or URL in String format).
Throws
DCoreException.Network.notFound
if content does not exist.Default Implementation
Parameters
ref
Reference (id or URL in String format).
Return Value
-
exist(byUrl:)
Default implementationCheck if content exist by url.
Throws
DCoreException.Network.notFound
if account does not exist.Default Implementation
Declaration
Swift
func exist(byUrl url: URLConvertible) -> Single<Bool>
Parameters
url
Content uri, as
URL
orString
format.Return Value
true
if 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
bound
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.
limit
Maximum 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
ids
List 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
privateKey
Private El Gamal key.
id
Id of purchase object
Return Value
AES encryption key.
-
create(on:author:publishingFee:fee:)
Default implementationCreate content.
Throws
DCoreException.Network.alreadyFound
if 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 : SynopsisConvertible
Parameters
content
SubmitContent object.
author
Credentials of account which will pay operation fee, will owner of content.
publishingFee
AssetAmount
fee, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.Return Value
TransactionConfirmation
that content was created. -
update(on:synopsis:price:coAuthors:credentials:fee:)
Default implementationUpdate content.
Throws
DCoreException.Network.notFound
if 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 : SynopsisConvertible
Parameters
reference
Content reference (id or uri) of object to update.
synopsis
Updated synopsis.
price
Updated price.
coAuthors
Updated coauthors.
credentials
Credentials of owner account, which will pay operation fee.
fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.Return Value
TransactionConfirmation
that content was updated. -
delete(byReference:author:fee:)
Default implementationDelete content by reference (id or uri).
Throws
DCoreException.Network.notFound
if content with given reference does not exist.Default Implementation
Declaration
Swift
func delete(byReference ref: Content.Reference, author: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation>
Parameters
ref
Content reference (id or uri).
author
Credentials of account which will pay operation fee, will owner of content.
fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.Return Value
TransactionConfirmation
that content was deleted. -
delete(byId:author:fee:)
Default implementationDelete content by id.
Throws
DCoreException.Network.notFound
if content with given id does not exist.Default Implementation
Declaration
Swift
func delete(byId id: ObjectIdConvertible, author: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation>
Parameters
id
Content id, as
ContentObjectId
orString
format.author
Credentials of account which will pay operation fee, will owner of content.
fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.Return Value
TransactionConfirmation
that content was deleted. -
delete(byUrl:author:fee:)
Default implementationDelete content by url (URL or String).
Throws
DCoreException.Network.notFound
if content with given uri does not exist.Default Implementation
Declaration
Swift
func delete(byUrl url: URLConvertible, author: Credentials, fee: AssetAmount) -> Single<TransactionConfirmation>
Parameters
url
URL or String.
author
Credentials of account which will pay operation fee, will owner of content.
fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.Return Value
TransactionConfirmation
that content was deleted. -
createPurchase(byId:consumer:)
Default implementationCreate a purchase content operation.
Throws
DCoreException.Network.notFound
if content with given id does not exist.Default Implementation
Declaration
Swift
func createPurchase(byId id: ObjectIdConvertible, consumer: Credentials) -> Single<PurchaseContentOperation>
Parameters
id
Content id, as
ContentObjectId
orString
format.consumer
Account credentials.
Return Value
-
createPurchase(byUrl:consumer:)
Default implementationCreate a purchase content operation.
Throws
DCoreException.Network.notFound
if content with given id does not exist.Default Implementation
Declaration
Swift
func createPurchase(byUrl url: URLConvertible, consumer: Credentials) -> Single<PurchaseContentOperation>
Parameters
url
URL or String.
consumer
Account credentials.
Return Value
-
purchase(byId:consumer:)
Default implementationMake a content purchase.
Throws
DCoreException.Network.notFound
if content with given id does not exist.Default Implementation
Declaration
Swift
func purchase(byId id: ObjectIdConvertible, consumer: Credentials) -> Single<TransactionConfirmation>
Parameters
id
Content id, as
ContentObjectId
orString
format.consumer
Account credentials.
Return Value
TransactionConfirmation
of successfull purchase. -
purchase(byUrl:consumer:)
Default implementationMake a content purchase.
Throws
DCoreException.Network.notFound
if content with given url does not exist.Default Implementation
Declaration
Swift
func purchase(byUrl url: URLConvertible, consumer: Credentials) -> Single<TransactionConfirmation>
Parameters
url
URL or String.
consumer
Account credentials.
Return Value
TransactionConfirmation
of 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
from
account.Throws
DCoreException.Network.notFound
if 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
ref
Receiver content reference.
consumer
Sender account credentials.
amount
AssetAmount
to send with asset type.message
Message (Optional).
encrypted
If message present, encrypted is visible only for sender and receiver, unencrypted is visible publicly, default
true
.fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the 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
from
account.Throws
DCoreException.Network.notFound
if 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
ref
Receiver content reference.
consumer
Sender account credentials.
amount
AssetAmount
to send with asset type.message
Message (Optional).
encrypted
If message present, encrypted is visible only for sender and receiver, unencrypted is visible publicly, default
true
.fee
AssetAmount
fee for the operation, if leftAssetAmount.unset
the fee will be computed in DCT asset, defaultAssetAmount.unset
.Return Value
A transaction confirmation.