Class Parkrun

The main hub for interacting with the Parkrun API.

Hierarchy

  • Parkrun

Properties

version: string = version

The Parkrun.JS version.

Returns

Package version.

license: string = license

The Parkrun.JS license, as stated by NPM.

Returns

License type.

Methods

  • Asynchronously authenticate a user via id/password

    Throws

    ParkrunAuthError (Unexpected) error during authentication flow.

    Throws

    ParkrunUserPassError Error thrown when the username or password is incorrect.

    Static

    Example

    const Parkrun = require("parkrun.js")
    const client = await Parkrun.authSync("A1234567", "password")

    Parameters

    • id: string
    • password: string

    Returns Promise<Parkrun>

  • Synchronously authenticate a user via id/password

    Throws

    ParkrunAuthError (Unexpected) error during authentication flow.

    Throws

    ParkrunUserPassError Error thrown when the username or password is incorrect.

    Static

    Example

    const Parkrun = require("parkrun.js")
    Parkrun.auth("A1234567", "password", function(client, err) {
    if (!err) {
    // no errors, continue
    }
    })

    // Alternative example using ES6
    const Parkrun = require("parkrun.js")
    Parkrun.auth("A1234567", "password", (client, err) => {
    if (!err) {
    // no errors, continue
    }
    })

    Parameters

    • id: string
    • password: string
    • callback: any

      the callback to run once login has completed. The first paramater is the Parkrun client.

    Returns void

  • Recreate a client based on previous authentication details.

    Please note that no authentication checks are handled here.

    See

    authRefresh instead for an actual authentication method.

    Deprecated

    This method was meant for legacy users, and has a better alternative available. However, it will be included for the forseeable future.

    Static

    Returns

    Parameters

    • data: Object

    Returns Parkrun

  • Get an array of Event objects for each parkrun that the specified athlete has run, in alphabetical order.

    (Needed for freedomRuns)

    Throws

    ParkrunNetError ParkrunJS Networking Error.

    Parameters

    • athleteID: number

      The athlete ID for which to get results for.

    Returns Promise<Event[]>

  • Parameters

    • url: string
    • options: any
    • dataName: any
    • rangeName: any

    Returns Promise<any[]>

  • Parameters

    • __namedParameters: { url?: string; params?: { expandedDetails: boolean; athleteID?: number } }
      • Optional url?: string
      • Optional params?: { expandedDetails: boolean; athleteID?: number }
        • expandedDetails: boolean
        • Optional athleteID?: number

    Returns Promise<any[]>

Constructors

Generated using TypeDoc