holidayapi
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -1,2 +0,2 @@ | ||
import { CountriesRequest, CountriesResponse, HolidaysRequest, HolidaysResponse, LanguagesRequest, LanguagesResponse, WorkdayRequest, WorkdayResponse } from './types'; | ||
import { CountriesRequest, CountriesResponse, HolidaysRequest, HolidaysResponse, LanguagesRequest, LanguagesResponse, WorkdayRequest, WorkdayResponse, WorkdaysRequest, WorkdaysResponse } from './types'; | ||
export declare class HolidayAPI { | ||
@@ -15,2 +15,3 @@ baseUrl: string; | ||
workday(request?: WorkdayRequest): Promise<WorkdayResponse>; | ||
workdays(request?: WorkdaysRequest): Promise<WorkdaysResponse>; | ||
} |
@@ -155,4 +155,21 @@ "use strict"; | ||
}; | ||
HolidayAPI.prototype.workdays = function (request) { | ||
if (request === void 0) { request = {}; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (!request.country) { | ||
throw new Error('Missing country'); | ||
} | ||
else if (!request.start) { | ||
throw new Error('Missing start date'); | ||
} | ||
else if (!request.end) { | ||
throw new Error('Missing end date'); | ||
} | ||
return [2, this.request('workdays', request)]; | ||
}); | ||
}); | ||
}; | ||
return HolidayAPI; | ||
}()); | ||
exports.HolidayAPI = HolidayAPI; |
@@ -1,3 +0,3 @@ | ||
export declare type Endpoint = 'countries' | 'holidays' | 'languages' | 'workday'; | ||
declare type Weekday = { | ||
export declare type Endpoint = 'countries' | 'holidays' | 'languages' | 'workday' | 'workdays'; | ||
export declare type Weekday = { | ||
name: 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday' | 'Sunday'; | ||
@@ -12,3 +12,2 @@ numeric: 1 | 2 | 3 | 4 | 5 | 6 | 7; | ||
}; | ||
export declare type Requests = CountriesRequest | HolidaysRequest | LanguagesRequest | WorkdayRequest; | ||
export declare type CountriesRequest = Request & { | ||
@@ -37,6 +36,11 @@ country?: string; | ||
}; | ||
export declare type WorkdaysRequest = Request & { | ||
country?: string; | ||
start?: string; | ||
end?: string; | ||
}; | ||
export declare type Response = { | ||
requests: { | ||
available: number; | ||
resets: Date; | ||
resets: string; | ||
used: number; | ||
@@ -47,3 +51,2 @@ }; | ||
}; | ||
export declare type Responses = CountriesResponse | HolidaysResponse | LanguagesResponse | WorkdayResponse; | ||
export declare type CountriesResponse = Response & { | ||
@@ -74,5 +77,5 @@ countries?: { | ||
country: string; | ||
date: Date; | ||
date: string; | ||
name: string; | ||
observed: Date; | ||
observed: string; | ||
public: boolean; | ||
@@ -91,6 +94,11 @@ uuid: string; | ||
workday?: { | ||
date: Date; | ||
date: string; | ||
weekday: Weekday; | ||
}; | ||
}; | ||
export declare type WorkdaysResponse = Response & { | ||
workdays?: number; | ||
}; | ||
export declare type Requests = (CountriesRequest | HolidaysRequest | LanguagesRequest | WorkdayRequest | WorkdaysRequest); | ||
export declare type Responses = (CountriesResponse | HolidaysResponse | LanguagesResponse | WorkdayResponse | WorkdaysResponse); | ||
export {}; |
{ | ||
"name": "holidayapi", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Official Node.js library for Holiday API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40809
981