Created
January 26, 2016 11:19
-
-
Save agarciadom/2ef4e3fd5ae170ddac74 to your computer and use it in GitHub Desktop.
Emfatic fragment for an ecore2thrift blogging service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@thrift(javans="ecore2thrift.example") | |
@namespace(uri="http://github.com/ecore2thrift", prefix="") | |
package Blog; | |
@doc(d="One post in the blog") | |
class Post { | |
@doc(d="Title of the post") | |
attr String title; | |
@doc(d="Date and time in ISO 8601 format") | |
attr String date; | |
@doc(d="Text in the post") | |
attr String text; | |
@doc(d="True if the post is a draft and should not be visible yet") | |
attr Boolean draft = false; | |
} | |
@doc(d="Entire blog") | |
class Blog { | |
@doc(d="List of posts in the blog") | |
val Post[*] posts; | |
} | |
@doc(d="The specified post has not been found.") | |
class PostDoesNotExist { | |
@doc(d="Unique identifier for the post.") | |
attr Integer identifier; | |
} | |
@doc(d="Manages the contents of the blog.") | |
class BlogService { | |
@doc(d="Returns the entire blog at once.") | |
op Blog getBlog(); | |
@doc(d="Returns the number of posts in the blog.") | |
op Integer getCountPosts(); | |
@doc(d="Returns a specific post.") | |
op Post getPost(Integer identifier) throws PostDoesNotExist; | |
@doc(d="Removes a specific post.") | |
op void removePost(Integer identifier) throws PostDoesNotExist; | |
@doc(d="Updates a specific post.") | |
op void updatePost(Integer identifier, Post updatedPost) throws PostDoesNotExist; | |
@doc(d="Adds a new post.") | |
op Integer addPost(Post newPost); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment