AniLink - v1.29.2
    Preparing search index...

    Function unwrapGraphQLResponse

    • Unwraps the single root field of a GraphQL response envelope.

      The AniList API returns every operation's result inside a { data } envelope. For operations whose selection set has exactly one root field (for example User, Media, or MediaListCollection), this helper returns the bare field value. For responses with multiple root fields, or responses without a data object (for example GraphQL errors), the full envelope is returned unchanged.

      Type Parameters

      • T

      Parameters

      • response: unknown

        The full GraphQL response envelope.

      Returns T

      The unwrapped single-root-field value, or the envelope as-is.