0.0.1 • Published 7 years ago

oparl v0.0.1

Weekly downloads
2
License
Unlicense
Repository
github
Last release
7 years ago

#oparl.js

This is a JavaScript library for the OParl protocoll.

THE LIB IS IN THE BEGINING. PRE-ALPHA...

Some links: the OParl spec, a (real) test system, and a live demo of the oparl.js

##Getting started

You can use oparl.js directly in your HTML/JavaScript file or in your node.js project.

###HTML file

  1. Include the JavaScript lib file in HTML header
<script src="lib/oparl-src.js"></script>
  1. Use the global OParl object
OParl.open(url);

###Node.js

  1. Installation
npm install oparl --save
  1. Usage
var OParl = require('oparl');
OParl.open(url);

###Load first data from the OParl endpoint

Use the function OParl.open with 2 parameters. The first parameter contains the OParl endpoint URI of the requested domain. The second parameter is a callback function called asynchroniously. The callback function with 2 parameters return an error message if the first parameter is non-null. The second contains an oparl:System object, if the call was successful.

OParl.open(uriToOParlServer, function (err, serverObj) {
	if (err !== null) {
		console.error('Something went wrong: ' + err);
	} else {
		console.log(serverObj);
	}
});

##Object types

The OParl.open function serves an oparl:System object to the callback function. First you should read the description of these type.

####item object

FunctionDescription
get(callback)The get function collect one object. This could be done by an internet request call. So the function did not return the object, it calls the callback function when it's done.callback(error, object)The error parameter contains an error message or, if it is null, the object parameter contains an object in one of the oparl: types (listed below).

####list object

FunctionDescription
get(callback)The get function collect a list of items. This could be done by an internet request call. So the function did not return a list, it calls the callback function when it's done.callback(error, itemList)The error parameter contains an error message or, if it is null, the itemList parameter contains an array of item objects.

To do: the list object should handle the paging and pagination. Currently a maximum of 100 objects will be listed.

####oparl:Body

The oparl:Body object represent one city, country or municipal.

ParameterTypeDescription
objectTypestringis 'oparl:Body'
namestringthe official (and long) name of the body
organizationListlist objectlist of all organizations, see object oparl:Organization
personListlist objectlist of all persons, see object oparl:Person
meetingListlist objectlist of all meetings, see object oparl:Meeting
paperListlist objectlist of all papers, see object oparl:Paper
legislativeTermListlist objectlist of all legislative terms, see object oparl:LegislativeTerm
systemObject (optional)item objectthe parent OParl system, see object oparl:System
shortName (optional)stringa shorter version of the body name
website (optional)stringURI to the ordinary website of the body
license (optional)stringURI of the used license
licenseValidSince (optional)Datelast license changed date
oparlSince (optional)Datedate for the first use of OParl
ags (optional)string8 digits of the AGS (the German Amtliche Gemeindeschlüssel)
rgs (optional)string12 digits of the RGS (the German Regionalschlüssel)
equivalent (optional)arrayexternal links for the body
contactEmail (optional)stringcontact mail address
contactName (optional)stringname of the contact person
classification (optional)stringclassification of the body
location (optional)stringlocation of the body
^^ type should be changed ^^
modified (optional)Datelast modified

####oparl:LegislativeTerm

The oparl:LegislativeTerm object represent one legislative period.

ParameterTypeDescription
objectTypestringis 'oparl:LegislativeTerm'
bodyObject (optional)item objectthe body of the legislation period, see object oparl:Body
name (optional)stringuser friendly title of the legislative period
startDate (optional)Datefirst day of the legislative period
endDate (optional)Datelast day of the legislative period

####oparl:Organization

The oparl:Organization object represent one organization unit.

ParameterTypeDescription
objectTypestringis 'oparl:Organization'
bodyObject (optional)item objectthe body of the organization, see object oparl:Body
name (optional)stringthe official (and long) name of the organization
membershipList (optional)list objectlist of all memberships, see object oparl:Membership
meetingList (optional)list objectlist of all meetings, see object oparl:Meeting
shortName (optional)stringa shorter version of the organization name
post (optional)arrayarray of strings
subOrganizationOfObject (optional)item objecta superior organization, see object oparl:Organization
organizationType (optional)stringtype of the organization
classification (optional)stringgroup of the organization
startDate (optional)Datedate of formation
endDate (optional)Datedate of termination
website (optional)stringURI of the organization website
locationObject (optional)item objectlocation of the organization, see object oparl:Location
externalBodyObject (optional)item objectthe body of an external OParl system, see object oparl:Body

####oparl:System

The oparl:System object is the entry point for all clients. It defines basic information of the OParl system.

ParameterTypeDescription
objectTypestringis 'oparl:System'
oparlVersionstringversion number of supported OParl
bodyListlist objectlist of all bodies, see object oparl:Body
otherOparlVersions (optional)arrayarray of URIs
^^ type should be changed ^^
license (optional)stringURI of the used license
name (optional)stringuser friendly title of the system
contactEmail (optional)stringcontact email address
contactName (optional)stringname of the contact person
website (optional)stringURI of the RIS website
vendor (optional)stringURI of the vendor of the RIS software
product (optional)stringURI of the software product

####not yet ready object types

oparl:Person
oparl:Membership
oparl:Meeting
oparl:AgendaItem
oparl:Paper
oparl:Consultation
oparl:File
oparl:Location
oparl:Membership
oparl:AgendaItem
oparl:Consultation
oparl:File
oparl:Location

##Contributing

##Release History

  • 0.0.1 Initial release

##License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.