Skip to content

ComputePricing ​

Overview ​

Available Operations ​

  • getPricing - Get the latest committed storage price
  • putPricing - Create an immutable storage-price version

getPricing ​

The latest version may be scheduled for the next UTC hour. Before the first version is written this route returns pricing_not_configured.

Example Usage ​

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.computePricing.getPricing({});

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { computePricingGetPricing } from "@meetkai/mka1/funcs/computePricingGetPricing.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await computePricingGetPricing(sdk, {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("computePricingGetPricing failed:", res.error);
  }
}

run();

React hooks and utilities ​

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useComputePricingGetPricing,
  useComputePricingGetPricingSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchComputePricingGetPricing,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateComputePricingGetPricing,
  invalidateAllComputePricingGetPricing,
} from "@meetkai/mka1/react-query/computePricingGetPricing.js";

Parameters ​

ParameterTypeRequiredDescription
requestoperations.GetPricingRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<operations.GetPricingResponse>

Errors ​

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*

putPricing ​

Cluster administrators only. If-Match: 0 performs the explicit bootstrap. Every version activates at the next UTC-hour boundary; equivalent idempotent replay precedes version comparison.

Example Usage ​

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.computePricing.putPricing({
    idempotencyKey: "<value>",
    ifMatch: "<value>",
    computePricingUpdate: {
      volumeStorageUsdPerGibHour: 6479.35,
    },
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { computePricingPutPricing } from "@meetkai/mka1/funcs/computePricingPutPricing.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await computePricingPutPricing(sdk, {
    idempotencyKey: "<value>",
    ifMatch: "<value>",
    computePricingUpdate: {
      volumeStorageUsdPerGibHour: 6479.35,
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("computePricingPutPricing failed:", res.error);
  }
}

run();

React hooks and utilities ​

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useComputePricingPutPricingMutation
} from "@meetkai/mka1/react-query/computePricingPutPricing.js";

Parameters ​

ParameterTypeRequiredDescription
requestoperations.PutPricingRequest✔️The request object to use for the request.
optionsRequestOptions➖Used to set various options for making HTTP requests.
options.fetchOptionsRequestInit➖Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfig➖Enables retrying HTTP requests under certain failure conditions.

Response ​

Promise<operations.PutPricingResponse>

Errors ​

Error TypeStatus CodeContent Type
errors.APIError4XX, 5XX*/*