How to use @netlify/open-api - 7 common examples

To help you get started, we’ve selected a few @netlify/open-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github netlify / js-client / src / index.js View on Github external
constructor(accessToken, opts) {
    addMethods(this)

    // variadic arguments
    if (typeof accessToken === 'object') {
      opts = accessToken
      accessToken = null
    }
    // default opts
    opts = Object.assign(
      {
        userAgent: 'netlify/js-client',
        scheme: dfn.schemes[0],
        host: dfn.host,
        pathPrefix: dfn.basePath,
        accessToken,
        globalParams: {}
      },
      opts
    )

    this.defaultHeaders = {
      'User-agent': opts.userAgent,
      accept: 'application/json'
    }

    this.scheme = opts.scheme
    this.host = opts.host
    this.pathPrefix = opts.pathPrefix
    this.globalParams = opts.globalParams
    this.accessToken = opts.accessToken
github netlify / js-client / src / index.js View on Github external
constructor(accessToken, opts) {
    addMethods(this)

    // variadic arguments
    if (typeof accessToken === 'object') {
      opts = accessToken
      accessToken = null
    }
    // default opts
    opts = Object.assign(
      {
        userAgent: 'netlify/js-client',
        scheme: dfn.schemes[0],
        host: dfn.host,
        pathPrefix: dfn.basePath,
        accessToken,
        globalParams: {}
      },
      opts
    )

    this.defaultHeaders = {
      'User-agent': opts.userAgent,
      accept: 'application/json'
    }

    this.scheme = opts.scheme
    this.host = opts.host
    this.pathPrefix = opts.pathPrefix
    this.globalParams = opts.globalParams
github netlify / js-client / src / index.js View on Github external
constructor(accessToken, opts) {
    addMethods(this)

    // variadic arguments
    if (typeof accessToken === 'object') {
      opts = accessToken
      accessToken = null
    }
    // default opts
    opts = Object.assign(
      {
        userAgent: 'netlify/js-client',
        scheme: dfn.schemes[0],
        host: dfn.host,
        pathPrefix: dfn.basePath,
        accessToken,
        globalParams: {}
      },
      opts
    )

    this.defaultHeaders = {
      'User-agent': opts.userAgent,
      accept: 'application/json'
    }

    this.scheme = opts.scheme
    this.host = opts.host
    this.pathPrefix = opts.pathPrefix
github netlify / cli / src / utils / api / index.js View on Github external
constructor(accessToken, opts) {
    if (typeof accessToken === 'object') {
      opts = accessToken
      accessToken = null
    }
    opts = Object.assign(
      {
        userAgent: '@netlify/js-client',
        scheme: dfn.schemes[0],
        host: dfn.host,
        pathPrefix: dfn.basePath
      },
      opts
    )
    this.defaultHeaders = {
      'User-agent': opts.userAgent,
      accept: 'application/json'
    }
    this.scheme = opts.scheme
    this.host = opts.host
    this.pathPrefix = opts.pathPrefix
    this.globalParams = Object.assign({}, opts.globalParams)
    if (accessToken) this.accessToken = accessToken
  }
github netlify / cli / src / utils / api / index.js View on Github external
constructor(accessToken, opts) {
    if (typeof accessToken === 'object') {
      opts = accessToken
      accessToken = null
    }
    opts = Object.assign(
      {
        userAgent: '@netlify/js-client',
        scheme: dfn.schemes[0],
        host: dfn.host,
        pathPrefix: dfn.basePath
      },
      opts
    )
    this.defaultHeaders = {
      'User-agent': opts.userAgent,
      accept: 'application/json'
    }
    this.scheme = opts.scheme
    this.host = opts.host
    this.pathPrefix = opts.pathPrefix
    this.globalParams = Object.assign({}, opts.globalParams)
    if (accessToken) this.accessToken = accessToken
  }
github netlify / cli / src / utils / api / index.js View on Github external
constructor(accessToken, opts) {
    if (typeof accessToken === 'object') {
      opts = accessToken
      accessToken = null
    }
    opts = Object.assign(
      {
        userAgent: '@netlify/js-client',
        scheme: dfn.schemes[0],
        host: dfn.host,
        pathPrefix: dfn.basePath
      },
      opts
    )
    this.defaultHeaders = {
      'User-agent': opts.userAgent,
      accept: 'application/json'
    }
    this.scheme = opts.scheme
    this.host = opts.host
    this.pathPrefix = opts.pathPrefix
    this.globalParams = Object.assign({}, opts.globalParams)
    if (accessToken) this.accessToken = accessToken
  }
github netlify / js-client / src / open-api / shape-swagger.js View on Github external
const dfn = require('@netlify/open-api')

const { sortParams, mergeParams } = require('./util')
const methods = []

Object.entries(dfn.paths).forEach(([apiPath, verbs]) => {
  const topParams = sortParams(verbs.parameters)
  delete verbs.parameters

  Object.entries(verbs).forEach(([verb, props]) => {
    const verbParams = sortParams(props.parameters)
    delete props.parameters

    const opSpec = Object.assign(
      {},
      props,
      {
        verb,
        path: apiPath
      },
      {
        parameters: mergeParams(topParams, verbParams)

@netlify/open-api

Netlify's open-api definition as a module

MIT
Latest version published 3 months ago

Package Health Score

86 / 100
Full package analysis