@nebius/js-sdk - v0.2.54
    Preparing search index...

    Class SDK

    Creates service clients and owns shared SDK resources.

    Pass the SDK to a generated service client. A generated client creates a Request when you call a service method. The SDK reuses one gRPC channel for each resolved address and applies credentials to each request.

    Set SDKOptions.userAgentPrefix to your application name and version. Create one SDK for the lifetime of an application, and call SDK.close during shutdown.

    import { SDK } from '@nebius/js-sdk';
    import { EnvBearer } from '@nebius/js-sdk/runtime/token/static';

    const sdk = new SDK({
    credentials: new EnvBearer('NEBIUS_IAM_TOKEN'),
    userAgentPrefix: 'example-application/1.0',
    });
    try {
    console.log(await sdk.whoami());
    } finally {
    await sdk.close();
    }

    Implements

    Index
    • Creates an SDK with the selected credentials and connection settings.

      Construction reads a supplied configuration reader and prepares TLS settings. It does not send an API request. Some credential types defer network access until the first authenticated request.

      Parameters

      Returns SDK

      A supplied configuration reader can throw when its configuration is invalid.

    • Adds interceptors to clients that the SDK creates later.

      This method does not modify clients that are already in the shared client cache.

      Parameters

      • ...ints: Interceptor[]

      Returns void

    • Closes the authorization provider and all shared gRPC channels.

      The default grace period is 20 seconds. After that period, this method returns even if a close watcher has not completed. Do not start new requests after calling this method.

      Parameters

      • OptionalgraceMs: number

      Returns Promise<void>

      try {
      await sdk.whoami();
      } finally {
      await sdk.close();
      }
    • Returns per-address channel credentials when set, or the SDK default.

      Parameters

      • address: string

      Returns ChannelCredentials

    • Resolves a service name to a gRPC address.

      Parameters

      • serviceName: string
      • OptionalapiServiceName: string

      Returns string

    • Returns the combined gRPC options for an address.

      The result contains keepalive settings and the SDK user-agent. Per-address options override global options. Global interceptors run before per-address interceptors.

      Parameters

      • address: string

      Returns Partial<ClientOptions>

    • Returns a shared gRPC client for an address.

      The first call creates the client. Later calls with the same address return the same object. Changes from addInterceptors or setClientOptions do not affect an existing client.

      Parameters

      • address: string

      Returns Client

    • Returns the TLS root certificates for HTTP and gRPC calls.

      Credential helpers use this value so that their HTTP calls trust the same roots as SDK gRPC calls. Do not modify a returned buffer.

      Returns string | string[] | Buffer<ArrayBufferLike> | undefined

    • Replaces the authorization provider for new requests.

      The change does not restart a request that is already running. Pass undefined to disable authorization for later requests.

      Parameters

      Returns void

    • Replaces the default gRPC client options for clients created later.

      This method does not modify clients that already exist.

      Parameters

      • opts: Partial<ClientOptions> | undefined

      Returns void

    • Uses a token bearer as the authorization provider for new requests.

      The SDK also connects the bearer to the configured authorization metrics.

      Parameters

      Returns void