Create a Phoenix client.

The client is strongly typed and uses generated openapi types.

import { createClient } from "@arize/phoenix-client";

const client = createClient();

const response = await client.GET("/v1/traces");
// ^ path string is strongly typed, and completion works with autocomplete
// path parameters, query parameters, and request body are also strongly typed based on the openapi spec,
// the path, and the method.
  • Parameters

    • config: {
          getEnvironmentOptions?: () => Partial<ClientOptions>;
          options?: Partial<ClientOptions>;
      } = {}

      The configuration to use for the client.

      • OptionalgetEnvironmentOptions?: () => Partial<ClientOptions>

        The function to use to get the environment options. By default, a function that returns process.env is used.

      • Optionaloptions?: Partial<ClientOptions>

        The options to use for openapi-fetch.createOpenApiClient.

    Returns {
        config: ClientOptions;
        DELETE: ClientMethod<paths, "delete", `${string}/${string}`>;
        GET: ClientMethod<paths, "get", `${string}/${string}`>;
        HEAD: ClientMethod<paths, "head", `${string}/${string}`>;
        OPTIONS: ClientMethod<paths, "options", `${string}/${string}`>;
        PATCH: ClientMethod<paths, "patch", `${string}/${string}`>;
        POST: ClientMethod<paths, "post", `${string}/${string}`>;
        PUT: ClientMethod<paths, "put", `${string}/${string}`>;
        TRACE: ClientMethod<paths, "trace", `${string}/${string}`>;
        eject(...middleware: Middleware[]): void;
        use(...middleware: Middleware[]): void;
    }

    The Phoenix client as a strongly typed openapi-fetch client.

    • config: ClientOptions
    • DELETE: ClientMethod<paths, "delete", `${string}/${string}`>

      Call a DELETE endpoint

    • GET: ClientMethod<paths, "get", `${string}/${string}`>

      Call a GET endpoint

    • HEAD: ClientMethod<paths, "head", `${string}/${string}`>

      Call a HEAD endpoint

    • OPTIONS: ClientMethod<paths, "options", `${string}/${string}`>

      Call a OPTIONS endpoint

    • PATCH: ClientMethod<paths, "patch", `${string}/${string}`>

      Call a PATCH endpoint

    • POST: ClientMethod<paths, "post", `${string}/${string}`>

      Call a POST endpoint

    • PUT: ClientMethod<paths, "put", `${string}/${string}`>

      Call a PUT endpoint

    • TRACE: ClientMethod<paths, "trace", `${string}/${string}`>

      Call a TRACE endpoint

    • eject:function
      • Unregister middleware

        Parameters

        • ...middleware: Middleware[]

        Returns void

    • use:function
      • Register middleware

        Parameters

        • ...middleware: Middleware[]

        Returns void