[Fusionforge-commits] FusionForge branch feature/plugin-repositoryapi updated. v6.0.5-1355-gc1a3f8c

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Mar 22 15:52:36 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, feature/plugin-repositoryapi has been updated
       via  c1a3f8c1a255c76a858f5d32107a8b38424d77bd (commit)
       via  015afe85845b32fbebf7ee38d23b63fab4297418 (commit)
      from  3b591818e98e1c8d5057752f01c107aa93fc8312 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=c1a3f8c1a255c76a858f5d32107a8b38424d77bd

commit c1a3f8c1a255c76a858f5d32107a8b38424d77bd
Author: Matthieu FAURE <mfaure at asqatasun.org>
Date:   Fri Mar 10 18:51:02 2017 +0100

    API Documentation

diff --git a/src/plugins/repositoryapi/Documentation/API_documentation.md b/src/plugins/repositoryapi/Documentation/API_documentation.md
new file mode 100644
index 0000000..4f45c70
--- /dev/null
+++ b/src/plugins/repositoryapi/Documentation/API_documentation.md
@@ -0,0 +1,125 @@
+# API Documentation
+
+The SOAP API of the plugin provides the following commands:
+
+* `repositoryapi_repositoryList`
+* `repositoryapi_repositoryInfo`
+* `repositoryapi_repositoryActivity`
+
+## Data structure: repository entry
+
+A repository entry is compound of the following elements:
+
+* `group_id`: the id of the project
+* `repository_id`: the id of the repos
+* `repository_urls[]`: array containing the URL(s) of the repository(ies). Typically, SVN repos have at both https:// and svn:// URLs.
+* `repository_type`: type of the repository, may be "git" for "svn"
+
+## Data structure: activity entry
+
+* `group_id`: the id of the project
+* `repository_id`: the id of the repos
+* `timestamp`: timestamp of the activity, expressed as number of seconds since 1/1/1970 00:00:00.
+* `type`: As of 2017-03-10, always = "change" (i.e. means: a modification has been made on the repos)
+
+From a human point of view, an *activity* is "something done" on the repos.
+Typically, this is a commit for an SVN repos, a push for a git repos.
+
+## repositoryapi_repositoryList
+
+### Purpose
+
+Retuns a list of repositories available on the forge.
+
+### Parameters
+
+```python
+repositoryapi_repositoryList(session, limit, offset)
+```
+
+* `session`: **MANDATORY** Id of session if identified, empty if anonymous.
+* `limit`: Maximum number of entries returned. Default value = 1000. Higher possible value: 1000.
+* `offset`: Number of entries to bypass.
+
+### Results returned
+
+A set of repository entries.
+
+### Example: List first 1000 repositories
+
+```python
+repositoryapi_repositoryList(session)
+```
+
+Only one parameter is passed, as we rely on default values for `limit` and `offset`.
+
+### Example: List repositories from 1001 to 2000
+
+```python
+repositoryapi_repositoryList(session, 999, 1001)
+```
+
+## repositoryapi_repositoryInfo
+
+### Purpose
+
+Returns details on a given repository
+
+### Parameters
+
+```python
+repositoryapi_repositoryInfo(session, repo_id)
+```
+
+* `session`: **MANDATORY** Id of session if identified, empty if anonymous.
+* `repo_id`: **MANDATORY** Id of the repository queried
+
+### Results returned
+
+One repository entries.
+
+### Example: query repository "s2low/svn/s2low"
+
+```python
+repositoryapi_repositoryInfo(session, "s2low/svn/s2low")
+```
+
+## repositoryapi_repositoryActivity
+
+### Purpose
+
+Returns the activity of the forge. This is the main feature of the plugin.
+
+### Parameters
+
+```php
+repositoryapi_repositoryActivity(session, fromDate, toDate, limit, offset)
+```
+
+* `session`: **MANDATORY** Id of session if identified, empty if anonymous.
+* `fromDate`: **MANDATORY** Min date to look for activity
+* `toDate`: **MANDATORY** Max date to look for activity
+* `limit`: Maximum number of entries returned. Default value = 1000. Higher possible value: 1000.
+* `offset`: Number of entries to bypass.
+
+**Important notes**:
+
+* Dates are expressed as number of seconds since 1/1/1970 00:00:00.
+* Interval between `fromDate` and `toDate` must be less or equal 31 days
+
+### Results returned
+
+* `effective_t0`: the actual `fromDate` taken for grabbing activities
+* `effective_t1`: the actual `toDate` taken for grabbing activities
+* a set of activity entries
+
+**Important Notes**:
+
+The number of returned activity entries is **limited to 1000**.
+
+Thus the actual `fromDate` and `toDate` may change. That's why the `effective_t0`
+and `effective_t1` are part of the result.
+
+For instance, let say you request the activities on a 31-days interval, and there are (say) 2000 activities
+made. You will only get the first 1000 activities. And the interval between `effective_t0` and `effective_t1` will be
+smaller than the one between `fromDate` and `toDate`.
\ No newline at end of file
diff --git a/src/plugins/repositoryapi/Documentation/repository_API_client.py b/src/plugins/repositoryapi/Documentation/repository_API_client.py
new file mode 100644
index 0000000..9499c1d
--- /dev/null
+++ b/src/plugins/repositoryapi/Documentation/repository_API_client.py
@@ -0,0 +1,46 @@
+#! /usr/bin/python
+
+from suds.client import Client
+import time
+import logging
+
+logging.basicConfig(level=logging.INFO)
+logging.getLogger('suds.client').setLevel(logging.INFO)
+logging.getLogger('suds.transport').setLevel(logging.INFO)
+# logging.getLogger('suds.client').setLevel(logging.DEBUG)
+# logging.getLogger('suds.transport').setLevel(logging.DEBUG)
+
+url = "https://adullact.net/soap/?wsdl=1"
+client = Client(url)
+session = ''
+# session = client.service.login('admin','secretpass')
+# print client
+
+t1 = int(time.time())
+t0 = t1 - 3600*24
+t0 = t1 - 3600*24*30
+results = []
+
+print ("\n==================================================================\n")
+print ("Repository List")
+results = client.service.repositoryapi_repositoryList(session)
+for r in results:
+    print(r)
+
+print ("\n==================================================================\n")
+print ("Repository Info for repos s2low/svn/s2low (SVN)")
+results = client.service.repositoryapi_repositoryInfo(session, "s2low/svn/s2low")
+for r in results:
+    print(r)
+
+print ("\n==================================================================\n")
+print ("Repository Info for repos milimail/git/milimail (GIT)")
+results = client.service.repositoryapi_repositoryInfo(session, "milimail/git/milimail")
+for r in results:
+    print(r)
+
+print ("\n==================================================================\n")
+print ("Repository Activity from t0 seconds ago to now, paginated")
+results = client.service.repositoryapi_repositoryActivity(session, t0, t1, 10, 1)
+for r in results:
+    print(r)

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=015afe85845b32fbebf7ee38d23b63fab4297418

commit 015afe85845b32fbebf7ee38d23b63fab4297418
Author: Matthieu FAURE <mfaure at asqatasun.org>
Date:   Fri Mar 10 17:48:42 2017 +0100

    Documentation (READMEs are OK)

diff --git a/src/plugins/repositoryapi/Documentation/README.md b/src/plugins/repositoryapi/Documentation/README.md
new file mode 100644
index 0000000..cf5d44e
--- /dev/null
+++ b/src/plugins/repositoryapi/Documentation/README.md
@@ -0,0 +1,25 @@
+# Repository_API documentation
+
+## API Documentation
+
+The documenation fo the SOAP API provided by the plugin is in [API_Documentation.md](API_Documentation.md)
+
+## Python client for the API
+
+A Python2 client is provided to demonstrate how to use the API.
+
+### Pre-requisites
+
+```sh
+sudo apt-get install python-suds
+```
+
+### Usage
+
+Note: this is Python2
+
+```sh
+python2 repository_API_client.py
+```
+
+Edit the python file and adjust for your needs.
\ No newline at end of file
diff --git a/src/plugins/repositoryapi/README.md b/src/plugins/repositoryapi/README.md
index 03bf418..119f0b8 100644
--- a/src/plugins/repositoryapi/README.md
+++ b/src/plugins/repositoryapi/README.md
@@ -16,4 +16,8 @@ This plugin provides a forge-wide view into the activities of all
 projects (modulo permissions).  It can be seen as an aggregate of all
 the project-wide "activity" pages.
 
-The relevant data is made available through a SOAP API.
\ No newline at end of file
+The relevant data is made available through a SOAP API.
+
+## Documentation
+
+All doc is in the [Documentation directory](Documentation/README.md).
\ No newline at end of file

-----------------------------------------------------------------------

Summary of changes:
 .../Documentation/API_documentation.md             | 125 +++++++++++++++++++++
 src/plugins/repositoryapi/Documentation/README.md  |  25 +++++
 .../Documentation/repository_API_client.py         |  46 ++++++++
 src/plugins/repositoryapi/README.md                |   6 +-
 4 files changed, 201 insertions(+), 1 deletion(-)
 create mode 100644 src/plugins/repositoryapi/Documentation/API_documentation.md
 create mode 100644 src/plugins/repositoryapi/Documentation/README.md
 create mode 100644 src/plugins/repositoryapi/Documentation/repository_API_client.py


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list