jmap-kit
    Preparing search index...
    Index

    Constructors

    Accessors

    • get createdIds(): Readonly<Record<string, string>> | null

      Get the map of created IDs that are included in this request

      Returns Readonly<Record<string, string>> | null

    Methods

    • Add a method call to the request. All methods must be unique. If the method already exists in the request, it will not be added again.

      Parameters

      Returns this

      The invocation builder instance to allow for method chaining

      Error if the method's capability is not registered with the client

      Error if adding this method would exceed the server's maxCallsInRequest limit

      AggregateError if the invocation validation fails

    • Add the map of client specified creation IDs to server assigned IDs, to be included in the request.

      This may be invoked with an empty object to initialise the createdIds for the first request, or with a map of client-specified creation IDs to the server-assigned IDs that were obtained from a previous response.

      Parameters

      • createdIds: IdMap

        The map of client-specified creation IDs to the server assigned IDs

      Returns this

      The invocation builder instance to allow for method chaining

    • Build the JMAP request object from the current state of the builder.

      This will generate unique IDs for each method call, and resolve any client-specified creation IDs to server-assigned IDs if they were provided.

      Parameters

      • idPrefix: string = ID_PREFIX

        The prefix to use for generated IDs (default is "id_")

      Returns JMAPRequest

      The constructed JMAP request object

      AggregateError if the pre-build validation fails

    • Reset the map of creation ids to remove any that had been previously added. After invoking this, the createdIds property will will be omitted from the request.

      Returns this

    • Send this request to the JMAP server using the associated client.

      Parameters

      • Optionalsignal: AbortSignal

        Optional AbortSignal to cancel the request.

      Returns Promise<
          {
              createdIds: IdMap;
              methodResponses: InvocationList<BaseInvocationArgs>;
              sessionState: string;
          },
      >

      The parsed response from the server.

    • Serialise the request for sending as a request body. By default, returns a JSON string, but can be extended to support other formats.

      Returns Promise<{ body: string | Blob | ArrayBuffer | File; headers: Headers }>

      The serialised request (string, Blob, ArrayBuffer, etc.)

      AggregateError if the pre-serialization validation fails

      AggregateError if the post-serialization validation fails