PowerShell wrapper around the Calendarific API
Calendarific offers a webservice for listing holidays from different countries. They also have an API that can be used by developers to implement this holiday queries in the their own applications.
Accessing this API requires an API key which can be registered for free at https://calendarific.com/signup.
This module is a wrapper around the Calendarific API. You can install the module from the PowerShell Gallery.
|
|
The following commands are available in this module.
|
|
Register-PSCalendarificDefaultConfiguration
This command helps set the parameter defaults for accessing the API. At present, this command supports only storing APIKey and Country values as default configuration. API key must always be provided and the Get-PSCalendarificHoliday
requires Country name as well for listing the holidays. Therefore, these configuration settings can be stored locally so that other commands in the module can be used without explicitly providing any of these parameters.
Note: Storing API key on local filesystem is not a good practice.
|
|
This command has no mandatory parameters. You can specify either APIKey or Country or both. When you need to update either configuration parameters, just specify the parameter you want to update.
Unregister-PSCalendarificDefaultConfiguration
This command helps you remove the stored API key or just delete the configuration store itself.
|
|
If you do not specify any parameters, the configuration store gets deleted.
Get-PSCalendarificDefaultConfiguration
This command gets the stored defaults from the configuration store.
|
|
Get-PSCalendarificHoliday
This command lists all holidays for a given country based on the parameters supplied. If you do not provide any parameters, this commands tries to find and use the default parameter values from the configuration store.
|
|
The following are different parameters supported with this command.
Parameter Name | Description | Default Value |
---|---|---|
APIKey | Key to access the API | No default Value. When not specified, the command will try to use the default parameter from configuration store. |
Country | Country | No default Value. When not specified, the command will try to use the default parameter from configuration store. |
Year | Year for which the holidays need to be listed | The command internally defaults to the current year. |
Month | Month for which the holidays need to be listed. | No default value but the valid values are 1 .. 12 |
Day | Day for which the holidays need to be listed. | No default value but the valid values are 1 .. 31. |
Type | Type of holidays | No default value but the valid values are national, local, religious, and observance. |
This module is available on GitHub as well in case you want to contribute or create issues.
Share on: