# PostsLogicInterface

interface PostsLogicInterface

Interface PostLogicInterface

## Methods

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)

No description

RESTClient
getPostDetails($userName, $resourceHash)

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

RESTClient
deletePosts(string $userName, string $resourceHash)

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

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

POST /api/users/[username]/posts

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

Updates the post(s) in the database.

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

Adds a document to a post.

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

Adds a document to a post.

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

No description

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.

## Details

###
at line 65
`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 77
`RESTClient getPostDetails($userName, $resourceHash)`

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

#### Parameters

| $userName |
| $resourceHash |

#### Return Value

RESTClient |

#### Exceptions

ResourceNotFoundException | if the resource of a given resourceHash could not be found

###
at line 88
`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 100
`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 112
`RESTClient updatePosts(ModelObject $posts, string $userName, string $resourceHash)`

Updates the post(s) in the database.

#### Parameters

ModelObject | $posts |
string | $userName | user name of the post owner
string | $resourceHash | of the post

#### Return Value

RESTClient |

###
at line 124
`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 137
`RESTClient changeDocumentName(string $filePath, string $resourceHash, string $userName, Document $document)`

Adds a document to a post.

#### Parameters

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

#### Return Value

RESTClient |

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

#### Parameters

string | $userName |
string | $resourceHash |
string | $fileName |
string | $type | (file|SMALL|MIDDLE|LARGE). 'file' returns the considered file (e.g. pdf), SMALL, MEDIUM, LARGE return a png preview image. All options in `\AcademicPuma\RestClient\Config\DocumentType`

#### Return Value

RESTClient |

###
at line 164
`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 |