Options
All
  • Public
  • Public/Protected
  • All
Menu

qmk

Index

Type aliases

API_VERSION

API_VERSION: "v1"

Key

Key: object

Type declaration

  • label: string
  • x: number
  • y: number

Keyboard

Keyboard: object

Type declaration

  • bootloader: string
  • description: string
  • device_ver: string
  • height: number
  • identifier: string
  • keyboard_folder: string
  • keyboard_name: string
  • keymaps: string[]
  • layouts: Layouts
  • maintainer: string
  • Optional manufacturer?: undefined | string
  • platform: string
  • processor: string
  • processor_type: string
  • Optional product_id?: string | number
  • readme: boolean
  • url: string
  • Optional vendor_id?: string | number
  • width: number

KeyboardMeta

KeyboardMeta: object

Type declaration

  • description: string | boolean
  • keyboard: string
  • manufacturer: string
  • product_id: string
  • vendor_id: string

Keyboards

Keyboards: object

Type declaration

KeyboardsMeta

KeyboardsMeta: object

Type declaration

KeyboardsResponse

KeyboardsResponse: object

Type declaration

  • Optional git_hash?: undefined | string
  • keyboards: Keyboards
  • last_updated: string

Layout

Layout: object

Type declaration

  • key_count: number
  • layout: Key[]

Layouts

Layouts: object

Type declaration

PostData

PostData: object | string

Products

Products: object

Type declaration

QueryParam

QueryParams

QueryParams: object

Type declaration

QueryPrimitive

QueryPrimitive: string | number | boolean

RequestMethod

RequestMethod: "POST" | "GET" | "PUT" | "PATCH" | "DELETE" | "OPTIONS"

Vendors

Vendors: object

Type declaration

Variables

Const API_ROOT

API_ROOT: "https://api.qmk.fm/" = "https://api.qmk.fm/"

Headers

Headers: object

Type declaration

  • constructor: function
    • new __type(init?: HeadersInit): Headers
    • Parameters

      • Optional init: HeadersInit

      Returns Headers

  • prototype: Headers

Request

Request: object

Type declaration

  • constructor: function
    • new __type(input: RequestInfo, init?: RequestInit): Request
    • Parameters

      • input: RequestInfo
      • Optional init: RequestInit

      Returns Request

  • prototype: Request

fetch

fetch: fetch

Functions

Const fetchData

  • fetchData<T>(r: RequestInfo): Promise<T>

Const get

  • get<T>(uri: string, query?: QueryParams, headers?: HeadersInit): Promise<T>
  • Issue a simple get request and return JSON content

    Type parameters

    • T

    Parameters

    • uri: string

      The URI the GET request will be sent to

    • Optional query: QueryParams

      Optional query params object

    • Optional headers: HeadersInit

    Returns Promise<T>

Const getDefaultHeaders

  • Parameters

    Returns HeadersInit

Const getURI

  • Parameters

    Returns string

Const hex

  • hex(n: number): string
  • Convert a numeric vendor or product ID to a hex representation used by QMK

    Parameters

    • n: number

      A numeric vendor ID or product ID

    Returns string

    Hex string in the format 0x0000

Const isQueryPrimitive

  • Parameters

    Returns boolean

Const keyboards

  • Retrieve metadata about keyboards

    const { git_hash, last_updated, keyboards } = await keyboards('https://api.qmk.fm/v1/', 'massdrop/alt');

    Parameters

    • api: string

      The QMK API url

    • Rest ...names: string[]

      Provide one or more keyboard names, or use the special "all" keyword

    Returns Promise<KeyboardsResponse>

Const post

  • post<T>(uri: string, data?: PostData, query?: QueryParams, headers?: HeadersInit): Promise<T>
  • Issue a post request and return the deserialized json response content

    Type parameters

    • T

    Parameters

    • uri: string

      The URI the POST request will be sent to

    • Optional data: PostData

      Optional PostData sent to the URI as JSON content

    • Optional query: QueryParams

      Optional query parameters added to the provided URI

    • Optional headers: HeadersInit

    Returns Promise<T>

Const readme

  • readme(api: string, name: string): Promise<string>
  • Get the readme file associated with the keyboard

    Parameters

    • api: string

      The QMK API endpoint

    • name: string

      The name of the keyboard

      const altReadme = await readme('https://api.qmk.fm/v1/', 'massdrop/alt');

    Returns Promise<string>

Const serialize

  • serialize(data?: PostData): string | undefined
  • Parameters

    Returns string | undefined

Const serializeQueryParam

  • serializeQueryParam(__namedParameters: [string, string | number | false | true | (string | number | false | true)[]]): string
  • Parameters

    • __namedParameters: [string, string | number | false | true | (string | number | false | true)[]]

    Returns string

Const usb

  • usb(api: string): Promise<Vendors>
  • Retrieve keyboard metadata by vendor and product ID

    const vendor = '0x04D8';
    const { [vendor]: massdrop } = await usb('https://api.qmk.fm/v1/');
    console.info(massdrop);

    Parameters

    • api: string

      The QMK API url

    Returns Promise<Vendors>

Generated using TypeDoc