Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -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)
43 changes: 43 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -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:
37 changes: 37 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -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']
54 changes: 54 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
@@ -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 <https://dev.pokemontcg.io/>`_.

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
23 changes: 23 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -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 <https://pokemontcg.io/>`_.
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`

11 changes: 11 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -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.
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -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