Skip to main content

TimeTree SDK

Project description

TimeTree SDK for Python

TimeTree API SDK for Python.

Installing

$ pip install timetree-sdk

Usage

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

oauth_authorize_url = TimeTreeApi.get_oauth_authorize_url('CLIENT_ID', 'REDIRECT_URI', 'RESPONSE_TYPE', 'STATE')

User

get current user

user = api.get_current_user()
print(user.data.attributes.name) # user name

Calendar

get calendars

calendars = api.get_calendars()
print(calendars.data[0].attributes.name) # first calendar name

get calendar

calendar = api.get_calendar('CALENDAR_ID')
print(calendar.data.attributes.name) # calendar name

get calendar labels

labels = api.get_calendar_labels('CALENDAR_ID')
print(labels.data[0].attributes.name) # first calendar's label name

get calendar members

members = api.get_calendar_members('CALENDAR_ID')
print(members.data[0].attributes.name) # first calendar's member name

Event

get event

event = api.get_event('CALENDAR_ID', 'EVENT_ID')
print(event.data.attributes.title) # event title

get upcoming events

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

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

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

status_code = api.delete_event('CALENDAR_ID', 'EVENT_ID')
print(status_code) # 204 on success

Event Comment

create comment to event

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tooniez_timetree_sdk-0.0.1.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tooniez_timetree_sdk-0.0.1-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file tooniez_timetree_sdk-0.0.1.tar.gz.

File metadata

  • Download URL: tooniez_timetree_sdk-0.0.1.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for tooniez_timetree_sdk-0.0.1.tar.gz
Algorithm Hash digest
SHA256 00cdf7f84874411528f8432aa4c472207341a2b24a43a592f4cdeec9b0212441
MD5 06d1406e6585e6dec2d7f4ffd54f228e
BLAKE2b-256 25c30c5510478255d35d4a84f2d913ca39fbce4de418c92c61b58b8e9045cf45

See more details on using hashes here.

File details

Details for the file tooniez_timetree_sdk-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tooniez_timetree_sdk-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9aa7fbe1ead422e6789c16c579bd94d5fa0badf104b10f7fe0ece78016ccfb26
MD5 7dcf5d88cbe8ed81e5b06a80714a5fd5
BLAKE2b-256 d125a0f07e62654c1499cdc62714b92d482c8bd2b0570b9fca6e55050a74b7a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page