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

    Class Request<TReq, TRes>

    Runs one unary SDK request and exposes its result and diagnostics.

    Generated service methods return this object. You can await the object directly because it implements PromiseLike, or you can await Request.result. Keep the object when you also need metadata, status, request IDs, or cancellation.

    The runtime adds authorization metadata when a provider exists. It adds one idempotency key to mutating methods and reuses that key for every retry. For update methods, it can also create an x-resetmask header from the request.

    import {
    BucketService,
    GetBucketRequest,
    } from '@nebius/js-sdk/api/nebius/storage/v1/index';

    async function inspectRequest(client: BucketService) {
    const call = client.get(GetBucketRequest.create({ id: 'bucket-id' }));
    try {
    const resource = await call;
    const status = await call.status;
    console.log(resource, status.code);
    } catch (error) {
    console.error('request failed', error);
    }
    }

    Type Parameters

    • TReq

      The generated request message type.

    • TRes

      The generated response type.

    Implements

    Indexable

    • [key: symbol]: (() => string) | (() => Record<string, unknown>)

      Runs one unary SDK request and exposes its result and diagnostics.

      Generated service methods return this object. You can await the object directly because it implements PromiseLike, or you can await Request.result. Keep the object when you also need metadata, status, request IDs, or cancellation.

      The runtime adds authorization metadata when a provider exists. It adds one idempotency key to mutating methods and reuses that key for every retry. For update methods, it can also create an x-resetmask header from the request.

      • () => string
          • (): string
          • Formats the current request state for Node.js inspection.

            Returns string

      • () => Record<string, unknown>
          • (): Record<string, unknown>
          • Returns a JSON-safe value for logs.

            Returns Record<string, unknown>

    Index
    • Creates and starts a request.

      Generated service clients call this constructor. Construction starts authorization and the gRPC call without waiting for the result.

      Type Parameters

      • TReq

        The generated request message type.

      • TRes

        The generated response type.

      Parameters

      • sdk: SDKInterface
      • spec: RequestSpec<TReq>
      • addr: string
      • deserializer: (value: Buffer) => TRes
          • (value: Buffer): TRes
          • Creates and starts a request.

            Generated service clients call this constructor. Construction starts authorization and the gRPC call without waiting for the result.

            Parameters

            • value: Buffer

            Returns TRes

      • request: TReq
      • requestMetadata: Metadata | undefined
      • OptionalrequestOptions: Partial<CallOptions> & RetryOptions

      Returns Request<TReq, TRes>

    $type: "nebius.sdk.Request" = 'nebius.sdk.Request'

    Contains the fully qualified runtime type name.

    initialMetadata: Promise<Metadata>

    Resolves with the response headers when gRPC reports them.

    requestId: Promise<string>

    Resolves with x-request-id when the server returns that header.

    Do not await this promise as a completion signal. It stays pending when the server does not return the header.

    result: Promise<TRes>

    Resolves with the response, or rejects with the final request error.

    status: Promise<Status>

    Resolves with the final Google RPC status for success or failure.

    traceId: Promise<string>

    Resolves with x-trace-id when the server returns that header.

    Do not await this promise as a completion signal. It stays pending when the server does not return the header.

    trailingMetadata: Promise<Metadata>

    Resolves with the response trailers when gRPC reports them.

    • Returns a JSON-safe value for logs.

      Returns Record<string, unknown>

    • Cancels active gRPC calls and prevents later retries.

      Cancellation is safe to call more than once. The result rejects with a cancellation error after the active call reports cancellation.

      Parameters

      • Optionalreason: string

      Returns void

      import {
      BucketService,
      GetBucketRequest,
      } from '@nebius/js-sdk/api/nebius/storage/v1/index';

      async function getWithLocalTimeout(client: BucketService) {
      const call = client.get(GetBucketRequest.create({ id: 'bucket-id' }));
      const timer = setTimeout(() => call.cancel('local timeout'), 5_000);
      try {
      return await call.result;
      } finally {
      clearTimeout(timer);
      }
      }