Skip to content

Commit

Permalink
Initial documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
zsalkus committed Jun 19, 2020
1 parent 23c240c commit ffaeb38
Show file tree
Hide file tree
Showing 66 changed files with 9,134 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode
_build
_ext/__pycache__
20 changes: 20 additions & 0 deletions 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)
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<img src="https://dev.ishareworks.org/_static/logo.svg" alt="iSHARE">

# iSHARE Documentation
The documentation is built with [Sphinx](https://github.com/sphinx-doc/sphinx) using a [rtd theme](https://github.com/readthedocs/sphinx_rtd_theme). The documentation is open sourced to allow the readers to directly contribute on its improvements.

# HTML Generation
First, make sure you have [Sphinx](http://sphinx-doc.org/) installed. To view the generated HTML before creating a pull request run the following command in the folder where make.bat is located:

```
C:\Documentation> .\make.bat html
```

In case not all HTML updated, this could be solved by the following command:

```
C:\Documentation> .\make.bat clean
```

# Contribution
If you find anything that could be improved, feel free to create a pull request to the master branch.
45 changes: 45 additions & 0 deletions _ext/edit_on_github.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
"""
Sphinx extension to add ReadTheDocs-style "Edit on GitHub" links to the
sidebar.
Loosely based on https://github.com/astropy/astropy/pull/347
"""

import os
import warnings


__licence__ = 'BSD (3 clause)'


def get_github_url(app, view, path):
return 'https://github.com/{project}/{view}/{branch}/{path}'.format(
project=app.config.edit_on_github_project,
view=view,
branch=app.config.edit_on_github_branch,
path=path)


def html_page_context(app, pagename, templatename, context, doctree):
if templatename != 'page.html':
return

if not app.config.edit_on_github_project:
warnings.warn("edit_on_github_project not specified")
return

path = os.path.relpath(doctree.get('source'), app.builder.srcdir)
show_url = get_github_url(app, 'blob', path)
edit_url = get_github_url(app, 'edit', path)

context['show_on_github_url'] = show_url
context['edit_on_github_url'] = edit_url

context['display_github'] = True
context['github_user'] = app.config.edit_on_github_project.split('/')[0]
context['github_version'] = app.config.edit_on_github_branch + '/'
context['github_repo'] = app.config.edit_on_github_project.split('/')[1]

def setup(app):
app.add_config_value('edit_on_github_project', '', True)
app.add_config_value('edit_on_github_branch', 'master', True)
app.connect('html-page-context', html_page_context)
Binary file added _static/favicon.ico
Binary file not shown.
15 changes: 15 additions & 0 deletions _static/ishare.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.wy-side-nav-search {
background-color: #EFEFEF;
}

/* since we use definition lists only for source code,
it's more beautiful to have them without rst theme format */
.rst-content dl dt {
display: block !important;
margin: 0 !important;
font-size: 16px !important;
background: #fcfcfc !important;
border: 0 !important;
padding: 0 0 6px 0 !important;
color: #000000 !important;
}
138 changes: 138 additions & 0 deletions _static/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions _templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% extends "!layout.html" %}
{% block extrahead %}
<link href="{{ pathto("_static/ishare.css", True) }}" rel="stylesheet" type="text/css">
{% endblock %}
15 changes: 15 additions & 0 deletions _templates/sourcelink.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{%- if show_source and has_source and sourcename %}
<h3>{{ _('This Page') }}</h3>
<ul class="this-page-menu">
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
rel="nofollow">{{ _('Show Source') }}</a></li>
{%- if show_on_github_url %}
<li><a href="{{ show_on_github_url }}"
rel="nofollow">{{ _('Show on GitHub') }}</a></li>
{%- endif %}
{%- if edit_on_github_url %}
<li><a href="{{ edit_on_github_url }}"
rel="nofollow">{{ _('Edit on GitHub') }}</a></li>
{%- endif %}
</ul>
{%- endif %}
50 changes: 50 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
trigger:
branches:
include:
- master
paths:
exclude:
- README.md

pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python36:
python.version: '3.6'
architecture: 'x64'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
displayName: 'Use python $(python.version)'

- script: |
pip install --upgrade sphinx
displayName: 'Install sphinx'

- script: |
pip install --upgrade sphinx_rtd_theme
displayName: 'Install sphinx_rtd_theme'

- task: CmdLine@2
inputs:
script: 'make html'
workingDirectory: '$(build.sourcesdirectory)'
displayName: 'Compile documentation'

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(build.sourcesDirectory)/_build/html'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
replaceExistingArchive: true

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
displayName: 'Publish documentation as artifact'
191 changes: 191 additions & 0 deletions common/capabilities.rst

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions common/token.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
.. _refM2MToken:

Access Token (M2M)
==================

This endpoint is used to obtain an OAuth access token from the party. The format of ``access_token`` is not defined by this specification. They are left to the server and should be opaque to the Service Consumer.

Request
-------

HTTP methods
~~~~~~~~~~~~

* POST

Headers
~~~~~~~

``Content-Type``
| **String**.
| Defines request body content type. MUST be equal to *application/x-www-form-urlencoded*.
Parameters
~~~~~~~~~~

``grant_type``
| **String**.
| OAuth 2.0 grant type. MUST be equal to *client_credentials*.
``scope``
| **String**. *Optional*.
| OAuth 2.0 scope. Defaults to *iSHARE* if not provided, indicating all rights of the Service Consumer are requested. Other values allow the Service Consumer to get tokens that do not include all rights the Service Consumer has.
``client_id``
| **String**.
| OpenID Connect 1.0 client ID. Used in iSHARE for all client identification for OAuth/OpenID Connect. MUST contain a valid iSHARE identifier of the Service Consumer.
``client_assertion_type``
| **String**.
| OpenID Connect 1.0 client assertion type. Used in iSHARE for all client identification for OAuth/OpenID Connect. MUST be equal to *urn:ietf:params:oauth:client-assertion-type:jwt-bearer*.
``client_assertion``
| **String (JWT)**.
| OpenID Connect 1.0 client assertion. Used in iSHARE for all client identification for OAuth/OpenID Connect. MUST contain :ref:`JWT token conform iSHARE specifications<refJWT>`, signed by the client.
Example
~~~~~~~

::

> Content-Type: application/x-www-form-urlencoded

POST connect/token

grant_type=client_credentials&
scope=iSHARE&
client_id=EU.EORI.NL000000001&
client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer&
client_assertion=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsIng1YyI6WyJNSUlFZ1RDQ0FtbWdBd0lCQWdJSU45VmlDRGkzQndzd0RRWUpLb1pJaHZjTkFRRUxCUUF3U0RFWk1CY0dBMVVFQXd3UWFWTklRVkpGVkdWemRFTkJYMVJNVXpFTk1Bc0dBMVVFQ3d3RVZHVnpkREVQTUEwR0ExVUVDZ3dHYVZOSVFWSkZNUXN3Q1FZRFZRUUdFd0pPVERBZUZ3MHhPVEF5TVRVeE1UUTJNVFZhRncweU1UQXlNVFF4TVRRMk1UVmFNRUl4RlRBVEJnTlZCQU1NREVGQ1F5QlVjblZqYTJsdVp6RWNNQm9HQTFVRUJSTVRSVlV1UlU5U1NTNU9UREF3TURBd01EQXdNVEVMTUFrR0Ex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Qu1A_m5VB0O_XD4JGLwrwjD2d-UE4Fhyy4ilKSPKFpqhoAi2qPkmonZki-RaYoPkrq49LW_v8OVKW7yFJvEDIwph0hEcWxl0udyeu3Cy35NWMnLZdu6gp2f4yxOq3FPrufO5bT0aihioI04V8avggzVJdVcrDTK9Q0Hzhs-22VamkncUZqPvRmo_uwypNHFBg

(URL encoding removed, and line breaks added for readability)

Response
--------

Headers
~~~~~~~

``Content-Type``
| **String**.
| Defines response body content type. MUST be equal to *application/json*.
HTTP status codes
~~~~~~~~~~~~~~~~~

200 OK
| When a valid request is sent an OK result should be returned.
400 Bad Request
| When invalid request is sent a Bad Request result should be returned.
Parameters
~~~~~~~~~~

``access_token``
| **String**.
| The access token which will be used to access endpoints that require authorization.
``token_type``
| **String**.
| Since we follow OAuth 2.0 specification value should be equal to *Bearer*.
``expires_in``
| **Integer**.
| Access token expiration time in seconds. Should be *3600*.
200 OK Example
~~~~~~~~~~~~~~

::

< Content-Type: application/json

{
"access_token": "aW2ys9NGE8RjHPZ4mytQivkWJO5HGQCYJ7VyMBGGDLIOw",
"token_type": "Bearer",
"expires_in": 3600
}

(Line breaks added for readability)
75 changes: 75 additions & 0 deletions conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# 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.

import os
import sys
sys.path.insert(0, os.path.abspath('_ext'))


# -- Project information -----------------------------------------------------

project = 'dev.ishareworks.org'
copyright = '2020, iSHARE'
author = 'iSHARE'

# The full version, including alpha/beta/rc tags
release = '1.0.0'


# -- General configuration ---------------------------------------------------

import sphinx_rtd_theme

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx_rtd_theme',
'edit_on_github'
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'

html_theme_options = {
'canonical_url': '',
'logo_only': True,
'display_version': False,
'sticky_navigation': True,
'navigation_depth': -1,
'collapse_navigation': False
}

html_logo = '_static/logo.svg'

html_favicon = '_static/favicon.ico'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

edit_on_github_project = 'iSHAREScheme/Documentation'
edit_on_github_branch = 'master'
Loading

0 comments on commit ffaeb38

Please sign in to comment.