Skip to content

Commit

Permalink
Added support for item_relations_vocabularies to the API
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Jan 8, 2015
1 parent a13dba7 commit 8a24be5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
20 changes: 19 additions & 1 deletion ItemRelationsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ public function filterApiResources($apiResources)
// List of GET parameters available for your index action.
'index_params' => array('subject_item_id', 'object_item_id', 'property_id'),
);
//Added GET only for looking up properties, TODO Post and Put
$apiResources['item_relations_vocabularies'] = array(
// Module associated with your resource.
//'module' => 'ItemRelationsPlugin',
// Controller associated with your resource.
// Type of record associated with your resource.
'record_type' => 'ItemRelationsVocabulary',
// List of actions available for your resource.
'actions' => array(
'index', // GET request without ID
'get', // GET request with ID
//'post', // POST request
//'put', // PUT request (ID is required)
//'delete', // DELETE request (ID is required)
),
// List of GET parameters available for your index action.
'index_params' => array('label', 'id', 'name', 'namespace_uri', 'namespace_prefix'),
);

//Added GET only for looking up properties, TODO Post and Put
$apiResources['item_relations_properties'] = array(
Expand All @@ -75,7 +93,7 @@ public function filterApiResources($apiResources)
//'delete', // DELETE request (ID is required)
),
// List of GET parameters available for your index action.
'index_params' => array('label', 'id'),
'index_params' => array('label', 'id', 'vocabulary_id'),
);


Expand Down
13 changes: 13 additions & 0 deletions models/Api/ItemRelationsVocabulary.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
//GET only implementation to start with - will want to be able POST and PUT as well

class Api_ItemRelationsVocabulary extends Omeka_Record_Api_AbstractRecordAdapter
{
// Get the REST representation of a record.
public function getRepresentation(Omeka_Record_AbstractRecord $record)
{
return $record;
// Return a PHP array, representing the passed record.
}

}
1 change: 1 addition & 0 deletions models/ItemRelationsProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ItemRelationsProperty extends Omeka_Record_AbstractRecord
*/
public $id;


/**
* @var int
*/
Expand Down

0 comments on commit 8a24be5

Please sign in to comment.