diff --git a/commands.yaml b/doc/commands.yaml similarity index 100% rename from commands.yaml rename to doc/commands.yaml diff --git a/queries.yaml b/doc/queries.yaml similarity index 100% rename from queries.yaml rename to doc/queries.yaml diff --git a/scratch.py b/scratch.py deleted file mode 100644 index e69de29..0000000 diff --git a/generate_schema_file.py b/scripts/generate_schema_file.py similarity index 100% rename from generate_schema_file.py rename to scripts/generate_schema_file.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..64feda2 --- /dev/null +++ b/setup.py @@ -0,0 +1,24 @@ +from setuptools import setup, find_packages + +VERSION = '0.0.1' +DESCRIPTION = 'Python package to interface with TeamSnap API' +LONG_DESCRIPTION = 'https://www.teamsnap.com/documentation' + +# Setting up +setup( + name="teamsnap-python", + version=VERSION, + author="Anthony Correa", + author_email="a@correa.co", + description=DESCRIPTION, + long_description=LONG_DESCRIPTION, + packages=find_packages(), + install_requires=[ + "api-client", + "collection_json" + ], + + keywords=['teamsnap'], + classifiers=[ + ] +) \ No newline at end of file diff --git a/teamsnap/api.py b/teamsnap/api.py index c467c1f..ec15d53 100644 --- a/teamsnap/api.py +++ b/teamsnap/api.py @@ -4,7 +4,6 @@ from apiclient import APIClient, HeaderAuthentication, JsonResponseHandler from collection_json import Collection import json - class ApiObject(): rel = None diff --git a/teamsnap/models.py b/teamsnap/models.py deleted file mode 100644 index 9194c61..0000000 --- a/teamsnap/models.py +++ /dev/null @@ -1,21 +0,0 @@ -from dataclasses import dataclass -from typing import Optional -from teamsnap.api import TeamSnap -from urllib.parse import urljoin - -class Item: - id: int - type: str - data: dict = {} - - def __init__(self, client:TeamSnap, rel, id, data: dict = {}): - self._client = client - self.type = rel - self.id = id - self._data = data - - @property - def data(self): - if self._data: return self._data - else: - return self._client.get_item(self.type, self.id) diff --git a/tests/credentials.py b/tests/credentials.py deleted file mode 100644 index 4640e5d..0000000 --- a/tests/credentials.py +++ /dev/null @@ -1,2 +0,0 @@ -token="u2SqDq78FumVvhkt1D-V1CQ2ZIaB-nUVlzGwd1YhGtA" -team_id = 7644001 \ No newline at end of file diff --git a/tests/private_test.py b/tests/private_test.py index af50b38..d44d861 100644 --- a/tests/private_test.py +++ b/tests/private_test.py @@ -1,21 +1,18 @@ import unittest -from credentials import team_id as TEAM_ID -from credentials import token as TOKEN from teamsnap import TeamSnap -from teamsnap.models import Item from teamsnap.api import Team, Event, Availability, Me, ApiObject -import teamsnap -TEAM_ID = 7644001 -EVENT_1 = 239261604 +from os import getenv -c = TeamSnap(token=TOKEN) -es = Event.search(c, team_id=TEAM_ID) -q1 = c.query("events", "search", team_id=TEAM_ID) -team = c.teams.get(TEAM_ID) -event = Item(client=c, rel="events", id=EVENT_1) -# event = c.events.get(239261604) -col = c.get_collection(rel="events", id=EVENT_1) -print(event.data) +TEAMSNAP_TOKEN = getenv('TEAMSNAP_TOKEN') +TEAMSNAP_TEAM = getenv('TEAMSNAP_TEAM') +TEAMSNAP_EVENT = getenv('TEAMSNAP_EVENT') + +c = TeamSnap(token=TEAMSNAP_TOKEN) +es = Event.search(c, team_id=TEAMSNAP_TEAM) +q1 = c.query("events", "search", team_id=TEAMSNAP_TEAM) +team = c.teams.get(TEAMSNAP_TEAM) +event = c.events.get(TEAMSNAP_EVENT) +col = c.get_collection(rel="events", id=TEAMSNAP_TEAM) pass # q2 = c.events.search(team_id=TEAM_ID) # a = c.availabilities.search(event_id=q2[0]['id'])