Class default

Implements the CKAN action API as per the latest documentation: https://docs.ckan.org/en/2.10/api/

Hierarchy

  • default

Constructors

  • Parameters

    • baseUrl: string

      The url for the CKAN API endpoint.

    • Optional options: Settings = {}

      Base settings for CKAN

    Returns default

Properties

_baseUrl: string

The base URL for the API

options: Settings

Settings for the API handler.

malformedApiResponse: "Malformed API response, cannot parse data." = "Malformed API response, cannot parse data."

Accessors

  • get baseUrl(): string
  • Returns string

  • set baseUrl(newUrl): void
  • Parameters

    • newUrl: string

    Returns void

Methods

  • Carries out a generic CKAN action. Should generally be avoided in favour of specific functions unless the action has not been implemented.

    Type Parameters

    • T

    • U

    Parameters

    • action: string

      The API action to use.

    • Optional data: T

      The data to pass onto the API

    • Optional method: AllowedMethods = "GET"

      The HTTP request method to use for this endpoint

    Returns Promise<U>

  • Private

    Checks that implementations are not faulty, and detailed endpoints do, in fact, return details Must be used before returning a string array since there are 0 guarantees that responses are formatted correctly And according to my TypeScript definitions

    Type Parameters

    • T

    Parameters

    • check: T

      the array that needs checking

    • Optional expectedFields: string[]

    Returns T

  • Private

    Checks that implementations are not faulty, and simplified endpoints are in fact simplified Must be used before returning a string array since there are 0 guarantees that responses are formatted correctly And according to my TypeScript definitions

    Type Parameters

    • T

    Parameters

    • check: T

      the array that needs checking. Should be string[], but mis-implemented APIs can cause an error

    Returns string[]

  • Gets the autocomplete list for formats

    Parameters

    • query: string
    • Optional limit: number

    Returns Promise<string[]>

  • Gets the autocomplete list for tags

    Parameters

    • query: string
    • Optional limit: number

    Returns Promise<string[]>

  • Checks whether an API is accessible.

    Returns Promise<boolean>

  • Private

    Converts one sort option to parameters that CKAN can handle

    Parameters

    Returns string

  • Private

    Converts the sort options to parameters that CKAN can handle

    Parameters

    Returns string

  • Private

    Converts the user options to parameters that CKAN can handle

    Parameters

    Returns {
        email: string;
        order_by: any;
        q: string;
    }

    • email: string
    • order_by: any
    • q: string
  • Gets the details of a data set from the API.

    Parameters

    • id: string

    Returns Promise<Dataset>

  • Gets the API's dataset (package) list.

    Parameters

    Returns Promise<string[]>

  • Gets the API's dataset (package) list with additional information.

    Parameters

    Returns Promise<Dataset[]>

  • Gets the API's group list with details.

    Parameters

    Returns Promise<Group[]>

  • Gets the API's tag list with details.

    Parameters

    Returns Promise<Tag[]>

  • Gets the API's detailed user list.

    Parameters

    Returns Promise<User[]>

  • Gets the API's group list by only names.

    Parameters

    Returns Promise<string[]>

  • Gets the API's organizations list.

    Parameters

    Returns Promise<string[]>

  • Gets the details of a resource from the API.

    Parameters

    • id: string

    Returns Promise<Resource>

  • Searches for a given dataset (package). Does not handle faceted search.

    Parameters

    Returns Promise<Dataset[]>

  • Searches for a given resource.

    Parameters

    • query: string

      A solr query string

    • Optional options: SortOptions

    Returns Promise<Resource[]>

  • Private

    Changes the base url

    Parameters

    • baseUrl: string

      The url for the CKAN API endpoint.

    Returns void

  • Gets the API's tag list.

    Parameters

    Returns Promise<string[]>

  • Gets a user from the API.

    Parameters

    • id: string

    Returns Promise<User>

  • Gets the API's user list.

    Parameters

    Returns Promise<string[]>

Generated using TypeDoc