Skip to content

IETSTarget

Overview

License: MIT

interface IETSTarget

Structs info

Target

struct Target {
	string targetURI;
	address createdBy;
	uint256 enriched;
	uint256 httpStatus;
	string ipfsHash;
}

Events info

AccessControlsSet

event AccessControlsSet(address etsAccessControls)

emitted when the ETSAccessControls is set.

Parameters:

NameTypeDescription
etsAccessControlsaddresscontract address ETSAccessControls is set to.

EnrichTargetSet

event EnrichTargetSet(address etsEnrichTarget)

emitted when the ETSEnrichTarget API address is set.

Parameters:

NameTypeDescription
etsEnrichTargetaddresscontract address ETSEnrichTarget is set to.

TargetCreated

event TargetCreated(uint256 targetId)

emitted when a new Target is created.

Parameters:

NameTypeDescription
targetIduint256Unique Id of new Target.

TargetUpdated

event TargetUpdated(uint256 targetId)

emitted when an existing Target is updated.

Parameters:

NameTypeDescription
targetIduint256Id of Target being updated.

Functions info

setEnrichTarget (0xf0496c86)

function setEnrichTarget(address _etsEnrichTarget) external

Sets ETSEnrichTarget contract address so that Target metadata enrichment functions can be called from ETSTarget.

Parameters:

NameTypeDescription
_etsEnrichTargetaddressAddress of ETSEnrichTarget contract.

getOrCreateTargetId (0xcf99c815)

function getOrCreateTargetId(
    string memory _targetURI
) external returns (uint256)

Get ETS targetId from URI.

Combo function that given a URI string will return it's ETS targetId if it exists, or create a new Target record and return corresponding targetId.

Parameters:

NameTypeDescription
_targetURIstringURI passed in as string

Return values:

NameTypeDescription
[0]uint256Id of ETS Target record

createTarget (0x31bb0c69)

function createTarget(
    string memory _targetURI
) external returns (uint256 targetId)

Create a Target record and return it's targetId.

Parameters:

NameTypeDescription
_targetURIstringURI passed in as string

Return values:

NameTypeDescription
targetIduint256Id of ETS Target record

updateTarget (0x7ab3f1cd)

function updateTarget(
    uint256 _targetId,
    string calldata _targetURI,
    uint256 _enriched,
    uint256 _httpStatus,
    string calldata _ipfsHash
) external returns (bool success)

Update a Target record.

Parameters:

NameTypeDescription
_targetIduint256Id of Target being updated.
_targetURIstringUnique resource identifier Target points to.
_enricheduint256block timestamp when Target was last enriched
_httpStatusuint256https status of last response from ETSEnrichTarget API eg. "404", "200". defaults to 0
_ipfsHashstringipfsHash of additional metadata for Target collected by ETSEnrichTarget API

Return values:

NameTypeDescription
successbooltrue when Target is successfully updated.

computeTargetId (0x23c7e9f3)

function computeTargetId(
    string memory _targetURI
) external view returns (uint256 targetId)

Function to deterministically compute & return a targetId.

Every Target in ETS is mapped to by it's targetId. This Id is computed from the target URI sting hashed and cast as a uint256.

Note: Function does not verify if Target record exists.

Parameters:

NameTypeDescription
_targetURIstringUnique resource identifier Target record points to.

Return values:

NameTypeDescription
targetIduint256Id of the potential Target record.

targetExistsByURI (0x0c48789c)

function targetExistsByURI(
    string memory _targetURI
) external view returns (bool)

Check that a Target record exists for a given URI string.

Parameters:

NameTypeDescription
_targetURIstringUnique resource identifier Target record points to.

Return values:

NameTypeDescription
[0]booltrue if Target record exists; false if not.

targetExistsById (0xcd7c68e2)

function targetExistsById(uint256 _targetId) external view returns (bool)

Check that a Target record exists for a given computed targetId.

Parameters:

NameTypeDescription
_targetIduint256targetId uint computed from URI via computeTargetId().

Return values:

NameTypeDescription
[0]booltrue if Target record exists; false if not.

getTargetByURI (0x794e75fc)

function getTargetByURI(
    string memory _targetURI
) external view returns (IETSTarget.Target memory)

Retrieve a Target record for a given URI string.

Note: returns a struct with empty members when no Target exists.

Parameters:

NameTypeDescription
_targetURIstringUnique resource identifier Target record points to.

Return values:

NameTypeDescription
[0]struct IETSTarget.TargetTarget record.

getTargetById (0x1b2d87c3)

function getTargetById(
    uint256 _targetId
) external view returns (IETSTarget.Target memory)

Retrieve a Target record for a computed targetId.

Note: returns a struct with empty members when no Target exists.

Parameters:

NameTypeDescription
_targetIduint256targetId uint computed from URI via computeTargetId().

Return values:

NameTypeDescription
[0]struct IETSTarget.TargetTarget record.