# TimeTree SDK for Python
[TimeTree API](https://developers.timetreeapp.com/en/docs/api) SDK for Python.
# Installing
```
$ pip install tooniez-timetree-sdk
```
# Usage
```python
from timetree_sdk import TimeTreeApi
api = TimeTreeApi('API_ACCESS_TOKEN')
calendar = api.get_calendar('CALENDAR_ID')
print(calendar.data.attributes.name) # calendar name
```
# API
## Oauth
### get oauth authorize url
```python
oauth_authorize_url = TimeTreeApi.get_oauth_authorize_url('CLIENT_ID', 'REDIRECT_URI', 'RESPONSE_TYPE', 'STATE')
```
## User
### get current user
```python
user = api.get_current_user()
print(user.data.attributes.name) # user name
```
## Calendar
### get calendars
```python
calendars = api.get_calendars()
print(calendars.data[0].attributes.name) # first calendar name
```
### get calendar
```python
calendar = api.get_calendar('CALENDAR_ID')
print(calendar.data.attributes.name) # calendar name
```
### get calendar labels
```python
labels = api.get_calendar_labels('CALENDAR_ID')
print(labels.data[0].attributes.name) # first calendar's label name
```
### get calendar members
```python
members = api.get_calendar_members('CALENDAR_ID')
print(members.data[0].attributes.name) # first calendar's member name
```
## Event
### get event
```python
event = api.get_event('CALENDAR_ID', 'EVENT_ID')
print(event.data.attributes.title) # event title
```
### get upcoming events
```python
events = api.get_upcoming_events('CALENDAR_ID', 'Asia/Tokyo', 7)
print(events.data[0].attributes.title) # most recent event title in 7 days
```
### create event
```python
event = Event(
data=EventData(
attributes=EventAttributes(
title='Title',
category='schedule',
all_day=False,
start_at='2020-04-04T11:00:00.000Z',
end_at='2020-04-04T13:00:00.000Z',
description='Description',
location='Location',
start_timezone='Japan',
end_timezone='Japan'
),
relationships=EventRelationships(
label=EventRelationshipsLabel(
data=EventRelationshipsLabelData(
id='LABEL_ID',
type='label'
)
),
attendees=EventRelationshipsAttendees(
data=[EventRelationshipsAttendeesData(
id='USER_ID',
type='user'
)]
)
)
)
)
response = api.create_event('CALENDAR_ID', event)
print(response.data.attributes.title) # Title
```
### update event
```python
event = Event(
data=EventData(
attributes=EventAttributes(
title='Updated Title',
category='schedule',
all_day=False,
start_at='2020-04-04T11:30:00.000Z',
end_at='2020-04-04T13:30:00.000Z',
description='Description',
location='Location',
start_timezone='Japan',
end_timezone='Japan'
),
relationships=EventRelationships(
label=EventRelationshipsLabel(
data=EventRelationshipsLabelData(
id='LABEL_ID',
type='label'
)
),
attendees=EventRelationshipsAttendees(
data=[EventRelationshipsAttendeesData(
id='USER_ID',
type='user'
)]
)
)
)
)
response = api.create_event('CALENDAR_ID', 'EVENT_ID', event)
print(response.data.attributes.title) # Updated Title
```
### delete event
```python
status_code = api.delete_event('CALENDAR_ID', 'EVENT_ID')
print(status_code) # 204 on success
```
## Event Comment
### create comment to event
```python
comment = EventComment(
data=EventCommentData(
attributes=EventCommentAttributes(
content='Hello, world'
)
)
)
event_comment = api.create_event_comment('CALENDAR_ID', 'EVENT_ID', comment)
print(event_comment.data.attributes.content) # Hello, world
```
# Documentation
Official API documentation
English: https://developers.timetreeapp.com/en/docs/api
Japanese: https://developers.timetreeapp.com/ja/docs/api
Raw data
{
"_id": null,
"home_page": "https://github.com/tooniez/tooniez-timetree-sdk",
"name": "tooniez-timetree-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "timetree api sdk",
"author": "tooniez",
"author_email": "tooni22@proton.me",
"download_url": "https://files.pythonhosted.org/packages/48/44/360fee54c9e0eac79e0c86499a4471af056c7087396dfa8eb080d06956d9/tooniez-timetree-sdk-0.0.5.tar.gz",
"platform": null,
"description": "# TimeTree SDK for Python\n\n[TimeTree API](https://developers.timetreeapp.com/en/docs/api) SDK for Python.\n\n# Installing\n\n```\n$ pip install tooniez-timetree-sdk\n```\n\n# Usage\n\n```python\nfrom timetree_sdk import TimeTreeApi\n\napi = TimeTreeApi('API_ACCESS_TOKEN')\ncalendar = api.get_calendar('CALENDAR_ID')\nprint(calendar.data.attributes.name) # calendar name\n```\n\n# API\n\n## Oauth\n\n### get oauth authorize url\n\n```python\noauth_authorize_url = TimeTreeApi.get_oauth_authorize_url('CLIENT_ID', 'REDIRECT_URI', 'RESPONSE_TYPE', 'STATE')\n```\n\n## User\n\n### get current user\n\n```python\nuser = api.get_current_user()\nprint(user.data.attributes.name) # user name\n```\n\n## Calendar\n\n### get calendars\n\n```python\ncalendars = api.get_calendars()\nprint(calendars.data[0].attributes.name) # first calendar name\n```\n\n### get calendar\n\n```python\ncalendar = api.get_calendar('CALENDAR_ID')\nprint(calendar.data.attributes.name) # calendar name\n```\n\n### get calendar labels\n\n```python\nlabels = api.get_calendar_labels('CALENDAR_ID')\nprint(labels.data[0].attributes.name) # first calendar's label name\n```\n\n### get calendar members\n\n```python\nmembers = api.get_calendar_members('CALENDAR_ID')\nprint(members.data[0].attributes.name) # first calendar's member name\n```\n\n## Event\n\n### get event\n\n```python\nevent = api.get_event('CALENDAR_ID', 'EVENT_ID')\nprint(event.data.attributes.title) # event title\n```\n\n### get upcoming events\n\n```python\nevents = api.get_upcoming_events('CALENDAR_ID', 'Asia/Tokyo', 7)\nprint(events.data[0].attributes.title) # most recent event title in 7 days\n```\n\n### create event\n\n```python\nevent = Event(\n data=EventData(\n attributes=EventAttributes(\n title='Title',\n category='schedule',\n all_day=False,\n start_at='2020-04-04T11:00:00.000Z',\n end_at='2020-04-04T13:00:00.000Z',\n description='Description',\n location='Location',\n start_timezone='Japan',\n end_timezone='Japan'\n ),\n relationships=EventRelationships(\n label=EventRelationshipsLabel(\n data=EventRelationshipsLabelData(\n id='LABEL_ID',\n type='label'\n )\n ),\n attendees=EventRelationshipsAttendees(\n data=[EventRelationshipsAttendeesData(\n id='USER_ID',\n type='user'\n )]\n )\n )\n )\n)\nresponse = api.create_event('CALENDAR_ID', event)\nprint(response.data.attributes.title) # Title\n```\n\n### update event\n\n```python\nevent = Event(\n data=EventData(\n attributes=EventAttributes(\n title='Updated Title',\n category='schedule',\n all_day=False,\n start_at='2020-04-04T11:30:00.000Z',\n end_at='2020-04-04T13:30:00.000Z',\n description='Description',\n location='Location',\n start_timezone='Japan',\n end_timezone='Japan'\n ),\n relationships=EventRelationships(\n label=EventRelationshipsLabel(\n data=EventRelationshipsLabelData(\n id='LABEL_ID',\n type='label'\n )\n ),\n attendees=EventRelationshipsAttendees(\n data=[EventRelationshipsAttendeesData(\n id='USER_ID',\n type='user'\n )]\n )\n )\n )\n)\nresponse = api.create_event('CALENDAR_ID', 'EVENT_ID', event)\nprint(response.data.attributes.title) # Updated Title\n```\n\n### delete event\n\n```python\nstatus_code = api.delete_event('CALENDAR_ID', 'EVENT_ID')\nprint(status_code) # 204 on success\n```\n\n## Event Comment\n\n### create comment to event\n\n```python\ncomment = EventComment(\n data=EventCommentData(\n attributes=EventCommentAttributes(\n content='Hello, world'\n )\n )\n)\nevent_comment = api.create_event_comment('CALENDAR_ID', 'EVENT_ID', comment)\nprint(event_comment.data.attributes.content) # Hello, world\n```\n\n# Documentation\n\nOfficial API documentation\n\nEnglish: https://developers.timetreeapp.com/en/docs/api\n\nJapanese: https://developers.timetreeapp.com/ja/docs/api\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "TimeTree SDK",
"version": "0.0.5",
"project_urls": {
"Homepage": "https://github.com/tooniez/tooniez-timetree-sdk"
},
"split_keywords": [
"timetree",
"api",
"sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "56cd63bd166a102d721e02a0805acf6a644417b1d560c3ab6f4c42c9bed6e9b3",
"md5": "331dce7f7d805a647d43d9af4f7e6453",
"sha256": "5f3513930e65a78ea2fba08e8cad85981880bfd4370bffca20d7e58eb8932645"
},
"downloads": -1,
"filename": "tooniez_timetree_sdk-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "331dce7f7d805a647d43d9af4f7e6453",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6646,
"upload_time": "2024-05-09T06:54:38",
"upload_time_iso_8601": "2024-05-09T06:54:38.798355Z",
"url": "https://files.pythonhosted.org/packages/56/cd/63bd166a102d721e02a0805acf6a644417b1d560c3ab6f4c42c9bed6e9b3/tooniez_timetree_sdk-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4844360fee54c9e0eac79e0c86499a4471af056c7087396dfa8eb080d06956d9",
"md5": "601192dcc361d3693f16fb89ddce0e52",
"sha256": "bd039c342bb1a35792458c216ef48e492ac2ffbda63bea3dcf42c8438ce6a5ea"
},
"downloads": -1,
"filename": "tooniez-timetree-sdk-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "601192dcc361d3693f16fb89ddce0e52",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6621,
"upload_time": "2024-05-09T06:54:46",
"upload_time_iso_8601": "2024-05-09T06:54:46.959464Z",
"url": "https://files.pythonhosted.org/packages/48/44/360fee54c9e0eac79e0c86499a4471af056c7087396dfa8eb080d06956d9/tooniez-timetree-sdk-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-09 06:54:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tooniez",
"github_project": "tooniez-timetree-sdk",
"github_not_found": true,
"lcname": "tooniez-timetree-sdk"
}