Skip to content

Latest commit

 

History

History
414 lines (311 loc) · 30.6 KB

File metadata and controls

414 lines (311 loc) · 30.6 KB

Microfrontends

Overview

Available Operations

getMicrofrontendsGroups

Get the microfrontends group IDs for a team.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.microfrontends.getMicrofrontendsGroups({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { microfrontendsGetMicrofrontendsGroups } from "@vercel/sdk/funcs/microfrontendsGetMicrofrontendsGroups.js";

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

async function run() {
  const res = await microfrontendsGetMicrofrontendsGroups(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("microfrontendsGetMicrofrontendsGroups failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetMicrofrontendsGroupsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit 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.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetMicrofrontendsGroupsResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getMicrofrontendsInGroup

Get the microfrontends for a given group ID.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.microfrontends.getMicrofrontendsInGroup({
    groupId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { microfrontendsGetMicrofrontendsInGroup } from "@vercel/sdk/funcs/microfrontendsGetMicrofrontendsInGroup.js";

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

async function run() {
  const res = await microfrontendsGetMicrofrontendsInGroup(vercel, {
    groupId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("microfrontendsGetMicrofrontendsInGroup failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetMicrofrontendsInGroupRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit 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.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetMicrofrontendsInGroupResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getMicrofrontendsConfig

Get the microfrontends config for a deployment.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.microfrontends.getMicrofrontendsConfig({
    deploymentId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { microfrontendsGetMicrofrontendsConfig } from "@vercel/sdk/funcs/microfrontendsGetMicrofrontendsConfig.js";

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

async function run() {
  const res = await microfrontendsGetMicrofrontendsConfig(vercel, {
    deploymentId: "<id>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("microfrontendsGetMicrofrontendsConfig failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetMicrofrontendsConfigRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit 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.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetMicrofrontendsConfigResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

getMicrofrontendsConfigForProject

Get the microfrontends config for a project by ID or name.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.microfrontends.getMicrofrontendsConfigForProject({
    projectIdOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { microfrontendsGetMicrofrontendsConfigForProject } from "@vercel/sdk/funcs/microfrontendsGetMicrofrontendsConfigForProject.js";

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

async function run() {
  const res = await microfrontendsGetMicrofrontendsConfigForProject(vercel, {
    projectIdOrName: "<value>",
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("microfrontendsGetMicrofrontendsConfigForProject failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.GetMicrofrontendsConfigForProjectRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit 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.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.GetMicrofrontendsConfigForProjectResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*

createMicrofrontendsGroupWithApplications

Creates a microfrontends group and attaches multiple projects in a single request.

Example Usage

import { Vercel } from "@vercel/sdk";

const vercel = new Vercel({
  bearerToken: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await vercel.microfrontends.createMicrofrontendsGroupWithApplications({
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      groupName: "MFE Group 1",
      defaultApp: {
        projectId: "<id>",
      },
      otherApplications: [
        {
          projectId: "<id>",
        },
      ],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { VercelCore } from "@vercel/sdk/core.js";
import { microfrontendsCreateMicrofrontendsGroupWithApplications } from "@vercel/sdk/funcs/microfrontendsCreateMicrofrontendsGroupWithApplications.js";

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

async function run() {
  const res = await microfrontendsCreateMicrofrontendsGroupWithApplications(vercel, {
    teamId: "team_1a2b3c4d5e6f7g8h9i0j1k2l",
    slug: "my-team-url-slug",
    requestBody: {
      groupName: "MFE Group 1",
      defaultApp: {
        projectId: "<id>",
      },
      otherApplications: [
        {
          projectId: "<id>",
        },
      ],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("microfrontendsCreateMicrofrontendsGroupWithApplications failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request models.CreateMicrofrontendsGroupWithApplicationsRequest ✔️ The request object to use for the request.
options RequestOptions Used to set various options for making HTTP requests.
options.fetchOptions RequestInit 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.retries RetryConfig Enables retrying HTTP requests under certain failure conditions.

Response

Promise<models.CreateMicrofrontendsGroupWithApplicationsResponseBody>

Errors

Error Type Status Code Content Type
models.SDKError 4XX, 5XX */*