Gordian Envelope TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Class Request

    A Request represents a message requesting execution of a function with parameters.

    import { Request, ARID } from '@bcts/envelope';

    // Create a random request ID
    const requestId = ARID.new();

    // Create a request to execute a function with parameters
    const request = Request.new("getBalance", requestId)
    .withParameter("account", "alice")
    .withParameter("currency", "USD")
    .withNote("Monthly balance check");

    // Convert to an envelope
    const envelope = request.toEnvelope();

    Implements

    Index

    Methods

    • Creates a new request with a function and ID.

      This is a convenience method that creates an expression from the function and then creates a request with that expression.

      Parameters

      • func: string | number | Function
      • id: ARID

      Returns Request