How to use @microlink/mql - 6 common examples

To help you get started, we’ve selected a few @microlink/mql 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 microlinkhq / www / src / components / patterns / FetchProvider.js View on Github external
const fetchData = async (url, opts) => {
    try {
      setQuery({ url, ...opts })
      setError(null)
      setStatus('fetching')
      const { data } = await mql(url, { ...mqlOpts, ...opts })
      setData(data)
      setStatus('fetched')
    } catch (err) {
      setStatus('error')
      setError(err)
    }
  }
github microlinkhq / www / src / pages / iframe.js View on Github external
async function fetchData () {
      const { data } = await mql(url, {
        meta: false,
        iframe: true
      })
      setIframe(data.iframe)
    }
    fetchData()
github microlinkhq / www / src / components / pages / meta / examples.js View on Github external
const fetchAndSetData = async url => {
    try {
      const { data } = await mql(url, { iframe: true })
      setData(data)
    } catch (err) {}
  }
github microlinkhq / www / src / helpers / mql-code.js View on Github external
const createApiUrl = ({ url = 'https://example.com', ...props } = {}) => {
  const [apiUrl] = mql.getApiUrl(url, props)
  return apiUrl
}
github microlinkhq / sdk / packages / react / src / utils / index.js View on Github external
export const getApiUrl = ({
  apiKey,
  contrast = false,
  data,
  force,
  headers,
  media,
  prerender,
  proxy,
  ttl,
  url
}) =>
  createApiUrl(url, {
    apiKey,
    audio: media.includes('audio'),
    data,
    force,
    headers,
    iframe: media.includes('iframe'),
    palette: contrast,
    prerender,
    proxy,
    screenshot: media.includes('screenshot'),
    ttl,
    video: media.includes('video')
  })
github microlinkhq / www / src / helpers / screenshot-url.js View on Github external
export default (url, opts) => {
  const [screenshotUrl] = getApiUrl(url, {
    ...opts,
    screenshot: true,
    meta: false,
    embed: 'screenshot.url'
  })
  return screenshotUrl
}

@microlink/mql

Microlink Query Language. The official HTTP client to interact with Microlink API for Node.js, browsers & Deno.

MIT
Latest version published 22 days ago

Package Health Score

75 / 100
Full package analysis

Popular @microlink/mql functions