Skip to content

Session ​

Overview ​

Available Operations ​

getPendingInvitation ​

Requires a session with a verified email. Returns a pending, unexpired organization invitation first, otherwise an unclaimed, unexpired cluster invitation bound to that email. Open cluster invitations are never returned. Does not accept or modify the invitation.

Example Usage ​

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

const sdk = new SDK();

async function run() {
  const result = await sdk.session.getPendingInvitation({
    sessionCookie: "<YOUR_API_KEY_HERE>",
  }, {});

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await sessionGetPendingInvitation(sdk, {
    sessionCookie: "<YOUR_API_KEY_HERE>",
  }, {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sessionGetPendingInvitation 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.
  useSessionGetPendingInvitation,
  useSessionGetPendingInvitationSuspense,

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

Parameters ​

ParameterTypeRequiredDescription
requestoperations.GetPendingInvitationRequest✔️The request object to use for the request.
securityoperations.GetPendingInvitationSecurity✔️The security requirements 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.GetPendingInvitationResponseBody>

Errors ​

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

exchangeSessionToken ​

Mints a short-lived, audience-bound token with the same authority as the current live browser or device-login session. Identity, tenancy, permissions, and lifetime cannot be selected by the caller. The JSON body is limited to 4 KiB.

Example Usage ​

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

const sdk = new SDK();

async function run() {
  const result = await sdk.session.exchangeSessionToken({
    sessionCookie: "<YOUR_API_KEY_HERE>",
  }, {
    requestBody: {
      audience: "https://apigw.mka1.com",
    },
  });

  console.log(result);
}

run();

Standalone function ​

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await sessionExchangeSessionToken(sdk, {
    sessionCookie: "<YOUR_API_KEY_HERE>",
  }, {
    requestBody: {
      audience: "https://apigw.mka1.com",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("sessionExchangeSessionToken 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.
  useSessionExchangeSessionTokenMutation
} from "@meetkai/mka1/react-query/sessionExchangeSessionToken.js";

Parameters ​

ParameterTypeRequiredDescription
requestoperations.ExchangeSessionTokenRequest✔️The request object to use for the request.
securityoperations.ExchangeSessionTokenSecurity✔️The security requirements 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.ExchangeSessionTokenResponse>

Errors ​

Error TypeStatus CodeContent Type
errors.ExchangeSessionTokenResponseBody400application/json
errors.ExchangeSessionTokenSessionResponseBody401application/json
errors.ExchangeSessionTokenSessionResponseResponseBody403application/json
errors.ExchangeSessionTokenSessionResponse413ResponseBody413application/json
errors.ExchangeSessionTokenSessionResponse429ResponseBody429application/json
errors.ExchangeSessionTokenSessionResponse500ResponseBody500application/json
errors.APIError4XX, 5XX*/*