bothy-sdk
    Preparing search index...

    Function update

    • Disables, reactivates or changes an own component (updateComponent).

      If-Match carries version; a stale one is 412 version_conflict with the current component in current. used and expired are final, active -> disabled is allowed, disabled -> active only before expires_at (09 11.4). A new definition follows 09 11.1 for the component's type, for example the definition of a builder of this module; the server checks it. Type, custom ID and the access members cannot change.

      Parameters

      • api: InteractionClient

        An openapi-fetch client of the public API.

      • componentId: string

        The component (Interaction.component_id or a Component.id).

      • version: number

        The component version the change is based on, a positive integer.

      • change: {}

        state and/or definition.

      • options: UpdateOptions = {}

        The Idempotency-Key.

      Returns Promise<{}>

      The component as the server stored it.

      RangeError before sending for a version that is not a positive integer, a member outside ComponentUpdate, a state outside UPDATE_STATES or a definition that is not an object; ProblemError when the server refuses.

      const interaction = await respond(api, interactionId, "acknowledged");
      await update(api, interaction.component_id, 1, { state: "disabled" });