openholidays

package module
v0.0.0-...-abb7108 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

README

go-openholidays

A golang client library for the Open Holidays Api

How it's made ?

  1. Install oapi-codegen : go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen
  2. Generate types: oapi-codegen -generate types -package openholidays -o types.go https://openholidaysapi.org/swagger/v1/swagger.json
  3. Generate client: oapi-codegen -generate client -package openholidays -o client.go https://openholidaysapi.org/swagger/v1/swagger.json

Usage

Example: Get the public holidays for Canton de Vaud in 2025

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"io"
	"log"
	"time"

	"openholidays"

	"github.com/oapi-codegen/runtime/types"
)

func main() {

	ctx := context.Background()

	client, _ := openholidays.NewClient("https://openholidaysapi.org")

	from, _ := time.Parse("2006-01-02", "2025-01-01")
	to, _ := time.Parse("2006-01-02", "2025-12-31")

	validFrom := types.Date{
		Time: from,
	}

	validTo := types.Date{
		Time: to,
	}

	params := openholidays.GetPublicHolidaysParams{
		CountryIsoCode:  "CH",
		ValidFrom:       validFrom,
		ValidTo:         validTo,
		LanguageIsoCode: func(s string) *string { return &s }("FR"),
		SubdivisionCode: func(s string) *string { return &s }("CH-VD"),
	}

	// Example for GetHolidays function
	holidays, err := client.GetPublicHolidays(ctx, &params)
	if err != nil {
		log.Fatalf("Error getting holidays: %v", err)
	}

	var holidayResponses []openholidays.HolidayResponse
	bodyBytes, err := io.ReadAll(holidays.Body)
	if err != nil {
		log.Fatalf("Error reading response body: %v", err)
	}
	err = json.Unmarshal(bodyBytes, &holidayResponses)
	if err != nil {
		log.Fatalf("Error unmarshalling holidays: %v", err)
	}

	for _, holiday := range holidayResponses {
		name := "Unknown"
		for _, localizedText := range holiday.Name {
			if localizedText.Language == "FR" {
				name = localizedText.Text
				break
			}
		}
		fmt.Printf("Holiday: %s on %s\n", name, holiday.StartDate)
	}

}

Result:

❯ go run main/main.go
Holiday: Nouvel an on 2025-01-01
Holiday: Saint-Berchtold on 2025-01-02
Holiday: Vendredi saint on 2025-04-18
Holiday: Lundi de Pâques on 2025-04-21
Holiday: Ascension on 2025-05-29
Holiday: Lundi de Pentecôte on 2025-06-09
Holiday: Fête nationale suisse on 2025-08-01
Holiday: Jeûne fédéral on 2025-09-21
Holiday: Noël on 2025-12-25

Documentation

Overview

Package openholidays provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.2.0 DO NOT EDIT.

Package openholidays provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.2.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetCountriesRequest

func NewGetCountriesRequest(server string, params *GetCountriesParams) (*http.Request, error)

NewGetCountriesRequest generates requests for GetCountries

func NewGetLanguagesRequest

func NewGetLanguagesRequest(server string, params *GetLanguagesParams) (*http.Request, error)

NewGetLanguagesRequest generates requests for GetLanguages

func NewGetPublicHolidaysByDateRequest

func NewGetPublicHolidaysByDateRequest(server string, params *GetPublicHolidaysByDateParams) (*http.Request, error)

NewGetPublicHolidaysByDateRequest generates requests for GetPublicHolidaysByDate

func NewGetPublicHolidaysRequest

func NewGetPublicHolidaysRequest(server string, params *GetPublicHolidaysParams) (*http.Request, error)

NewGetPublicHolidaysRequest generates requests for GetPublicHolidays

func NewGetSchoolHolidaysByDateRequest

func NewGetSchoolHolidaysByDateRequest(server string, params *GetSchoolHolidaysByDateParams) (*http.Request, error)

NewGetSchoolHolidaysByDateRequest generates requests for GetSchoolHolidaysByDate

func NewGetSchoolHolidaysRequest

func NewGetSchoolHolidaysRequest(server string, params *GetSchoolHolidaysParams) (*http.Request, error)

NewGetSchoolHolidaysRequest generates requests for GetSchoolHolidays

func NewGetStatisticsPublicHolidaysRequest

func NewGetStatisticsPublicHolidaysRequest(server string, params *GetStatisticsPublicHolidaysParams) (*http.Request, error)

NewGetStatisticsPublicHolidaysRequest generates requests for GetStatisticsPublicHolidays

func NewGetStatisticsSchoolHolidaysRequest

func NewGetStatisticsSchoolHolidaysRequest(server string, params *GetStatisticsSchoolHolidaysParams) (*http.Request, error)

NewGetStatisticsSchoolHolidaysRequest generates requests for GetStatisticsSchoolHolidays

func NewGetSubdivisionsRequest

func NewGetSubdivisionsRequest(server string, params *GetSubdivisionsParams) (*http.Request, error)

NewGetSubdivisionsRequest generates requests for GetSubdivisions

Types

type Client

type Client struct {
	// The endpoint of the server conforming to this interface, with scheme,
	// https://api.deepmap.com for example. This can contain a path relative
	// to the server, such as https://api.deepmap.com/dev-test, and all the
	// paths in the swagger spec will be appended to the server.
	Server string

	// Doer for performing requests, typically a *http.Client with any
	// customized settings, such as certificate chains.
	Client HttpRequestDoer

	// A list of callbacks for modifying requests which are generated before sending over
	// the network.
	RequestEditors []RequestEditorFn
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) GetCountries

func (c *Client) GetCountries(ctx context.Context, params *GetCountriesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetLanguages

func (c *Client) GetLanguages(ctx context.Context, params *GetLanguagesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetPublicHolidays

func (c *Client) GetPublicHolidays(ctx context.Context, params *GetPublicHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetPublicHolidaysByDate

func (c *Client) GetPublicHolidaysByDate(ctx context.Context, params *GetPublicHolidaysByDateParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetSchoolHolidays

func (c *Client) GetSchoolHolidays(ctx context.Context, params *GetSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetSchoolHolidaysByDate

func (c *Client) GetSchoolHolidaysByDate(ctx context.Context, params *GetSchoolHolidaysByDateParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetStatisticsPublicHolidays

func (c *Client) GetStatisticsPublicHolidays(ctx context.Context, params *GetStatisticsPublicHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetStatisticsSchoolHolidays

func (c *Client) GetStatisticsSchoolHolidays(ctx context.Context, params *GetStatisticsSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetSubdivisions

func (c *Client) GetSubdivisions(ctx context.Context, params *GetSubdivisionsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// GetCountries request
	GetCountries(ctx context.Context, params *GetCountriesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetLanguages request
	GetLanguages(ctx context.Context, params *GetLanguagesParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPublicHolidays request
	GetPublicHolidays(ctx context.Context, params *GetPublicHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPublicHolidaysByDate request
	GetPublicHolidaysByDate(ctx context.Context, params *GetPublicHolidaysByDateParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetSchoolHolidays request
	GetSchoolHolidays(ctx context.Context, params *GetSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetSchoolHolidaysByDate request
	GetSchoolHolidaysByDate(ctx context.Context, params *GetSchoolHolidaysByDateParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetStatisticsPublicHolidays request
	GetStatisticsPublicHolidays(ctx context.Context, params *GetStatisticsPublicHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetStatisticsSchoolHolidays request
	GetStatisticsSchoolHolidays(ctx context.Context, params *GetStatisticsSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetSubdivisions request
	GetSubdivisions(ctx context.Context, params *GetSubdivisionsParams, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) GetCountriesWithResponse

func (c *ClientWithResponses) GetCountriesWithResponse(ctx context.Context, params *GetCountriesParams, reqEditors ...RequestEditorFn) (*GetCountriesResponse, error)

GetCountriesWithResponse request returning *GetCountriesResponse

func (*ClientWithResponses) GetLanguagesWithResponse

func (c *ClientWithResponses) GetLanguagesWithResponse(ctx context.Context, params *GetLanguagesParams, reqEditors ...RequestEditorFn) (*GetLanguagesResponse, error)

GetLanguagesWithResponse request returning *GetLanguagesResponse

func (*ClientWithResponses) GetPublicHolidaysByDateWithResponse

func (c *ClientWithResponses) GetPublicHolidaysByDateWithResponse(ctx context.Context, params *GetPublicHolidaysByDateParams, reqEditors ...RequestEditorFn) (*GetPublicHolidaysByDateResponse, error)

GetPublicHolidaysByDateWithResponse request returning *GetPublicHolidaysByDateResponse

func (*ClientWithResponses) GetPublicHolidaysWithResponse

func (c *ClientWithResponses) GetPublicHolidaysWithResponse(ctx context.Context, params *GetPublicHolidaysParams, reqEditors ...RequestEditorFn) (*GetPublicHolidaysResponse, error)

GetPublicHolidaysWithResponse request returning *GetPublicHolidaysResponse

func (*ClientWithResponses) GetSchoolHolidaysByDateWithResponse

func (c *ClientWithResponses) GetSchoolHolidaysByDateWithResponse(ctx context.Context, params *GetSchoolHolidaysByDateParams, reqEditors ...RequestEditorFn) (*GetSchoolHolidaysByDateResponse, error)

GetSchoolHolidaysByDateWithResponse request returning *GetSchoolHolidaysByDateResponse

func (*ClientWithResponses) GetSchoolHolidaysWithResponse

func (c *ClientWithResponses) GetSchoolHolidaysWithResponse(ctx context.Context, params *GetSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*GetSchoolHolidaysResponse, error)

GetSchoolHolidaysWithResponse request returning *GetSchoolHolidaysResponse

func (*ClientWithResponses) GetStatisticsPublicHolidaysWithResponse

func (c *ClientWithResponses) GetStatisticsPublicHolidaysWithResponse(ctx context.Context, params *GetStatisticsPublicHolidaysParams, reqEditors ...RequestEditorFn) (*GetStatisticsPublicHolidaysResponse, error)

GetStatisticsPublicHolidaysWithResponse request returning *GetStatisticsPublicHolidaysResponse

func (*ClientWithResponses) GetStatisticsSchoolHolidaysWithResponse

func (c *ClientWithResponses) GetStatisticsSchoolHolidaysWithResponse(ctx context.Context, params *GetStatisticsSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*GetStatisticsSchoolHolidaysResponse, error)

GetStatisticsSchoolHolidaysWithResponse request returning *GetStatisticsSchoolHolidaysResponse

func (*ClientWithResponses) GetSubdivisionsWithResponse

func (c *ClientWithResponses) GetSubdivisionsWithResponse(ctx context.Context, params *GetSubdivisionsParams, reqEditors ...RequestEditorFn) (*GetSubdivisionsResponse, error)

GetSubdivisionsWithResponse request returning *GetSubdivisionsResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetCountriesWithResponse request
	GetCountriesWithResponse(ctx context.Context, params *GetCountriesParams, reqEditors ...RequestEditorFn) (*GetCountriesResponse, error)

	// GetLanguagesWithResponse request
	GetLanguagesWithResponse(ctx context.Context, params *GetLanguagesParams, reqEditors ...RequestEditorFn) (*GetLanguagesResponse, error)

	// GetPublicHolidaysWithResponse request
	GetPublicHolidaysWithResponse(ctx context.Context, params *GetPublicHolidaysParams, reqEditors ...RequestEditorFn) (*GetPublicHolidaysResponse, error)

	// GetPublicHolidaysByDateWithResponse request
	GetPublicHolidaysByDateWithResponse(ctx context.Context, params *GetPublicHolidaysByDateParams, reqEditors ...RequestEditorFn) (*GetPublicHolidaysByDateResponse, error)

	// GetSchoolHolidaysWithResponse request
	GetSchoolHolidaysWithResponse(ctx context.Context, params *GetSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*GetSchoolHolidaysResponse, error)

	// GetSchoolHolidaysByDateWithResponse request
	GetSchoolHolidaysByDateWithResponse(ctx context.Context, params *GetSchoolHolidaysByDateParams, reqEditors ...RequestEditorFn) (*GetSchoolHolidaysByDateResponse, error)

	// GetStatisticsPublicHolidaysWithResponse request
	GetStatisticsPublicHolidaysWithResponse(ctx context.Context, params *GetStatisticsPublicHolidaysParams, reqEditors ...RequestEditorFn) (*GetStatisticsPublicHolidaysResponse, error)

	// GetStatisticsSchoolHolidaysWithResponse request
	GetStatisticsSchoolHolidaysWithResponse(ctx context.Context, params *GetStatisticsSchoolHolidaysParams, reqEditors ...RequestEditorFn) (*GetStatisticsSchoolHolidaysResponse, error)

	// GetSubdivisionsWithResponse request
	GetSubdivisionsWithResponse(ctx context.Context, params *GetSubdivisionsParams, reqEditors ...RequestEditorFn) (*GetSubdivisionsResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CountryReference

type CountryReference struct {
	// IsoCode Country ISO code
	IsoCode string `json:"isoCode"`
}

CountryReference Representation of a country reference

type CountryResponse

type CountryResponse struct {
	// IsoCode ISO 3166-1 country code
	IsoCode string `json:"isoCode"`

	// Name Localized country names
	Name []LocalizedText `json:"name"`

	// OfficialLanguages Official ISO-639-1 language codes
	OfficialLanguages []string `json:"officialLanguages"`
}

CountryResponse Representation of a country as defined in ISO 3166-1

type GetCountriesParams

type GetCountriesParams struct {
	// LanguageIsoCode ISO-639-1 code of a language or empty
	LanguageIsoCode *string `form:"languageIsoCode,omitempty" json:"languageIsoCode,omitempty"`
}

GetCountriesParams defines parameters for GetCountries.

type GetCountriesResponse

type GetCountriesResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]CountryResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetCountriesResponse

func ParseGetCountriesResponse(rsp *http.Response) (*GetCountriesResponse, error)

ParseGetCountriesResponse parses an HTTP response from a GetCountriesWithResponse call

func (GetCountriesResponse) Status

func (r GetCountriesResponse) Status() string

Status returns HTTPResponse.Status

func (GetCountriesResponse) StatusCode

func (r GetCountriesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetLanguagesParams

type GetLanguagesParams struct {
	// LanguageIsoCode ISO-639-1 code of a language or empty
	LanguageIsoCode *string `form:"languageIsoCode,omitempty" json:"languageIsoCode,omitempty"`
}

GetLanguagesParams defines parameters for GetLanguages.

type GetLanguagesResponse

type GetLanguagesResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]LanguageResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetLanguagesResponse

func ParseGetLanguagesResponse(rsp *http.Response) (*GetLanguagesResponse, error)

ParseGetLanguagesResponse parses an HTTP response from a GetLanguagesWithResponse call

func (GetLanguagesResponse) Status

func (r GetLanguagesResponse) Status() string

Status returns HTTPResponse.Status

func (GetLanguagesResponse) StatusCode

func (r GetLanguagesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPublicHolidaysByDateParams

type GetPublicHolidaysByDateParams struct {
	// Date Date of interest
	Date openapi_types.Date `form:"date" json:"date"`

	// LanguageIsoCode ISO-639-1 code of a language or empty
	LanguageIsoCode *string `form:"languageIsoCode,omitempty" json:"languageIsoCode,omitempty"`
}

GetPublicHolidaysByDateParams defines parameters for GetPublicHolidaysByDate.

type GetPublicHolidaysByDateResponse

type GetPublicHolidaysByDateResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]HolidayByDateResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetPublicHolidaysByDateResponse

func ParseGetPublicHolidaysByDateResponse(rsp *http.Response) (*GetPublicHolidaysByDateResponse, error)

ParseGetPublicHolidaysByDateResponse parses an HTTP response from a GetPublicHolidaysByDateWithResponse call

func (GetPublicHolidaysByDateResponse) Status

Status returns HTTPResponse.Status

func (GetPublicHolidaysByDateResponse) StatusCode

func (r GetPublicHolidaysByDateResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPublicHolidaysParams

type GetPublicHolidaysParams struct {
	// CountryIsoCode ISO 3166-1 code of the country
	CountryIsoCode string `form:"countryIsoCode" json:"countryIsoCode"`

	// ValidFrom Start of the date range
	ValidFrom openapi_types.Date `form:"validFrom" json:"validFrom"`

	// ValidTo End of the date range
	ValidTo openapi_types.Date `form:"validTo" json:"validTo"`

	// LanguageIsoCode ISO-639-1 code of a language or empty
	LanguageIsoCode *string `form:"languageIsoCode,omitempty" json:"languageIsoCode,omitempty"`

	// SubdivisionCode Code of the subdivision or empty
	SubdivisionCode *string `form:"subdivisionCode,omitempty" json:"subdivisionCode,omitempty"`
}

GetPublicHolidaysParams defines parameters for GetPublicHolidays.

type GetPublicHolidaysResponse

type GetPublicHolidaysResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]HolidayResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetPublicHolidaysResponse

func ParseGetPublicHolidaysResponse(rsp *http.Response) (*GetPublicHolidaysResponse, error)

ParseGetPublicHolidaysResponse parses an HTTP response from a GetPublicHolidaysWithResponse call

func (GetPublicHolidaysResponse) Status

func (r GetPublicHolidaysResponse) Status() string

Status returns HTTPResponse.Status

func (GetPublicHolidaysResponse) StatusCode

func (r GetPublicHolidaysResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetSchoolHolidaysByDateParams

type GetSchoolHolidaysByDateParams struct {
	// Date Date of interest
	Date openapi_types.Date `form:"date" json:"date"`

	// LanguageIsoCode ISO-639-1 code of a language or empty
	LanguageIsoCode *string `form:"languageIsoCode,omitempty" json:"languageIsoCode,omitempty"`
}

GetSchoolHolidaysByDateParams defines parameters for GetSchoolHolidaysByDate.

type GetSchoolHolidaysByDateResponse

type GetSchoolHolidaysByDateResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]HolidayByDateResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetSchoolHolidaysByDateResponse

func ParseGetSchoolHolidaysByDateResponse(rsp *http.Response) (*GetSchoolHolidaysByDateResponse, error)

ParseGetSchoolHolidaysByDateResponse parses an HTTP response from a GetSchoolHolidaysByDateWithResponse call

func (GetSchoolHolidaysByDateResponse) Status

Status returns HTTPResponse.Status

func (GetSchoolHolidaysByDateResponse) StatusCode

func (r GetSchoolHolidaysByDateResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetSchoolHolidaysParams

type GetSchoolHolidaysParams struct {
	// CountryIsoCode ISO 3166-1 code of the country
	CountryIsoCode string `form:"countryIsoCode" json:"countryIsoCode"`

	// ValidFrom Start of the date range
	ValidFrom openapi_types.Date `form:"validFrom" json:"validFrom"`

	// ValidTo End of the date range
	ValidTo openapi_types.Date `form:"validTo" json:"validTo"`

	// LanguageIsoCode ISO-639-1 code of a language or empty
	LanguageIsoCode *string `form:"languageIsoCode,omitempty" json:"languageIsoCode,omitempty"`

	// SubdivisionCode Code of the subdivision or empty
	SubdivisionCode *string `form:"subdivisionCode,omitempty" json:"subdivisionCode,omitempty"`
}

GetSchoolHolidaysParams defines parameters for GetSchoolHolidays.

type GetSchoolHolidaysResponse

type GetSchoolHolidaysResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]HolidayResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetSchoolHolidaysResponse

func ParseGetSchoolHolidaysResponse(rsp *http.Response) (*GetSchoolHolidaysResponse, error)

ParseGetSchoolHolidaysResponse parses an HTTP response from a GetSchoolHolidaysWithResponse call

func (GetSchoolHolidaysResponse) Status

func (r GetSchoolHolidaysResponse) Status() string

Status returns HTTPResponse.Status

func (GetSchoolHolidaysResponse) StatusCode

func (r GetSchoolHolidaysResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetStatisticsPublicHolidaysParams

type GetStatisticsPublicHolidaysParams struct {
	// CountryIsoCode ISO 3166-1 code of the country
	CountryIsoCode string `form:"countryIsoCode" json:"countryIsoCode"`

	// SubdivisionCode Code of the subdivision or empty
	SubdivisionCode *string `form:"subdivisionCode,omitempty" json:"subdivisionCode,omitempty"`
}

GetStatisticsPublicHolidaysParams defines parameters for GetStatisticsPublicHolidays.

type GetStatisticsPublicHolidaysResponse

type GetStatisticsPublicHolidaysResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]StatisticsResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetStatisticsPublicHolidaysResponse

func ParseGetStatisticsPublicHolidaysResponse(rsp *http.Response) (*GetStatisticsPublicHolidaysResponse, error)

ParseGetStatisticsPublicHolidaysResponse parses an HTTP response from a GetStatisticsPublicHolidaysWithResponse call

func (GetStatisticsPublicHolidaysResponse) Status

Status returns HTTPResponse.Status

func (GetStatisticsPublicHolidaysResponse) StatusCode

StatusCode returns HTTPResponse.StatusCode

type GetStatisticsSchoolHolidaysParams

type GetStatisticsSchoolHolidaysParams struct {
	// CountryIsoCode ISO 3166-1 code of the country
	CountryIsoCode string `form:"countryIsoCode" json:"countryIsoCode"`

	// SubdivisionCode Code of the subdivision or empty
	SubdivisionCode *string `form:"subdivisionCode,omitempty" json:"subdivisionCode,omitempty"`
}

GetStatisticsSchoolHolidaysParams defines parameters for GetStatisticsSchoolHolidays.

type GetStatisticsSchoolHolidaysResponse

type GetStatisticsSchoolHolidaysResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]StatisticsResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetStatisticsSchoolHolidaysResponse

func ParseGetStatisticsSchoolHolidaysResponse(rsp *http.Response) (*GetStatisticsSchoolHolidaysResponse, error)

ParseGetStatisticsSchoolHolidaysResponse parses an HTTP response from a GetStatisticsSchoolHolidaysWithResponse call

func (GetStatisticsSchoolHolidaysResponse) Status

Status returns HTTPResponse.Status

func (GetStatisticsSchoolHolidaysResponse) StatusCode

StatusCode returns HTTPResponse.StatusCode

type GetSubdivisionsParams

type GetSubdivisionsParams struct {
	// CountryIsoCode ISO 3166-1 code of the country
	CountryIsoCode string `form:"countryIsoCode" json:"countryIsoCode"`

	// LanguageIsoCode ISO-639-1 code of a language or empty
	LanguageIsoCode *string `form:"languageIsoCode,omitempty" json:"languageIsoCode,omitempty"`
}

GetSubdivisionsParams defines parameters for GetSubdivisions.

type GetSubdivisionsResponse

type GetSubdivisionsResponse struct {
	Body                      []byte
	HTTPResponse              *http.Response
	JSON200                   *[]SubdivisionResponse
	ApplicationproblemJSON400 *ProblemDetails
	ApplicationproblemJSON500 *ProblemDetails
}

func ParseGetSubdivisionsResponse

func ParseGetSubdivisionsResponse(rsp *http.Response) (*GetSubdivisionsResponse, error)

ParseGetSubdivisionsResponse parses an HTTP response from a GetSubdivisionsWithResponse call

func (GetSubdivisionsResponse) Status

func (r GetSubdivisionsResponse) Status() string

Status returns HTTPResponse.Status

func (GetSubdivisionsResponse) StatusCode

func (r GetSubdivisionsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HolidayByDateResponse

type HolidayByDateResponse struct {
	// Comment Additional localized comments
	Comment *[]LocalizedText `json:"comment"`

	// Country Representation of a country reference
	Country *CountryReference `json:"country,omitempty"`

	// Id Unqiue holiday id
	Id openapi_types.UUID `json:"id"`

	// Name Localized names of the holiday
	Name []LocalizedText `json:"name"`

	// Nationwide Is the holiday nationwide?
	Nationwide bool `json:"nationwide"`

	// RegionalScope Regional scope of a holdiay
	RegionalScope *RegionalScope `json:"regionalScope,omitempty"`

	// Subdivisions List of subdivision references
	Subdivisions []SubdivisionReference `json:"subdivisions"`

	// TemporalScope Temporal scope of a holdiay
	TemporalScope *TemporalScope `json:"temporalScope,omitempty"`

	// Type Type of holiday
	Type *HolidayType `json:"type,omitempty"`
}

HolidayByDateResponse Representation of a holiday by date

type HolidayResponse

type HolidayResponse struct {
	// Comment Additional localized comments
	Comment *[]LocalizedText `json:"comment"`

	// EndDate End date of the holiday
	EndDate openapi_types.Date `json:"endDate"`

	// Id Unqiue holiday id
	Id openapi_types.UUID `json:"id"`

	// Name Localized names of the holiday
	Name []LocalizedText `json:"name"`

	// Nationwide Is the holiday nationwide?
	Nationwide bool `json:"nationwide"`

	// RegionalScope Regional scope of a holdiay
	RegionalScope *RegionalScope `json:"regionalScope,omitempty"`

	// StartDate Start date of the holiday
	StartDate openapi_types.Date `json:"startDate"`

	// Subdivisions List of subdivision references
	Subdivisions []SubdivisionReference `json:"subdivisions"`

	// TemporalScope Temporal scope of a holdiay
	TemporalScope *TemporalScope `json:"temporalScope,omitempty"`

	// Type Type of holiday
	Type *HolidayType `json:"type,omitempty"`
}

HolidayResponse Representation of a holiday

type HolidayType

type HolidayType string

HolidayType Type of holiday

const (
	BackToSchool HolidayType = "BackToSchool"
	Bank         HolidayType = "Bank"
	EndOfLessons HolidayType = "EndOfLessons"
	Optional     HolidayType = "Optional"
	Public       HolidayType = "Public"
	School       HolidayType = "School"
)

Defines values for HolidayType.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type LanguageResponse

type LanguageResponse struct {
	// IsoCode ISO-639-1 language code
	IsoCode string `json:"isoCode"`

	// Name Localized language names
	Name []LocalizedText `json:"name"`
}

LanguageResponse Representation of a language as defined in ISO-639-1

type LocalizedText

type LocalizedText struct {
	// Language ISO-639-1 language code
	Language string `json:"language"`

	// Text The localized text
	Text string `json:"text"`
}

LocalizedText A localized text string

type ProblemDetails

type ProblemDetails struct {
	Detail               *string                `json:"detail"`
	Instance             *string                `json:"instance"`
	Status               *int32                 `json:"status"`
	Title                *string                `json:"title"`
	Type                 *string                `json:"type"`
	AdditionalProperties map[string]interface{} `json:"-"`
}

ProblemDetails defines model for ProblemDetails.

func (ProblemDetails) Get

func (a ProblemDetails) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for ProblemDetails. Returns the specified element and whether it was found

func (ProblemDetails) MarshalJSON

func (a ProblemDetails) MarshalJSON() ([]byte, error)

Override default JSON handling for ProblemDetails to handle AdditionalProperties

func (*ProblemDetails) Set

func (a *ProblemDetails) Set(fieldName string, value interface{})

Setter for additional properties for ProblemDetails

func (*ProblemDetails) UnmarshalJSON

func (a *ProblemDetails) UnmarshalJSON(b []byte) error

Override default JSON handling for ProblemDetails to handle AdditionalProperties

type RegionalScope

type RegionalScope string

RegionalScope Regional scope of a holdiay

const (
	Local    RegionalScope = "Local"
	National RegionalScope = "National"
	Regional RegionalScope = "Regional"
)

Defines values for RegionalScope.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type StatisticsResponse

type StatisticsResponse struct {
	// OldestStartDate The oldest holiday start date in the database
	OldestStartDate openapi_types.Date `json:"oldestStartDate"`

	// YoungestStartDate The youngest holiday start date in the database
	YoungestStartDate openapi_types.Date `json:"youngestStartDate"`
}

StatisticsResponse Statistical data of the holidays database

type SubdivisionReference

type SubdivisionReference struct {
	// Code Subdivision code
	Code string `json:"code"`

	// ShortName Short name for display
	ShortName string `json:"shortName"`
}

SubdivisionReference Representation of a subdivision reference

type SubdivisionResponse

type SubdivisionResponse struct {
	// Category Localized categories of the subdivision
	Category []LocalizedText `json:"category"`

	// Children Child subdivisions
	Children *[]SubdivisionResponse `json:"children"`

	// Code Subdivision code
	Code string `json:"code"`

	// Comment Localized comments of the subdivision
	Comment []LocalizedText `json:"comment"`

	// IsoCode ISO 3166-2 subdivision code (if defined)
	IsoCode *string `json:"isoCode"`

	// Name Localized names of the subdivision
	Name []LocalizedText `json:"name"`

	// OfficialLanguages Official languages as ISO-639-1 codes
	OfficialLanguages []string `json:"officialLanguages"`

	// ShortName Short name for display
	ShortName string `json:"shortName"`
}

SubdivisionResponse Representation of a subdivision

type TemporalScope

type TemporalScope string

TemporalScope Temporal scope of a holdiay

const (
	FullDay TemporalScope = "FullDay"
	HalfDay TemporalScope = "HalfDay"
)

Defines values for TemporalScope.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL