Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@builder.io/admin-sdk

Package Overview
Dependencies
Maintainers
9
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@builder.io/admin-sdk

Builder.io Admin API SDK

  • 0.0.4
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-4.73%
Maintainers
9
Weekly downloads
 
Created
Source

Builder.io Admin API SDK.

Nodejs SDK to interact with Builder.io Graphql Admin API (beta).

How to use

  • Install using your favorite package manager:
npm install @builder.io/admin-sdk
  • get a private key of the space you want to administer bpk-xxx
import { createAdminApiClient } from '@builder.io/admin-sdk';
const adminSDK = createAdminApiClient(process.env.BUILDER_PRIVATE_KEY);

// example getting space settings:
const res = await adminSDK.query({
  settings: true,
});

// example getting all models fields on a space:
const res = await adminSDK.query({
  models: {
    id: true,
    fields: true,
  },
});

// example creating a model from admin api
await adminSDK.chain.mutation
  .addModel({
    body: {
      defaultQuery: [],
      kind: 'component',
      showTargeting: true,
      allowHeatmap: true,
      id: 'xxxxxx',
      showMetrics: true,
      publicReadable: true,
      name: 'announcement-bar',
      useQueryParamTargetingClientSide: false,
      fields: [
        {
          type: 'uiBlocks',
          '@type': '@builder.io/core:Field',
          required: true,
          hideFromFieldsEditor: true,
          name: 'blocks',
          showTemplatePicker: true,
        },
      ],
      helperText: 'This model is for announcement bars',
      allowBuiltInComponents: true,
      bigData: false,
      strictPrivateWrite: false,
      requiredTargets: [],
      schema: {},
      examplePageUrl: 'https://my.site.com/preview',
      webhooks: [],
      apiGenerated: true,
      showScheduling: true,
      showAbTests: true,
      pathPrefix: '/',
      componentsOnlyMode: false,
    },
  })
  .execute({});

More info:

  • check the graphiql explorer on beta.builder.io/api/v2/admin, add your private key to the http headers section and inspect available queries / mutations:

BUILDER

Keywords

FAQs

Package last updated on 18 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc