Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NodeLocationManager

Hierarchy

Index

Constructors

Properties

cache: Dict<number, NodeLocation>
client: PteroApp

Accessors

  • get FILTERS(): readonly string[]
  • get INCLUDES(): readonly string[]
  • get SORTS(): readonly never[]

Methods

  • _patch(data: any): any
  • Transforms the raw location object(s) into typed objects.

    Parameters

    • data: any

      The resolvable location object(s).

    Returns any

    The resolved location object(s).

  • adminURLFor(id: number): string
  • Creates a location.

    example
    app.locations.create('ca', 'canada')
    .then(console.log)
    .catch(console.error);

    Parameters

    • short: string

      The short name for the location (usually the country code).

    • long: string

      The long name for the location.

    Returns Promise<NodeLocation>

    The new location.

  • delete(id: number): Promise<void>
  • getFetchAll<T, K>(...options: unknown[]): Promise<Dict<T, K>>
  • getQueryOptions(): { filters: readonly string[]; includes: readonly string[]; sorts: readonly string[] }
  • Gets the allowed query options from the inherited manager.

    internal

    Returns { filters: readonly string[]; includes: readonly string[]; sorts: readonly string[] }

    The query options.

    • filters: readonly string[]
    • includes: readonly string[]
    • sorts: readonly string[]
  • Queries the API for locations that match the specified query filters. This fetches from the API directly and does not check the cache. Use cache methods for filtering and sorting.

    Available query filters:

    • short
    • long
    example
    app.locations.query('us', { filter: 'long' })
    .then(console.log)
    .catch(console.error);

    Parameters

    • entity: string

      The entity to query.

    • options: Filter<{ sort?: string }>

      The query options to filter by.

    Returns Promise<Dict<number, NodeLocation>>

    The queried locations.

  • update(id: number, options: { long?: string; short?: string }): Promise<NodeLocation>
  • Updates a location.

    example
    app.locations.update(10, { long: 'united kingdom' })
    .then(console.log)
    .catch(console.error);

    Parameters

    • id: number

      The ID of the location.

    • options: { long?: string; short?: string }

      The updated short and/or long name of the location.

      • Optional long?: string
      • Optional short?: string

    Returns Promise<NodeLocation>

    The updated location.

Generated using TypeDoc