holidayapi-node/dist/types.d.ts
Josh Sherman bd634f7442
chore: updating dependencies and node versions
* Updated supported Node.js versions

Dropped support for 14 and 16 in favor of the current LTS versions 18
and 20.

* Updated Node.js dependencies

Bumped nearly all dependencies to the latest. The exception being
`node-fetch` which made the jump to using ESM which is still causing
folks a lot of grief.

* Shored code coverage back up to 100%

Had some remnants from when this library did sanity checks pre-flight to
the API that required additional tests to cover them, or just adjusting
the argument defaults.

* Removed the "build" badge from the README

Seems there were some gotchas with that badge that makes it kind of a
pain, as it has to be hard coded a certain way. I messed with it and
couldn't get it working, seems like more trouble than it's worth.

Further details: https://github.com/badges/shields/issues/8671

* Added .nvmrc file

Pretty self explanatory.

* Bumped version number

Lucky number 7, y'all!
2023-10-26 16:51:36 -05:00

99 lines
2.4 KiB
TypeScript

export type Endpoint = 'countries' | 'holidays' | 'languages' | 'workday' | 'workdays';
export type Weekday = {
name: 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday';
numeric: 1 | 2 | 3 | 4 | 5 | 6 | 7;
};
type Request = {
format?: 'csv' | 'json' | 'php' | 'tsv' | 'xml' | 'yaml';
key?: string;
pretty?: boolean;
search?: string;
};
export type CountriesRequest = Request & {
country?: string;
public?: boolean;
};
export type HolidaysRequest = Request & {
country?: string;
day?: number;
language?: string;
month?: number;
previous?: boolean;
public?: boolean;
subdivisions?: boolean;
upcoming?: boolean;
year?: number;
};
export type LanguagesRequest = Request & {
language?: string;
};
export type WorkdayRequest = Request & {
country?: string;
start?: string;
days?: number;
};
export type WorkdaysRequest = Request & {
country?: string;
start?: string;
end?: string;
};
export type Response = {
requests: {
available: number;
resets: string;
used: number;
};
status: number;
error?: string;
};
export type CountriesResponse = Response & {
countries?: {
code: string;
codes: {
'alpha-2': string;
'alpha-3': string;
numeric: string;
};
flag: string;
languages: string[];
name: string;
subdivisions: {
code: string;
languages: string[];
name: string;
}[];
weekday: {
date: Weekday;
observed: Weekday;
};
}[];
};
export type HolidaysResponse = Response & {
holidays?: {
country: string;
date: string;
name: string;
observed: string;
public: boolean;
uuid: string;
subdivisions?: string[];
}[];
};
export type LanguagesResponse = Response & {
languages?: {
code: string;
name: string;
}[];
};
export type WorkdayResponse = Response & {
workday?: {
date: string;
weekday: Weekday;
};
};
export type WorkdaysResponse = Response & {
workdays?: number;
};
export type Requests = (CountriesRequest | HolidaysRequest | LanguagesRequest | WorkdayRequest | WorkdaysRequest);
export type Responses = (CountriesResponse | HolidaysResponse | LanguagesResponse | WorkdayResponse | WorkdaysResponse);
export {};