Creating a custom google calendar component using import instead of API

There is an API to fetch calendar events using a bearer token at

http://homeassistant:8123/api/calendars/calendar.name?start=2019-12-09T00:00:00Z&end=2019-12-10T00:00:00Z

If I wanna do this internally in the custom component I’m building I have got the information that I should import the calendar component. Im struggling how to utilize this component to fetch the same data as I did with the HTTP API.

There is also the Google Calendar component, is it that one I should use instead since Im only doing google calendar data?

How would I fetch the same data as doing with the API but with the imported component?

Thank you

Hi @myhrmans ,

could you please tell us where you found the api documentation for that /api/calendars endpoint?
It’s not mentioned at https://developers.home-assistant.io/docs/api/rest

I’d like to use it to create a custom sensor.