Returns the mean (average) of all the results returned by the provided subtasks and subjobs. Nested tasks or jobs must return a Number.

Input: None

Returns: A numerical result.

Example: Returns the mean numerical result of 3 tasks.

{"meanTask": {"tasks": [{"valueTask": {"value": 10}},{"valueTask": {"value": 20}},{"valueTask": {"value": 30}}]}}

Example: Returns the mean numerical result of 3 jobs.

{"meanTask": {"jobs": [{"tasks": [{"httpTask": {"url": "https://www.binance.com/api/v3/ticker/price?symbol=SOLUSDT"}},{"jsonParseTask": {"path": "$.price"}}]},{"tasks": [{"httpTask": {"url": "https://www.binance.us/api/v3/ticker/price?symbol=SOLUSD"}},{"jsonParseTask": {"path": "$.price"}}]},{"tasks": [{"httpTask": {"url": "https://api-pub.bitfinex.com/v2/tickers?symbols=tSOLUSD"}},{"jsonParseTask": {"path": "$[0][7]"}}]}]}}

Implements

Constructors

  • Constructs a new MeanTask.

    Parameters

    • Optional properties: IMeanTask

      Properties to set

    Returns MeanTask

Properties

jobs: IOracleJob[]

A list of subjobs to process and produce a list of result values.

tasks: ITask[]

A list of subtasks to process and produce a list of result values.

Methods

  • Converts this MeanTask to JSON.

    Returns {
        [k: string]: any;
    }

    JSON object

    • [k: string]: any
  • Creates a new MeanTask instance using the specified properties.

    Parameters

    • Optional properties: IMeanTask

      Properties to set

    Returns MeanTask

    MeanTask instance

  • Decodes a MeanTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    • Optional length: number

      Message length if known beforehand

    Returns MeanTask

    MeanTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Decodes a MeanTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    Returns MeanTask

    MeanTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Encodes the specified MeanTask message. Does not implicitly verify messages.

    Parameters

    • message: IMeanTask

      MeanTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified MeanTask message, length delimited. Does not implicitly verify messages.

    Parameters

    • message: IMeanTask

      MeanTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a MeanTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: {
          [k: string]: any;
      }

      Plain object

      • [k: string]: any

    Returns MeanTask

    MeanTask

  • Gets the default type url for MeanTask

    Parameters

    • Optional typeUrlPrefix: string

      your custom typeUrlPrefix(default "type.googleapis.com")

    Returns string

    The default type url

  • Creates a plain object from a MeanTask message. Also converts values to other types if specified.

    Parameters

    • message: MeanTask

      MeanTask

    • Optional options: IConversionOptions

      Conversion options

    Returns {
        [k: string]: any;
    }

    Plain object

    • [k: string]: any
  • Verifies a MeanTask message.

    Parameters

    • message: {
          [k: string]: any;
      }

      Plain object to verify

      • [k: string]: any

    Returns string

    null if valid, otherwise the reason why it is not