nextspace
    Preparing search index...

    Class Api

    Singleton class to manage API tokens.

    Token storage now delegates to TokenManager so there is a single source of truth for token state. The Api class is kept for backward compatibility but thin-wraps TokenManager for all token operations.

    Index

    Methods

    • Clears all regular (non-admin) tokens from TokenManager.

      Returns void

    • Returns the current access token. Always call this at point-of-use so you get the live value from the singleton rather than a value captured at render/effect time that may have gone stale after a token refresh.

      Returns string

    • Returns Promise<
          {
              availablePlatforms: { label?: string; name: string }[];
              conversationBotName: string;
              conversationTypes: {
                  adapters?: {
                      [key: string]: {
                          audioChannels?: {
                              agent?: (...) | (...);
                              config?: (...) | (...);
                              direct?: (...) | (...) | (...);
                              direction: (...) | (...) | (...);
                              name?: (...) | (...);
                          }[];
                          chatChannels?: {
                              agent?: (...)
                              | (...);
                              config?: (...) | (...);
                              direct?: (...) | (...) | (...);
                              direction: (...) | (...) | (...);
                              name?: (...) | (...);
                          }[];
                          config?: { [key: string]: unknown };
                          dmChannels?: {
                              agent?: (...) | (...);
                              config?: (...) | (...);
                              direct?: (...) | (...) | (...);
                              direction: (...) | (...) | (...);
                              name?: (...) | (...);
                          }[];
                          type: string;
                      };
                  };
                  agents?: {
                      name: string;
                      properties?: (
                          | {
                              default?: ...;
                              description?: ...;
                              itemKey?: ...;
                              label?: ...;
                              name: ...;
                              options?: ...;
                              required: ...;
                              schema?: ...;
                              type: ...;
                              validationKeys?: ...;
                          }
                          | { $ref: ... }
                      )[];
                  }[];
                  channels?: { direct?: boolean; name: string; passcode?: string
                  | null }[];
                  description: string;
                  enableDMs?: string[];
                  features?: {
                      agents: { name: string }[];
                      default: boolean;
                      description?: string;
                      label: string;
                      name: string;
                      properties?: {
                          default?: (...) | (...) | (...) | (...) | (...) | (...);
                          description?: (...) | (...);
                          itemKey?: (...) | (...);
                          label?: (...) | (...);
                          name: string;
                          options?: (...) | (...);
                          required: boolean;
                          schema?: (...) | (...);
                          type: (...) | (...) | (...) | (...) | (...);
                          validationKeys?: (...) | (...);
                      }[];
                  }[];
                  label?: string;
                  name: string;
                  platforms: { label?: string; name: string }[];
                  properties: {
                      default?: string | number | boolean | Record<string, never>;
                      description?: string;
                      itemKey?: string;
                      label?: string;
                      name: string;
                      options?: Record<string, never>[];
                      required: boolean;
                      schema?: Record<string, never>[];
                      type: "string" | "number" | "boolean" | "object" | "enum";
                      validationKeys?: string[];
                  }[];
              }[];
              supportedModels: {
                  defaultModelOptions?: { [key: string]: unknown };
                  description: string;
                  label: string;
                  llmModel: string;
                  llmPlatform: string;
                  name: string;
              }[];
          },
      >

    • Returns { access, refresh } token strings for backward compatibility. The authoritative store is TokenManager.

      Returns ApiTokens

    • Returns true if the user has a valid access token (via TokenManager).

      Returns boolean

    • Store access + refresh tokens. Delegates to TokenManager so that expiry-based proactive refresh, cross-tab sync, and deduplication all work automatically.

      Parameters

      • access: string

        Raw access token string.

      • refresh: string

        Raw refresh token string.

      • OptionalaccessExpires: string

        Optional ISO-8601 expiry for the access token.

      • OptionalrefreshExpires: string

        Optional ISO-8601 expiry for the refresh token.

      Returns void