diff --git a/Makefile b/Makefile index 8ec3528..e1a5d15 100644 --- a/Makefile +++ b/Makefile @@ -35,5 +35,5 @@ coverage-html: env unit tox: env @env/bin/tox -#docs: - #@cd mtgsdk/docs && make html && open _build/html/index.html +docs: + @cd docs && $(MAKE) html && open _build/html/index.html diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 0000000..b36340e --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,43 @@ +API Reference +============= + +This section provides a detailed reference for all the classes and modules in the Pokémon TCG SDK. + +Resource Objects +---------------- + +These are the main classes you'll use to interact with the API. + +.. automodule:: pokemontcgsdk.card + :members: + +.. automodule:: pokemontcgsdk.set + :members: + +.. automodule:: pokemontcgsdk.type + :members: + +.. automodule:: pokemontcgsdk.subtype + :members: + +.. automodule:: pokemontcgsdk.supertype + :members: + +.. automodule:: pokemontcgsdk.rarity + :members: + +Querying +-------- + +The `QueryBuilder` class provides a flexible way to build complex queries. + +.. automodule:: pokemontcgsdk.querybuilder + :members: + +Configuration +------------- + +The `RestClient` is used to configure the SDK, such as setting the API key. + +.. automodule:: pokemontcgsdk.restclient + :members: \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..bb3dbcf --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,37 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'Pokemon TCG SDK' +copyright = '2024, PokemonTCG' +author = 'PokemonTCG' +release = '1.0.0' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +import os +import sys +sys.path.insert(0, os.path.abspath('..')) + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode' +] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'alabaster' +html_static_path = ['_static'] diff --git a/docs/getting_started.rst b/docs/getting_started.rst new file mode 100644 index 0000000..cee5886 --- /dev/null +++ b/docs/getting_started.rst @@ -0,0 +1,54 @@ + +Getting Started +=============== + +This guide will walk you through the basics of using the Pokémon TCG SDK. + +Setting Your API Key +-------------------- + +Before you can fetch data, you need to set your API key. You can obtain a free API key from the `pokemontcg.io developer portal `_. + +You can set your API key in two ways: + +**1. Environment Variable** + +Set the `POKEMONTCG_IO_API_KEY` environment variable: + +.. code-block:: bash + + export POKEMONTCG_IO_API_KEY='your-api-key' + +**2. Configure the RestClient** + +Alternatively, you can configure the API key directly in your code: + +.. code-block:: python + + from pokemontcgsdk import RestClient + + RestClient.configure('your-api-key') + +Importing Resources +------------------- + +The SDK provides several resource classes to interact with the API. The most common ones are `Card` and `Set`. + +.. code-block:: python + + from pokemontcgsdk import Card, Set, Type, Subtype, Supertype, Rarity + +Fetching a Card +--------------- + +You can fetch a specific card by its ID using the `find()` method: + +.. code-block:: python + + from pokemontcgsdk import Card + + # Find the Charizard card from the Base set + card = Card.find('base1-4') + + print(card.name) # Output: Charizard + print(card.hp) # Output: 120 \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..a5832fd --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,23 @@ +Pokemon TCG SDK documentation +============================= + +The Pokémon TCG SDK for Python is a wrapper around the official `Pokémon TCG API `_. +It allows developers to easily search and retrieve Pokémon card and set data. + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + installation + getting_started + api + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 0000000..11ab5d4 --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,11 @@ + +Installation +============ + +To install the Pokémon TCG SDK, you can use pip: + +.. code-block:: bash + + pip install pokemontcgsdk + +The SDK officially supports Python 3.9 and higher. \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..954237b --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd