Represents an SDK for interacting with the Open Holiday API.

Constructors

  • Constructs a new instance of the Holiday SDK.

    Parameters

    • options: HolidayOptions = {}

      The options for configuring the SDK.

    Returns Holiday

Properties

url: string

The base URL of the Open Holiday API. This won't have a slash at the end!

Methods

  • Get all countries

    Official docs

    Parameters

    • Optional language: string

      The optional language to get the country names in. If a incorrect is given the data will be in english. If no language is given the data will be in all available languages.

    Returns Promise<{
        isoCode: string;
        name: {
            language: string;
            text: string;
        }[];
        officialLanguages: string[];
    }[]>

    A promise that resolves in all countries supported.

  • Get all languages

    Parameters

    • Optional language: string

      The optional language to get the languages names in. If a incorrect is given the data will be in english. If no language is given the data will be in all available languages.

    Returns Promise<{
        isoCode: string;
        name: {
            language: string;
            text: string;
        }[];
    }[]>

    A promise that resolves in all langauges supported.

  • Get school holidays

    Official docs

    Parameters

    • country: string

      The iso code of the country

    • startDate: Date

      The date to beginn the search from

    • endDate: Date

      The date to end the search at, maximum three years after startDate

    • Optional subdivision: string

      Optional administrative unit

    • Optional language: string

      The optional language to get all the data in

    Returns Promise<{
        comment?: {
            language: string;
            text: string;
        }[];
        endDate: Date;
        id: string;
        name: {
            language: string;
            text: string;
        }[];
        nationwide: boolean;
        quality?: "Optional" | "Mandatory";
        startDate: Date;
        subdivisions?: {
            code: string;
            shortName: string;
        }[];
        type: "Public" | "Bank" | "National" | "Regional" | "Local" | "School" | "BackToSchool" | "EndOfLessons" | "Optional";
    }[]>

    A promise that resolves into the public holidays

  • Get school holidays

    Official docs

    Parameters

    • country: string

      The iso code of the country

    • startDate: Date

      The date to beginn the search from

    • endDate: Date

      The date to end the search at, maximum three years after startDate

    • Optional subdivision: string

      Optional administrative unit

    • Optional language: string

      The optional language to get all the data in

    Returns Promise<{
        comment?: {
            language: string;
            text: string;
        }[];
        endDate: Date;
        id: string;
        name: {
            language: string;
            text: string;
        }[];
        nationwide: boolean;
        quality?: "Optional" | "Mandatory";
        startDate: Date;
        subdivisions?: {
            code: string;
            shortName: string;
        }[];
        type: "Public" | "Bank" | "National" | "Regional" | "Local" | "School" | "BackToSchool" | "EndOfLessons" | "Optional";
    }[]>

    A promise that resolves into the school holidays

  • Get all subdivisions in a state

    Official docs

    Parameters

    • country: string

      The iso-code of the country which subdivisions are in question

    • Optional language: string

      The language in which to receive the subdivison names

    Returns Promise<{
        category: {
            language: string;
            text: string;
        }[];
        code: string;
        isoCode: string;
        name: {
            language: string;
            text: string;
        }[];
        officialLanguages: string[];
        shortName: string;
    }[]>

    A promise that resolves into a list of all subdivions that are important for holidays

Generated using TypeDoc