AniLink - v2.0.0
    Preparing search index...

    Function sendRequest

    • Sends a request to the specified URL.

      This is the provider-agnostic transport entry point. GraphQL callers get envelope unwrapping by leaving contentType unset; REST callers pass an explicit contentType (for example application/json) and receive the parsed body verbatim.

      Type Parameters

      • T = unknown

      Parameters

      • url: string

        The URL to send the request to.

      • method: HttpMethod

        The HTTP method to use ('GET', 'POST', 'PUT', or 'DELETE').

      • Optionaldata: object

        The data to send with the request.

      • Optionalauth: RequestAuthInput

        The authentication material to include in the request headers. A string is treated as a bearer token for backwards compatibility.

      • ...requestOptions: [
            requiresAuth?: boolean,
            options?: RequestOptions,
            operation?: string,
            contentType?: string,
        ]

        Optional positional transport arguments: requiresAuth (whether the operation requires an authentication token), options (per-request RequestOptions; when omitted, library defaults apply — 30 second timeout, automatic retries under the default policy, no hooks), operation (optional operation name included in missing-token auth errors), and contentType (optional Content-Type override for non-GraphQL endpoints — for example form-urlencoded OAuth token requests, or application/json for REST calls — which also returns the parsed body verbatim instead of unwrapping a GraphQL envelope).

      Returns Promise<T>

      The unwrapped response data. For documents with a single root field this is the bare field value; multi-root-field (or zero-root-field) documents are returned as the full { data } envelope unchanged. Use unwrapGraphQLResponse for the tolerant rule or unwrapSingleRootField when a caller needs the strict single-root-field result (undefined signals the document did not match). With a contentType override, the parsed response body is returned as-is.

      AniLinkAuthError when authentication is required but no auth material is configured.

      AniLinkApiError for an upstream HTTP failure.

      AniLinkGraphQLError for GraphQL errors in an HTTP 200 envelope.

      AniLinkNetworkError for network, timeout, cancellation, or circuit-breaker failures.