Interface TypedFunction<RequestT,ResponseT>

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface TypedFunction<RequestT,ResponseT>
Represents a Cloud Function with a strongly typed interface that is activated by an HTTP request.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Describes how to deserialize request object and serialize response objects for an HTTP invocation.
  • Method Summary

    Modifier and Type
    Method
    Description
    Called to service an incoming HTTP request.
    Called to get the the format object that handles request decoding and response encoding.
  • Method Details

    • apply

      Called to service an incoming HTTP request. This interface is implemented by user code to provide the action for a given HTTP function. If this method throws any exception (including any Error) then the HTTP response will have a 500 status code.
      Parameters:
      arg - the payload of the event, deserialized from the original JSON string.
      Returns:
      invocation result or null to indicate the body of the response should be empty.
      Throws:
      Exception - to produce a 500 status code in the HTTP response.
    • getWireFormat

      Called to get the the format object that handles request decoding and response encoding. If null is returned a default JSON format is used.
      Returns:
      the TypedFunction.WireFormat to use for serialization