class RESTClient implements LogicInterface, Renderer

PHP REST-client for BibSonomy API and PUMA API.

Methods

__construct(Accessor $accessor)

No description

changeDocumentName(string $filePath, string $resourceHash, string $userName, Document $document)

No description

createConcept(Tag $concept, string $conceptName, string $userName)

POST /users/[userName]/concepts/[conceptName]

createDocument(string $filePath, string $resourceHash, string $userName)

Adds a document to a post.

createPosts(Post|Posts $posts, string $userName)

POST /api/users/[username]/posts

createUserRelationship(User $sourceUser, User $targetUser)

We create a UserRelation of the form (sourceUser, targetUser)\in relation sourceUser should be logged in for this

deleteConcept(string $conceptName, string $userName)

DELETE /users/[username]/concepts/[conceptname]

deleteDocument(string $userName, string $resourceHash, string $fileName)

Deletes an existing document. If the resourceHash is given, the document is assumed to be connected to the corresponding resource (identified by the user name in the document). Otherwise the document is independent of any post.

deletePosts(string $userName, string $resourceHash)

Removes the given post - identified by the connected resource's hash - from the user.

getConceptDetails(string $conceptName, string $userName)

GET /users/[userName]/concepts/[conceptName] GET /concepts/[conceptName]

getConcepts(string $resourceType, string $grouping, string $groupingName, string $regex, array $tags, string $status, int $start, int $end)

/concepts

getDocumentFile(string $userName, string $resourceHash, string $fileName, string $type = Config\DocumentType::FILE)

Get a document from a publication resource.

getGroupDetails(string $groupName)

/groups/[groupName]

getGroups(int $start, int $end)

/groups

getPostDetails(string $userName, string $resourceHash, string $format = 'xml')

Returns details to a post. A post is uniquely identified by a hash of the corresponding resource and a username.

getPosts(string $resourceType = Config\Resourcetype::BIBTEX, string $grouping = Config\Grouping::USER, string $groupingName = '', array $tags = array(), string $resourceHash = '', string $search = '', string $format = 'xml', int $start, int $end = 20)

No description

getTagDetails(string $tagName)

/tags/[tag]

getTagRelation(integer $start, integer $end, string $relation, string $tagName)

No description

getTags(string $grouping, string $groupingName, string $regex, string $order, integer $start, integer $end)

/tags ?filter=[regex] ?(user|group|viewable)=[username/groupname] ?order=(frequency|alph)

getUserDetails(string $userName)

/users/[username]

getUserListOfGroup(string $groupName, integer $start, integer $end)

GET /groups/[groupName]/users

getUsers(integer $start, integer $end)

URL: /users

updateConcept(Tag $concept, string $userName, string $operation = null)

PUT /users/[username]/concepts/[conceptname]

updatePosts(ModelObject $posts, string $userName, string $resourceHash)

Updates the post(s) in the database.

string
bibliography(string $bibliographyStyleName = 'apa', string $lang = 'en', string $bibliographyStyle = null)

Publication List of the requested API Result, rendered in given CSL Style

string
bibtex()

BibTeX Representation of the requested API Result.

csl()

CSL Representation of the requested API Result.

string
endnote()

Endnote representation of the requested API Result.

model()

Model Object representation of the requested API Result.

string
xml()

XML Representation of the requested API Result.

StreamInterface
file()

No description

string
getBody()

No description

getQuery()

Returns the Query object of the last used request. Null, if no request has been called before.

Details

at line 57
__construct(Accessor $accessor)

Parameters

Accessor $accessor

at line 71
RESTClient changeDocumentName(string $filePath, string $resourceHash, string $userName, Document $document)

Parameters

string $filePath
string $resourceHash
string $userName
Document $document

Return Value

RESTClient

at line 93
RESTClient createConcept(Tag $concept, string $conceptName, string $userName)

POST /users/[userName]/concepts/[conceptName]

Create a new relation/concept note: if a concept already exists with the given name it will be replaced

Parameters

Tag $concept the tag containing subTags
string $conceptName the name of the super tag of the concept
string $userName the user name of the user the concept belongs to.

Return Value

RESTClient

at line 111
RESTClient createDocument(string $filePath, string $resourceHash, string $userName)

Adds a document to a post.

Parameters

string $filePath
string $resourceHash
string $userName

Return Value

RESTClient

at line 129
RESTClient createPosts(Post|Posts $posts, string $userName)

POST /api/users/[username]/posts

Add post(s) to an user's collection.

Parameters

Post|Posts $posts the post(s) to add
string $userName The username under which the posts will be added.

Return Value

RESTClient

at line 147
RESTClient createUserRelationship(User $sourceUser, User $targetUser)

We create a UserRelation of the form (sourceUser, targetUser)\in relation sourceUser should be logged in for this

Parameters

User $sourceUser leftHandSide of the relation
User $targetUser rightHandSide of the relation

Return Value

RESTClient

at line 166
RESTClient deleteConcept(string $conceptName, string $userName)

DELETE /users/[username]/concepts/[conceptname]

Delete an existing concept

Parameters

string $conceptName
  • name of the concept to delete
string $userName name of user holding the concept

Return Value

RESTClient

at line 187
RESTClient deleteDocument(string $userName, string $resourceHash, string $fileName)

Deletes an existing document. If the resourceHash is given, the document is assumed to be connected to the corresponding resource (identified by the user name in the document). Otherwise the document is independent of any post.

Parameters

string $userName user name of the post/document owner
string $resourceHash the intraHash of the post the document belongs to.
string $fileName fileName of the document which should be deleted.

Return Value

RESTClient

at line 204
RESTClient deletePosts(string $userName, string $resourceHash)

Removes the given post - identified by the connected resource's hash - from the user.

Parameters

string $userName user who's posts are to be removed
string $resourceHash hash of the resource, which is connected to the post to delete

Return Value

RESTClient

at line 225
RESTClient getConceptDetails(string $conceptName, string $userName)

GET /users/[userName]/concepts/[conceptName] GET /concepts/[conceptName]

Retrieve Details for a concept, containing the belonging subTags.

Parameters

string $conceptName the supertag of the concept
string $userName the user name of the user the concept belongs to. If null, system-wide relations will be returned.

Return Value

RESTClient

at line 249
RESTClient getConcepts(string $resourceType, string $grouping, string $groupingName, string $regex, array $tags, string $status, int $start, int $end)

/concepts

Retrieve relations

Parameters

string $resourceType the requested resourcetype
string $grouping grouping entity
string $groupingName the grouping name
string $regex a regex to possibly filter the relatons retrieved
array $tags a list of tags which shall be part of the relations
string $status the conceptstatus, i.e. all, picked or unpicked
int $start start index
int $end end index

Return Value

RESTClient

at line 268
RESTClient getDocumentFile(string $userName, string $resourceHash, string $fileName, string $type = Config\DocumentType::FILE)

Get a document from a publication resource.

Parameters

string $userName name of the publication owner
string $resourceHash intraHash of the post resource
string $fileName file name of the document
string $type determines whether a picture or the actual file will be received

Return Value

RESTClient

at line 286
RESTClient getGroupDetails(string $groupName)

/groups/[groupName]

Returns details of one group.

Parameters

string $groupName name of the group

Return Value

RESTClient

at line 305
RESTClient getGroups(int $start, int $end)

/groups

Returns all groups of the system.

Parameters

int $start start index
int $end end index

Return Value

RESTClient

at line 326
RESTClient getPostDetails(string $userName, string $resourceHash, string $format = 'xml')

Returns details to a post. A post is uniquely identified by a hash of the corresponding resource and a username.

Parameters

string $userName name of the post-owner
string $resourceHash hash value of the corresponding resource
string $format Format of received post (xml|json|csl|bibtex|endnote). Default value is 'xml'. If you want to use the model or any ModelRenderer, please keep it empty or use 'xml'.

Return Value

RESTClient

at line 353
RESTClient getPosts(string $resourceType = Config\Resourcetype::BIBTEX, string $grouping = Config\Grouping::USER, string $groupingName = '', array $tags = array(), string $resourceHash = '', string $search = '', string $format = 'xml', int $start, int $end = 20)

Parameters

string $resourceType resource type (bookmark|bibtex)
string $grouping grouping tells whom posts are to be shown: the posts of a user, of a group or of the viewables.
string $groupingName name of the grouping. if grouping is user, then its the username. if grouping is set to {@link GroupingEntity#ALL}, then its an empty string!
array $tags a set of tags
string $resourceHash intraHash value of a resource, if one would like to get a list of all posts belonging to a given resource.
string $search free text search
string $format Format of received post (xml|json|csl|bibtex|endnote). Default value is 'xml'. If you want to use the model or any ModelRenderer, please keep it empty or use 'xml'.
int $start inclusive start index of the view window
int $end exclusive end index of the view window

Return Value

RESTClient

at line 378
RESTClient getTagDetails(string $tagName)

/tags/[tag]

Returns details about a tag. Those details are:

  • details about the tag itself, like number of occurrences etc
  • list of subtags
  • list of supertags
  • list of correlated tags

Parameters

string $tagName name of the tag

Return Value

RESTClient

at line 395
RESTClient getTagRelation(integer $start, integer $end, string $relation, string $tagName)

Parameters

integer $start
integer $end
string $relation
string $tagName

Return Value

RESTClient

at line 423
RESTClient getTags(string $grouping, string $groupingName, string $regex, string $order, integer $start, integer $end)

/tags ?filter=[regex] ?(user|group|viewable)=[username/groupname] ?order=(frequency|alph)

Returns a list of tags which can be filtered.

Parameters

string $grouping grouping tells whom tags are to be shown: the tags of a user, of a group or of the viewables.
string $groupingName name of the grouping. if grouping is user, then its the username. if grouping is set to {@link GroupingEntity#ALL}, then its an empty string!
string $regex a regular expression used to filter the tagnames
string $order (frequency|alph)
integer $start
integer $end

Return Value

RESTClient

at line 441
RESTClient getUserDetails(string $userName)

/users/[username]

Returns details about a specified user

Parameters

string $userName name of the user we want to get details from

Return Value

RESTClient

at line 459
RESTClient getUserListOfGroup(string $groupName, integer $start, integer $end)

GET /groups/[groupName]/users

Parameters

string $groupName name of the group
integer $start start index
integer $end end index

Return Value

RESTClient

at line 478
RESTClient getUsers(integer $start, integer $end)

URL: /users

Generic method to retrieve lists of users

Parameters

integer $start start position
integer $end end position

Return Value

RESTClient

at line 497
RESTClient updateConcept(Tag $concept, string $userName, string $operation = null)

PUT /users/[username]/concepts/[conceptname]

Update an existing relation/concept

Parameters

Tag $concept the concept to update
string $userName name of the user who created the concept
string $operation

Return Value

RESTClient

at line 514
RESTClient updatePosts(ModelObject $posts, string $userName, string $resourceHash)

Updates the post(s) in the database.

Parameters

ModelObject $posts post(s) to update
string $userName user name of the post owner
string $resourceHash of the updated post

Return Value

RESTClient

at line 532
string bibliography(string $bibliographyStyleName = 'apa', string $lang = 'en', string $bibliographyStyle = null)

Publication List of the requested API Result, rendered in given CSL Style

Parameters

string $bibliographyStyleName
string $lang
string $bibliographyStyle XML formatted CSL Style

Return Value

string

at line 544
string bibtex()

BibTeX Representation of the requested API Result.

Return Value

string

Exceptions

UnsupportedOperationException

at line 556
stdClass csl()

CSL Representation of the requested API Result.

Return Value

stdClass

Exceptions

UnsupportedOperationException

at line 568
string endnote()

Endnote representation of the requested API Result.

Return Value

string

Exceptions

UnsupportedOperationException

at line 578
ModelObject model()

Model Object representation of the requested API Result.

Return Value

ModelObject

at line 590
string xml()

XML Representation of the requested API Result.

Return Value

string xml formatted string

Exceptions

UnsupportedOperationException

at line 600
StreamInterface file()

Return Value

StreamInterface

Exceptions

UnsupportedOperationException

at line 614
string getBody()

Return Value

string

Exceptions

UnsupportedOperationException

at line 624
AbstractQuery getQuery()

Returns the Query object of the last used request. Null, if no request has been called before.

Return Value

AbstractQuery