note description: "API interface to internal_blog services." author: "Peter Wyss " date: "$Date$" revision: "$Revision$" class INTERNAL_BLOG_SERVICE inherit API_SERVICE create make feature -- Basic operations blog_add (a_session: STRING; a_project: INTEGER_REF; a_title: STRING; a_url: STRING; a_diff: STRING; a_revision: INTEGER_REF; a_old_revision: INTEGER_REF; a_is_private: BOOLEAN_REF): BOOLEAN_REF -- Create a new blog workitem with a_session, a_project, a_title and a_text. local l_msg: O_BLOG_ADD_MESSAGE do -- argument validiation check_anonymous_session (a_session) if not is_valid_session (a_session) then last_fault := err_invalid_session elseif a_project <= 0 then last_fault := err_invalid_project elseif a_title = Void or else a_title.is_empty then last_fault := err_invalid_title elseif a_diff = Void or else a_diff.is_empty then last_fault := err_invalid_diff elseif a_revision <= 0 then last_fault := err_invalid_revision elseif a_old_revision < 0 then last_fault := err_invalid_revision else -- generate and send message create l_msg.make (a_session, a_project.item, a_title, a_url, a_diff, a_revision.item, a_old_revision.item, a_is_private.item) send_and_wait_for_reply (l_msg) if is_ok then create Result Result.set_item (True) end end end feature -- Creation new_tuple (a_name: STRING): TUPLE -- Tuple of default-valued arguments to pass to call `a_name'. do if a_name.is_equal (blog_add_name) then create {TUPLE [STRING, INTEGER_REF, STRING, STRING, STRING, INTEGER_REF, INTEGER_REF, BOOLEAN_REF]}Result end end feature -- Initialisation self_register -- Register all actions for this service do register_with_help (agent blog_add, blog_add_name, "Add a blog workitem.") end feature {NONE} -- Implementation blog_add_name: STRING = "add" end