Browse Source

switched to flask theme

master
Julio Biason 11 years ago
parent
commit
547c944bb9
  1. 3
      .gitmodules
  2. 1
      doc/_themes/flask-sphinx-themes
  3. 79
      doc/client/index.rst
  4. 21
      doc/client/users_and_tokens.rst
  5. 28
      doc/conf.py

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "doc/_themes/flask-sphinx-themes"]
path = doc/_themes/flask-sphinx-themes
url = https://github.com/mitsuhiko/flask-sphinx-themes.git

1
doc/_themes/flask-sphinx-themes vendored

@ -0,0 +1 @@
Subproject commit 1cc44686f0f9dad27cce2c9d16cf42f97bc87dbd

79
doc/client/index.rst

@ -0,0 +1,79 @@
About the API
==============
A few things you must know before diving into the API:
Everything is JSON
-------------------
Every request should have a JSON payload; anything else will be refused and
return a 400 status. For example:
.. sourcecode:: http
POST /randomendpoint
Host: example.com
Accept: text/html
Content-Type: application/x-www-form-urlencoded
field1=value&field2=value
The response will always be:
.. sourcecode:: http
HTTP/1.1 400 Bad Request
Content-Type: text/json
{ "status": "ERROR", "message": "Request MUST be in JSON format" }
If instead you do a proper JSON request with:
.. sourcecode:: http
POST /randomendpoint
Host: example.com
Content-type: text/json
{ "field1": "value", "field2": "value" }
Then everything would go fine.
Standard responses
-------------------
Responses will always have a ``status`` parameter with the result of the
operation -- more fields may be also returned, depending on the request.
Successful requests with have the value ``OK`` for ``status`` -- and, again,
more fields may be returned in most cases. Also, the HTTP status code will
**always** be 200.
In case of failure, ``status`` will have the text ``ERROR`` (in all caps) and
a ``message`` field will have the reason for the error -- and, as success, it
may contain more fields with information about the error. For different errors
in the operation there will be a different HTTP status. We tried as hard as
possible to give each error a meaningful HTTP status, even if this sometimes
wouldn't make much sense -- for example, if you try to change the ownership of
a group and the group doesn't exist, you'll get a 404 status; if the new owner
doesn't exist, instead of a proper 404, we will return a 412 status, not
because there is a precondition error in the headers, but because we need
a different code to point that the new user does not exist.
Redirects
----------
All URLs must end with "/"; if you forget to add them in the URL, you'll
receive a redirect to the path with "/".
API
----
.. toctree::
:maxdepth: 2
users_and_tokens
.. autoflask:: luncho.server:app
:blueprints: token, users
:undoc-endpoints: static

21
doc/client/users_and_tokens.rst

@ -0,0 +1,21 @@
Users and Tokens
=================
Token
------
All requests require an access token to be valid. The token is valid for a
whole day and, unless you don't have the access token or it expired, you
should use this request to get a valid token:
.. autoflask:: luncho.server:app
:blueprints: token
:undoc-endpoints: static
Users
------
.. autoflask:: luncho.server:app
:blueprints: users
:undoc-endpoints: static

28
doc/conf.py

@ -19,6 +19,7 @@ import os
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..')) sys.path.insert(0, os.path.abspath('..'))
sys.path.append(os.path.abspath('_themes/flask-sphinx-themes'))
# -- General configuration ------------------------------------------------ # -- General configuration ------------------------------------------------
@ -103,7 +104,8 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'default' #html_theme = 'default'
html_theme = 'flask'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
@ -111,7 +113,7 @@ html_theme = 'default'
#html_theme_options = {} #html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [] html_theme_path = ['_themes/flask-sphinx-themes/']
# The name for this set of Sphinx documents. If None, it defaults to # The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation". # "<project> v<release> documentation".
@ -187,22 +189,22 @@ htmlhelp_basename = 'Luncho-odoc'
# -- Options for LaTeX output --------------------------------------------- # -- Options for LaTeX output ---------------------------------------------
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). # The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper', #'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt'). # The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt', #'pointsize': '10pt',
# Additional stuff for the LaTeX preamble. # Additional stuff for the LaTeX preamble.
#'preamble': '', #'preamble': '',
} }
# Grouping the document tree into LaTeX files. List of tuples # Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, # (source start file, target name, title,
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
('index', 'Luncho-o.tex', u'Luncho-o Documentation', ('index', 'Luncho-o.tex', u'Luncho-o Documentation',
u'Julio Biason', 'manual'), u'Julio Biason', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
@ -245,9 +247,9 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'Luncho-o', u'Luncho-o Documentation', ('index', 'Luncho-o', u'Luncho-o Documentation',
u'Julio Biason', 'Luncho-o', 'One line description of project.', u'Julio Biason', 'Luncho-o', 'Lunch for groups.',
'Miscellaneous'), 'Miscellaneous'),
] ]
# Documents to append as an appendix to all manuals. # Documents to append as an appendix to all manuals.

Loading…
Cancel
Save