Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace License

Index

Functions

  • description

    Creates a license, given a plan and email. Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/create-license

    example
    import { Client, License } from 'hyper'
    const client = Hyper('my-api-key')

    let body = {
    plan: "plan-123",
    email: "admin@hyper.co"
    }

    const res = await License.create(client, body)

    Parameters

    Returns Promise<HyperApiResponse>

    HyperApiResponse

  • description

    Deletes a license, given its key. Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/delete-license

    example
    import { Client, License } from 'hyper'
    const client = Hyper('my-api-key')

    let license = "FOO-1111-2222-3333-4444"

    const res = await License.destroy(client)

    Parameters

    • client: HyperApiClient

      (HyperApiClient) The client to use for the request

    • license: string

      (string) The key of the license to delete

    Returns Promise<HyperApiResponse>

    HyperApiResponse

  • description

    Retrieves a license, given its key. Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/retrieve-license

    example
    import { Client, License } from 'hyper'
    const client = Hyper('my-api-key')

    let license = "FOO-1111-2222-3333-4444"

    const res = await License.get(client, license)

    Parameters

    • client: HyperApiClient

      (HyperApiClient) The client to use for the request

    • license: string

      (string) The key of the license to fetch

    Returns Promise<HyperApiResponse>

    HyperApiResponse

  • description

    Lists all licenses. Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/list-licenses

    example
    import { Client, License } from 'hyper'
    const client = Hyper('my-api-key')

    // Page 1
    const res = await License.list(client)

    // Note: HyperApiPaginatedResponse .next() and .previous() return null once you reach a nonexisting page.

    // Page 2
    res.next()

    // Page 1
    res.previous()

    Parameters

    • client: HyperApiClient
    • limit: number = 20

      (number) The maximum number of licenses per page (capped at 100).

    • page: number = 1

      (number) The page number to fetch. Defaults to 1.

    Returns Promise<HyperApiPaginatedResponse>

    HyperApiPaginatedResponse

  • description

    Updates a license, given its key and new value(s). Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/update-license

    example
    import { Client, License } from 'hyper'
    const client = Hyper('my-api-key')

    let license = "FOO-1111-2222-3333-4444"

    let body = {
    email: "admin@hyper.co",
    subscription: {
    "cancel_at_period_end": false
    }
    }

    const res = await License.update(client, license, body)

    Parameters

    • client: HyperApiClient

      (HyperApiClient) The client to use for the request

    • license: string

      (string) The key of the license to update

    • body: LicenseBodyUpdate

      (LicenseBodyUpdate) An object with the updated key/value pairs provided

    Returns Promise<HyperApiResponse>

    HyperApiResponse

  • description

    Updates a license's metadata, given its key. Called asynchronously with await. All data is provided as-is from the server, with the addition of an ok boolean for error handling.

    docs

    https://docs.hyper.co/reference/update-license-metadata

    example
    import { Client, License } from 'hyper'
    const client = Hyper('my-api-key')

    let license = "FOO-1111-2222-3333-4444"

    let metadata = {
    foo: 'bar' // values MUST be strings
    }

    const res = await License.updateMetadata(client, license, metadata)

    Parameters

    • client: HyperApiClient

      (HyperApiClient) The client to use for the request

    • license: string

      (string) The key of the license to update

    • metadata: LicenseMetadataUpdate

      (LicenseMetadataUpdate) An object with key/value pairs provided, where values are provided only as strings.

    Returns Promise<HyperApiResponse>

    HyperApiResponse

Generated using TypeDoc